Skip to content

Commit

Permalink
feat: support deleting stable
Browse files Browse the repository at this point in the history
  • Loading branch information
Mivik committed May 12, 2023
1 parent ac601be commit c237ee0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 2 additions & 0 deletions phira/src/client/model/user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ bitflags! {
const STABILIZE_CHART = 0x00000020;
const EDIT_TAGS = 0x00000040;
const STABILIZE_JUDGE = 0x00000080;
const DELETE_STABLE = 0x00000080;
}
}

Expand Down Expand Up @@ -58,6 +59,7 @@ impl Roles {
}
if self.contains(Self::HEAD_SUPERVISOR) {
perm |= Permissions::STABILIZE_JUDGE;
perm |= Permissions::DELETE_STABLE;
}
perm
}
Expand Down
9 changes: 7 additions & 2 deletions phira/src/scene/song.rs
Original file line number Diff line number Diff line change
Expand Up @@ -551,8 +551,13 @@ impl SongScene {
self.menu_options.push("stabilize-deny");
}
if self.info.id.is_some()
&& (perms.contains(Permissions::DELETE_UNSTABLE) || is_uploader)
&& self.entity.as_ref().map_or(false, |it| !it.stable)
&& self.entity.as_ref().map_or(false, |it| {
if it.stable {
perms.contains(Permissions::DELETE_STABLE)
} else {
is_uploader || perms.contains(Permissions::DELETE_UNSTABLE)
}
})
{
self.menu_options.push("review-del");
}
Expand Down

0 comments on commit c237ee0

Please sign in to comment.