Skip to content
This repository was archived by the owner on Jul 14, 2025. It is now read-only.

Commit 4b1671e

Browse files
committed
WIP notes
1 parent 1a4d77d commit 4b1671e

File tree

5 files changed

+21
-6
lines changed

5 files changed

+21
-6
lines changed

app/serializers/assigned_topic_serializer.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ class AssignedTopicSerializer < BasicTopicSerializer
88
has_one :user, serializer: BasicUserSerializer, embed: :objects
99

1010
def assigned_to_user
11-
# checkout out this basic user serializer
1211
BasicUserSerializer.new(object.assigned_to, scope: scope, root: false).as_json
1312
end
1413

assets/javascripts/discourse/components/assign-actions-dropdown.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export default class AssignActionsDropdown extends DropdownSelectBoxComponent {
2424
icon: this.group ? "group-times" : "user-xmark",
2525
name: i18n("discourse_assign.unassign.title"),
2626
description: i18n("discourse_assign.unassign.help", {
27-
username: this.assignee,
27+
username: this.assignee, // here
2828
}),
2929
},
3030
{
@@ -45,7 +45,7 @@ export default class AssignActionsDropdown extends DropdownSelectBoxComponent {
4545
icon: assignee.username ? "user-xmark" : "group-times",
4646
name: i18n("discourse_assign.unassign_post.title"),
4747
description: i18n("discourse_assign.unassign_post.help", {
48-
username: assignee.username || assignee.name,
48+
username: assignee.username || assignee.name, // here
4949
}),
5050
});
5151
});

assets/javascripts/discourse/components/assigned-to-post.gjs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ export default class AssignedToPost extends Component {
1111
@service taskActions;
1212
@service siteSettings;
1313

14+
get nameOrUsername() {
15+
if (this.siteSettings.prioritize_full_name_in_ux) {
16+
return this.args.assignedToUser.name || this.args.assignedToUser.username;
17+
} else {
18+
return this.args.assignedToUser.username;
19+
}
20+
}
21+
1422
@action
1523
unassign() {
1624
this.taskActions.unassignPost(this.args.post);
@@ -34,7 +42,7 @@ export default class AssignedToPost extends Component {
3442

3543
<a href={{@href}} class="assigned-to-username">
3644
{{#if @assignedToUser}}
37-
{{@assignedToUser.username}}
45+
{{this.nameOrUsername}}
3846
{{else}}
3947
{{@assignedToGroup.name}}
4048
{{/if}}

assets/javascripts/discourse/components/topic-level-assign-menu.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,14 @@ function avatarHtml(user, size, classes) {
105105
});
106106
}
107107

108+
// function nameOrUsername() {
109+
// if (this.siteSettings.prioritize_full_name_in_ux) {
110+
// topic.assigned_to_user?.name || topic.assigned_to_user?.username;
111+
// } else {
112+
// topic.assigned_to_user?.username;
113+
// }
114+
// }
115+
108116
function extractPostId(buttonId) {
109117
// buttonId format is "unassign-from-post-${postId}"
110118
const start = buttonId.lastIndexOf("-") + 1;

assets/javascripts/discourse/initializers/extend-for-assigns.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -580,6 +580,7 @@ function initialize(api) {
580580
);
581581
});
582582
}
583+
console.log(assigneeElements);
583584
if (!isEmpty(assigneeElements)) {
584585
return h("p.assigned-to", [
585586
assignedToUser ? iconNode("user-plus") : iconNode("group-plus"),
@@ -681,8 +682,7 @@ function initialize(api) {
681682
api.decorateWidget("post-contents:after-cooked", (dec) => {
682683
const postModel = dec.getModel();
683684
if (postModel) {
684-
console.log("!!!!!!!!!!!!!!!!!!!!!!", dec.attrs);
685-
// need to make sure 'name' is not empty in the attrs ^
685+
// 'name' is not empty in the attrs ^, looking good
686686
let assignedToUser, assignedToGroup, postAssignment, href;
687687
if (dec.attrs.post_number === 1) {
688688
return dec.widget.attach("assigned-to-first-post", {

0 commit comments

Comments
 (0)