mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 10:43:57 +08:00
FEATURE: Copying invite link triggers a save (#12581)
Changing the invite type from link to email and then copying it was confusing because it gave user the impression that the invite was updated and the invite link will reflect the latest changes, but it did not.
This commit is contained in:
parent
81e5352e01
commit
bfd0c00944
|
@ -101,7 +101,9 @@ export default Controller.extend(
|
|||
this.send("closeModal");
|
||||
} else {
|
||||
this.appEvents.trigger("modal-body:flash", {
|
||||
text: I18n.t("user.invited.invite.invite_saved"),
|
||||
text: opts.copy
|
||||
? I18n.t("user.invited.invite.invite_copied")
|
||||
: I18n.t("user.invited.invite.invite_saved"),
|
||||
messageClass: "success",
|
||||
});
|
||||
}
|
||||
|
@ -156,12 +158,14 @@ export default Controller.extend(
|
|||
|
||||
@action
|
||||
copied() {
|
||||
this.appEvents.trigger("modal-body:flash", {
|
||||
text: I18n.t("user.invited.invite.invite_copied"),
|
||||
messageClass: "success",
|
||||
});
|
||||
if (this.type === "email" && !this.buffered.get("email")) {
|
||||
return this.appEvents.trigger("modal-body:flash", {
|
||||
text: I18n.t("user.invited.invite.blank_email"),
|
||||
messageClass: "error",
|
||||
});
|
||||
}
|
||||
|
||||
this.setAutogenerated(false);
|
||||
this.save({ sendEmail: false, copy: true });
|
||||
},
|
||||
|
||||
@action
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { click, fillIn, visit } from "@ember/test-helpers";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { test } from "qunit";
|
||||
import I18n from "I18n";
|
||||
|
||||
acceptance("Invites - Create & Edit Invite Modal", function (needs) {
|
||||
let deleted;
|
||||
|
@ -89,6 +90,18 @@ acceptance("Invites - Create & Edit Invite Modal", function (needs) {
|
|||
await click(".modal-footer .btn:last-child");
|
||||
assert.notOk(deleted, "does not delete invite on close");
|
||||
});
|
||||
|
||||
test("copying an email invite without an email shows error message", async function (assert) {
|
||||
await visit("/u/eviltrout/invited/pending");
|
||||
await click(".invite-controls .btn:first-child");
|
||||
|
||||
await click("#invite-type-email");
|
||||
await click(".invite-link-field .btn");
|
||||
assert.equal(
|
||||
find("#modal-alert").text(),
|
||||
I18n.t("user.invited.invite.blank_email")
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
acceptance("Invites - Link Invites", function (needs) {
|
||||
|
|
|
@ -1526,6 +1526,7 @@ en:
|
|||
|
||||
invite_saved: "Invite was saved."
|
||||
invite_copied: "Invite link was copied."
|
||||
blank_email: "The email field cannot be empty."
|
||||
|
||||
bulk_invite:
|
||||
none: "No invitations to display on this page."
|
||||
|
|
Loading…
Reference in New Issue
Block a user