diff --git a/assets/javascripts/discourse/components/assign-user-form.gjs b/assets/javascripts/discourse/components/assign-user-form.gjs new file mode 100644 index 00000000..f8ff6d78 --- /dev/null +++ b/assets/javascripts/discourse/components/assign-user-form.gjs @@ -0,0 +1,36 @@ +import Component from "@glimmer/component"; +import { tracked } from "@glimmer/tracking"; +import { action } from "@ember/object"; +import Assignment from "./assignment"; + +export default class AssignUserForm extends Component { + @tracked showValidationErrors = false; + + constructor() { + super(...arguments); + + this.args.formApi.submit = this.assign; + } + + get assigneeIsEmpty() { + return !this.args.model.username && !this.args.model.group_name; + } + + @action + async assign() { + if (this.assigneeIsEmpty) { + this.showValidationErrors = true; + return; + } + + await this.args.onSubmit(); + } + + +} diff --git a/assets/javascripts/discourse/components/assign-user-form.hbs b/assets/javascripts/discourse/components/assign-user-form.hbs deleted file mode 100644 index 9b3bc37e..00000000 --- a/assets/javascripts/discourse/components/assign-user-form.hbs +++ /dev/null @@ -1,56 +0,0 @@ -
- - - - {{#if this.assigneeError}} - - {{d-icon "exclamation-triangle"}} - {{i18n "discourse_assign.assign_modal.choose_assignee"}} - - {{/if}} -
- -{{#if this.siteSettings.enable_assign_status}} -
- - -
-{{/if}} - -
- - -