WIP notes
This commit is contained in:
parent
230256fedb
commit
730c9bd02e
|
@ -8,7 +8,6 @@ class AssignedTopicSerializer < BasicTopicSerializer
|
||||||
has_one :user, serializer: BasicUserSerializer, embed: :objects
|
has_one :user, serializer: BasicUserSerializer, embed: :objects
|
||||||
|
|
||||||
def assigned_to_user
|
def assigned_to_user
|
||||||
# checkout out this basic user serializer
|
|
||||||
BasicUserSerializer.new(object.assigned_to, scope: scope, root: false).as_json
|
BasicUserSerializer.new(object.assigned_to, scope: scope, root: false).as_json
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ export default class AssignActionsDropdown extends DropdownSelectBoxComponent {
|
||||||
icon: this.group ? "group-times" : "user-xmark",
|
icon: this.group ? "group-times" : "user-xmark",
|
||||||
name: i18n("discourse_assign.unassign.title"),
|
name: i18n("discourse_assign.unassign.title"),
|
||||||
description: i18n("discourse_assign.unassign.help", {
|
description: i18n("discourse_assign.unassign.help", {
|
||||||
username: this.assignee,
|
username: this.assignee, // here
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -45,7 +45,7 @@ export default class AssignActionsDropdown extends DropdownSelectBoxComponent {
|
||||||
icon: assignee.username ? "user-xmark" : "group-times",
|
icon: assignee.username ? "user-xmark" : "group-times",
|
||||||
name: i18n("discourse_assign.unassign_post.title"),
|
name: i18n("discourse_assign.unassign_post.title"),
|
||||||
description: i18n("discourse_assign.unassign_post.help", {
|
description: i18n("discourse_assign.unassign_post.help", {
|
||||||
username: assignee.username || assignee.name,
|
username: assignee.username || assignee.name, // here
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -11,6 +11,14 @@ export default class AssignedToPost extends Component {
|
||||||
@service taskActions;
|
@service taskActions;
|
||||||
@service siteSettings;
|
@service siteSettings;
|
||||||
|
|
||||||
|
get nameOrUsername() {
|
||||||
|
if (this.siteSettings.prioritize_full_name_in_ux) {
|
||||||
|
return this.args.assignedToUser.name || this.args.assignedToUser.username;
|
||||||
|
} else {
|
||||||
|
return this.args.assignedToUser.username;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
unassign() {
|
unassign() {
|
||||||
this.taskActions.unassignPost(this.args.post);
|
this.taskActions.unassignPost(this.args.post);
|
||||||
|
@ -34,7 +42,7 @@ export default class AssignedToPost extends Component {
|
||||||
|
|
||||||
<a href={{@href}} class="assigned-to-username">
|
<a href={{@href}} class="assigned-to-username">
|
||||||
{{#if @assignedToUser}}
|
{{#if @assignedToUser}}
|
||||||
{{@assignedToUser.username}}
|
{{this.nameOrUsername}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{@assignedToGroup.name}}
|
{{@assignedToGroup.name}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
|
@ -105,6 +105,14 @@ function avatarHtml(user, size, classes) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// function nameOrUsername() {
|
||||||
|
// if (this.siteSettings.prioritize_full_name_in_ux) {
|
||||||
|
// topic.assigned_to_user?.name || topic.assigned_to_user?.username;
|
||||||
|
// } else {
|
||||||
|
// topic.assigned_to_user?.username;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
function extractPostId(buttonId) {
|
function extractPostId(buttonId) {
|
||||||
// buttonId format is "unassign-from-post-${postId}"
|
// buttonId format is "unassign-from-post-${postId}"
|
||||||
const start = buttonId.lastIndexOf("-") + 1;
|
const start = buttonId.lastIndexOf("-") + 1;
|
||||||
|
|
|
@ -624,6 +624,7 @@ function initialize(api) {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
console.log(assigneeElements);
|
||||||
if (!isEmpty(assigneeElements)) {
|
if (!isEmpty(assigneeElements)) {
|
||||||
return h("p.assigned-to", [
|
return h("p.assigned-to", [
|
||||||
assignedToUser ? iconNode("user-plus") : iconNode("group-plus"),
|
assignedToUser ? iconNode("user-plus") : iconNode("group-plus"),
|
||||||
|
@ -725,8 +726,7 @@ function initialize(api) {
|
||||||
api.decorateWidget("post-contents:after-cooked", (dec) => {
|
api.decorateWidget("post-contents:after-cooked", (dec) => {
|
||||||
const postModel = dec.getModel();
|
const postModel = dec.getModel();
|
||||||
if (postModel) {
|
if (postModel) {
|
||||||
console.log("!!!!!!!!!!!!!!!!!!!!!!", dec.attrs);
|
// 'name' is not empty in the attrs ^, looking good
|
||||||
// need to make sure 'name' is not empty in the attrs ^
|
|
||||||
let assignedToUser, assignedToGroup, postAssignment, href;
|
let assignedToUser, assignedToGroup, postAssignment, href;
|
||||||
if (dec.attrs.post_number === 1) {
|
if (dec.attrs.post_number === 1) {
|
||||||
return dec.widget.attach("assigned-to-first-post", {
|
return dec.widget.attach("assigned-to-first-post", {
|
||||||
|
|
Loading…
Reference in New Issue