ה-Back-end מאפשר למודרטורים להשתמש במיזוג/העברת פוסטים להודעה פרטית, אך ה-Front-end לא

סיכום מבוסס בינה מלאכותית

In a Support category thread titled Back-end allows moderators to use merge/move posts to private message, but front-end does not, Hooksmith reports a UI inconsistency: while the back-end permits moderators (all staff) to move posts to a new private message (PM), the front-end only shows this option to admins due to a hardcoded currentUser.admin check. Hooksmith proposes changing it to currentUser.staff and offers to submit a PR. codinghorror seeks input from techAPJ, who explains the restriction was intentional — moderators can’t view PMs, and the code would fail when trying to create one. Hooksmith suggests a workaround: automatically adding the acting moderator as a recipient of the new PM, enabling them to view it. techAPJ agrees to investigate this solution and confirms that a PR would be welcome. Hooksmith offers further help if the fix gets deprioritized, and techAPJ reiterates that PRs are encouraged, though it may take time to address internally.

This functionality shows up when you are administrator, but not for moderators:

The front-end code for this is here:

Note the “this.currentUser.admin”.

However, the back-end allows for moderators (all staff) to perform this action just fine:


I think the front-end code should be adjusted:

@discourseComputed("canSplitTopic")
canSplitToPM(canSplitTopic) {
-  return canSplitTopic && this.currentUser && this.currentUser.admin;
+  return canSplitTopic && this.currentUser && this.currentUser.staff;
},

If you agree with this being a bug I’d be happy to make a PR to fix it. Our moderation team would have need of this fix.

I’m not sure but it seems plausible. What do you think @techAPJ?

The decision to not show “move to new PM” option for moderators was made explicitly in:

https://github.com/discourse/discourse/commit/dc2776bcddc07e69e5a4ab92526f6238f3a5ccd7

This is because the moderators do not have permission to see PMs and the relevant code will fail at:

Would it be feasible if a code change is made so that the acting moderator/administrator is added as a recipient on the newly created topic (private message) so that they can see the new topic once it is created? (and would this be a change you folks are interested in receiving?)

I’ll look into the possibility of adding acting moderator as PM recipient and subsequently enabling the feature “move posts to a new PM” for moderators.

Great! In case this ends up in backlog / deprioritized and is PR welcome, please let me know and I could help with implementation.

It might take a bit for me to get to this. PR is 100% welcome here! :+1: