Skip to content

Commit

Permalink
feat: add stabilize kind
Browse files Browse the repository at this point in the history
  • Loading branch information
Mivik committed May 12, 2023
1 parent c237ee0 commit 3554e28
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions phira/locales/en-US/song.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ stabilize-warn = Normal user can only request to stabilize beatmap once per 3 da
stabilize-requested = Stablizing request sent
stabilize-failed = Stabilize failed
stabilize-approve = Approve stable
stabilize-approve-ranked = Approve ranked
stabilize-deny = Deny stable
stabilize-approved = Approved
stabilize-approved-passed = Approved, the beatmap is stablized
Expand Down
1 change: 1 addition & 0 deletions phira/locales/zh-CN/song.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ stabilize-warn = 普通用户每 3 天可以申请一次 stable 谱面。至少
stabilize-requested = 申请 stable 成功
stabilize-failed = 申请 stable 失败
stabilize-approve = 通过 stable
stabilize-approve-ranked = 通过 ranked
stabilize-deny = 拒绝 stable
stabilize-approved = 已通过
stabilize-approved-passed = 已通过,谱面已 stable
Expand Down
11 changes: 7 additions & 4 deletions phira/src/scene/song.rs
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,7 @@ impl SongScene {
}
if self.info.id.is_some() && self.entity.as_ref().map_or(false, |it| it.stable_request) && perms.contains(Permissions::STABILIZE_CHART) {
self.menu_options.push("stabilize-approve");
self.menu_options.push("stabilize-approve-ranked");
self.menu_options.push("stabilize-deny");
}
if self.info.id.is_some()
Expand Down Expand Up @@ -1360,7 +1361,8 @@ impl Scene for SongScene {
}
}
if self.menu.changed() {
match self.menu_options[self.menu.selected()] {
let option = self.menu_options[self.menu.selected()];
match option {
"delete" => {
confirm_delete(self.should_delete.clone());
}
Expand Down Expand Up @@ -1409,13 +1411,14 @@ impl Scene for SongScene {
"stabilize" => {
confirm_dialog(tl!("stabilize"), tl!("stabilize-warn"), Arc::clone(&self.should_stabilize));
}
"stabilize-approve" => {
"stabilize-approve" | "stabilize-approve-ranked" => {
let kind = if option == "stabilize-approve-ranked" { 1 } else { 0 };
let id = self.info.id.unwrap();
self.review_task = Some(Task::new(async move {
let resp: StableR = recv_raw(Client::post(
format!("/chart/{id}/stabilize"),
&json!({
"approve": true
"kind": kind,
}),
))
.await?
Expand Down Expand Up @@ -1627,7 +1630,7 @@ impl Scene for SongScene {
let resp: StableR = recv_raw(Client::post(
format!("/chart/{id}/stabilize"),
&json!({
"approve": false,
"kind": -1,
"reason": text,
}),
))
Expand Down

0 comments on commit 3554e28

Please sign in to comment.