Fix moderation issues #1156 #1157

Merged
trinity-1686a merged 5 commits from gro2bl/Plume:fix_moderation_issues into main 2024-07-08 23:54:36 +00:00
Contributor

This PR includes the fixes for issues mentioned in #1156

This PR includes the fixes for issues mentioned in #1156
gro2bl added 3 commits 2024-06-12 17:00:52 +00:00
gro2bl added 1 commit 2024-06-12 17:10:31 +00:00
trinity-1686a requested changes 2024-06-29 10:14:42 +00:00
trinity-1686a left a comment
Owner

the changes looks sensible, but i have a few codestyle issues

the changes looks sensible, but i have a few codestyle issues
@ -90,0 +90,4 @@
} else {
@if ctx.2.clone().map(|u| u.is_moderator()).unwrap_or(false) {
<a href="@uri!(instance::admin_mod)">@i18n!(ctx.1, "Moderation")</a>
}

codestyle:

-                } else {
-                    @if ctx.2.clone().map(|u| u.is_moderator()).unwrap_or(false) {
-                        <a href="@uri!(instance::admin_mod)">@i18n!(ctx.1, "Moderation")</a>
-                    }
+                } else if ctx.2.clone().map(|u| u.is_moderator()).unwrap_or(false) {
+                   <a href="@uri!(instance::admin_mod)">@i18n!(ctx.1, "Moderation")</a>
codestyle: ```diff - } else { - @if ctx.2.clone().map(|u| u.is_moderator()).unwrap_or(false) { - <a href="@uri!(instance::admin_mod)">@i18n!(ctx.1, "Moderation")</a> - } + } else if ctx.2.clone().map(|u| u.is_moderator()).unwrap_or(false) { + <a href="@uri!(instance::admin_mod)">@i18n!(ctx.1, "Moderation")</a> ```
Author
Contributor

done

done
gro2bl marked this conversation as resolved
@ -0,0 +7,4 @@
<h1>@i18n!(ctx.1, title)</h1>
@tabs(&[
(&uri!(instance::admin).to_string(), i18n!(ctx.1, "Configuration"), if selected_tab == 1 {true} else {false}),

can you replace all the if selected_tab == 1 {true} else {false} to simple selected_tab == 1 please?

can you replace all the `if selected_tab == 1 {true} else {false}` to simple `selected_tab == 1` please?
Author
Contributor

done

done
gro2bl marked this conversation as resolved
@ -0,0 +18,4 @@
@tabs(&[
(&uri!(instance::admin_instances: page = _).to_string(), i18n!(ctx.1, "Instances"), if selected_tab == 1 {true} else {false}),
(&uri!(instance::admin_users: page = _).to_string(), i18n!(ctx.1, "Users"), if selected_tab == 2 {true} else {false}),
(&uri!(instance::admin_email_blocklist: page=_).to_string(), i18n!(ctx.1, "Email blocklist"), if selected_tab == 3 {true} else {false})

oh, i get why the conditions elsewhere. This would be a lot easier to understand if the numbers used for the moderation half be the same (2,3,4) as the admin half. No needs for branch everywhere

oh, i get why the conditions elsewhere. This would be a lot easier to understand if the numbers used for the moderation half be the same (2,3,4) as the admin half. No needs for branch everywhere
Author
Contributor

done

done
gro2bl marked this conversation as resolved
@ -12,3 +7,1 @@
(&uri!(instance::admin_instances: page = _).to_string(), i18n!(ctx.1, "Instances"), false),
(&uri!(instance::admin_users: page = _).to_string(), i18n!(ctx.1, "Users"), false),
])
@:admin_header(ctx, "Moderation", 0)

shouldn't it be 1 instead of 0?

shouldn't it be 1 instead of 0?
Author
Contributor

There is an inconsistency problem on how admin.rs.html handles default tab and how admin_mod.rs.html does it. Actually the Configuration tab has been hardcoded inside admin.rs.html which is not available in admin_mod.rs.html. Also other tabs have their own layout (i.e. they are not a child template) so it's not feasible to include the first moderation tab (Instances) by default to be loaded in /admin when the user is a moderator. I just left it as is for you to make a decision:

  1. We can just redirect the /admin to their first tab route, both for admin and moderator, this needs the creation of a separate template for Configuration tab and then both admin.rs.html and admin_mod.rs.html would be useless.
  2. We can leave it as is, and later show some dashboard like stuff as the default content of the /admin and instead of tabs on the top, use some other type of UX component to show different pages.
  3. For now we can just show a welcome message to admins and moderators as the default content of the /admin route and do the #1.

If you want I can go for one of these or any other idea you have but the 0, 1 or even 2 doesn't make any difference here, the result would be an empty admin page with some tabs.

There is an inconsistency problem on how `admin.rs.html` handles default tab and how `admin_mod.rs.html` does it. Actually the Configuration tab has been hardcoded inside `admin.rs.html` which is not available in `admin_mod.rs.html`. Also other tabs have their own layout (i.e. they are not a child template) so it's not feasible to include the first moderation tab (Instances) by default to be loaded in `/admin` when the user is a moderator. I just left it as is for you to make a decision: 1. We can just redirect the `/admin` to their first tab route, both for admin and moderator, this needs the creation of a separate template for Configuration tab and then both `admin.rs.html` and `admin_mod.rs.html` would be useless. 2. We can leave it as is, and later show some dashboard like stuff as the default content of the `/admin` and instead of tabs on the top, use some other type of UX component to show different pages. 3. For now we can just show a welcome message to admins and moderators as the default content of the `/admin` route and do the #1. If you want I can go for one of these or any other idea you have but the `0`, `1` or even `2` doesn't make any difference here, the result would be an empty admin page with some tabs.

I agree that 0 or 1 changes nothing, i just find it more coherent. We are in a way on the configuration tab which refused to load. But yeah, the html generated is the same either way (2 would change slightly the result, showing Instances as the selected tab i believe)

I agree that 0 or 1 changes nothing, i just find it more coherent. We are in a way on the configuration tab which refused to load. But yeah, the html generated is the same either way (2 would change slightly the result, showing `Instances` as the selected tab i believe)
Author
Contributor

2 It shows Instances as selected tab but without the instances page template because "Instances" template is a whole page template not a partial template and we cannot include it as a child inside admin_mod. that's why we might need to do one of those 3 solutions I mentioned above.

2 It shows Instances as selected tab but without the instances page template because "Instances" template is a whole page template not a partial template and we cannot include it as a child inside admin_mod. that's why we might need to do one of those 3 solutions I mentioned above.
@ -13,2 +7,2 @@
(&uri!(instance::admin_email_blocklist:page=_).to_string(), i18n!(ctx.1, "Email blocklist"), true),
])
@:base(ctx, i18n!(ctx.1, "Blocklisted Emails"), {}, {}, {
@:admin_header(ctx, "Blocklisted Emails", (if ctx.2.clone().map(|u| u.is_admin()).unwrap() {4} else {3}))

it looks to me like it was always 4th entry before, why is it now sometime 3rd?

it looks to me like it was always 4th entry before, why is it now sometime 3rd?
gro2bl marked this conversation as resolved
@ -14,3 +9,1 @@
(&uri!(instance::admin_users: page = _).to_string(), i18n!(ctx.1, "Users"), false),
(&uri!(instance::admin_email_blocklist:page=_).to_string(), i18n!(ctx.1, "Email blocklist"), false),
])
@:admin_header(ctx, "Instances", (if ctx.2.clone().map(|u| u.is_admin()).unwrap() {2} else {1}))

why not always 2?

why not always 2?
gro2bl marked this conversation as resolved
@ -14,3 +9,1 @@
(&uri!(instance::admin_users: page = _).to_string(), i18n!(ctx.1, "Users"), true),
(&uri!(instance::admin_email_blocklist: page=_).to_string(), i18n!(ctx.1, "Email blocklist"), false)
])
@:admin_header(ctx, "Users", (if ctx.2.clone().map(|u| u.is_admin()).unwrap() {3} else {2}))

why not always 3?

why not always 3?
gro2bl marked this conversation as resolved
gro2bl added 1 commit 2024-07-04 18:40:19 +00:00
requested review from trinity-1686a 2024-07-06 14:13:36 +00:00
trinity-1686a approved these changes 2024-07-07 14:41:27 +00:00
trinity-1686a merged commit d9464d1dbb into main 2024-07-08 23:54:36 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Plume/Plume#1157
No description provided.