You've already forked AstralRinth
forked from didirus/AstralRinth
Register notification routes, add action method for notifications, and fix auto-featuring versions
This commit is contained in:
@@ -33,6 +33,8 @@ pub fn mods_config(cfg: &mut web::ServiceConfig) {
|
||||
.service(mods::mod_delete)
|
||||
.service(mods::mod_edit)
|
||||
.service(mods::mod_icon_edit)
|
||||
.service(mods::mod_follow)
|
||||
.service(mods::mod_unfollow)
|
||||
.service(web::scope("{mod_id}").service(versions::version_list)),
|
||||
);
|
||||
}
|
||||
@@ -66,7 +68,8 @@ pub fn users_config(cfg: &mut web::ServiceConfig) {
|
||||
.service(users::mods_list)
|
||||
.service(users::user_delete)
|
||||
.service(users::user_edit)
|
||||
.service(users::user_icon_edit),
|
||||
.service(users::user_icon_edit)
|
||||
.service(users::user_follows),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -81,6 +84,16 @@ pub fn teams_config(cfg: &mut web::ServiceConfig) {
|
||||
);
|
||||
}
|
||||
|
||||
pub fn notifications_config(cfg: &mut web::ServiceConfig) {
|
||||
cfg.service(notifications::notifications_get);
|
||||
|
||||
cfg.service(
|
||||
web::scope("notification")
|
||||
.service(notifications::notification_get)
|
||||
.service(notifications::notification_delete),
|
||||
);
|
||||
}
|
||||
|
||||
pub fn moderation_config(cfg: &mut web::ServiceConfig) {
|
||||
cfg.service(web::scope("moderation").service(moderation::mods));
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ pub fn convert_notification(
|
||||
.into_iter()
|
||||
.map(|x| NotificationAction {
|
||||
title: x.title,
|
||||
action_route: x.action_route,
|
||||
action_route: (x.action_route_method, x.action_route),
|
||||
})
|
||||
.collect(),
|
||||
}
|
||||
|
||||
@@ -220,11 +220,14 @@ pub async fn add_team_member(
|
||||
actions: vec![
|
||||
NotificationActionBuilder {
|
||||
title: "Accept".to_string(),
|
||||
action_route: format!("team/{}/join", team),
|
||||
action_route: ("POST".to_string(), format!("team/{}/join", team)),
|
||||
},
|
||||
NotificationActionBuilder {
|
||||
title: "Deny".to_string(),
|
||||
action_route: format!("team/{}/members/{}", team, new_member.user_id),
|
||||
action_route: (
|
||||
"DELETE".to_string(),
|
||||
format!("team/{}/members/{}", team, new_member.user_id),
|
||||
),
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
@@ -81,6 +81,12 @@ pub async fn version_list(
|
||||
.map(|version| response.push(convert_version(version.clone())))
|
||||
.unwrap_or(());
|
||||
});
|
||||
|
||||
if response.is_empty() {
|
||||
versions
|
||||
.into_iter()
|
||||
.for_each(|version| response.push(convert_version(version.clone())));
|
||||
}
|
||||
}
|
||||
|
||||
response.sort_by(|a, b| b.date_published.cmp(&a.date_published));
|
||||
|
||||
Reference in New Issue
Block a user