DEV: address PR feedback

This commit is contained in:
Kelvin Tan 2023-11-23 12:26:24 +08:00
parent e9f6566474
commit fd6bfdc082
No known key found for this signature in database
GPG Key ID: 49C85DCE965C53EF
4 changed files with 8 additions and 14 deletions

View File

@ -26,7 +26,7 @@
{{#if n.can_delete}} {{#if n.can_delete}}
<span class="controls"> <span class="controls">
<DButton <DButton
@action={{(fn this.removeNote n)}} @action={{fn this.removeNote n}}
@icon="far-trash-alt" @icon="far-trash-alt"
@class="btn-small btn-danger" @class="btn-small btn-danger"
@title="user_notes.remove" @title="user_notes.remove"

View File

@ -10,17 +10,11 @@ export default class UserNotesModal extends Component {
@service store; @service store;
@tracked newNote; @tracked newNote;
@tracked userId; @tracked userId = this.args.model.userId;
@tracked saving = false; @tracked saving = false;
postId; postId = this.args.model.postId;
callback; callback = this.args.model.callback;
constructor() {
super(...arguments);
this.userId = this.args.model.userId;
this.callback = this.args.model.callback;
this.postId = this.args.model.postId;
}
#refreshCount() { #refreshCount() {
if (this.callback) { if (this.callback) {
this.callback(this.args.model.note.length); this.callback(this.args.model.note.length);

View File

@ -1,5 +1,5 @@
<DButton <DButton
@class="btn btn-default show-user-notes-btn" class="btn-default show-user-notes-btn"
@action={{@show}} @action={{@show}}
@icon="pencil-alt" @icon="pencil-alt"
@translatedLabel={{this.label}} @translatedLabel={{this.label}}

View File

@ -41,15 +41,15 @@ acceptance("User Notes", function (needs) {
test("creates note from user's profile", async function (assert) { test("creates note from user's profile", async function (assert) {
await visit("/admin/users/1/eviltrout"); await visit("/admin/users/1/eviltrout");
const modalClass = ".user-notes-modal .d-modal__container"; const modalClass = ".user-notes-modal";
assert assert
.dom(".user-controls .show-user-notes-btn") .dom(".user-controls .show-user-notes-btn")
.hasText(I18n.t("user_notes.title")); .hasText(I18n.t("user_notes.title"));
assert.dom(modalClass).isNotVisible(); assert.dom(modalClass).doesNotExist();
await click(".user-controls .show-user-notes-btn"); await click(".user-controls .show-user-notes-btn");
assert.dom(modalClass).isVisible(); assert.dom(modalClass).exists();
await fillIn(`${modalClass} textarea`, "Helpful user"); await fillIn(`${modalClass} textarea`, "Helpful user");