return proper error when fetching latest logs of a user who opted out

This commit is contained in:
boring_nick 2023-07-22 11:10:54 +03:00
parent d827f540e3
commit 607cbfb8b9
1 changed files with 2 additions and 0 deletions

View File

@ -258,6 +258,8 @@ async fn redirect_to_latest_user_logs(
app.get_user_id_by_name(&user).await?
};
app.check_opted_out(&channel_id, Some(&user_id))?;
let available_logs = read_available_user_logs(&app.db, &channel_id, &user_id).await?;
let latest_log = available_logs.first().ok_or(Error::NotFound)?;