add: 4 more achievements
This commit is contained in:
parent
50f4592de2
commit
b501a7c5f0
5 changed files with 52 additions and 7 deletions
|
@ -582,6 +582,7 @@ input[type="checkbox"]:checked {
|
|||
font-size: 12px;
|
||||
border-radius: 6px;
|
||||
height: max-content;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.notification.tr {
|
||||
|
@ -670,7 +671,7 @@ nav .button:not(.title):not(.active):hover {
|
|||
margin-bottom: 0;
|
||||
backdrop-filter: none;
|
||||
bottom: 0;
|
||||
position: absolute;
|
||||
position: fixed;
|
||||
height: max-content;
|
||||
top: unset;
|
||||
}
|
||||
|
|
|
@ -464,11 +464,20 @@ pub async fn enable_totp_request(
|
|||
Extension(data): Extension<State>,
|
||||
) -> impl IntoResponse {
|
||||
let data = &(data.read().await).0;
|
||||
let user = match get_user_from_token!(jar, data) {
|
||||
let mut user = match get_user_from_token!(jar, data) {
|
||||
Some(ua) => ua,
|
||||
None => return Json(Error::NotAllowed.into()),
|
||||
};
|
||||
|
||||
// award achievement
|
||||
if let Err(e) = data
|
||||
.add_achievement(&mut user, AchievementName::Enable2fa.into())
|
||||
.await
|
||||
{
|
||||
return Json(e.into());
|
||||
}
|
||||
|
||||
// ...
|
||||
match data.enable_totp(id, user).await {
|
||||
Ok(x) => Json(ApiReturn {
|
||||
ok: true,
|
||||
|
|
|
@ -16,6 +16,7 @@ use crate::{
|
|||
use tetratto_core::{
|
||||
database::NAME_REGEX,
|
||||
model::{
|
||||
auth::AchievementName,
|
||||
journals::{JournalPrivacyPermission, Note},
|
||||
oauth,
|
||||
permissions::FinePermission,
|
||||
|
@ -190,11 +191,20 @@ pub async fn update_content_request(
|
|||
Json(props): Json<UpdateNoteContent>,
|
||||
) -> impl IntoResponse {
|
||||
let data = &(data.read().await).0;
|
||||
let user = match get_user_from_token!(jar, data, oauth::AppScope::UserManageNotes) {
|
||||
let mut user = match get_user_from_token!(jar, data, oauth::AppScope::UserManageNotes) {
|
||||
Some(ua) => ua,
|
||||
None => return Json(Error::NotAllowed.into()),
|
||||
};
|
||||
|
||||
// award achievement
|
||||
if let Err(e) = data
|
||||
.add_achievement(&mut user, AchievementName::EditNote.into())
|
||||
.await
|
||||
{
|
||||
return Json(e.into());
|
||||
}
|
||||
|
||||
// ...
|
||||
match data.update_note_content(id, &user, &props.content).await {
|
||||
Ok(_) => {
|
||||
if let Err(e) = data
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue