continued

This commit is contained in:
Jarek Radosz 2023-06-20 19:32:18 +02:00
parent 86ecf26751
commit e0a2e14c11
No known key found for this signature in database
GPG Key ID: 62D0FBAE5BF9B953
47 changed files with 442 additions and 439 deletions

View File

@ -1,5 +1,6 @@
export default { export default {
resource: "group", resource: "group",
map() { map() {
this.route("assigned", function () { this.route("assigned", function () {
this.route("show", { path: "/:filter" }); this.route("show", { path: "/:filter" });

View File

@ -1,5 +1,6 @@
export default { export default {
resource: "user.userPrivateMessages", resource: "user.userPrivateMessages",
map() { map() {
this.route("assigned", { path: "/assigned" }, function () { this.route("assigned", { path: "/assigned" }, function () {
this.route("index", { path: "/" }); this.route("index", { path: "/" });

View File

@ -1,5 +1,6 @@
export default { export default {
resource: "user.userActivity", resource: "user.userActivity",
map() { map() {
this.route("assigned"); this.route("assigned");
}, },

View File

@ -1,15 +1,15 @@
<div class="reviewable-filter discourse-assign-assign-to-filter"> <div class="reviewable-filter discourse-assign-assign-to-filter">
<label class="filter-label">{{i18n "discourse_assign.assigned_to"}}</label> <label class="filter-label">{{i18n "discourse_assign.assigned_to"}}</label>
<EmailGroupUserChooser <EmailGroupUserChooser
@value={{additionalFilters.assigned_to}} @value={{this.additionalFilters.assigned_to}}
@onChange={{action "updateAssignedTo"}} @onChange={{action "updateAssignedTo"}}
autocomplete="off" autocomplete="off"
@options={{hash @options={{hash
maximum=1 maximum=1
fullWidthWrap=true fullWidthWrap=true
filterPlaceholder=placeholderKey filterPlaceholder=this.placeholderKey
includeGroups=false includeGroups=false
groupMembersOf=allowedGroups groupMembersOf=this.allowedGroups
}} }}
/> />
</div> </div>

View File

@ -4,7 +4,7 @@
}}</label> }}</label>
<div class="controls"> <div class="controls">
<EmailGroupUserChooser <EmailGroupUserChooser
@value={{searchedTerms.assigned}} @value={{this.searchedTerms.assigned}}
@onChange={{action "onChangeAssigned"}} @onChange={{action "onChangeAssigned"}}
@options={{hash @options={{hash
maximum=1 maximum=1

View File

@ -4,7 +4,7 @@
<label class="checkbox-label"> <label class="checkbox-label">
<Input <Input
@type="checkbox" @type="checkbox"
@checked={{readonly category.enable_unassigned_filter}} @checked={{readonly this.category.enable_unassigned_filter}}
{{on "change" (action "onChangeSetting" value="target.checked")}} {{on "change" (action "onChangeSetting" value="target.checked")}}
/> />
{{i18n "discourse_assign.add_unassigned_filter"}} {{i18n "discourse_assign.add_unassigned_filter"}}

View File

@ -1 +1 @@
<GroupAssignedMenuItem @group={{group}} /> <GroupAssignedMenuItem @group={{this.group}} />

View File

@ -1,8 +1,7 @@
export default { export default {
shouldRender(args, component) { shouldRender(args, component) {
return ( return (
component.currentUser && component.currentUser?.can_assign &&
component.currentUser.can_assign &&
args.group.can_show_assigned_tab && args.group.can_show_assigned_tab &&
args.group.assignment_count > 0 args.group.assignment_count > 0
); );

View File

@ -9,9 +9,9 @@
<ComboBox <ComboBox
@name="alias" @name="alias"
@valueProperty="value" @valueProperty="value"
@value={{assignableLevel}} @value={{this.assignableLevel}}
@content={{assignableLevelOptions}} @content={{this.assignableLevelOptions}}
@class="groups-form-assignable-level" @class="groups-form-assignable-level"
@onChange={{action (mut model.assignable_level)}} @onChange={{action (mut this.model.assignable_level)}}
/> />
</div> </div>

View File

@ -15,6 +15,7 @@ export default {
{ name: I18n.t("groups.alias_levels.everyone"), value: 99 }, { name: I18n.t("groups.alias_levels.everyone"), value: 99 },
]; ];
// TODO
defineProperty( defineProperty(
component, component,
"assignableLevel", "assignableLevel",

View File

@ -1,4 +1,4 @@
{{#if currentUser.can_assign}} {{#if this.currentUser.can_assign}}
<LinkTo @route="userActivity.assigned"> <LinkTo @route="userActivity.assigned">
{{d-icon "user-plus"}} {{d-icon "user-plus"}}
{{i18n "discourse_assign.assigned"}} {{i18n "discourse_assign.assigned"}}

View File

@ -1,4 +1,4 @@
<LinkTo @route="userPrivateMessages.assigned" @model={{model}}> <LinkTo @route="userPrivateMessages.assigned" @model={{this.model}}>
{{d-icon "user-plus" class="glyph"}} {{d-icon "user-plus" class="glyph"}}
{{i18n "discourse_assign.assigned"}} {{i18n "discourse_assign.assigned"}}
</LinkTo> </LinkTo>

View File

@ -1,9 +1,7 @@
export function shouldShowAssigned(args, component) { export function shouldShowAssigned(args, component) {
const needsButton = const needsButton = component.currentUser?.can_assign;
component.currentUser && component.currentUser.get("can_assign");
return ( return (
needsButton && needsButton && (!component.site.mobileView || args.model.isPrivateMessage)
(!component.get("site.mobileView") || args.model.get("isPrivateMessage"))
); );
} }

View File

@ -1 +1 @@
<RemindAssignsFrequency @user={{model}} /> <RemindAssignsFrequency @user={{this.model}} />

View File

@ -1,5 +1,5 @@
export default { export default {
shouldRender(args, component) { shouldRender(args, component) {
return component.currentUser && component.currentUser.get("can_assign"); return component.currentUser?.can_assign;
}, },
}; };

View File

@ -8,17 +8,19 @@ import { isEmpty } from "@ember/utils";
import { ajax } from "discourse/lib/ajax"; import { ajax } from "discourse/lib/ajax";
import { popupAjaxError } from "discourse/lib/ajax-error"; import { popupAjaxError } from "discourse/lib/ajax-error";
export default Controller.extend(ModalFunctionality, { export default class AssignUser extends Controller.extend(ModalFunctionality) {
topicBulkActions: controller(), @service taskActions;
assignSuggestions: null, @controller topicBulkActions;
allowedGroups: null,
taskActions: service(),
autofocus: not("capabilities.touch"),
assigneeName: or("model.username", "model.group_name"),
assigneeError: false,
init() { assignSuggestions = null;
this._super(...arguments); allowedGroups = null;
assigneeError = false;
@not("capabilities.touch") autofocus;
@or("model.username", "model.group_name") assigneeName;
constructor() {
super(...arguments);
this.set("allowedGroups", []); this.set("allowedGroups", []);
this.set("assigneeError", false); this.set("assigneeError", false);
@ -31,17 +33,17 @@ export default Controller.extend(ModalFunctionality, {
this.set("allowedGroups", data.assign_allowed_on_groups); this.set("allowedGroups", data.assign_allowed_on_groups);
this.set("allowedGroupsForAssignment", data.assign_allowed_for_groups); this.set("allowedGroupsForAssignment", data.assign_allowed_for_groups);
}); });
}, }
onShow() { onShow() {
this.set("assigneeError", false); this.set("assigneeError", false);
}, }
onClose() { onClose() {
if (this.get("model.onClose") && this.get("model.username")) { if (this.model.onClose && this.model.username) {
this.get("model.onClose")(this.get("model.username")); this.model.onClose(this.model.username);
}
} }
},
bulkAction(username, note) { bulkAction(username, note) {
return this.topicBulkActions.performAndRefresh({ return this.topicBulkActions.performAndRefresh({
@ -49,19 +51,19 @@ export default Controller.extend(ModalFunctionality, {
username, username,
note, note,
}); });
}, }
@discourseComputed("siteSettings.enable_assign_status") @discourseComputed("siteSettings.enable_assign_status")
statusEnabled() { statusEnabled() {
return this.siteSettings.enable_assign_status; return this.siteSettings.enable_assign_status;
}, }
@discourseComputed("siteSettings.assign_statuses") @discourseComputed("siteSettings.assign_statuses")
availableStatuses() { availableStatuses() {
return this.siteSettings.assign_statuses.split("|").map((status) => { return this.siteSettings.assign_statuses.split("|").map((status) => {
return { id: status, name: status }; return { id: status, name: status };
}); });
}, }
@discourseComputed("siteSettings.assign_statuses", "model.status") @discourseComputed("siteSettings.assign_statuses", "model.status")
status() { status() {
@ -70,22 +72,19 @@ export default Controller.extend(ModalFunctionality, {
this.model.target.assignment_status || this.model.target.assignment_status ||
this.siteSettings.assign_statuses.split("|")[0] this.siteSettings.assign_statuses.split("|")[0]
); );
}, }
@action @action
handleTextAreaKeydown(event) { handleTextAreaKeydown(event) {
if ((event.ctrlKey || event.metaKey) && event.key === "Enter") { if ((event.ctrlKey || event.metaKey) && event.key === "Enter") {
this.assign(); this.assign();
} }
}, }
@action @action
assign() { assign() {
if (this.isBulkAction) { if (this.isBulkAction) {
return this.bulkAction( return this.bulkAction(this.model.username, this.model.note);
this.get("model.username"),
this.get("model.note")
);
} }
if (!this.assigneeName) { if (!this.assigneeName) {
@ -95,18 +94,15 @@ export default Controller.extend(ModalFunctionality, {
let path = "/assign/assign"; let path = "/assign/assign";
if (isEmpty(this.get("model.username"))) { if (isEmpty(this.model.username)) {
this.model.target.set("assigned_to_user", null); this.model.target.set("assigned_to_user", null);
} }
if (isEmpty(this.get("model.group_name"))) { if (isEmpty(this.model.group_name)) {
this.model.target.set("assigned_to_group", null); this.model.target.set("assigned_to_group", null);
} }
if ( if (isEmpty(this.model.username) && isEmpty(this.model.group_name)) {
isEmpty(this.get("model.username")) &&
isEmpty(this.get("model.group_name"))
) {
path = "/assign/unassign"; path = "/assign/unassign";
} }
@ -115,19 +111,19 @@ export default Controller.extend(ModalFunctionality, {
return ajax(path, { return ajax(path, {
type: "PUT", type: "PUT",
data: { data: {
username: this.get("model.username"), username: this.model.username,
group_name: this.get("model.group_name"), group_name: this.model.group_name,
target_id: this.get("model.target.id"), target_id: this.model.target.id,
target_type: this.get("model.targetType"), target_type: this.model.targetType,
note: this.get("model.note"), note: this.model.note,
status: this.get("model.status"), status: this.model.status,
}, },
}) })
.then(() => { .then(() => {
this.get("model.onSuccess")?.(); this.model.onSuccess?.();
}) })
.catch(popupAjaxError); .catch(popupAjaxError);
}, }
@action @action
assignUser(name) { assignUser(name) {
@ -136,27 +132,27 @@ export default Controller.extend(ModalFunctionality, {
if (name) { if (name) {
return this.assign(); return this.assign();
} }
}, }
@action @action
assignUsername(selected) { assignUsername(selected) {
this.setGroupOrUser(selected.firstObject); this.setGroupOrUser(selected.firstObject);
}, }
setGroupOrUser(name) { setGroupOrUser(name) {
this.set("assigneeError", false); this.set("assigneeError", false);
this.set("model.allowedGroups", this.taskActions.allowedGroups);
if (this.allowedGroupsForAssignment.includes(name)) { if (this.allowedGroupsForAssignment.includes(name)) {
this.setProperties({ this.setProperties({
"model.username": null, "model.username": null,
"model.group_name": name, "model.group_name": name,
"model.allowedGroups": this.taskActions.allowedGroups,
}); });
} else { } else {
this.setProperties({ this.setProperties({
"model.username": name, "model.username": name,
"model.group_name": null, "model.group_name": null,
"model.allowedGroups": this.taskActions.allowedGroups,
}); });
} }
}, }
}); }

View File

@ -6,22 +6,23 @@ import { inject as controller } from "@ember/controller";
import { inject as service } from "@ember/service"; import { inject as service } from "@ember/service";
import { action } from "@ember/object"; import { action } from "@ember/object";
export default UserTopicsList.extend({ export default class GroupAssignedShow extends UserTopicsList {
user: controller(), @service taskActions;
taskActions: service(), @controller user;
order: "",
ascending: false,
search: "",
bulkSelectEnabled: false,
selected: [],
canBulkSelect: alias("currentUser.staff"),
queryParams: ["order", "ascending", "search"], queryParams = ["order", "ascending", "search"];
order = "";
ascending = false;
search = "";
bulkSelectEnabled = false;
selected = [];
@alias("currentUser.staff") canBulkSelect;
_setSearchTerm(searchTerm) { _setSearchTerm(searchTerm) {
this.set("search", searchTerm); this.set("search", searchTerm);
this.refreshModel(); this.refreshModel();
}, }
refreshModel() { refreshModel() {
this.set("loading", true); this.set("loading", true);
@ -39,21 +40,21 @@ export default UserTopicsList.extend({
.finally(() => { .finally(() => {
this.set("loading", false); this.set("loading", false);
}); });
}, }
@action @action
unassign(targetId, targetType = "Topic") { unassign(targetId, targetType = "Topic") {
this.taskActions this.taskActions
.unassign(targetId, targetType) .unassign(targetId, targetType)
.then(() => this.send("changeAssigned")); .then(() => this.send("changeAssigned"));
}, }
@action @action
reassign(topic) { reassign(topic) {
this.taskActions this.taskActions
.assign(topic) .assign(topic)
.set("model.onSuccess", () => this.send("changeAssigned")); .set("model.onSuccess", () => this.send("changeAssigned"));
}, }
@action @action
changeSort(sortBy) { changeSort(sortBy) {
@ -64,20 +65,20 @@ export default UserTopicsList.extend({
this.setProperties({ order: sortBy, ascending: false }); this.setProperties({ order: sortBy, ascending: false });
this.refreshModel(); this.refreshModel();
} }
}, }
@action @action
onChangeFilter(value) { onChangeFilter(value) {
discourseDebounce(this, this._setSearchTerm, value, INPUT_DELAY * 2); discourseDebounce(this, this._setSearchTerm, value, INPUT_DELAY * 2);
}, }
@action @action
toggleBulkSelect() { toggleBulkSelect() {
this.toggleProperty("bulkSelectEnabled"); this.toggleProperty("bulkSelectEnabled");
}, }
@action @action
refresh() { refresh() {
this.refreshModel(); this.refreshModel();
}, }
}); }

View File

@ -6,33 +6,34 @@ import discourseComputed from "discourse-common/utils/decorators";
import discourseDebounce from "discourse-common/lib/debounce"; import discourseDebounce from "discourse-common/lib/debounce";
import { INPUT_DELAY } from "discourse-common/config/environment"; import { INPUT_DELAY } from "discourse-common/config/environment";
export default Controller.extend({ export default class GroupAssigned extends Controller {
router: service(), @service router;
application: controller(), @controller application;
loading: false,
offset: 0, loading = false;
filterName: "", offset = 0;
filter: "", filterName = "";
filter = "";
@discourseComputed("router.currentRoute.queryParams.order") @discourseComputed("router.currentRoute.queryParams.order")
order(order) { order(order) {
return order || ""; return order || "";
}, }
@discourseComputed("router.currentRoute.queryParams.ascending") @discourseComputed("router.currentRoute.queryParams.ascending")
ascending(ascending) { ascending(ascending) {
return ascending || false; return ascending || false;
}, }
@discourseComputed("router.currentRoute.queryParams.search") @discourseComputed("router.currentRoute.queryParams.search")
search(search) { search(search) {
return search || ""; return search || "";
}, }
@discourseComputed("site.mobileView") @discourseComputed("site.mobileView")
isDesktop(mobileView) { isDesktop(mobileView) {
return !mobileView; return !mobileView;
}, }
_setFilter(filter) { _setFilter(filter) {
this.set("loading", true); this.set("loading", true);
@ -53,7 +54,7 @@ export default Controller.extend({
.finally(() => { .finally(() => {
this.set("loading", false); this.set("loading", false);
}); });
}, }
findMembers(refresh) { findMembers(refresh) {
if (refresh) { if (refresh) {
@ -77,15 +78,15 @@ export default Controller.extend({
}) })
.finally(() => this.set("loading", false)); .finally(() => this.set("loading", false));
} }
}, }
@action @action
loadMore() { loadMore() {
this.findMembers(); this.findMembers();
}, }
@action @action
onChangeFilterName(value) { onChangeFilterName(value) {
discourseDebounce(this, this._setFilter, value, INPUT_DELAY * 2); discourseDebounce(this, this._setFilter, value, INPUT_DELAY * 2);
}, }
}); }

View File

@ -12,7 +12,7 @@ import { htmlSafe } from "@ember/template";
export default class UserActivityAssigned extends UserTopicsList { export default class UserActivityAssigned extends UserTopicsList {
@service taskActions; @service taskActions;
@controller user; @controller user;
queryParams = ["order", "ascending", "search"]; queryParams = ["order", "ascending", "search"];
order = ""; order = "";

View File

@ -1,31 +1,24 @@
import DiscourseRoute from "discourse/routes/discourse"; import DiscourseRoute from "discourse/routes/discourse";
import { findOrResetCachedTopicList } from "discourse/lib/cached-topic-list"; import { findOrResetCachedTopicList } from "discourse/lib/cached-topic-list";
export default DiscourseRoute.extend({ export default class GroupAssignedShow extends DiscourseRoute {
beforeModel(transition) { beforeModel(transition) {
if (!(transition.hasOwnProperty("from") && transition.from)) { if (transition.from?.localName === "show") {
return;
}
if (transition.from.localName === "show") {
this.session.set("topicListScrollPosition", 1); this.session.set("topicListScrollPosition", 1);
} }
}, }
model(params) { model(params) {
let filter = null; let filter;
if ( if (["everyone", this.modelFor("group").name].includes(params.filter)) {
["everyone", this.modelFor("group").get("name")].includes(params.filter) filter = `topics/group-topics-assigned/${this.modelFor("group").name}`;
) {
filter = `topics/group-topics-assigned/${this.modelFor("group").get(
"name"
)}`;
} else { } else {
filter = `topics/messages-assigned/${params.filter}`; filter = `topics/messages-assigned/${params.filter}`;
} }
const lastTopicList = findOrResetCachedTopicList(this.session, filter);
return lastTopicList return (
? lastTopicList findOrResetCachedTopicList(this.session, filter) ||
: this.store.findFiltered("topicList", { this.store.findFiltered("topicList", {
filter, filter,
params: { params: {
order: params.order, order: params.order,
@ -33,17 +26,18 @@ export default DiscourseRoute.extend({
search: params.search, search: params.search,
direct: params.filter !== "everyone", direct: params.filter !== "everyone",
}, },
}); })
}, );
}
setupController(controller, model) { setupController(controller, model) {
controller.setProperties({ controller.setProperties({
model, model,
search: this.currentModel.params.search, search: this.currentModel.params.search,
}); });
}, }
renderTemplate() { renderTemplate() {
this.render("group-topics-list"); this.render("group-topics-list");
}, }
}); }

View File

@ -2,10 +2,10 @@ import DiscourseRoute from "discourse/routes/discourse";
import { ajax } from "discourse/lib/ajax"; import { ajax } from "discourse/lib/ajax";
import { action } from "@ember/object"; import { action } from "@ember/object";
export default DiscourseRoute.extend({ export default class GroupAssigned extends DiscourseRoute {
model() { model() {
return ajax(`/assign/members/${this.modelFor("group").get("name")}`); return ajax(`/assign/members/${this.modelFor("group").name}`);
}, }
setupController(controller, model) { setupController(controller, model) {
controller.setProperties({ controller.setProperties({
@ -19,7 +19,7 @@ export default DiscourseRoute.extend({
}); });
controller.findMembers(true); controller.findMembers(true);
}, }
redirect(model, transition) { redirect(model, transition) {
if (transition.to.params.hasOwnProperty("filter")) { if (transition.to.params.hasOwnProperty("filter")) {
@ -27,10 +27,10 @@ export default DiscourseRoute.extend({
} else { } else {
this.transitionTo("group.assigned.show", "everyone"); this.transitionTo("group.assigned.show", "everyone");
} }
}, }
@action @action
changeAssigned() { changeAssigned() {
this.refresh(); this.refresh();
}, }
}); }

View File

@ -3,19 +3,19 @@ import UserTopicListRoute from "discourse/routes/user-topic-list";
import cookie from "discourse/lib/cookie"; import cookie from "discourse/lib/cookie";
import { action } from "@ember/object"; import { action } from "@ember/object";
export default UserTopicListRoute.extend({ export default class UserActivityAssigned extends UserTopicListRoute {
templateName: "user-activity-assigned", templateName = "user-activity-assigned";
controllerName: "user-activity-assigned", controllerName = "user-activity-assigned";
userActionType: 16, userActionType = 16;
noContentHelpKey: "discourse_assigns.no_assigns", noContentHelpKey = "discourse_assigns.no_assigns";
beforeModel() { beforeModel() {
if (!this.currentUser) { if (!this.currentUser) {
cookie("destination_url", window.location.href); cookie("destination_url", window.location.href);
this.transitionTo("login"); this.transitionTo("login");
} }
}, }
model(params) { model(params) {
return this.store.findFiltered("topicList", { return this.store.findFiltered("topicList", {
@ -29,14 +29,14 @@ export default UserTopicListRoute.extend({
search: params.search, search: params.search,
}, },
}); });
}, }
titleToken() { titleToken() {
return I18n.t("discourse_assign.assigned"); return I18n.t("discourse_assign.assigned");
}, }
@action @action
changeAssigned() { changeAssigned() {
this.refresh(); this.refresh();
}, }
}); }

View File

@ -2,16 +2,16 @@ import I18n from "I18n";
import DropdownSelectBoxComponent from "select-kit/components/dropdown-select-box"; import DropdownSelectBoxComponent from "select-kit/components/dropdown-select-box";
import { action } from "@ember/object"; import { action } from "@ember/object";
export default DropdownSelectBoxComponent.extend({ export default class AssignActionsDropdown extends DropdownSelectBoxComponent {
classNames: ["assign-actions-dropdown"], classNames = ["assign-actions-dropdown"];
headerIcon: null, headerIcon = null;
allowInitialValueMutation: false, allowInitialValueMutation = false;
showFullTitle: true, showFullTitle = true;
selectKitOptions: { selectKitOptions = {
icon: null, icon: null,
translatedNone: "...", translatedNone: "...",
showFullTitle: true, showFullTitle: true,
}, };
computeContent() { computeContent() {
let options = []; let options = [];
@ -49,7 +49,7 @@ export default DropdownSelectBoxComponent.extend({
}); });
} }
return options; return options;
}, }
@action @action
onSelect(id) { onSelect(id) {
@ -65,5 +65,5 @@ export default DropdownSelectBoxComponent.extend({
if (postId) { if (postId) {
this.unassign(postId, "Post"); this.unassign(postId, "Post");
} }
}, }
}); }

View File

@ -1,5 +1,9 @@
{{avatar user imageSize="small"}} <div class="assigned-to-user">
<span class="assigned-username"> {{avatar @user imageSize="small"}}
{{user.username}}
</span> <span class="assigned-username">
{{yield}} {{@user.username}}
</span>
{{yield}}
</div>

View File

@ -1,5 +0,0 @@
import Component from "@ember/component";
export default Component.extend({
classNames: ["assigned-to-user"],
});

View File

@ -5,84 +5,84 @@
This causes the topic-post-badge to be considered the same word as "text" This causes the topic-post-badge to be considered the same word as "text"
at the end of the link, preventing it from line wrapping onto its own line. at the end of the link, preventing it from line wrapping onto its own line.
}} }}
{{#if bulkSelectEnabled}} {{#if this.bulkSelectEnabled}}
<td class="bulk-select topic-list-data"> <td class="bulk-select topic-list-data">
<input type="checkbox" class="bulk-select" /> <input type="checkbox" class="bulk-select" />
</td> </td>
{{/if}} {{/if}}
<td class="main-link clearfix topic-list-data" colspan="1"> <td class="main-link clearfix topic-list-data" colspan="1">
<span class="link-top-line"> <span class="link-top-line">
{{~raw "topic-status" topic=topic}} {{~raw "topic-status" topic=this.topic}}
{{~#if isPrivateMessage}} {{~#if this.isPrivateMessage}}
{{~d-icon "envelope" class="private-message-icon"}} {{~d-icon "envelope" class="private-message-icon"}}
{{~/if}} {{~/if}}
{{~topic-link topic class="raw-link raw-topic-link"}} {{~topic-link this.topic class="raw-link raw-topic-link"}}
{{~#if topic.featured_link}} {{~#if this.topic.featured_link}}
{{~topic-featured-link topic}} {{~topic-featured-link this.topic}}
{{~/if}} {{~/if}}
{{~#if showTopicPostBadges}} {{~#if this.showTopicPostBadges}}
{{~raw {{~raw
"topic-post-badges" "topic-post-badges"
unread=topic.unread unread=this.topic.unread
unseen=topic.unseen unseen=this.topic.unseen
url=topic.lastUnreadUrl url=this.topic.lastUnreadUrl
newDotText=newDotText newDotText=this.newDotText
}} }}
{{~/if}} {{~/if}}
</span> </span>
<div class="link-bottom-line"> <div class="link-bottom-line">
{{#unless hideCategory}} {{#unless this.hideCategory}}
{{#unless topic.isPinnedUncategorized}} {{#unless this.topic.isPinnedUncategorized}}
{{category-link topic.category}} {{category-link this.topic.category}}
{{/unless}} {{/unless}}
{{/unless}} {{/unless}}
{{discourse-tags topic mode="list" tagsForUser=tagsForUser}} {{discourse-tags this.topic mode="list" tagsForUser=this.tagsForUser}}
{{raw {{raw
"list/action-list" "list/action-list"
topic=topic topic=this.topic
postNumbers=topic.liked_post_numbers postNumbers=this.topic.liked_post_numbers
className="likes" className="likes"
icon="heart" icon="heart"
}} }}
</div> </div>
{{#if expandPinned}} {{#if this.expandPinned}}
{{raw "list/topic-excerpt" topic=topic}} {{raw "list/topic-excerpt" topic=this.topic}}
{{/if}} {{/if}}
</td> </td>
{{#if showPosters}} {{#if this.showPosters}}
{{raw "list/posters-column" posters=topic.featuredUsers}} {{raw "list/posters-column" posters=this.topic.featuredUsers}}
{{/if}} {{/if}}
{{raw "list/posts-count-column" topic=topic}} {{raw "list/posts-count-column" topic=this.topic}}
<td class="num views {{topic.viewsHeat}} topic-list-data">{{number <td class="num views {{this.topic.viewsHeat}} topic-list-data">{{number
topic.views this.topic.views
numberKey="views_long" numberKey="views_long"
}}</td> }}</td>
{{raw {{raw
"list/activity-column" "list/activity-column"
topic=topic topic=this.topic
class="num topic-list-data" class="num topic-list-data"
tagName="td" tagName="td"
}} }}
<td class="topic-list-data"> <td class="topic-list-data">
{{#if topic.assigned_to_user}} {{#if this.topic.assigned_to_user}}
<AssignActionsDropdown <AssignActionsDropdown
@topic={{topic}} @topic={{this.topic}}
@assignee={{topic.assigned_to_user.username}} @assignee={{this.topic.assigned_to_user.username}}
@unassign={{unassign}} @unassign={{this.unassign}}
@reassign={{reassign}} @reassign={{this.reassign}}
/> />
{{else if topic.assigned_to_group}} {{else if this.topic.assigned_to_group}}
<AssignActionsDropdown <AssignActionsDropdown
@topic={{topic}} @topic={{this.topic}}
@assignee={{topic.assigned_to_group.name}} @assignee={{this.topic.assigned_to_group.name}}
@group={{true}} @group={{true}}
@unassign={{unassign}} @unassign={{this.unassign}}
@reassign={{reassign}} @reassign={{this.reassign}}
/> />
{{else}} {{else}}
<AssignActionsDropdown @topic={{topic}} @unassign={{unassign}} /> <AssignActionsDropdown @topic={{this.topic}} @unassign={{this.unassign}} />
{{/if}} {{/if}}
</td> </td>

View File

@ -1,7 +1,8 @@
import TopicListItem from "discourse/components/topic-list-item"; import TopicListItem from "discourse/components/topic-list-item";
import { equal } from "@ember/object/computed"; import { equal } from "@ember/object/computed";
export default TopicListItem.extend({ export default class AssignedTopicListItem extends TopicListItem {
classNames: ["assigned-topic-list-item"], classNames = ["assigned-topic-list-item"];
isPrivateMessage: equal("topic.archetype", "private_message"),
}); @equal("topic.archetype", "private_message") isPrivateMessage;
}

View File

@ -1,42 +1,46 @@
{{#unless skipHeader}} {{#unless this.skipHeader}}
<thead class="topic-list-header assigned-topic-list-header"> <thead class="topic-list-header assigned-topic-list-header">
{{raw {{raw
"topic-list-header" "topic-list-header"
canBulkSelect=canBulkSelect canBulkSelect=this.canBulkSelect
canDoBulkActions=canDoBulkActions canDoBulkActions=this.canDoBulkActions
toggleInTitle=toggleInTitle toggleInTitle=this.toggleInTitle
hideCategory=hideCategory hideCategory=this.hideCategory
showPosters=true showPosters=true
showLikes=showLikes showLikes=this.showLikes
showOpLikes=showOpLikes showOpLikes=this.showOpLikes
order=order order=this.order
ascending=ascending ascending=this.ascending
sortable=sortable sortable=this.sortable
listTitle=listTitle listTitle=this.listTitle
bulkSelectEnabled=bulkSelectEnabled bulkSelectEnabled=this.bulkSelectEnabled
}} }}
</thead> </thead>
{{/unless}} {{/unless}}
<tbody class="topic-list-body assigned-topic-list-body"> <tbody class="topic-list-body assigned-topic-list-body">
{{#each filteredTopics as |topic|}} {{#each this.filteredTopics as |topic|}}
<AssignedTopicListItem <AssignedTopicListItem
@topic={{topic}} @topic={{topic}}
@bulkSelectEnabled={{bulkSelectEnabled}} @bulkSelectEnabled={{this.bulkSelectEnabled}}
@showTopicPostBadges={{showTopicPostBadges}} @showTopicPostBadges={{this.showTopicPostBadges}}
@hideCategory={{hideCategory}} @hideCategory={{this.hideCategory}}
@showPosters={{true}} @showPosters={{true}}
@showLikes={{showLikes}} @showLikes={{this.showLikes}}
@showOpLikes={{showOpLikes}} @showOpLikes={{this.showOpLikes}}
@expandGloballyPinned={{expandGloballyPinned}} @expandGloballyPinned={{this.expandGloballyPinned}}
@expandAllPinned={{expandAllPinned}} @expandAllPinned={{this.expandAllPinned}}
@lastVisitedTopic={{lastVisitedTopic}} @lastVisitedTopic={{this.lastVisitedTopic}}
@selected={{selected}} @selected={{this.selected}}
@tagsForUser={{tagsForUser}} @tagsForUser={{this.tagsForUser}}
@unassign={{unassign}} @unassign={{this.unassign}}
@reassign={{reassign}} @reassign={{this.reassign}}
/> />
{{raw "list/visited-line" lastVisitedTopic=lastVisitedTopic topic=topic}} {{raw
"list/visited-line"
lastVisitedTopic=this.lastVisitedTopic
topic=topic
}}
{{/each}} {{/each}}
</tbody> </tbody>

View File

@ -1,3 +1,3 @@
import EmailGroupUserChooserRow from "select-kit/components/email-group-user-chooser-row"; import EmailGroupUserChooserRow from "select-kit/components/email-group-user-chooser-row";
export default EmailGroupUserChooserRow.extend(); export default class AssigneeChooserRow extends EmailGroupUserChooserRow {}

View File

@ -1,7 +1,7 @@
import EmailGroupUserChooser from "select-kit/components/email-group-user-chooser"; import EmailGroupUserChooser from "select-kit/components/email-group-user-chooser";
export default EmailGroupUserChooser.extend({ export default class AssigneeChooser extends EmailGroupUserChooser {
modifyComponentForRow() { modifyComponentForRow() {
return "assignee-chooser-row"; return "assignee-chooser-row";
}, }
}); }

View File

@ -1,37 +1,37 @@
<ConditionalLoadingSpinner @condition={{loading}}> <ConditionalLoadingSpinner @condition={{this.loading}}>
{{#if hasIncoming}} {{#if this.hasIncoming}}
<div class="show-mores"> <div class="show-mores">
<a href class="alert alert-info clickable" {{action showInserted}}> <a href class="alert alert-info clickable" {{action this.showInserted}}>
<CountI18n <CountI18n
@key="topic_count_" @key="topic_count_"
@suffix="latest" @suffix="latest"
@count={{incomingCount}} @count={{this.incomingCount}}
/> />
</a> </a>
</div> </div>
{{/if}} {{/if}}
{{#if topics}} {{#if this.topics}}
<AssignedTopicList <AssignedTopicList
@showPosters={{showPosters}} @showPosters={{this.showPosters}}
@hideCategory={{hideCategory}} @hideCategory={{this.hideCategory}}
@topics={{topics}} @topics={{this.topics}}
@expandExcerpts={{expandExcerpts}} @expandExcerpts={{this.expandExcerpts}}
@bulkSelectEnabled={{bulkSelectEnabled}} @bulkSelectEnabled={{this.bulkSelectEnabled}}
@canBulkSelect={{canBulkSelect}} @canBulkSelect={{this.canBulkSelect}}
@bulkSelectAction={{bulkSelectAction}} @bulkSelectAction={{this.bulkSelectAction}}
@selected={{selected}} @selected={{this.selected}}
@skipHeader={{skipHeader}} @skipHeader={{this.skipHeader}}
@tagsForUser={{tagsForUser}} @tagsForUser={{this.tagsForUser}}
@changeSort={{changeSort}} @changeSort={{this.changeSort}}
@toggleBulkSelect={{toggleBulkSelect}} @toggleBulkSelect={{this.toggleBulkSelect}}
@unassign={{unassign}} @unassign={{this.unassign}}
@reassign={{reassign}} @reassign={{this.reassign}}
@onScroll={{onScroll}} @onScroll={{this.onScroll}}
@scrollOnLoad={{scrollOnLoad}} @scrollOnLoad={{this.scrollOnLoad}}
/> />
{{else}} {{else}}
{{#unless loadingMore}} {{#unless this.loadingMore}}
<div class="alert alert-info"> <div class="alert alert-info">
{{i18n "choose_topic.none_found"}} {{i18n "choose_topic.none_found"}}
</div> </div>

View File

@ -7,21 +7,21 @@ function assignIfEqual(topic, data) {
} }
} }
export default Component.extend({ export default class FlaggedTopicListener extends Component {
didInsertElement() { didInsertElement() {
this._super(); super.didInsertElement(...arguments);
this.messageBus.subscribe("/staff/topic-assignment", (data) => { this.messageBus.subscribe("/staff/topic-assignment", (data) => {
let flaggedTopics = this.flaggedTopics; if (this.flaggedTopics) {
if (flaggedTopics) { this.flaggedTopics.forEach((ft) => assignIfEqual(ft.topic, data));
flaggedTopics.forEach((ft) => assignIfEqual(ft.topic, data));
} else { } else {
assignIfEqual(this.topic, data); assignIfEqual(this.topic, data);
} }
}); });
}, }
willDestroyElement() { willDestroyElement() {
this._super(); super.willDestroyElement(...arguments);
this.messageBus.unsubscribe("/staff/topic-assignment"); this.messageBus.unsubscribe("/staff/topic-assignment");
}, }
}); }

View File

@ -1,53 +1,55 @@
{{#if showAvatar}} <li>
{{#if @showAvatar}}
<LinkTo <LinkTo
@route="group.assigned.show" @route="group.assigned.show"
@model={{filter.username_lower}} @model={{@filter.username_lower}}
@query={{hash order=order ascending=ascending search=search}} @query={{hash order=@order ascending=@ascending search=@search}}
> >
<div class="assign-image"> <div class="assign-image">
<a href={{filter.userPath}} data-user-card={{filter.username}}>{{avatar <a
filter href={{@filter.userPath}}
imageSize="large" data-user-card={{@filter.username}}
}}</a> >{{avatar filter imageSize="large"}}</a>
</div> </div>
<div class="assign-names"> <div class="assign-names">
<div class="assign-username">{{format-username filter.username}}</div> <div class="assign-username">{{format-username @filter.username}}</div>
<div class="assign-name">{{filter.name}}</div> <div class="assign-name">{{@filter.name}}</div>
</div> </div>
<div class="assign-count"> <div class="assign-count">
{{filter.assignments_count}} {{@filter.assignments_count}}
</div> </div>
</LinkTo> </LinkTo>
{{else if groupName}} {{else if @groupName}}
<LinkTo <LinkTo
@route="group.assigned.show" @route="group.assigned.show"
@model={{filter}} @model={{@filter}}
@query={{hash order=order ascending=ascending search=search}} @query={{hash order=@order ascending=@ascending search=@search}}
> >
<div class="assign-image"> <div class="assign-image">
{{d-icon "group-plus"}} {{d-icon "group-plus"}}
</div> </div>
<div class="assign-names"> <div class="assign-names">
<div class="assign-username">{{groupName}}</div> <div class="assign-username">{{@groupName}}</div>
</div> </div>
<div class="assign-count"> <div class="assign-count">
{{assignmentCount}} {{@assignmentCount}}
</div> </div>
</LinkTo> </LinkTo>
{{else}} {{else}}
<LinkTo <LinkTo
@route="group.assigned.show" @route="group.assigned.show"
@model={{filter}} @model={{@filter}}
@query={{hash order=order ascending=ascending search=search}} @query={{hash order=@order ascending=@ascending search=@search}}
> >
<div class="assign-everyone"> <div class="assign-everyone">
{{i18n "discourse_assign.group_everyone"}} {{i18n "discourse_assign.group_everyone"}}
</div> </div>
<div class="assign-count"> <div class="assign-count">
{{assignmentCount}} {{@assignmentCount}}
</div> </div>
</LinkTo> </LinkTo>
{{/if}} {{/if}}
</li>

View File

@ -1,5 +0,0 @@
import Component from "@ember/component";
export default Component.extend({
tagName: "li",
});

View File

@ -1,4 +1,4 @@
<LinkTo @route="group.assigned"> <LinkTo @route="group.assigned">
{{d-icon "group-plus" class="glyph"}}{{i18n "discourse_assign.assigned"}} {{d-icon "group-plus" class="glyph"}}{{i18n "discourse_assign.assigned"}}
({{group.assignment_count}}) ({{@group.assignment_count}})
</LinkTo> </LinkTo>

View File

@ -1,5 +0,0 @@
import Component from "@ember/component";
export default Component.extend({
tagName: "",
});

View File

@ -1,12 +1,14 @@
{{#if siteSettings.assign_enabled}} {{#if this.siteSettings.assign_enabled}}
<div class="controls controls-dropdown"> <div class="controls controls-dropdown">
<label>{{i18n "discourse_assign.reminders_frequency.description"}}</label> <label>{{i18n "discourse_assign.reminders_frequency.description"}}</label>
<ComboBox <ComboBox
@id="remind-assigns-frequency" @id="remind-assigns-frequency"
@valueProperty="value" @valueProperty="value"
@content={{availableFrequencies}} @content={{this.availableFrequencies}}
@value={{selectedFrequency}} @value={{this.selectedFrequency}}
@onChange={{action (mut user.custom_fields.remind_assigns_frequency)}} @onChange={{action
(mut this.user.custom_fields.remind_assigns_frequency)
}}
/> />
</div> </div>
{{/if}} {{/if}}

View File

@ -2,7 +2,7 @@ import Component from "@ember/component";
import I18n from "I18n"; import I18n from "I18n";
import discourseComputed from "discourse-common/utils/decorators"; import discourseComputed from "discourse-common/utils/decorators";
export default Component.extend({ export default class RemindAssignsFrequency extends Component {
@discourseComputed( @discourseComputed(
"user.custom_fields.remind_assigns_frequency", "user.custom_fields.remind_assigns_frequency",
"siteSettings.remind_assigns_frequency" "siteSettings.remind_assigns_frequency"
@ -17,16 +17,14 @@ export default Component.extend({
} }
return siteDefaultAssignsFrequency; return siteDefaultAssignsFrequency;
}, }
@discourseComputed("user.reminders_frequency") @discourseComputed("user.reminders_frequency")
availableFrequencies(userRemindersFrequency) { availableFrequencies(userRemindersFrequency) {
return userRemindersFrequency.map((freq) => { return userRemindersFrequency.map((freq) => ({
return {
name: I18n.t(freq.name), name: I18n.t(freq.name),
value: freq.value, value: freq.value,
selected: false, selected: false,
}; }));
}); }
}, }
});

View File

@ -2,7 +2,7 @@ import Service from "@ember/service";
import { ajax } from "discourse/lib/ajax"; import { ajax } from "discourse/lib/ajax";
import showModal from "discourse/lib/show-modal"; import showModal from "discourse/lib/show-modal";
export default Service.extend({ export default class TaskActions extends Service {
i18nSuffix(targetType) { i18nSuffix(targetType) {
switch (targetType) { switch (targetType) {
case "Post": case "Post":
@ -10,7 +10,7 @@ export default Service.extend({
case "Topic": case "Topic":
return "_modal"; return "_modal";
} }
}, }
unassign(targetId, targetType = "Topic") { unassign(targetId, targetType = "Topic") {
return ajax("/assign/unassign", { return ajax("/assign/unassign", {
@ -20,7 +20,7 @@ export default Service.extend({
target_type: targetType, target_type: targetType,
}, },
}); });
}, }
assign(target, options = { isAssigned: false, targetType: "Topic" }) { assign(target, options = { isAssigned: false, targetType: "Topic" }) {
return showModal("assign-user", { return showModal("assign-user", {
@ -37,7 +37,7 @@ export default Service.extend({
status: target.assignment_status, status: target.assignment_status,
}, },
}); });
}, }
reassignUserToTopic(user, target, targetType = "Topic") { reassignUserToTopic(user, target, targetType = "Topic") {
return ajax("/assign/assign", { return ajax("/assign/assign", {
@ -49,5 +49,5 @@ export default Service.extend({
status: target.assignment_status, status: target.assignment_status,
}, },
}); });
}, }
}); }

View File

@ -2,7 +2,7 @@
<div class="inline-form full-width"> <div class="inline-form full-width">
<Input <Input
class="no-blur" class="no-blur"
@value={{readonly search}} @value={{readonly this.search}}
placeholder={{i18n "discourse_assign.topic_search_placeholder"}} placeholder={{i18n "discourse_assign.topic_search_placeholder"}}
autocomplete="off" autocomplete="off"
@type="search" @type="search"
@ -17,24 +17,24 @@
@action={{action "loadMore"}} @action={{action "loadMore"}}
> >
<BasicAssignedTopicList <BasicAssignedTopicList
@topicList={{model}} @topicList={{this.model}}
@hideCategory={{hideCategory}} @hideCategory={{this.hideCategory}}
@showPosters={{showPosters}} @showPosters={{this.showPosters}}
@bulkSelectEnabled={{bulkSelectEnabled}} @bulkSelectEnabled={{this.bulkSelectEnabled}}
@canBulkSelect={{canBulkSelect}} @canBulkSelect={{this.canBulkSelect}}
@selected={{selected}} @selected={{this.selected}}
@hasIncoming={{hasIncoming}} @hasIncoming={{this.hasIncoming}}
@incomingCount={{incomingCount}} @incomingCount={{this.incomingCount}}
@showInserted={{action "showInserted"}} @showInserted={{action "showInserted"}}
@tagsForUser={{tagsForUser}} @tagsForUser={{this.tagsForUser}}
@changeSort={{action "changeSort"}} @changeSort={{action "changeSort"}}
@toggleBulkSelect={{action "toggleBulkSelect"}} @toggleBulkSelect={{action "toggleBulkSelect"}}
@bulkSelectAction={{action "refresh"}} @bulkSelectAction={{action "refresh"}}
@unassign={{action "unassign"}} @unassign={{action "unassign"}}
@reassign={{action "reassign"}} @reassign={{action "reassign"}}
@onScroll={{saveScrollPosition}} @onScroll={{this.saveScrollPosition}}
@scrollOnLoad={{true}} @scrollOnLoad={{true}}
/> />
<ConditionalLoadingSpinner @condition={{model.loadingMore}} /> <ConditionalLoadingSpinner @condition={{this.model.loadingMore}} />
</LoadMore> </LoadMore>

View File

@ -3,53 +3,58 @@
@class="activity-nav" @class="activity-nav"
@desktopClass="action-list activity-list nav-stacked" @desktopClass="action-list activity-list nav-stacked"
> >
{{#if isDesktop}} {{#if this.isDesktop}}
<div class="search-div"> <div class="search-div">
<Input <Input
@type="text" @type="text"
placeholder={{i18n placeholder={{i18n
"discourse_assign.sidebar_name_filter_placeholder" "discourse_assign.sidebar_name_filter_placeholder"
}} }}
@value={{readonly filterName}} @value={{readonly this.filterName}}
class="search" class="search"
{{on "input" (action "onChangeFilterName" value="target.value")}} {{on "input" (action this.onChangeFilterName value="target.value")}}
/> />
</div> </div>
{{/if}} {{/if}}
<LoadMore @selector=".activity-nav li" @action={{action "loadMore"}}> <LoadMore @selector=".activity-nav li" @action={{action "loadMore"}}>
<GroupAssignedFilter <GroupAssignedFilter
@showAvatar={{false}} @showAvatar={{false}}
@filter="everyone" @filter="everyone"
@routeType={{route_type}} @routeType={{this.route_type}}
@assignmentCount={{group.assignment_count}} @assignmentCount={{this.group.assignment_count}}
@search={{search}} @search={{this.search}}
@ascending={{ascending}} @ascending={{this.ascending}}
@order={{order}} @order={{this.order}}
/> />
<GroupAssignedFilter <GroupAssignedFilter
@showAvatar={{false}} @showAvatar={{false}}
@groupName={{group.name}} @groupName={{this.group.name}}
@filter={{group.name}} @filter={{this.group.name}}
@routeType={{route_type}} @routeType={{this.route_type}}
@assignmentCount={{group.group_assignment_count}} @assignmentCount={{this.group.group_assignment_count}}
@search={{search}} @search={{this.search}}
@ascending={{ascending}} @ascending={{this.ascending}}
@order={{order}} @order={{this.order}}
/> />
{{#each members as |member|}}
{{#each this.members as |member|}}
<GroupAssignedFilter <GroupAssignedFilter
@showAvatar={{true}} @showAvatar={{true}}
@filter={{member}} @filter={{member}}
@routeType={{route_type}} @routeType={{this.route_type}}
@search={{search}} @search={{this.search}}
@ascending={{ascending}} @ascending={{this.ascending}}
@order={{order}} @order={{this.order}}
/> />
{{/each}} {{/each}}
<ConditionalLoadingSpinner @condition={{loading}} />
<ConditionalLoadingSpinner @condition={{this.loading}} />
</LoadMore> </LoadMore>
</MobileNav> </MobileNav>
</section> </section>
<section class="user-content"> <section class="user-content">
{{outlet}} {{outlet}}
</section> </section>

View File

@ -1,25 +1,25 @@
<td class="topic-list-data"> <td class="topic-list-data">
<div class="main-link"> <div class="main-link">
<TopicStatus @topic={{topic}} /> <TopicStatus @topic={{this.topic}} />
{{~#if isPrivateMessage}} {{~#if this.isPrivateMessage}}
{{~d-icon "envelope" class="private-message-icon"}} {{~d-icon "envelope" class="private-message-icon"}}
{{~/if}} {{~/if}}
{{~topic-link topic}} {{~topic-link this.topic}}
{{#if topic.unseen}} {{#if this.topic.unseen}}
<span class="badge-notification new-topic"></span> <span class="badge-notification new-topic"></span>
{{/if}} {{/if}}
{{#if topic.hasExcerpt}} {{#if this.topic.hasExcerpt}}
<div class="topic-excerpt"> <div class="topic-excerpt">
{{html-safe topic.excerpt}} {{html-safe this.topic.excerpt}}
{{#if topic.excerptTruncated}} {{#if this.topic.excerptTruncated}}
{{#unless topic.canClearPin}}<a href={{topic.url}}>{{i18n {{#unless this.topic.canClearPin}}<a href={{this.topic.url}}>{{i18n
"read_more" "read_more"
}}</a>{{/unless}} }}</a>{{/unless}}
{{/if}} {{/if}}
{{#if topic.canClearPin}} {{#if this.topic.canClearPin}}
<a <a
href href
{{action "clearPin" topic}} {{action "clearPin" this.topic}}
title={{i18n "topic.clear_pin.help"}} title={{i18n "topic.clear_pin.help"}}
>{{i18n "topic.clear_pin.title"}}</a> >{{i18n "topic.clear_pin.title"}}</a>
{{/if}} {{/if}}
@ -27,43 +27,49 @@
{{/if}} {{/if}}
</div> </div>
<div class="pull-right topic-list-num"> <div class="pull-right topic-list-num">
{{#if topic.assigned_to_user}} {{#if this.topic.assigned_to_user}}
<AssignActionsDropdown <AssignActionsDropdown
@topic={{topic}} @topic={{this.topic}}
@assignee={{topic.assigned_to_user.username}} @assignee={{this.topic.assigned_to_user.username}}
@unassign={{unassign}} @unassign={{this.unassign}}
@reassign={{reassign}} @reassign={{this.reassign}}
/> />
{{else if topic.assigned_to_group}} {{else if this.topic.assigned_to_group}}
<AssignActionsDropdown <AssignActionsDropdown
@topic={{topic}} @topic={{this.topic}}
@assignee={{topic.assigned_to_group.name}} @assignee={{this.topic.assigned_to_group.name}}
@group={{true}} @group={{true}}
@unassign={{unassign}} @unassign={{this.unassign}}
@reassign={{reassign}} @reassign={{this.reassign}}
/> />
{{else}} {{else}}
<AssignActionsDropdown @topic={{topic}} @unassign={{unassign}} /> <AssignActionsDropdown
@topic={{this.topic}}
@unassign={{this.unassign}}
/>
{{/if}} {{/if}}
</div> </div>
<div class="clearfix"></div> <div class="clearfix"></div>
<div class="topic-item-stats clearfix"> <div class="topic-item-stats clearfix">
{{discourse-tags topic mode="list" tagsForUser=tagsForUser}} {{discourse-tags this.topic mode="list" tagsForUser=this.tagsForUser}}
<div class="pull-right topic-list-num"> <div class="pull-right topic-list-num">
{{raw {{raw
"list/activity-column" "list/activity-column"
topic=topic topic=this.topic
tagName="div" tagName="div"
class="num activity last" class="num activity last"
}} }}
<a <a
href={{topic.lastPostUrl}} href={{this.topic.lastPostUrl}}
title="{{i18n 'last_post'}}: {{html-safe raw-date topic.bumped_at}}" title="{{i18n 'last_post'}}: {{html-safe
>{{topic.last_poster_username}}</a> raw-date
this.topic.bumped_at
}}"
>{{this.topic.last_poster_username}}</a>
</div> </div>
{{#unless hideCategory}} {{#unless this.hideCategory}}
<div class="category"> <div class="category">
{{category-link topic.category}} {{category-link this.topic.category}}
</div> </div>
{{/unless}} {{/unless}}
<div class="clearfix"></div> <div class="clearfix"></div>

View File

@ -1,29 +1,33 @@
<ConditionalLoadingSpinner @condition={{loading}}> <ConditionalLoadingSpinner @condition={{this.loading}}>
{{#if hasIncoming}} {{#if this.hasIncoming}}
<div class="show-mores"> <div class="show-mores">
<a href class="alert alert-info clickable" {{action showInserted}}> <a
href
class="alert alert-info clickable"
{{on "click" this.showInserted}}
>
<CountI18n <CountI18n
@key="topic_count_" @key="topic_count_"
@suffix="latest" @suffix="latest"
@count={{incomingCount}} @count={{this.incomingCount}}
/> />
</a> </a>
</div> </div>
{{/if}} {{/if}}
{{#if topics}} {{#if this.topics}}
<table class="topic-list assigned-topic-list"> <table class="topic-list assigned-topic-list">
<tbody class="topic-list-body assigned-topic-list-body"> <tbody class="topic-list-body assigned-topic-list-body">
{{#each topics as |t|}} {{#each this.topics as |topic|}}
<AssignedTopicListItem <AssignedTopicListItem
@topic={{t}} @topic={{topic}}
@expandGloballyPinned={{expandGloballyPinned}} @expandGloballyPinned={{this.expandGloballyPinned}}
@expandAllPinned={{expandAllPinned}} @expandAllPinned={{this.expandAllPinned}}
@lastVisitedTopic={{lastVisitedTopic}} @lastVisitedTopic={{this.lastVisitedTopic}}
@selected={{selected}} @selected={{this.selected}}
@tagsForUser={{tagsForUser}} @tagsForUser={{this.tagsForUser}}
@unassign={{unassign}} @unassign={{this.unassign}}
@reassign={{reassign}} @reassign={{this.reassign}}
/> />
{{/each}} {{/each}}
</tbody> </tbody>

View File

@ -4,22 +4,22 @@
<label>{{i18n "discourse_assign.assign_modal.assignee_label"}}</label> <label>{{i18n "discourse_assign.assign_modal.assignee_label"}}</label>
<AssigneeChooser <AssigneeChooser
autocomplete="off" autocomplete="off"
@value={{assigneeName}} @value={{this.assigneeName}}
@onChange={{action "assignUsername"}} @onChange={{action "assignUsername"}}
autofocus="autofocus" autofocus="autofocus"
@showUserStatus={{true}} @showUserStatus={{true}}
@options={{hash @options={{hash
mobilePlacementStrategy="absolute" mobilePlacementStrategy="absolute"
filterPlaceholder=placeholderKey filterPlaceholder=this.placeholderKey
includeGroups=true includeGroups=true
customSearchOptions=(hash customSearchOptions=(hash
assignableGroups=true defaultSearchResults=this.assignSuggestions assignableGroups=true defaultSearchResults=this.assignSuggestions
) )
groupMembersOf=allowedGroups groupMembersOf=this.allowedGroups
maximum=1 maximum=1
autofocus=autofocus autofocus=this.autofocus
tabindex=1 tabindex=1
expandedOnInsert=(not assigneeName) expandedOnInsert=(not this.assigneeName)
caretUpIcon="search" caretUpIcon="search"
caretDownIcon="search" caretDownIcon="search"
}} }}
@ -37,9 +37,9 @@
<label>{{i18n "discourse_assign.assign_modal.status_label"}}</label> <label>{{i18n "discourse_assign.assign_modal.status_label"}}</label>
<ComboBox <ComboBox
@id="assign-status" @id="assign-status"
@content={{availableStatuses}} @content={{this.availableStatuses}}
@value={{status}} @value={{this.status}}
@onChange={{action (mut model.status)}} @onChange={{action (mut this.model.status)}}
/> />
</div> </div>
{{/if}} {{/if}}
@ -52,7 +52,7 @@
</label> </label>
<Textarea <Textarea
id={{"assign-modal-note"}} id={{"assign-modal-note"}}
@value={{model.note}} @value={{this.model.note}}
{{! template-lint-disable no-down-event-binding }} {{! template-lint-disable no-down-event-binding }}
{{on "keydown" (action "handleTextAreaKeydown")}} {{on "keydown" (action "handleTextAreaKeydown")}}
/> />
@ -63,14 +63,14 @@
<div class="modal-footer"> <div class="modal-footer">
<DButton <DButton
@label={{if @label={{if
model.reassign this.model.reassign
"discourse_assign.reassign.title" "discourse_assign.reassign.title"
"discourse_assign.assign_modal.assign" "discourse_assign.assign_modal.assign"
}} }}
@icon={{inviteIcon}} @icon={{this.inviteIcon}}
@action={{this.assign}} @action={{this.assign}}
class="btn-primary" class="btn-primary"
@disabled={{disabled}} @disabled={{this.disabled}}
/> />
<DModalCancel @close={{route-action "closeModal"}} /> <DModalCancel @close={{route-action "closeModal"}} />
</div> </div>

View File

@ -1,7 +1,7 @@
{ {
"name": "discourse", "name": "discourse",
"version": "1.0.0", "version": "1.0.1",
"repository": "git@github.com:discourse/discourse-assign.git", "repository": "https://github.com/discourse/discourse-assign",
"author": "Discourse", "author": "Discourse",
"license": "MIT", "license": "MIT",
"devDependencies": { "devDependencies": {

View File

@ -5,7 +5,6 @@
# version: 1.0.1 # version: 1.0.1
# authors: Sam Saffron # authors: Sam Saffron
# url: https://github.com/discourse/discourse-assign # url: https://github.com/discourse/discourse-assign
# transpile_js: true
enabled_site_setting :assign_enabled enabled_site_setting :assign_enabled