Skip to content

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

UX: Update copy for topic bulk actions (#38714)

Natalie Tay4b6169028f20
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml
index 35f720a01cd..dbe4dd0a5ec 100644
--- a/config/locales/client.en.yml
+++ b/config/locales/client.en.yml
@@ -3676,11 +3676,11 @@ en:
confirm: "Confirm"
select_all: "Select All"
clear_all: "Clear All"
- unlist_topics: "Unlist Topics"
- relist_topics: "Relist Topics"
+ unlist_topics: "Unlist topics"
+ relist_topics: "Relist topics"
reset_bump_dates: "Reset bump dates"
defer: "Mark unread"
- delete: "Delete Topics"
+ delete: "Delete topics"
delete_topics_count:
one: "Delete Topic"
other: "Delete Topics"
@@ -3719,12 +3719,12 @@ en:
other: "Dismiss New (%{count})"
toggle: "toggle bulk selection of topics"
actions: "Bulk Actions"
- change_category: "Set Category…"
- close_topics: "Close Topics"
- archive_topics: "Archive Topics"
+ change_category: "Update category"
+ close_topics: "Close topics"
+ archive_topics: "Archive topics"
move_messages_to_inbox: "Move to Inbox"
archive_messages: "Move to Archive"
- notification_level: "Notifications…"
+ notification_level: "Update notifications"
change_notification_level: "Change Notification Level"
choose_new_category: "Choose the new category for the topics:"
selected:
@@ -3736,19 +3736,43 @@ en:
selected_count:
one: "%{count} selected"
other: "%{count} selected"
- change_tags: "Replace Tags"
- append_tags: "Append Tags"
+ change_tags: "Replace tags"
+ append_tags: "Add tags"
choose_new_tags: "Choose new tags for these topics:"
- choose_append_tags: "Choose new tags to append for these topics:"
+ choose_append_tags: "Add tags"
changed_tags: "The tags of those topics were changed."
- remove_tags: "Remove All Tags"
+ remove_tags: "Remove tags"
confirm_remove_tags:
one: "All tags will be removed from this topic. Are you sure?"
other: "All tags will be removed from %{count} topics. Are you sure?"
+ confirm_update_topics:
+ one: "Update %{count} topic"
+ other: "Update %{count} topics"
+ confirm_close_topics:
+ one: "Close %{count} topic"
+ other: "Close %{count} topics"
+ confirm_archive_topics:
+ one: "Archive %{count} topic"
+ other: "Archive %{count} topics"
+ confirm_unlist_topics:
+ one: "Unlist %{count} topic"
+ other: "Unlist %{count} topics"
+ confirm_relist_topics:
+ one: "Relist %{count} topic"
+ other: "Relist %{count} topics"
+ confirm_archive_messages:
+ one: "Archive %{count} message"
+ other: "Archive %{count} messages"
+ confirm_move_to_inbox:
+ one: "Move %{count} message to inbox"
+ other: "Move %{count} messages to inbox"
+ confirm_delete_topics:
+ one: "Delete %{count} topic"
+ other: "Delete %{count} topics"
progress:
one: "Progress: <strong>%{count}</strong> topic"
other: "Progress: <strong>%{count}</strong> topics"
- notify: "Notify users of this change."
+ notify: "Notify users of this change"
performing: "Performing bulk operations, please wait…"
completed: "Bulk operations completed successfully!"
completed_count:
@@ -3788,38 +3812,44 @@ en:
name: "Dismiss"
close_topics:
name: "Close"
- note: "Note"
+ description: "Closed topics prevent new replies. <a href='https://meta.discourse.org/t/what-is-a-closed-topic/68098' target='_blank'>Learn more</a>"
+ note: "Add a note to these topics"
optional: (optional)
archive_topics:
name: "Archive"
+ description: "Archived topics are hidden from search and the latest topic list. <a href='https://meta.discourse.org/t/what-is-a-archived-topic/68092' target='_blank'>Learn more</a>"
archive_messages:
name: "Move to Archive"
move_messages_to_inbox:
name: "Move to Inbox"
unlist_topics:
name: "Unlist"
+ description: "Unlisted topics are hidden from the topic list but can still be accessed via a direct link. <a href='https://meta.discourse.org/t/what-is-an-unlisted-topic/68096' target='_blank'>Learn more</a>"
relist_topics:
name: "Relist"
remove_tags:
name: "Remove Tags"
+ description: "Remove all tags from the selected topics."
append_tags:
- name: "Append Tags"
+ name: "Add Tags"
+ description: "Add the following tags to the selected topics:"
replace_tags:
name: "Replace Tags"
+ description: "Replace all existing tags on the selected topics with the following:"
delete_topics:
name: "Delete"
+ description: "Permanently delete the selected topics. This action cannot be undone."
update_category:
name: "Update Category"
- description: "Choose the new category for the selected topics"
+ description: "Move all selected topics to the following category:"
reset_bump_dates:
name: "Reset Bump Dates"
- description: "Reset the topic bump date to the last created post date, which affects ordering in the topic list"
+ description: "Do you want to update the bump dates to the last created post date? This may impact their ordering in the topic list."
defer:
name: "Mark Unread"
- description: "Mark topics as unread"
update_notifications:
name: "Update Notifications"
- description: "Change notification level to Watching, Tracking, Normal, or Muted"
+ description: "Update your personal notification level for the selected topics to:"
topic:
filter_to:
diff --git a/frontend/discourse/app/components/bulk-select-topics-dropdown.gjs b/frontend/discourse/app/components/bulk-select-topics-dropdown.gjs
index 351bcc2f30c..cf190c5b079 100644
--- a/frontend/discourse/app/components/bulk-select-topics-dropdown.gjs
+++ b/frontend/discourse/app/components/bulk-select-topics-dropdown.gjs
@@ -12,6 +12,7 @@ import DismissReadModal from "discourse/components/modal/dismiss-read";
import DMenu from "discourse/float-kit/components/d-menu";
import concatClass from "discourse/helpers/concat-class";
import icon from "discourse/helpers/d-icon";
+import Topic from "discourse/models/topic";
import { i18n } from "discourse-i18n";
const _customButtons = [];
@@ -33,6 +34,12 @@ export function addBulkDropdownButton(opts) {
if (opts.actionType === "performAndRefresh") {
actionOpts.setComponent = false;
}
+ if (opts.description) {
+ actionOpts.description = opts.description;
+ }
+ if (opts.confirmButtonTranslationKey) {
+ actionOpts.confirmButtonTranslationKey = opts.confirmButtonTranslationKey;
+ }
_customOnSelection[opts.id] = actionOpts;
}
@@ -41,6 +48,7 @@ export default class BulkSelectTopicsDropdown extends Component {
@service modal;
@service currentUser;
@service siteSettings;
+ @service toasts;
get buttons() {
let options = [
@@ -173,6 +181,7 @@ export default class BulkSelectTopicsDropdown extends Component {
let initialAction = null;
let initialActionLabel = null;
let description = null;
+ let confirmButtonTranslationKey = null;
if (opts.allowSilent === true) {
allowSilent = true;
}
@@ -182,18 +191,29 @@ export default class BulkSelectTopicsDropdown extends Component {
if (opts.setComponent === true) {
initialAction = "set-component";
}
+ if (_customOnSelection[actionName].description) {
+ description = i18n(_customOnSelection[actionName].description);
+ }
+ if (_customOnSelection[actionName].confirmButtonTranslationKey) {
+ confirmButtonTranslationKey =
+ _customOnSelection[actionName].confirmButtonTranslationKey;
+ }
} else {
title = i18n(`topics.bulk.${title}`);
}
if (opts.description) {
description = opts.description;
}
+ if (opts.confirmButtonTranslationKey) {
+ confirmButtonTranslationKey = opts.confirmButtonTranslationKey;
+ }
this.modal.show(BulkTopicActions, {
model: {
action: actionName,
title,
description,
+ confirmButtonTranslationKey,
bulkSelectHelper: this.args.bulkSelectHelper,
refreshClosure: () => this.args.afterBulkActionComplete(),
allowSilent,
@@ -229,6 +249,7 @@ export default class BulkSelectTopicsDropdown extends Component {
this.showBulkTopicActionsModal(actionId, "change_category", {
allowSilent: true,
description: i18n(`topic_bulk_actions.update_category.description`),
+ confirmButtonTranslationKey: "topics.bulk.confirm_update_topics",
});
break;
case "update-notifications":
@@ -236,52 +257,79 @@ export default class BulkSelectTopicsDropdown extends Component {
description: i18n(
`topic_bulk_actions.update_notifications.description`
),
+ confirmButtonTranslationKey: "topics.bulk.confirm_update_topics",
});
break;
case "close-topics":
this.showBulkTopicActionsModal("close", "close_topics", {
allowSilent: true,
+ description: i18n(`topic_bulk_actions.close_topics.description`),
+ confirmButtonTranslationKey: "topics.bulk.confirm_close_topics",
});
break;
case "archive-topics":
- this.showBulkTopicActionsModal("archive", "archive_topics");
+ this.showBulkTopicActionsModal("archive", "archive_topics", {
+ description: i18n(`topic_bulk_actions.archive_topics.description`),
+ confirmButtonTranslationKey: "topics.bulk.confirm_archive_topics",
+ });
break;
case "archive-messages":
- this.showBulkTopicActionsModal("archive_messages", "archive_messages");
+ this.showBulkTopicActionsModal("archive_messages", "archive_messages", {
+ confirmButtonTranslationKey: "topics.bulk.confirm_archive_messages",
+ });
break;
case "move-messages-to-inbox":
this.showBulkTopicActionsModal(
"move_messages_to_inbox",
- "move_messages_to_inbox"
+ "move_messages_to_inbox",
+ {
+ confirmButtonTranslationKey: "topics.bulk.confirm_move_to_inbox",
+ }
);
break;
case "unlist-topics":
- this.showBulkTopicActionsModal("unlist", "unlist_topics");
+ this.showBulkTopicActionsModal("unlist", "unlist_topics", {
+ description: i18n(`topic_bulk_actions.unlist_topics.description`),
+ confirmButtonTranslationKey: "topics.bulk.confirm_unlist_topics",
+ });
break;
case "relist-topics":
- this.showBulkTopicActionsModal("relist", "relist_topics");
+ this.showBulkTopicActionsModal("relist", "relist_topics", {
+ confirmButtonTranslationKey: "topics.bulk.confirm_relist_topics",
+ });
break;
case "append-tags":
- this.showBulkTopicActionsModal(actionId, "choose_append_tags");
+ this.showBulkTopicActionsModal(actionId, "append_tags", {
+ description: i18n(`topic_bulk_actions.append_tags.description`),
+ confirmButtonTranslationKey: "topics.bulk.confirm_update_topics",
+ });
break;
case "replace-tags":
- this.showBulkTopicActionsModal(actionId, "change_tags");
+ this.showBulkTopicActionsModal(actionId, "change_tags", {
+ description: i18n(`topic_bulk_actions.replace_tags.description`),
+ confirmButtonTranslationKey: "topics.bulk.confirm_update_topics",
+ });
break;
case "remove-tags":
- this.showBulkTopicActionsModal(actionId, "remove_tags");
+ this.showBulkTopicActionsModal(actionId, "remove_tags", {
+ description: i18n(`topic_bulk_actions.remove_tags.description`),
+ confirmButtonTranslationKey: "topics.bulk.confirm_update_topics",
+ });
break;
case "delete-topics":
- this.showBulkTopicActionsModal("delete", "delete");
+ this.showBulkTopicActionsModal("delete", "delete", {
+ description: i18n(`topic_bulk_actions.delete_topics.description`),
+ confirmButtonTranslationKey: "topics.bulk.confirm_delete_topics",
+ });
break;
case "reset-bump-dates":
this.showBulkTopicActionsModal(actionId, "reset_bump_dates", {
description: i18n(`topic_bulk_actions.reset_bump_dates.description`),
+ confirmButtonTranslationKey: "topics.bulk.confirm_update_topics",
});
break;
case "defer":
- this.showBulkTopicActionsModal(actionId, "defer", {
- description: i18n(`topic_bulk_actions.defer.description`),
- });
+ this.deferTopics();
break;
default:
if (_customOnSelection[actionId]) {
@@ -302,6 +350,28 @@ export default class BulkSelectTopicsDropdown extends Component {
}
}
+ @action
+ async deferTopics() {
+ try {
+ await Topic.bulkOperation(
+ this.args.bulkSelectHelper.selected,
+ { type: "destroy_post_timing" },
+ {}
+ );
+ this.args.afterBulkActionComplete?.();
+ this.args.bulkSelectHelper.toggleBulkSelect();
+ this.toasts.success({
+ duration: "short",
+ data: { message: i18n("topics.bulk.completed") },
+ });
+ } catch {
+ this.toasts.error({
+ duration: "short",
+ data: { message: i18n("generic_error") },
+ });
+ }
+ }
+
dismissRead(stopTracking) {
this.args.bulkSelectHelper.dismissRead(stopTracking ? "topics" : "posts");
}
diff --git a/frontend/discourse/app/components/modal/bulk-topic-actions.gjs b/frontend/discourse/app/components/modal/bulk-topic-actions.gjs
index dd96427730b..e752cc3d2dc 100644
--- a/frontend/discourse/app/components/modal/bulk-topic-actions.gjs
+++ b/frontend/discourse/app/components/modal/bulk-topic-actions.gjs
@@ -221,9 +221,6 @@ export default class BulkTopicActions extends Component {
case "reset-bump-dates":
this.performAndRefresh({ type: "reset_bump_dates" });
break;
- case "defer":
- this.performAndRefresh({ type: "destroy_post_timing" });
- break;
case "update-notifications":
this.performAndRefresh({
type: "change_notification_level",
@@ -391,6 +388,15 @@ export default class BulkTopicActions extends Component {
return this.soleCategory && this.isTagAction;
}
+ get confirmButtonLabel() {
+ if (this.model.confirmButtonTranslationKey) {
+ return i18n(this.model.confirmButtonTranslationKey, {
+ count: this.model.bulkSelectHelper.selected.length,
+ });
+ }
+ return i18n("topics.bulk.confirm");
+ }
+
get disabledSubmit() {
if (this.isNotificationAction) {
return !this.notificationLevelId || this.loading;
@@ -407,7 +413,6 @@ export default class BulkTopicActions extends Component {
<template>
<DModal
@title={{@model.title}}
- @subtitle={{@model.description}}
@closeModal={{@closeModal}}
class="topic-bulk-actions-modal -large"
>
@@ -446,8 +451,13 @@ export default class BulkTopicActions extends Component {
</ul>
</div>
{{else}}
- <div class="topic-bulk-actions-modal__selection-info">
+ {{#if @model.description}}
+ <p class="topic-bulk-actions-modal__description">{{trustHTML
+ @model.description
+ }}</p>
+ {{/if}}
+ <div class="topic-bulk-actions-modal__selection-info">
{{#if this.showSoleCategoryTip}}
{{trustHTML
(i18n
@@ -463,7 +473,6 @@ export default class BulkTopicActions extends Component {
)
}}
-
{{/if}}
</div>
@@ -565,8 +574,7 @@ export default class BulkTopicActions extends Component {
<DButton
@action={{this.performAction}}
@disabled={{this.disabledSubmit}}
- @icon="check"
- @label="topics.bulk.confirm"
+ @translatedLabel={{this.confirmButtonLabel}}
id="bulk-topics-confirm"
class="btn-primary"
/>
diff --git a/plugins/discourse-assign/assets/javascripts/discourse/initializers/extend-for-assigns.js b/plugins/discourse-assign/assets/javascripts/discourse/initializers/extend-for-assigns.js
index 6a33d533178..c6128dde65d 100644
--- a/plugins/discourse-assign/assets/javascripts/discourse/initializers/extend-for-assigns.js
+++ b/plugins/discourse-assign/assets/javascripts/discourse/initializers/extend-for-assigns.js
@@ -704,6 +704,8 @@ export default {
label: "topics.bulk.assign",
icon: "user-plus",
class: "btn-default assign-topics",
+ description: "topics.bulk.assign_description",
+ confirmButtonTranslationKey: "topics.bulk.confirm_assign_topics",
action({ setComponent }) {
setComponent(BulkActionsAssignUser);
},
@@ -715,6 +717,8 @@ export default {
label: "topics.bulk.unassign",
icon: "user-xmark",
class: "btn-default unassign-topics",
+ description: "topics.bulk.unassign_description",
+ confirmButtonTranslationKey: "topics.bulk.confirm_unassign_topics",
action({ performAndRefresh }) {
performAndRefresh({ type: "unassign" });
},
diff --git a/plugins/discourse-assign/config/locales/client.en.yml b/plugins/discourse-assign/config/locales/client.en.yml
index 88da3e6a02d..936ad4c282a 100644
--- a/plugins/discourse-assign/config/locales/client.en.yml
+++ b/plugins/discourse-assign/config/locales/client.en.yml
@@ -137,8 +137,16 @@ en:
label: "Assigned to"
topics:
bulk:
- unassign: "Unassign Topics"
- assign: "Assign Topics"
+ unassign: "Unassign topics"
+ assign: "Assign topics"
+ assign_description: "Assign the selected topics to the following user:"
+ unassign_description: "Do you want to unassign the selected topics?"
+ confirm_assign_topics:
+ one: "Assign %{count} topic"
+ other: "Assign %{count} topics"
+ confirm_unassign_topics:
+ one: "Unassign %{count} topic"
+ other: "Unassign %{count} topics"
discourse_automation:
scriptables:
random_assign: