diff --git a/crates/app/src/assets.rs b/crates/app/src/assets.rs index 5eba52a..a6bff19 100644 --- a/crates/app/src/assets.rs +++ b/crates/app/src/assets.rs @@ -60,6 +60,7 @@ pub const MOD_AUDIT_LOG: &str = include_str!("./public/html/mod/audit_log.html") pub const MOD_REPORTS: &str = include_str!("./public/html/mod/reports.html"); pub const MOD_FILE_REPORT: &str = include_str!("./public/html/mod/file_report.html"); pub const MOD_IP_BANS: &str = include_str!("./public/html/mod/ip_bans.html"); +pub const MOD_PROFILE: &str = include_str!("./public/html/mod/profile.html"); // langs pub const LANG_EN_US: &str = include_str!("./langs/en-US.toml"); @@ -186,6 +187,7 @@ pub(crate) async fn write_assets(config: &Config) -> PathBufD { write_template!(html_path->"mod/reports.html"(crate::assets::MOD_REPORTS) --config=config); write_template!(html_path->"mod/file_report.html"(crate::assets::MOD_FILE_REPORT) --config=config); write_template!(html_path->"mod/ip_bans.html"(crate::assets::MOD_IP_BANS) --config=config); + write_template!(html_path->"mod/profile.html"(crate::assets::MOD_PROFILE) --config=config); html_path } diff --git a/crates/app/src/langs/en-US.toml b/crates/app/src/langs/en-US.toml index 6275570..079bcc1 100644 --- a/crates/app/src/langs/en-US.toml +++ b/crates/app/src/langs/en-US.toml @@ -30,6 +30,7 @@ version = "1.0.0" "dialog:action.yes" = "Yes" "dialog:action.no" = "No" "dialog:action.save_and_close" = "Save and close" +"dialog:action.close" = "Close" "auth:action.login" = "Login" "auth:action.register" = "Register" @@ -45,7 +46,6 @@ version = "1.0.0" "auth:label.relationship" = "Relationship" "auth:label.joined_communities" = "Joined communities" "auth:label.recent_posts" = "Recent posts" -"auth:label.moderation" = "Moderation" "communities:action.create" = "Create" "communities:action.select" = "Select" @@ -94,3 +94,5 @@ version = "1.0.0" "settings:label.change_banner" = "Change banner" "mod_panel:label.open_reported_content" = "Open reported content" +"mod_panel:label.manage_profile" = "Manage profile" +"mod_panel:label.permissions_level_builder" = "Permission level builder" diff --git a/crates/app/src/public/css/style.css b/crates/app/src/public/css/style.css index 6ec1761..8e8107d 100644 --- a/crates/app/src/public/css/style.css +++ b/crates/app/src/public/css/style.css @@ -406,7 +406,7 @@ table ol { } .card-nest .card { - box-shadow: 0; + box-shadow: none; } .card-nest > .card:first-child { diff --git a/crates/app/src/public/html/communities/settings.html b/crates/app/src/public/html/communities/settings.html index 7c5f099..36d8c27 100644 --- a/crates/app/src/public/html/communities/settings.html +++ b/crates/app/src/public/html/communities/settings.html @@ -325,94 +325,23 @@ } // permissions manager - const permissions = { - // https://trisuaso.github.io/tetratto/tetratto/model/communities_permissions/struct.CommunityPermission.html - DEFAULT: 1 << 0, - ADMINISTRATOR: 1 << 1, - MEMBER: 1 << 2, - MANAGE_POSTS: 1 << 3, - MANAGE_ROLES: 1 << 4, - BANNED: 1 << 5, - REQUESTED: 1 << 6, - MANAGE_PINS: 1 << 7, - MANAGE_COMMUNITY: 1 << 8, - }; - - function all_matching_permissions(role) { - const matching = []; - const not_matching = []; - - for (permission of Object.entries(permissions)) { - if ((role & permission[1]) === permission[1]) { - matching.push(permission[0]); - } else { - not_matching.push(permission[0]); - } - } - - return [matching, not_matching]; - } - - function rebuild_role(matching) { - let role = 0; - - for (const permission of matching) { - role = role | permissions[permission]; - } - - document.getElementById("role").value = role; - return role; - } - - function get_permissions_html(role, id) { - const [matching, not_matching] = - all_matching_permissions(role); - - globalThis.remove_permission_from_role = ( - permission, - ) => { - matching.splice(matching.indexOf(permission), 1); - not_matching.push(permission); - - document.getElementById(id).innerHTML = - get_permissions_html( - rebuild_role(matching), - id, - ); - }; - - globalThis.add_permission_to_role = (permission) => { - not_matching.splice( - not_matching.indexOf(permission), - 1, - ); - matching.push(permission); - - document.getElementById(id).innerHTML = - get_permissions_html( - rebuild_role(matching), - id, - ); - }; - - let permissions_html = ""; - - for (const match of matching) { - permissions_html += `
${permissions[match]}
-
- ${permissions[match]}
-
-