From cf20fa66fdcd008c4013a8cb6c7427cdc2eb16aa Mon Sep 17 00:00:00 2001 From: Martii Date: Wed, 2 Jun 2021 20:43:38 -0600 Subject: [PATCH] Move around flagging a bit. * Moderators can now see the reason why something is flagged. This is absolutely necessary to evaluate if a pardon occurs. Moderators may currently additionally flag with their requested intentions/summary. This has been idle on response for several years and really has to be implemented this way. * Moderators will only see Rank so that there isn't a flame war since @sizzlemctwizzle defined it as ~"dime a dozen". * Moved flagger *(renamed to match)* to mod panel and put a danger class on it for those that can remove to prevent accidental removal *(hasn't happened yet but good idea)* * Some twiddling with class usage in *bootstrap* UI Applies to #642 Note(s): * This version of mustache generates a lot of extra UI code due to `{{#isAdmin}}` not being in scope in certain circumstances. --- controllers/flag.js | 2 + controllers/index.js | 2 +- controllers/script.js | 2 +- controllers/user.js | 6 +- views/includes/scriptAdminToolsPanel.html | 17 --- views/includes/scriptList.html | 139 +++++++++++++++------- views/includes/scriptModToolsPanel.html | 40 ++++++- views/includes/userAdminToolsPanel.html | 17 --- views/includes/userList.html | 93 ++++++++++----- views/includes/userModToolsPanel.html | 40 ++++++- 10 files changed, 242 insertions(+), 116 deletions(-) diff --git a/controllers/flag.js b/controllers/flag.js index c220b13d3..243cd182e 100644 --- a/controllers/flag.js +++ b/controllers/flag.js @@ -26,6 +26,7 @@ var flagLib = require('../libs/flag'); var statusCodePage = require('../libs/templateHelpers').statusCodePage; //--- Configuration inclusions +var userRoles = require('../models/userRoles.json'); //--- @@ -184,6 +185,7 @@ exports.getFlaggedListForContent = function (aModelName, aOptions, aCallback) { contentList[aContentKey].flaggedList.push({ name: aUser.name, + rank: userRoles[aUser.role], reason: aFlagList[aFlagKey].reason, since: aFlagList[aFlagKey].created }); diff --git a/controllers/index.js b/controllers/index.js index 6e0707194..9398d26b0 100644 --- a/controllers/index.js +++ b/controllers/index.js @@ -100,7 +100,7 @@ exports.home = function (aReq, aRes) { async.parallel([ function (aCallback) { - if (!!!options.isFlagged || !options.isAdmin) { // NOTE: Watchpoint + if (!!!options.isFlagged || !options.isMod) { // NOTE: Watchpoint aCallback(); return; } diff --git a/controllers/script.js b/controllers/script.js index 31f109200..9f530226c 100644 --- a/controllers/script.js +++ b/controllers/script.js @@ -340,7 +340,7 @@ exports.view = function (aReq, aRes, aNext) { async.parallel([ function (aCallback) { - if (!options.isAdmin) { // NOTE: Watchpoint + if (!options.isMod) { // NOTE: Watchpoint aCallback(); return; } diff --git a/controllers/user.js b/controllers/user.js index c499262e8..1aa1aa6e2 100644 --- a/controllers/user.js +++ b/controllers/user.js @@ -398,7 +398,7 @@ exports.userListPage = function (aReq, aRes, aNext) { async.parallel([ function (aCallback) { - if (!!!options.isFlagged || !options.isAdmin) { // NOTE: Watchpoint + if (!!!options.isFlagged || !options.isMod) { // NOTE: Watchpoint aCallback(); return; } @@ -471,7 +471,7 @@ exports.view = function (aReq, aRes, aNext) { async.parallel([ function (aCallback) { - if (!options.isAdmin) { // NOTE: Watchpoint + if (!options.isMod) { // NOTE: Watchpoint aCallback(); return; } @@ -703,7 +703,7 @@ exports.userScriptListPage = function (aReq, aRes, aNext) { async.parallel([ function (aCallback) { - if (!!!options.isFlagged || !options.isAdmin) { // NOTE: Watchpoint + if (!!!options.isFlagged || !options.isMod) { // NOTE: Watchpoint aCallback(); return; } diff --git a/views/includes/scriptAdminToolsPanel.html b/views/includes/scriptAdminToolsPanel.html index 8446819ef..dfaff8f65 100644 --- a/views/includes/scriptAdminToolsPanel.html +++ b/views/includes/scriptAdminToolsPanel.html @@ -7,23 +7,6 @@
- {{#hasFlagged}} -
-
- -
-
    - {{#script.flaggedList}} -
  • - {{#name}}{{name}}{{/name}} - {{#reason}}{{reason}}{{/reason}}{{^reason}}…{{/reason}} -
  • - {{/script.flaggedList}} -
-
-
-
- {{/hasFlagged}}
diff --git a/views/includes/scriptList.html b/views/includes/scriptList.html index 943572df7..44a966e27 100644 --- a/views/includes/scriptList.html +++ b/views/includes/scriptList.html @@ -11,51 +11,100 @@ - {{#scriptList}} - - - {{#showSourceNotices}}{{/showSourceNotices}} - {{#showSourceNoticesCritical}}{{/showSourceNoticesCritical}} - {{#_issueCount}}{{_issueCount}}{{/_issueCount}} - - {{name}} - {{#meta.UserScript.version}} - {{value}} - {{/meta.UserScript.version}} - by {{author.name}} - {{#_description}}

{{_description}}{{#hasLongDescription}}…{{/hasLongDescription}}

{{/_description}} - - {{^librariesOnly}} - -

{{#isLib}}–{{/isLib}}{{^isLib}}{{installs}}{{/isLib}}

- - {{/librariesOnly}} - -

{{rating}}

-
-
-
-
- - - - - {{#hasFlagged}} - -
    - {{#flaggedList}} -
  • - {{#name}}{{name}}{{/name}} - {{#reason}}{{reason}}{{/reason}}{{^reason}}…{{/reason}} -
  • - {{/flaggedList}} -
- - {{/hasFlagged}} - - {{/scriptList}} + {{#isAdmin}} + {{#scriptList}} + + + {{#showSourceNotices}}{{/showSourceNotices}} + {{#showSourceNoticesCritical}}{{/showSourceNoticesCritical}} + {{#_issueCount}}{{_issueCount}}{{/_issueCount}} + + {{name}} + {{#meta.UserScript.version}} + {{value}} + {{/meta.UserScript.version}} + by {{author.name}} + {{#_description}}

{{_description}}{{#hasLongDescription}}…{{/hasLongDescription}}

{{/_description}} + + {{^librariesOnly}} + +

{{#isLib}}–{{/isLib}}{{^isLib}}{{installs}}{{/isLib}}

+ + {{/librariesOnly}} + +

{{rating}}

+
+
+
+
+ + + + + {{#hasFlagged}} + +
    + {{#flaggedList}} +
  • + {{#name}}{{name}}{{/name}} + {{#reason}}{{reason}}{{/reason}}{{^reason}}…{{/reason}} +
  • + {{/flaggedList}} +
+ + {{/hasFlagged}} + + {{/scriptList}} + {{/isAdmin}} + {{^isAdmin}} + {{#scriptList}} + + + {{#showSourceNotices}}{{/showSourceNotices}} + {{#showSourceNoticesCritical}}{{/showSourceNoticesCritical}} + {{#_issueCount}}{{_issueCount}}{{/_issueCount}} + + {{name}} + {{#meta.UserScript.version}} + {{value}} + {{/meta.UserScript.version}} + by {{author.name}} + {{#_description}}

{{_description}}{{#hasLongDescription}}…{{/hasLongDescription}}

{{/_description}} + + {{^librariesOnly}} + +

{{#isLib}}–{{/isLib}}{{^isLib}}{{installs}}{{/isLib}}

+ + {{/librariesOnly}} + +

{{rating}}

+
+
+
+
+ + + + + {{#hasFlagged}} + +
    + {{#flaggedList}} +
  • + {{#name}}{{rank}}{{/name}} + {{#reason}}{{reason}}{{/reason}}{{^reason}}…{{/reason}} +
  • + {{/flaggedList}} +
+ + {{/hasFlagged}} + + {{/scriptList}} + {{/isAdmin}} {{^scriptList}} diff --git a/views/includes/scriptModToolsPanel.html b/views/includes/scriptModToolsPanel.html index fe872f6cf..325c59199 100644 --- a/views/includes/scriptModToolsPanel.html +++ b/views/includes/scriptModToolsPanel.html @@ -1,5 +1,5 @@ {{#modTools}} -
+
@@ -10,6 +10,44 @@ {{#script}} {{> includes/flagModelSnippet.html }} {{/script}} + {{#isAdmin}} + {{#hasFlagged}} +
+
+ +
+
    + {{#script.flaggedList}} +
  • + {{#name}}{{name}}{{/name}} + {{#reason}}{{reason}}{{/reason}}{{^reason}}…{{/reason}} +
  • + {{/script.flaggedList}} +
+
+
+
+ {{/hasFlagged}} + {{/isAdmin}} + {{^isAdmin}} + {{#hasFlagged}} +
+
+ +
+
    + {{#script.flaggedList}} +
  • + {{#name}}{{rank}}{{/name}} + {{#reason}}{{reason}}{{/reason}}{{^reason}}…{{/reason}} +
  • + {{/script.flaggedList}} +
+
+
+
+ {{/hasFlagged}} + {{/isAdmin}} {{#canRemove}}
- {{#hasFlagged}} -
-
- -
-
    - {{#user.flaggedList}} -
  • - {{#name}}{{name}}{{/name}} - {{#reason}}{{reason}}{{/reason}}{{^reason}}…{{/reason}} -
  • - {{/user.flaggedList}} -
-
-
-
- {{/hasFlagged}}
diff --git a/views/includes/userList.html b/views/includes/userList.html index ffea34d53..d4642df0c 100644 --- a/views/includes/userList.html +++ b/views/includes/userList.html @@ -1,7 +1,7 @@ - + {{#hasFlagged}} @@ -10,35 +10,68 @@ - {{#userList}} - - - - - {{#hasFlagged}} - - {{/hasFlagged}} - - {{/userList}} + {{#isAdmin}} + {{#userList}} + + + + + {{#hasFlagged}} + + {{/hasFlagged}} + + {{/userList}} + {{/isAdmin}} + {{^isAdmin}} + {{#userList}} + + + + + {{#hasFlagged}} + + {{/hasFlagged}} + + {{/userList}} + {{/isAdmin}} {{^userList}}
NameName Since Rank