WIP notes

This commit is contained in:
brrusselburg 2025-02-25 17:13:03 -06:00 committed by Juan David Martinez
parent 230256fedb
commit 730c9bd02e
No known key found for this signature in database
GPG Key ID: FE50F4B983E68D5B
5 changed files with 21 additions and 6 deletions

View File

@ -8,7 +8,6 @@ class AssignedTopicSerializer < BasicTopicSerializer
has_one :user, serializer: BasicUserSerializer, embed: :objects
def assigned_to_user
# checkout out this basic user serializer
BasicUserSerializer.new(object.assigned_to, scope: scope, root: false).as_json
end

View File

@ -24,7 +24,7 @@ export default class AssignActionsDropdown extends DropdownSelectBoxComponent {
icon: this.group ? "group-times" : "user-xmark",
name: i18n("discourse_assign.unassign.title"),
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",
name: i18n("discourse_assign.unassign_post.title"),
description: i18n("discourse_assign.unassign_post.help", {
username: assignee.username || assignee.name,
username: assignee.username || assignee.name, // here
}),
});
});

View File

@ -11,6 +11,14 @@ export default class AssignedToPost extends Component {
@service taskActions;
@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
unassign() {
this.taskActions.unassignPost(this.args.post);
@ -34,7 +42,7 @@ export default class AssignedToPost extends Component {
<a href={{@href}} class="assigned-to-username">
{{#if @assignedToUser}}
{{@assignedToUser.username}}
{{this.nameOrUsername}}
{{else}}
{{@assignedToGroup.name}}
{{/if}}

View File

@ -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) {
// buttonId format is "unassign-from-post-${postId}"
const start = buttonId.lastIndexOf("-") + 1;

View File

@ -624,6 +624,7 @@ function initialize(api) {
);
});
}
console.log(assigneeElements);
if (!isEmpty(assigneeElements)) {
return h("p.assigned-to", [
assignedToUser ? iconNode("user-plus") : iconNode("group-plus"),
@ -725,8 +726,7 @@ function initialize(api) {
api.decorateWidget("post-contents:after-cooked", (dec) => {
const postModel = dec.getModel();
if (postModel) {
console.log("!!!!!!!!!!!!!!!!!!!!!!", dec.attrs);
// need to make sure 'name' is not empty in the attrs ^
// 'name' is not empty in the attrs ^, looking good
let assignedToUser, assignedToGroup, postAssignment, href;
if (dec.attrs.post_number === 1) {
return dec.widget.attach("assigned-to-first-post", {