Skip to content

A platform for community discussion. Free, open, simple.

UX: refactor review queue buttons for more consistent language (#36812)

Krisfd8f5a9ceb23
diff --git a/app/assets/stylesheets/common/base/review.scss b/app/assets/stylesheets/common/base/review.scss
index 654a6d9c648..6f20be67836 100644
--- a/app/assets/stylesheets/common/base/review.scss
+++ b/app/assets/stylesheets/common/base/review.scss
@@ -76,9 +76,17 @@
background-color: var(--d-button-default-bg-color);
color: var(--d-button-default-text-color);
+ .d-icon {
+ color: var(--d-button-default-icon-color);
+ }
+
&:hover {
background-color: var(--d-button-default-bg-color--hover);
color: var(--d-button-default-text-color--hover);
+
+ .d-icon {
+ color: var(--d-button-default-icon-color--hover);
+ }
}
}
diff --git a/app/models/reviewable.rb b/app/models/reviewable.rb
index 45833f91aa4..3a58999ca2f 100644
--- a/app/models/reviewable.rb
+++ b/app/models/reviewable.rb
@@ -802,6 +802,7 @@ class Reviewable < ActiveRecord::Base
actions.add(:delete_user, bundle: bundle) do |a|
a.icon = "user-xmark"
a.label = "reviewables.actions.reject_user.delete.title"
+ a.description = "reviewables.actions.reject_user.delete.description"
a.require_reject_reason = require_reject_reason
end
diff --git a/app/models/reviewable_flagged_post.rb b/app/models/reviewable_flagged_post.rb
index f0e3409dbc6..68ffb940c74 100644
--- a/app/models/reviewable_flagged_post.rb
+++ b/app/models/reviewable_flagged_post.rb
@@ -61,9 +61,9 @@ class ReviewableFlaggedPost < Reviewable
end
if post.hidden?
- build_action(actions, :agree_and_keep_hidden, icon: "thumbs-up", bundle: agree_bundle)
+ build_action(actions, :agree_and_keep_hidden, icon: "far-eye-slash", bundle: agree_bundle)
else
- build_action(actions, :agree_and_keep, icon: "thumbs-up", bundle: agree_bundle)
+ build_action(actions, :agree_and_keep, icon: "far-eye", bundle: agree_bundle)
build_action(
actions,
:agree_and_edit,
@@ -87,62 +87,63 @@ class ReviewableFlaggedPost < Reviewable
end
end
- if (potential_spam? || potentially_illegal?) && guardian.can_delete_user?(target_created_by)
- delete_user_actions(actions, agree_bundle)
- end
-
if guardian.can_suspend?(target_created_by)
build_action(
actions,
- :agree_and_suspend,
- icon: "ban",
+ :agree_and_silence,
+ icon: "microphone-slash",
bundle: agree_bundle,
- client_action: "suspend",
+ client_action: "silence",
)
build_action(
actions,
- :agree_and_silence,
- icon: "microphone-slash",
+ :agree_and_suspend,
+ icon: "ban",
bundle: agree_bundle,
- client_action: "silence",
+ client_action: "suspend",
)
end
+ if (potential_spam? || potentially_illegal?) && guardian.can_delete_user?(target_created_by)
+ delete_user_actions(actions, agree_bundle)
+ end
+
if post.user_deleted?
build_action(actions, :agree_and_restore, icon: "far-eye", bundle: agree_bundle)
end
- if post.hidden?
- build_action(actions, :disagree_and_restore, icon: "thumbs-down")
- else
- build_action(actions, :disagree, icon: "thumbs-down")
- end
post_visible_or_system_user = !post.hidden? || guardian.user.is_system_user?
can_delete_post_or_topic = guardian.can_delete_post_or_topic?(post)
# We must return early in this case otherwise we can end up with a bundle
# with no associated actions, which is not valid on the client.
- return if !can_delete_post_or_topic && !post_visible_or_system_user
+ return if !can_delete_post_or_topic && !post_visible_or_system_user && post.hidden?
- ignore =
+ disagree_bundle =
actions.add_bundle(
- "#{id}-ignore",
- icon: "thumbs-up",
- label: "reviewables.actions.ignore.title",
+ "#{id}-disagree",
+ icon: "far-eye",
+ label: "reviewables.actions.disagree_bundle.title",
)
+ if post.hidden?
+ build_action(actions, :disagree_and_restore, icon: "far-eye", bundle: disagree_bundle)
+ else
+ build_action(actions, :disagree, icon: "far-eye", bundle: disagree_bundle)
+ end
+
if post_visible_or_system_user
- build_action(actions, :ignore_and_do_nothing, icon: "up-right-from-square", bundle: ignore)
+ build_action(actions, :ignore_and_do_nothing, icon: "xmark", bundle: disagree_bundle)
end
if can_delete_post_or_topic
- build_action(actions, :delete_and_ignore, icon: "trash-can", bundle: ignore)
+ build_action(actions, :delete_and_ignore, icon: "trash-can", bundle: disagree_bundle)
if post.reply_count > 0
build_action(
actions,
:delete_and_ignore_replies,
icon: "trash-can",
confirm: true,
- bundle: ignore,
+ bundle: disagree_bundle,
)
end
end
diff --git a/app/models/reviewable_post.rb b/app/models/reviewable_post.rb
index 62049b40bf1..3e5827b53bf 100644
--- a/app/models/reviewable_post.rb
+++ b/app/models/reviewable_post.rb
@@ -49,18 +49,34 @@ class ReviewablePost < Reviewable
reject =
actions.add_bundle(
- "#{id}-reject",
+ "#{id}-reject-post",
icon: "xmark",
- label: "reviewables.actions.reject.bundle_title",
+ label: "reviewables.actions.reject_post_bundle.title",
)
+ can_penalize = guardian.can_suspend?(target_created_by)
+
if post.trashed?
- build_action(actions, :reject_and_keep_deleted, icon: "trash-can", bundle: reject)
+ if can_penalize
+ build_action(actions, :reject_and_keep_deleted, icon: "trash-can", bundle: reject)
+ else
+ actions.add(:reject_and_keep_deleted, bundle: reject) do |a|
+ a.icon = "trash-can"
+ a.label = "reviewables.actions.reject_and_keep_deleted_standalone.title"
+ end
+ end
elsif guardian.can_delete_post_or_topic?(post)
- build_action(actions, :reject_and_delete, icon: "trash-can", bundle: reject)
+ if can_penalize
+ build_action(actions, :reject_and_delete, icon: "trash-can", bundle: reject)
+ else
+ actions.add(:reject_and_delete, bundle: reject) do |a|
+ a.icon = "trash-can"
+ a.label = "reviewables.actions.reject_and_delete_standalone.title"
+ end
+ end
end
- if guardian.can_suspend?(target_created_by)
+ if can_penalize
build_action(
actions,
:reject_and_suspend,
diff --git a/app/models/reviewable_queued_post.rb b/app/models/reviewable_queued_post.rb
index 586423f0ce1..8768157851c 100644
--- a/app/models/reviewable_queued_post.rb
+++ b/app/models/reviewable_queued_post.rb
@@ -49,23 +49,16 @@ class ReviewableQueuedPost < Reviewable
end
if pending?
- if guardian.can_delete_user?(target_created_by)
- reject_bundle =
- actions.add_bundle("#{id}-reject", label: "reviewables.actions.reject_post.title")
-
- build_action(
- actions,
- :discard_post,
- bundle: reject_bundle,
- icon: "xmark",
- button_class: "reject-post",
+ reject_bundle =
+ actions.add_bundle(
+ "#{id}-reject-post",
+ label: "reviewables.actions.reject_post_bundle.title",
)
- delete_user_actions(actions, reject_bundle)
- else
- build_action(actions, :reject_post, icon: "xmark")
- end
- build_action(actions, :revise_and_reject_post)
+ build_action(actions, :reject_post, bundle: reject_bundle, icon: "xmark")
+ build_action(actions, :revise_and_reject_post, bundle: reject_bundle, icon: "envelope")
+
+ delete_user_actions(actions, reject_bundle) if guardian.can_delete_user?(target_created_by)
end
build_action(actions, :delete) if guardian.can_delete?(self)
diff --git a/app/models/reviewable_user.rb b/app/models/reviewable_user.rb
index 451772918ef..d326661977d 100644
--- a/app/models/reviewable_user.rb
+++ b/app/models/reviewable_user.rb
@@ -16,9 +16,32 @@ class ReviewableUser < Reviewable
build_action(actions, :scrub, client_action: "scrub")
end
if status == "pending"
- build_action(actions, :approve_user, icon: "user-plus") if guardian.can_approve?(target)
-
- delete_user_actions(actions, require_reject_reason: !is_a_suspect_user?)
+ if is_a_suspect_user?
+ confirm_spam_bundle =
+ actions.add_bundle(
+ "#{id}-confirm-spam",
+ icon: "user-xmark",
+ label: "reviewables.actions.confirm_spam.title",
+ )
+ delete_user_actions(actions, confirm_spam_bundle, require_reject_reason: false)
+
+ if guardian.can_approve?(target)
+ actions.add(:approve_user, bundle: nil) do |a|
+ a.icon = "user-plus"
+ a.label = "reviewables.actions.not_spam.title"
+ a.description = "reviewables.actions.not_spam.description"
+ a.completed_message = "reviewables.actions.approve_user.complete"
+ end
+ end
+ else
+ if guardian.can_approve?(target)
+ actions.add(:approve_user, bundle: nil) do |a|
+ a.icon = "user-plus"
+ a.label = "reviewables.actions.approve_user.title"
+ end
+ end
+ delete_user_actions(actions, require_reject_reason: true)
+ end
end
end
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml
index 5c7f41d6a21..758f76ba973 100644
--- a/config/locales/client.en.yml
+++ b/config/locales/client.en.yml
@@ -708,6 +708,7 @@ en:
show_more: "Show more"
show_less: "Show less"
back_to_queue: "Back to queue"
+ editing_post: "Editing post…"
order_by: "Order by"
date_filter: "Posted between"
in_reply_to: "in reply to"
@@ -912,6 +913,10 @@ en:
is_this_post: "Is this %{reviewable_type} %{reviewable_human_score_types}?"
delimiter: "or"
something_else_wrong: "Is there something wrong with this %{reviewable_type}?"
+ approve_user: "Approve this user?"
+ suspect_user: "Is this user spam?"
+ approve_post: "Approve this post?"
+ approve_topic: "Approve this topic?"
types:
reviewable_flagged_post:
@@ -930,6 +935,15 @@ en:
reviewable_post:
title: "Post"
noun: "post"
+ reviewable_ai_chat_message:
+ title: "AI-Flagged Chat Message"
+ noun: "chat message"
+ reviewable_ai_post:
+ title: "AI-Flagged Post"
+ noun: "post"
+ reviewable_post_voting_comment:
+ title: "Flagged Comment"
+ noun: "comment"
flagged_as: "Flagged as"
post_flagged_as: "Post flagged as"
chat_flagged_as: "Chat flagged as"
diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml
index 562bae24efe..303542e7270 100644
--- a/config/locales/server.en.yml
+++ b/config/locales/server.en.yml
@@ -5735,19 +5735,19 @@ en:
description: "Agree with flag and hide this post + automatically send the user a message urging them to edit it."
complete: "Post hidden, user has been notified."
agree_and_edit:
- title: "Agree and Edit Post"
+ title: "Edit post"
description: "Agree with flag and open a composer window to edit the post."
complete: "Flag acknowledged, you can now edit the post."
delete:
title: "Delete"
complete: "Post deleted."
delete_and_ignore:
- title: "Ignore flag and delete post"
- description: "Ignore the flag by removing it from the queue and delete the post; if the first post, delete the topic as well. "
+ title: "Delete post and ignore flag"
+ description: "Delete the post and ignore the flag by removing it from the queue; if the first post, delete the topic as well. "
complete: "Post deleted."
delete_and_ignore_replies:
- title: "Ignore flag, delete post and replies"
- description: "Ignore the flag by removing it from the queue, delete the post and all of its replies; if the first post, delete the topic as well"
+ title: "Delete post and replies, ignore flag"
+ description: "Delete the post and all of its replies, then ignore the flag by removing it from the queue; if the first post, delete the topic as well"
confirm: "Are you sure you want to delete the replies to the post as well?"
complete: "Post and replies deleted."
delete_and_agree:
@@ -5760,11 +5760,14 @@ en:
confirm: "Are you sure you want to delete the replies to the post as well?"
complete: "Post and replies deleted."
disagree_and_restore:
- title: "No, restore post"
- description: "Restore the post so that all users can see it."
+ title: "Restore post"
+ description: "Disagree with flag and restore post"
complete: "Post restored."
- disagree:
+ disagree_bundle:
title: "No"
+ disagree:
+ title: "Keep post"
+ description: "Disagree with flag"
complete: "Flag ignored."
discard_post:
title: "Discard Post"
@@ -5774,37 +5777,45 @@ en:
complete: "Post rejected pending revision."
ignore:
title: "Ignore"
+ description: "Remove it from the queue without taking action."
complete: "Flag ignored."
ignore_and_do_nothing:
title: "Do nothing"
description: "Ignore the flag by removing it from the queue without taking any action. Hidden posts will stay hidden and be handled by the auto-tools."
complete: "Flag ignored."
approve:
- title: "Approve"
+ title: "Yes"
complete: "Post approved."
approve_post:
- title: "Approve Post"
+ title: "Yes"
complete: "Post approved."
approve_post_closed:
- title: "Approve Post"
+ title: "Yes"
confirm: "This topic is closed. Would you like to create the post anyway?"
complete: "Post approved."
+ reject_post_bundle:
+ title: "No"
reject_post:
title: "Reject Post"
complete: "Post rejected."
approve_user:
- title: "Approve User"
+ title: "Yes"
complete: "User approved."
reject_user:
- title: "Delete User…"
+ title: "No"
delete:
title: "Delete User"
- description: "The user will be deleted from the forum."
+ description: "Delete user without blocking"
complete: "User deleted."
block:
title: "Delete and Block User"
description: "The user will be deleted, and we'll block their IP and email address."
complete: "User deleted and blocked."
+ confirm_spam:
+ title: "Yes"
+ not_spam:
+ title: "No"
+ description: "Not spam, approve user"
reject:
title: "Reject"
bundle_title: "Reject…"
@@ -5817,16 +5828,20 @@ en:
reject_and_delete:
title: "Reject and Delete the post"
complete: "Post rejected and deleted."
+ reject_and_delete_standalone:
+ title: "No, delete post"
reject_and_keep_deleted:
title: "Keep post deleted"
complete: "Post rejected and kept deleted."
+ reject_and_keep_deleted_standalone:
+ title: "No, keep post deleted"
scrub:
title: Scrub record
approve_and_restore:
- title: "Approve and Restore post"
+ title: "Yes"
complete: "Post approved and restored."
approve_and_unhide:
- title: "Approve and Unhide post"
+ title: "Yes"
complete: "Post approved and unhidden"
# New separated post actions
post_actions:
diff --git a/frontend/discourse/app/components/reviewable-item.gjs b/frontend/discourse/app/components/reviewable-item.gjs
index 71fcfd8be01..5614639d78c 100644
--- a/frontend/discourse/app/components/reviewable-item.gjs
+++ b/frontend/discourse/app/components/reviewable-item.gjs
@@ -609,6 +609,10 @@ export default class ReviewableItem extends Component {
<h3 class="reviewable-item__context-question">
{{this.reviewable.flaggedReviewableContextQuestion}}
</h3>
+ {{else if this.reviewable.userReviewableContextQuestion}}
+ <h3 class="reviewable-item__context-question">
+ {{this.reviewable.userReviewableContextQuestion}}
+ </h3>
{{/if}}
<div class="reviewable-actions">
diff --git a/frontend/discourse/app/components/reviewable-refresh/item.gjs b/frontend/discourse/app/components/reviewable-refresh/item.gjs
index 7b78d14c026..89460e770be 100644
--- a/frontend/discourse/app/components/reviewable-refresh/item.gjs
+++ b/frontend/discourse/app/components/reviewable-refresh/item.gjs
@@ -37,6 +37,7 @@ import { showAlert } from "discourse/lib/post-action-feedback";
import { clipboardCopy } from "discourse/lib/utilities";
import Category from "discourse/models/category";
import Composer from "discourse/models/composer";
+import { PENDING } from "discourse/models/reviewable";
import Topic from "discourse/models/topic";
import { eq } from "discourse/truth-helpers";
import { i18n } from "discourse-i18n";
@@ -157,7 +158,8 @@ export default class ReviewableItem extends Component {
"claimOptional",
"claimRequired",
"reviewable.claimed_by",
- "siteSettings.reviewable_old_moderator_actions"
+ "siteSettings.reviewable_old_moderator_actions",
+ "isAiReviewable"
)
displayContextQuestion(
createdFromFlag,
@@ -165,16 +167,23 @@ export default class ReviewableItem extends Component {
claimOptional,
claimRequired,
claimedBy,
- oldModeratorActions
+ oldModeratorActions,
+ isAiReviewable
) {
return (
- oldModeratorActions &&
- createdFromFlag &&
- status === 0 &&
- (claimOptional || (claimRequired && claimedBy !== null))
+ (oldModeratorActions &&
+ createdFromFlag &&
+ status === 0 &&
+ (claimOptional || (claimRequired && claimedBy !== null))) ||
+ isAiReviewable
);
}
+ @discourseComputed("reviewable.type")
+ isAiReviewable(type) {
+ return type === "ReviewableAiChatMessage" || type === "ReviewableAiPost";
+ }
+
@discourseComputed(
"reviewable.topic",
"reviewable.topic_id",
@@ -832,8 +841,16 @@ export default class ReviewableItem extends Component {
{{#if this.canPerform}}
<div class="review-item__moderator-actions">
<h3 class="review-item__aside-title">
- {{#if this.displayContextQuestion}}
- {{this.reviewable.flaggedReviewableContextQuestion}}
+ {{#if this.editing}}
+ {{i18n "review.editing_post"}}
+ {{else if (eq this.reviewable.status PENDING)}}
+ {{#if this.displayContextQuestion}}
+ {{this.reviewable.flaggedReviewableContextQuestion}}
+ {{else if this.reviewable.userReviewableContextQuestion}}
+ {{this.reviewable.userReviewableContextQuestion}}
+ {{else}}
+ {{i18n "review.moderator_actions"}}
+ {{/if}}
{{else}}
{{i18n "review.moderator_actions"}}
{{/if}}
diff --git a/frontend/discourse/app/models/reviewable.js b/frontend/discourse/app/models/reviewable.js
index be0e039a240..a58fe941b70 100644
--- a/frontend/discourse/app/models/reviewable.js
+++ b/frontend/discourse/app/models/reviewable.js
@@ -79,6 +79,29 @@ export default class Reviewable extends RestModel {
});
}
+ @discourseComputed("resolvedType", "reviewable_scores")
+ userReviewableContextQuestion(resolvedType, scores) {
+ if (resolvedType === "ReviewableUser") {
+ const isSuspectUser = scores?.some(
+ (score) => score.reason_type === "suspect_user"
+ );
+ if (isSuspectUser) {
+ return i18n("review.context_question.suspect_user");
+ }
+ return i18n("review.context_question.approve_user");
+ }
+ if (resolvedType === "ReviewableQueuedPost") {
+ return i18n("review.context_question.approve_post");
+ }
+ if (resolvedType === "ReviewableQueuedTopic") {
+ return i18n("review.context_question.approve_topic");
+ }
+ if (resolvedType === "ReviewablePost") {
+ return i18n("review.context_question.approve_post");
+ }
+ return null;
+ }
+
@discourseComputed("category_id")
category() {
return Category.findById(this.category_id);
diff --git a/plugins/chat/app/models/chat/reviewable_message.rb b/plugins/chat/app/models/chat/reviewable_message.rb
index 9bf53945e50..68ccd955560 100644
--- a/plugins/chat/app/models/chat/reviewable_message.rb
+++ b/plugins/chat/app/models/chat/reviewable_message.rb
@@ -56,11 +56,9 @@ module Chat
if chat_message.deleted_at?
build_action(actions, :agree_and_restore, icon: "far-eye", bundle: agree)
build_action(actions, :agree_and_keep_deleted, icon: "thumbs-up", bundle: agree)
- build_action(actions, :disagree_and_restore, icon: "thumbs-down")
else
- build_action(actions, :agree_and_delete, icon: "far-eye-slash", bundle: agree)
- build_action(actions, :agree_and_keep_message, icon: "thumbs-up", bundle: agree)
- build_action(actions, :disagree, icon: "thumbs-down")
+ build_action(actions, :agree_and_delete, icon: "trash-can", bundle: agree)
+ build_action(actions, :agree_and_keep_message, icon: "far-eye", bundle: agree)
end
if guardian.can_suspend?(chat_message_creator)
@@ -80,12 +78,23 @@ module Chat
)
end
- ignore_bundle = actions.add_bundle("#{id}-ignore", label: "reviewables.actions.ignore.title")
+ disagree_bundle =
+ actions.add_bundle(
+ "#{id}-disagree",
+ icon: "far-eye",
+ label: "reviewables.actions.disagree_bundle.title",
+ )
+
+ if chat_message.deleted_at?
+ build_action(actions, :disagree_and_restore, icon: "far-eye", bundle: disagree_bundle)
+ else
+ build_action(actions, :disagree, icon: "far-eye", bundle: disagree_bundle)
+ end
- build_action(actions, :ignore, icon: "up-right-from-square", bundle: ignore_bundle)
+ build_action(actions, :ignore, icon: "xmark", bundle: disagree_bundle)
unless chat_message.deleted_at?
- build_action(actions, :delete_and_agree, icon: "trash-can", bundle: ignore_bundle)
+ build_action(actions, :delete_and_agree, icon: "trash-can", bundle: disagree_bundle)
end
end
diff --git a/plugins/chat/config/locales/server.en.yml b/plugins/chat/config/locales/server.en.yml
index 51c4cd9b3dd..63b7ae68475 100644
--- a/plugins/chat/config/locales/server.en.yml
+++ b/plugins/chat/config/locales/server.en.yml
@@ -134,16 +134,17 @@ en:
title: "Delete Message"
description: "Delete the message so that users cannot see it."
delete_and_agree:
- title: "Ignore Flag and Delete Message"
+ title: "Ignore flag and delete message"
description: "Ignore the flag by removing it from the queue and delete the message."
disagree_and_restore:
title: "Disagree and Restore Message"
description: "Restore the message so that all users can see it."
disagree:
- title: "Disagree"
+ title: "Keep message"
+ description: "Disagree with flag and leave message unchanged."
ignore:
- title: "Do Nothing"
- description: "Ignore the flag by removing it from the queue without taking any action."
+ title: "Ignore flag"
+ description: "Remove it from the queue without taking action."
direct_messages:
transcript_title: "Transcript of previous messages in %{channel_name}"
transcript_body: "To give you more context, we included a transcript of the previous messages in this conversation (up to ten):\n\n%{transcript}"
diff --git a/plugins/discourse-ai/app/models/reviewable_ai_chat_message.rb b/plugins/discourse-ai/app/models/reviewable_ai_chat_message.rb
index 175046e8ac9..8394015d751 100644
--- a/plugins/discourse-ai/app/models/reviewable_ai_chat_message.rb
+++ b/plugins/discourse-ai/app/models/reviewable_ai_chat_message.rb
@@ -42,12 +42,10 @@ class ReviewableAiChatMessage < Reviewable
if chat_message.deleted_at?
build_action(actions, :agree_and_restore, icon: "far-eye", bundle: agree)
- build_action(actions, :agree_and_keep_deleted, icon: "thumbs-up", bundle: agree)
- build_action(actions, :disagree_and_restore, icon: "thumbs-down")
+ build_action(actions, :agree_and_keep_deleted, icon: "far-eye-slash", bundle: agree)
else
- build_action(actions, :agree_and_delete, icon: "far-eye-slash", bundle: agree)
- build_action(actions, :agree_and_keep_message, icon: "thumbs-up", bundle: agree)
- build_action(actions, :disagree, icon: "thumbs-down")
+ build_action(actions, :agree_and_delete, icon: "trash-can", bundle: agree)
+ build_action(actions, :agree_and_keep_message, icon: "far-eye", bundle: agree)
end
if guardian.can_suspend?(chat_message_creator)
@@ -67,9 +65,24 @@ class ReviewableAiChatMessage < Reviewable
)
end
- build_action(actions, :ignore, icon: "up-right-from-square")
+ disagree_bundle =
+ actions.add_bundle(
+ "#{id}-disagree",
+ icon: "far-eye",
+ label: "reviewables.actions.disagree_bundle.title",
+ )
- build_action(actions, :delete_and_agree, icon: "far-trash-can") unless chat_message.deleted_at?
+ if chat_message.deleted_at?
+ build_action(actions, :disagree_and_restore, icon: "far-eye", bundle: disagree_bundle)
+ else
+ build_action(actions, :disagree, icon: "far-eye", bundle: disagree_bundle)
+ end
+
+ build_action(actions, :ignore, icon: "xmark", bundle: disagree_bundle)
+
+ unless chat_message.deleted_at?
+ build_action(actions, :delete_and_agree, icon: "trash-can", bundle: disagree_bundle)
+ end
end
def perform_agree_and_keep_message(performed_by, args)
diff --git a/plugins/discourse-ai/app/models/reviewable_ai_post.rb b/plugins/discourse-ai/app/models/reviewable_ai_post.rb
index 19019b7d935..d79be42728d 100644
--- a/plugins/discourse-ai/app/models/reviewable_ai_post.rb
+++ b/plugins/discourse-ai/app/models/reviewable_ai_post.rb
@@ -24,9 +24,22 @@ class ReviewableAiPost < Reviewable
end
if post.hidden?
- build_action(actions, :agree_and_keep_hidden, icon: "thumbs-up", bundle: agree)
+ build_action(actions, :agree_and_keep_hidden, icon: "far-eye-slash", bundle: agree)
else
- build_action(actions, :agree_and_keep, icon: "thumbs-up", bundle: agree)
+ build_action(actions, :agree_and_keep, icon: "far-eye", bundle: agree)
+ end
+
+ if guardian.can_delete_post_or_topic?(post)
+ build_action(actions, :delete_and_agree, icon: "trash-can", bundle: agree)
+ if post.reply_count > 0
+ build_action(
+ actions,
+ :delete_and_agree_replies,
+ icon: "trash-can",
+ bundle: agree,
+ confirm: true,
+ )
+ end
end
if guardian.can_suspend?(target_created_by)
@@ -46,46 +59,37 @@ class ReviewableAiPost < Reviewable
)
end
+ delete_user_actions(actions, agree) if guardian.can_delete_user?(target_created_by)
+
build_action(actions, :agree_and_restore, icon: "far-eye", bundle: agree) if post.user_deleted?
+ disagree_bundle =
+ actions.add_bundle(
+ "#{id}-disagree",
+ icon: "far-eye",
+ label: "reviewables.actions.disagree_bundle.title",
+ )
+
if post.hidden?
- build_action(actions, :disagree_and_restore, icon: "thumbs-down")
+ build_action(actions, :disagree_and_restore, icon: "far-eye", bundle: disagree_bundle)
else
- build_action(actions, :disagree, icon: "thumbs-down")
+ build_action(actions, :disagree, icon: "far-eye", bundle: disagree_bundle)
end
+ build_action(actions, :ignore, icon: "xmark", bundle: disagree_bundle)
+
if guardian.can_delete_post_or_topic?(post)
- delete =
- actions.add_bundle(
- "#{id}-delete",
- icon: "far-trash-can",
- label: "reviewables.actions.delete.title",
- )
- build_action(actions, :delete_and_ignore, icon: "up-right-from-square", bundle: delete)
+ build_action(actions, :delete_and_ignore, icon: "trash-can", bundle: disagree_bundle)
if post.reply_count > 0
build_action(
actions,
:delete_and_ignore_replies,
- icon: "up-right-from-square",
- confirm: true,
- bundle: delete,
- )
- end
- build_action(actions, :delete_and_agree, icon: "thumbs-up", bundle: delete)
- if post.reply_count > 0
- build_action(
- actions,
- :delete_and_agree_replies,
- icon: "up-right-from-square",
- bundle: delete,
+ icon: "trash-can",
confirm: true,
+ bundle: disagree_bundle,
)
end
end
-
- delete_user_actions(actions) if guardian.can_delete_user?(target_created_by)
-
- build_action(actions, :ignore, icon: "up-right-from-square")
end
def perform_agree_and_hide(performed_by, args)
diff --git a/plugins/discourse-ai/assets/javascripts/discourse/components/reviewable-refresh/ai-chat-message.gjs b/plugins/discourse-ai/assets/javascripts/discourse/components/reviewable-refresh/ai-chat-message.gjs
new file mode 100644
index 00000000000..f815f6c7e95
--- /dev/null
+++ b/plugins/discourse-ai/assets/javascripts/discourse/components/reviewable-refresh/ai-chat-message.gjs
@@ -0,0 +1,83 @@
+import Component from "@glimmer/component";
+import { cached } from "@glimmer/tracking";
+import { array } from "@ember/helper";
+import { LinkTo } from "@ember/routing";
+import ReviewableCreatedBy from "discourse/components/reviewable-refresh/created-by";
+import ReviewableTopicLink from "discourse/components/reviewable-refresh/topic-link";
+import highlightWatchedWords from "discourse/lib/highlight-watched-words";
+import { i18n } from "discourse-i18n";
+import ChannelTitle from "discourse/plugins/chat/discourse/components/channel-title";
+import ChatChannel from "discourse/plugins/chat/discourse/models/chat-channel";
+import ModelAccuracies from "../model-accuracies";
+
+export default class ReviewableRefreshAiChatMessage extends Component {
+ @cached
+ get channel() {
+ if (!this.args.reviewable.chat_channel) {
+ return;
+ }
+ return ChatChannel.create(this.args.reviewable.chat_channel);
+ }
+
+ get messageCooked() {
+ return (
+ this.args.reviewable.payload?.message_cooked ||
+ this.args.reviewable.cooked
+ );
+ }
+
+ <template>
+ <div class="review-item__meta-content">
+ <div class="review-item__meta-label">{{i18n
+ "chat.reviewable.message_in_channel"
+ }}</div>
+
+ <div class="review-item__meta-topic-title">
+ {{#if this.channel}}
+ <LinkTo
+ @route="chat.channel.near-message"
+ @models={{array
+ this.channel.slugifiedTitle
+ this.channel.id
+ @reviewable.target_id
+ }}
+ >
+ <ChannelTitle @channel={{this.channel}} />
+ </LinkTo>
+ {{else}}
+ <ReviewableTopicLink @reviewable={{@reviewable}} @tagName="" />
+ {{/if}}
+ </div>
+
+ <div class="review-item__meta-label">{{i18n "review.review_user"}}</div>
+
+ <div class="review-item__meta-flagged-user">
+ <ReviewableCreatedBy @user={{@reviewable.target_created_by}} />
+ </div>
+ </div>
+
+ <div class="review-item__post">
+ <div class="review-item__post-content-wrapper">
+ <div class="review-item__post-content">
+ {{highlightWatchedWords this.messageCooked @reviewable}}
+
+ {{#if @reviewable.payload.transcript_topic_id}}
+ <div class="transcript">
+ <LinkTo
+ @route="topic"
+ @models={{array "-" @reviewable.payload.transcript_topic_id}}
+ class="btn btn-default btn-small"
+ >
+ {{i18n "review.transcript.view"}}
+ </LinkTo>
+ </div>
+ {{/if}}
+
+ <ModelAccuracies @accuracies={{@reviewable.payload.accuracies}} />
+
+ {{yield}}
+ </div>
+ </div>
+ </div>
+ </template>
+}
diff --git a/plugins/discourse-ai/assets/javascripts/discourse/components/reviewable-refresh/ai-post.gjs b/plugins/discourse-ai/assets/javascripts/discourse/components/reviewable-refresh/ai-post.gjs
new file mode 100644
index 00000000000..1a7c3e8c885
--- /dev/null
+++ b/plugins/discourse-ai/assets/javascripts/discourse/components/reviewable-refresh/ai-post.gjs
@@ -0,0 +1,13 @@
+import ReviewablePost from "discourse/components/reviewable-refresh/post";
+import { i18n } from "discourse-i18n";
+import ModelAccuracies from "../model-accuracies";
+
+<template>
+ <ReviewablePost
+ @reviewable={{@reviewable}}
+ @userLabel={{i18n "review.flagged_user"}}
+ @pluginOutletName="after-reviewable-ai-post-body"
+ >
+ <ModelAccuracies @accuracies={{@reviewable.payload.accuracies}} />
+ </ReviewablePost>
+</template>
diff --git a/plugins/discourse-ai/spec/models/reviewable_ai_post_spec.rb b/plugins/discourse-ai/spec/models/reviewable_ai_post_spec.rb
index 7e914fc1e30..fe125a65c48 100644
--- a/plugins/discourse-ai/spec/models/reviewable_ai_post_spec.rb
+++ b/plugins/discourse-ai/spec/models/reviewable_ai_post_spec.rb
@@ -186,7 +186,7 @@ describe ReviewableAiPost do
Fabricate(:user),
raw: "this is the reply text",
reply_to_post_number: post.post_number,
- topic_id: post.topic,
+ topic_id: post.topic_id,
)
end
diff --git a/plugins/discourse-post-voting/app/models/reviewable_post_voting_comment.rb b/plugins/discourse-post-voting/app/models/reviewable_post_voting_comment.rb
index 977af6b17e5..762d3bf965b 100644
--- a/plugins/discourse-post-voting/app/models/reviewable_post_voting_comment.rb
+++ b/plugins/discourse-post-voting/app/models/reviewable_post_voting_comment.rb
@@ -42,12 +42,10 @@ class ReviewablePostVotingComment < Reviewable
if comment.deleted_at?
build_action(actions, :agree_and_restore, icon: "far-eye", bundle: agree)
- build_action(actions, :agree_and_keep_deleted, icon: "thumbs-up", bundle: agree)
- build_action(actions, :disagree_and_restore, icon: "thumbs-down")
+ build_action(actions, :agree_and_keep_deleted, icon: "far-eye-slash", bundle: agree)
else
- build_action(actions, :agree_and_delete, icon: "far-eye-slash", bundle: agree)
- build_action(actions, :agree_and_keep_comment, icon: "thumbs-up", bundle: agree)
- build_action(actions, :disagree, icon: "thumbs-down")
+ build_action(actions, :agree_and_delete, icon: "trash-can", bundle: agree)
+ build_action(actions, :agree_and_keep_comment, icon: "far-eye", bundle: agree)
end
if guardian.can_suspend?(comment_creator)
@@ -67,12 +65,23 @@ class ReviewablePostVotingComment < Reviewable
)
end
- ignore_bundle = actions.add_bundle("#{id}-ignore", label: "reviewables.actions.ignore.title")
+ disagree_bundle =
+ actions.add_bundle(
+ "#{id}-disagree",
+ icon: "far-eye",
+ label: "reviewables.actions.disagree_bundle.title",
+ )
+
+ if comment.deleted_at?
+ build_action(actions, :disagree_and_restore, icon: "far-eye", bundle: disagree_bundle)
+ else
+ build_action(actions, :disagree, icon: "far-eye", bundle: disagree_bundle)
+ end
- build_action(actions, :ignore, icon: "up-right-from-square", bundle: ignore_bundle)
+ build_action(actions, :ignore, icon: "xmark", bundle: disagree_bundle)
unless comment.deleted_at?
- build_action(actions, :delete_and_agree, icon: "far-trash-can", bundle: ignore_bundle)
+ build_action(actions, :delete_and_agree, icon: "trash-can", bundle: disagree_bundle)
end
end
diff --git a/plugins/discourse-post-voting/app/serializers/reviewable_post_voting_comments_serializer.rb b/plugins/discourse-post-voting/app/serializers/reviewable_post_voting_comments_serializer.rb
index 8bda810679a..c30e36905fd 100644
--- a/plugins/discourse-post-voting/app/serializers/reviewable_post_voting_comments_serializer.rb
+++ b/plugins/discourse-post-voting/app/serializers/reviewable_post_voting_comments_serializer.rb
@@ -16,7 +16,7 @@ class ReviewablePostVotingCommentSerializer < ReviewableSerializer
end
def comment_cooked
- object.payload["comment_cooked"]
+ object.payload&.dig("comment_cooked")
end
def include_target_created_at?
diff --git a/plugins/discourse-post-voting/config/locales/server.en.yml b/plugins/discourse-post-voting/config/locales/server.en.yml
index e4c91f46fc7..b99bce66443 100644
--- a/plugins/discourse-post-voting/config/locales/server.en.yml
+++ b/plugins/discourse-post-voting/config/locales/server.en.yml
@@ -48,9 +48,24 @@ en:
agree_and_delete:
title: "Delete comment"
description: "Delete the comment so that users cannot see it."
+ agree_and_suspend:
+ title: "Suspend user"
+ description: "Agree with flag and suspend the user."
+ agree_and_silence:
+ title: "Silence user"
+ description: "Agree with flag and silence the user."
disagree_and_restore:
title: "Disagree and Restore comment"
description: "Restore the comment so that all users can see it."
+ disagree:
+ title: "Keep comment"
+ description: "Disagree with flag and leave comment unchanged."
+ ignore:
+ title: "Ignore flag"
+ description: "Remove it from the queue without taking action."
+ delete_and_agree:
+ title: "Ignore flag and delete comment"
+ description: "Ignore the flag by removing it from the queue and delete the comment."
post_action_types:
vote:
@@ -102,16 +117,17 @@ en:
title: "Delete comment"
description: "Delete the comment so that users cannot see it."
delete_and_agree:
- title: "Ignore Flag and Delete comment"
+ title: "Ignore flag and delete comment"
description: "Ignore the flag by removing it from the queue and delete the comment."
disagree_and_restore:
title: "Disagree and Restore comment"
description: "Restore the comment so that all users can see it."
disagree:
- title: "Disagree"
+ title: "Keep comment"
+ description: "Disagree with flag and leave comment unchanged."
ignore:
- title: "Do Nothing"
- description: "Ignore the flag by removing it from the queue without taking any action."
+ title: "Ignore flag"
+ description: "Remove it from the queue without taking action."
transcript:
view: "View previous comments transcript"
reviewable_score_types:
diff --git a/spec/models/reviewable_queued_post_spec.rb b/spec/models/reviewable_queued_post_spec.rb
index 79d85f49d90..cf3175c40c1 100644
--- a/spec/models/reviewable_queued_post_spec.rb
+++ b/spec/models/reviewable_queued_post_spec.rb
@@ -456,7 +456,7 @@ RSpec.describe ReviewableQueuedPost, type: :model do
actions = reviewable.actions_for(Guardian.new(admin))
bundle_ids = actions.bundles.map(&:id)
- expect(bundle_ids).to include("#{reviewable.id}-reject")
+ expect(bundle_ids).to include("#{reviewable.id}-reject-post")
expect(bundle_ids).not_to include("#{reviewable.id}-post-actions")
expect(bundle_ids).not_to include("#{reviewable.id}-user-actions")
end
@@ -466,7 +466,7 @@ RSpec.describe ReviewableQueuedPost, type: :model do
action_ids = actions.to_a.map(&:id).map(&:to_s)
expect(action_ids).to include("approve_post")
- expect(action_ids).to include("discard_post")
+ expect(action_ids).to include("reject_post")
expect(action_ids).to include("revise_and_reject_post")
expect(action_ids).to include("delete_user")
expect(action_ids).to include("delete_user_block")
diff --git a/spec/models/reviewable_spec.rb b/spec/models/reviewable_spec.rb
index e25293896b6..b0a7f67ad92 100644
--- a/spec/models/reviewable_spec.rb
+++ b/spec/models/reviewable_spec.rb
@@ -844,16 +844,13 @@ RSpec.describe Reviewable, type: :model do
it "gets the bundles and actions for a reviewable" do
actions = reviewable.actions_for(user.guardian)
- expect(actions.bundles.map(&:id)).to eq(%w[approve_post reject_post revise_and_reject_post])
+ expect(actions.bundles.map(&:id)).to eq(["approve_post", "#{reviewable.id}-reject-post"])
expect(actions.bundles.find { |b| b.id == "approve_post" }.actions.map(&:id)).to eq(
["approve_post"],
)
- expect(actions.bundles.find { |b| b.id == "reject_post" }.actions.map(&:id)).to eq(
- ["reject_post"],
- )
- expect(actions.bundles.find { |b| b.id == "revise_and_reject_post" }.actions.map(&:id)).to eq(
- ["revise_and_reject_post"],
- )
+ expect(
+ actions.bundles.find { |b| b.id == "#{reviewable.id}-reject-post" }.actions.map(&:id),
+ ).to eq(%w[reject_post revise_and_reject_post])
end
describe "handling empty bundles" do
diff --git a/spec/system/page_objects/pages/refreshed_review.rb b/spec/system/page_objects/pages/refreshed_review.rb
index 9c41c18630d..a0a9313941e 100644
--- a/spec/system/page_objects/pages/refreshed_review.rb
+++ b/spec/system/page_objects/pages/refreshed_review.rb
@@ -18,9 +18,30 @@ module PageObjects
find(".action-list li.insights").click
end
- def select_bundled_action(reviewable, value)
+ def select_bundled_action(reviewable, value, bundle_id = nil)
within(reviewable_by_id(reviewable.id)) do
- reviewable_action_dropdown.select_row_by_value(value)
+ if bundle_id
+ dropdown_selector = "#{REVIEWABLE_ACTION_DROPDOWN}.#{bundle_id.dasherize}"
+ dropdown = PageObjects::Components::SelectKit.new(dropdown_selector)
+ dropdown.expand
+ dropdown.select_row_by_value(value)
+ else
+ dropdown_count = all(REVIEWABLE_ACTION_DROPDOWN).count
+ dropdown_count.times do |index|
+ dropdown_selector = "#{REVIEWABLE_ACTION_DROPDOWN}:nth-of-type(#{index + 1})"
+ dropdown = PageObjects::Components::SelectKit.new(dropdown_selector)
+ dropdown.expand
+ if dropdown.expanded_component.has_css?(
+ ".select-kit-row[data-value='#{value}']",
+ wait: 0,
+ )
+ dropdown.select_row_by_value(value)
+ break
+ else
+ dropdown.collapse
+ end
+ end
+ end
end
end
diff --git a/spec/system/reviewables_spec.rb b/spec/system/reviewables_spec.rb
index 73172fc09ad..1934651e2c3 100644
--- a/spec/system/reviewables_spec.rb
+++ b/spec/system/reviewables_spec.rb
@@ -63,7 +63,9 @@ describe "Reviewables", type: :system do
it "should show a toast when disagreeing with a flag flag" do
visit("/review")
- find(".post-disagree").click
+ select_kit = PageObjects::Components::SelectKit.new(".dropdown-select-box.post-disagree")
+ select_kit.expand
+ select_kit.select_row_by_value("post-disagree")
expect(toasts).to have_success(I18n.t("reviewables.actions.disagree.complete"))
end
@@ -109,7 +111,11 @@ describe "Reviewables", type: :system do
user_email = user.email
refreshed_review_page.visit_reviewable(reviewable)
- refreshed_review_page.select_bundled_action(reviewable, "user-delete_user")
+ refreshed_review_page.select_bundled_action(
+ reviewable,
+ "user-delete_user",
+ "user-delete-user",
+ )
rejection_reason_modal.fill_in_rejection_reason(rejection_reason)
rejection_reason_modal.select_send_rejection_email_checkbox
rejection_reason_modal.delete_user
@@ -128,7 +134,11 @@ describe "Reviewables", type: :system do
reviewable = ReviewableUser.find_by_target_id(user.id)
refreshed_review_page.visit_reviewable(reviewable)
- refreshed_review_page.select_bundled_action(reviewable, "user-delete_user")
+ refreshed_review_page.select_bundled_action(
+ reviewable,
+ "user-delete_user",
+ "user-delete-user",
+ )
rejection_reason_modal.fill_in_rejection_reason(rejection_reason)
rejection_reason_modal.delete_user
@@ -172,7 +182,11 @@ describe "Reviewables", type: :system do
expect(queued_post_reviewable.target_created_by).to be_present
expect(refreshed_review_page).to have_reviewable_with_pending_status(queued_post_reviewable)
- refreshed_review_page.select_bundled_action(queued_post_reviewable, "delete_user")
+ refreshed_review_page.select_bundled_action(
+ queued_post_reviewable,
+ "delete_user",
+ "reject-post",
+ )
expect(review_page).to have_no_error_dialog_visible
expect(refreshed_review_page).to have_reviewable_with_rejected_status(
@@ -191,7 +205,11 @@ describe "Reviewables", type: :system do
expect(queued_post_reviewable).to be_pending
expect(queued_post_reviewable.target_created_by).to be_present
- refreshed_review_page.select_action(queued_post_reviewable, "revise_and_reject_post")
+ refreshed_review_page.select_bundled_action(
+ queued_post_reviewable,
+ "revise_and_reject_post",
+ "reject-post",
+ )
expect(revise_modal).to be_open
@@ -225,7 +243,11 @@ describe "Reviewables", type: :system do
expect(queued_post_reviewable).to be_pending
expect(queued_post_reviewable.target_created_by).to be_present
- refreshed_review_page.select_action(queued_post_reviewable, "revise_and_reject_post")
+ refreshed_review_page.select_bundled_action(
+ queued_post_reviewable,
+ "revise_and_reject_post",
+ "reject-post",
+ )
expect(revise_modal).to be_open
reason_dropdown =
diff --git a/spec/system/viewing_reviewable_spec.rb b/spec/system/viewing_reviewable_spec.rb
index 4730b59678d..c0e0ede0a7b 100644
--- a/spec/system/viewing_reviewable_spec.rb
+++ b/spec/system/viewing_reviewable_spec.rb
@@ -364,7 +364,11 @@ describe "Viewing reviewable item", type: :system do
reviewable = ReviewableUser.find_by_target_id(user.id)
refreshed_review_page.visit_reviewable(reviewable)
- refreshed_review_page.select_bundled_action(reviewable, "user-approve_user")
+ refreshed_review_page.select_bundled_action(
+ reviewable,
+ "user-approve_user",
+ "user-approve_user",
+ )
expect(refreshed_review_page).to have_reviewable_with_approved_status(reviewable)
expect(refreshed_review_page).to have_approved_item_in_timeline(reviewable)