Show real posts that has assignments instead of scaffolded values

This commit is contained in:
Andrei Prigorshnev 2024-03-29 01:21:38 +04:00
parent 0a05e0a621
commit 4fbb693bad
No known key found for this signature in database
GPG Key ID: 185E0A5F45783902
2 changed files with 21 additions and 6 deletions

View File

@ -2,7 +2,7 @@
<div class="control-group">
<label>{{i18n "discourse_assign.assign_modal.assignment_label"}}</label>
<ComboBox
@value={{1}}
@value={{0}}
@content={{this.assignments}}
/>
</div>

View File

@ -19,11 +19,26 @@ export default class AssignUserForm extends Component {
}
get assignments() {
return [
{ id: 1, name: "Topic" },
{ id: 2, name: "Post #1" },
{ id: 3, name: "Post #2" },
];
const topicAssignment = { id: 0, name: "Topic" };
return [topicAssignment, ...this.postAssignments];
}
get postAssignments() {
if (this.args.model.targetType !== "Topic") {
return [];
}
const topic = this.args.model.target;
if (
!topic.indirectly_assigned_to ||
!Object.keys(topic.indirectly_assigned_to).length
) {
return [];
}
return Object.values(topic.indirectly_assigned_to).map((value) => {
return { id: value.post_number, name: `Post #${value.post_number}` };
});
}
get availableStatuses() {