WIP
This commit is contained in:
parent
cdfa3a6111
commit
9bd1a19f99
|
@ -40,12 +40,15 @@ export default class AssignActionsDropdown extends DropdownSelectBoxComponent {
|
|||
Object.entries(this.topic.indirectly_assigned_to).forEach((entry) => {
|
||||
const [postId, assignment_map] = entry;
|
||||
const assignee = assignment_map.assigned_to;
|
||||
console.log("!!!!!!!!!!!!!!!!!!!");
|
||||
options = options.concat({
|
||||
id: `unassign_post_${postId}`,
|
||||
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: !siteSettings.prioritize_full_name_in_ux
|
||||
? assignee.username
|
||||
: assignee.name,
|
||||
}),
|
||||
});
|
||||
});
|
||||
|
|
|
@ -30,6 +30,7 @@ const DEPENDENT_KEYS = [
|
|||
"topic.assigned_to_group",
|
||||
"currentUser.can_assign",
|
||||
"topic.assigned_to_user.username",
|
||||
"topic.assigned_to_user.name",
|
||||
];
|
||||
|
||||
function defaultTitle(topic) {
|
||||
|
@ -468,8 +469,31 @@ function initialize(api) {
|
|||
.filter(({ assignee }) => assignee)
|
||||
.flat();
|
||||
|
||||
if (!assignedTo) {
|
||||
return "";
|
||||
if (assignedTo) {
|
||||
return assignedTo
|
||||
.map(({ assignee, note }) => {
|
||||
let assignedPath;
|
||||
if (assignee.assignedToPostId) {
|
||||
assignedPath = `/p/${assignee.assignedToPostId}`;
|
||||
} else {
|
||||
assignedPath = `/t/${topic.id}`;
|
||||
}
|
||||
const icon = iconHTML(assignee.username ? "user-plus" : "group-plus");
|
||||
const tagName = params.tagName || "a";
|
||||
const href =
|
||||
tagName === "a"
|
||||
? `href="${getURL(assignedPath)}" data-auto-route="true"`
|
||||
: "";
|
||||
|
||||
const name = !siteSettings.prioritize_full_name_in_ux
|
||||
? assignee.username
|
||||
: assignee.name;
|
||||
|
||||
return `<${tagName} class="assigned-to discourse-tag simple" ${href}>${icon}<span title="${escapeExpression(
|
||||
note
|
||||
)}">${name}</span></${tagName}>`;
|
||||
})
|
||||
.join("");
|
||||
}
|
||||
|
||||
const createTagHtml = ({ assignee, note }) => {
|
||||
|
|
|
@ -6,6 +6,7 @@ export class Assignment extends EmberObject {
|
|||
const assignment = new Assignment();
|
||||
assignment.id = 0;
|
||||
assignment.username = topic.assigned_to_user?.username;
|
||||
assignment.name = topic.assigned_to_user?.name;
|
||||
assignment.groupName = topic.assigned_to_group?.name;
|
||||
assignment.status = topic.assignment_status;
|
||||
assignment.note = topic.assignment_note;
|
||||
|
@ -17,6 +18,7 @@ export class Assignment extends EmberObject {
|
|||
static fromPost(post) {
|
||||
const assignment = new Assignment();
|
||||
assignment.username = post.assigned_to.username;
|
||||
assignment.name = post.assigned_to.name;
|
||||
assignment.groupName = post.assigned_to.name;
|
||||
assignment.status = post.assignment_status;
|
||||
assignment.note = post.assignment_note;
|
||||
|
@ -31,6 +33,7 @@ export class Assignment extends EmberObject {
|
|||
// and models from server, that's why we have to call it "group_name" now
|
||||
@tracked group_name;
|
||||
@tracked username;
|
||||
@tracked name;
|
||||
@tracked status;
|
||||
@tracked note;
|
||||
targetId;
|
||||
|
|
Loading…
Reference in New Issue