Skip to content

A platform for community discussion. Free, open, simple.

UX: simplify PM participant removal (#34022)

Joffrey JAFFEUXbb8b5c349e5b
diff --git a/app/assets/stylesheets/common/base/personal-message.scss b/app/assets/stylesheets/common/base/personal-message.scss
index e36ab813ac9..cba4a7a3e49 100644
--- a/app/assets/stylesheets/common/base/personal-message.scss
+++ b/app/assets/stylesheets/common/base/personal-message.scss
@@ -153,12 +153,63 @@
.participants {
margin-bottom: 1.5em;
+ display: flex;
+ flex-wrap: wrap;
+ align-items: center;
+ gap: var(--space-2);
+
+ & + .controls {
+ margin-top: 0.5em;
+ }
+
+ &.hide-names .user {
+ .username,
+ .group-name {
+ display: none;
+ }
+ }
.user {
- border: none;
+ @include ellipsis;
+ display: flex;
+ align-items: center;
background: var(--primary-low);
- padding: 2px 4px;
border-radius: var(--d-border-radius);
+ padding-left: 0.65em;
+
+ .user-link,
+ .group-link {
+ @include ellipsis;
+ color: var(--primary-high);
+
+ &:hover {
+ color: var(--primary);
+ }
+ }
+
+ .avatar,
+ .d-icon-users {
+ margin-left: 0.25em;
+ margin-right: 0.25em;
+ }
+
+ .username,
+ .group-name {
+ margin-right: 0.25em;
+ }
+
+ &:last-child {
+ margin-right: 0;
+ }
+
+ .remove-invited {
+ display: flex;
+ flex: 1 0 0px;
+ align-items: center;
+ justify-content: center;
+ box-sizing: border-box;
+ border-radius: 0;
+ }
}
}
}
diff --git a/app/assets/stylesheets/common/components/topic-map.scss b/app/assets/stylesheets/common/components/topic-map.scss
index 8d32c6156c5..6c284eb5e52 100644
--- a/app/assets/stylesheets/common/components/topic-map.scss
+++ b/app/assets/stylesheets/common/components/topic-map.scss
@@ -155,79 +155,6 @@ body:not(.archetype-private_message) {
}
}
- .participants {
- // PMs
- display: flex;
- flex-wrap: wrap;
- align-items: center;
-
- & + .controls {
- margin-top: 0.5em;
- }
-
- &.hide-names .user {
- .username,
- .group-name {
- display: none;
- }
- }
-
- .user {
- @include ellipsis;
- border: 1px solid var(--content-border-color);
- border-radius: 0.25em;
- padding: 0;
- margin: 0.125em 0.25em 0.125em 0;
- display: flex;
- align-items: center;
- height: 26px;
-
- .user-link,
- .group-link {
- @include ellipsis;
- color: var(--primary-high);
-
- &:hover {
- color: var(--primary);
- }
- }
-
- .avatar,
- .d-icon-users {
- margin-left: 0.25em;
- margin-right: 0.25em;
- }
-
- .username,
- .group-name {
- margin-right: 0.25em;
- }
-
- &:last-child {
- margin-right: 0;
- }
-
- .remove-invited {
- display: flex;
- flex: 1 0 0px;
- align-items: center;
- justify-content: center;
- box-sizing: border-box;
- border-radius: 0 var(--border-radius) var(--border-radius) 0;
- padding-top: 0;
- padding-bottom: 0;
- height: calc(100% + 0.25em);
- margin-right: -4px;
- }
- }
- }
-
- .add-remove-participant-btn {
- .d-icon {
- margin-left: 0.25em;
- }
- }
-
&__buttons {
margin-left: auto;
display: flex;
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml
index 56ebe41c57f..52d59d550a1 100644
--- a/config/locales/client.en.yml
+++ b/config/locales/client.en.yml
@@ -4293,6 +4293,7 @@ en:
delete_post_notice: "Delete Official Notice"
remove_timer: "remove timer"
edit_timer: "edit timer"
+ remove_yourself_from_pm: "Are you sure you want to remove yourself from this message? You will no longer be able to see or reply to it."
actions:
people:
diff --git a/frontend/dialog-holder/addon/services/dialog.js b/frontend/dialog-holder/addon/services/dialog.js
index 10d0cdf8690..bba976e7f35 100644
--- a/frontend/dialog-holder/addon/services/dialog.js
+++ b/frontend/dialog-holder/addon/services/dialog.js
@@ -77,47 +77,71 @@ export default class DialogService extends Service {
alert(params) {
// support string param for easier porting of bootbox.alert
if (typeof params === "string") {
- return this.dialog({
+ return this.#promiseDialog({
message: params,
type: "alert",
+ shouldDisplayCancel: false,
});
}
- return this.dialog({
+ return this.#promiseDialog({
...params,
type: "alert",
+ shouldDisplayCancel: false,
});
}
confirm(params) {
- return this.dialog({
+ return this.#promiseDialog({
...params,
- shouldDisplayCancel: true,
buttons: null,
type: "confirm",
});
}
notice(message) {
- return this.dialog({
+ return this.#promiseDialog({
message,
type: "notice",
});
}
yesNoConfirm(params) {
- return this.confirm({
+ return this.#promiseDialog({
...params,
confirmButtonLabel: "yes_value",
cancelButtonLabel: "no_value",
+ buttons: null,
+ type: "confirm",
});
}
deleteConfirm(params) {
- return this.confirm({
+ return this.#promiseDialog({
...params,
confirmButtonClass: "btn-danger",
confirmButtonLabel: params.confirmButtonLabel || "delete",
+ buttons: null,
+ type: "confirm",
+ });
+ }
+
+ #promiseDialog(params) {
+ return new Promise((resolve) => {
+ const { didConfirm, didCancel } = params;
+
+ this.dialog({
+ shouldDisplayCancel: true,
+ ...params,
+ didConfirm: () => {
+ didConfirm?.();
+ resolve(true);
+ },
+ didCancel: () => {
+ didCancel?.();
+ resolve(false);
+ },
+ });
});
}
diff --git a/frontend/discourse/app/components/dialog-messages/second-factor-confirm-phrase.gjs b/frontend/discourse/app/components/dialog-messages/second-factor-confirm-phrase.gjs
index b9a69863788..b738c4e76d3 100644
--- a/frontend/discourse/app/components/dialog-messages/second-factor-confirm-phrase.gjs
+++ b/frontend/discourse/app/components/dialog-messages/second-factor-confirm-phrase.gjs
@@ -1,5 +1,4 @@
import Component from "@glimmer/component";
-import { tracked } from "@glimmer/tracking";
import { on } from "@ember/modifier";
import { action } from "@ember/object";
import { service } from "@ember/service";
@@ -11,12 +10,11 @@ export default class SecondFactorConfirmPhrase extends Component {
@service dialog;
@service currentUser;
- @tracked confirmPhraseInput = "";
disabledString = i18n("user.second_factor.disable");
@action
- onConfirmPhraseInput() {
- if (this.confirmPhraseInput === this.disabledString) {
+ onConfirmPhraseInput(event) {
+ if (event.target.value === this.disabledString) {
this.dialog.set("confirmButtonDisabled", false);
} else {
this.dialog.set("confirmButtonDisabled", true);
@@ -50,7 +48,6 @@ export default class SecondFactorConfirmPhrase extends Component {
</p>
<TextField
- @value={{this.confirmPhraseInput}}
{{on "input" this.onConfirmPhraseInput}}
@id="confirm-phrase"
@autocorrect="off"
diff --git a/frontend/discourse/app/components/invite-panel.gjs b/frontend/discourse/app/components/invite-panel.gjs
index 8a6c541d855..aea0c314872 100644
--- a/frontend/discourse/app/components/invite-panel.gjs
+++ b/frontend/discourse/app/components/invite-panel.gjs
@@ -20,6 +20,7 @@ import GroupChooser from "select-kit/components/group-chooser";
export default class InvitePanel extends Component {
@service site;
+ @service toasts;
@readOnly("currentUser.staff") isStaff;
@readOnly("currentUser.admin") isAdmin;
@@ -260,13 +261,12 @@ export default class InvitePanel extends Component {
return isPrivateTopic ? "required" : "optional";
}
- @discourseComputed("isPM", "invitee", "invitingExistingUserToTopic")
- successMessage(isPM, invitee, invitingExistingUserToTopic) {
+ successMessage(invitee) {
if (this.isInviteeGroup) {
return i18n("topic.invite_private.success_group");
- } else if (isPM) {
+ } else if (this.isPM) {
return i18n("topic.invite_private.success");
- } else if (invitingExistingUserToTopic) {
+ } else if (this.invitingExistingUserToTopic) {
return i18n("topic.invite_reply.success_existing_email", {
invitee,
});
@@ -351,6 +351,11 @@ export default class InvitePanel extends Component {
this.inviteModel.reload().then(() => {
// TODO (glimmer-post-stream) the Glimmer Post Stream does not listen to this event
this.appEvents.trigger("post-stream:refresh");
+
+ this.toasts.success({
+ data: { message: this.successMessage(this.invitee) },
+ });
+ this.closeModal();
});
})
.catch(onerror);
@@ -365,6 +370,11 @@ export default class InvitePanel extends Component {
);
// TODO (glimmer-post-stream) the Glimmer Post Stream does not listen to this event
this.appEvents.trigger("post-stream:refresh", { force: true });
+
+ this.toasts.success({
+ data: { message: this.successMessage(result) },
+ });
+ this.closeModal();
} else if (
this.invitingToTopic &&
emailValid(this.invitee.trim()) &&
@@ -372,6 +382,11 @@ export default class InvitePanel extends Component {
result.user
) {
this.set("invitingExistingUserToTopic", true);
+
+ this.toasts.success({
+ data: { message: this.successMessage(this.invitee) },
+ });
+ this.closeModal();
}
})
.catch(onerror);
@@ -467,10 +482,6 @@ export default class InvitePanel extends Component {
@link={{this.inviteModel.inviteLink}}
@email={{this.invitee}}
/>
- {{else}}
- <div class="success-message">
- {{htmlSafe this.successMessage}}
- </div>
{{/if}}
{{else}}
<div class="invite-user-control">
diff --git a/frontend/discourse/app/components/topic-map/private-message-map.gjs b/frontend/discourse/app/components/topic-map/private-message-map.gjs
index cda64c39e4e..a68b2381e2c 100644
--- a/frontend/discourse/app/components/topic-map/private-message-map.gjs
+++ b/frontend/discourse/app/components/topic-map/private-message-map.gjs
@@ -1,23 +1,17 @@
import Component from "@glimmer/component";
-import { tracked } from "@glimmer/tracking";
import { hash } from "@ember/helper";
import { action } from "@ember/object";
import { service } from "@ember/service";
-import { and } from "truth-helpers";
import DButton from "discourse/components/d-button";
import avatar from "discourse/helpers/bound-avatar-template";
import icon from "discourse/helpers/d-icon";
import { groupPath } from "discourse/lib/url";
-import { i18n } from "discourse-i18n";
export default class PrivateMessageMap extends Component {
@service site;
- @tracked isEditing = false;
-
get participantsClasses() {
- return !this.isEditing &&
- this.site.mobileView &&
+ return this.site.mobileView &&
this.args.topicDetails.allowed_groups.length > 4
? "participants hide-names"
: "participants";
@@ -38,31 +32,11 @@ export default class PrivateMessageMap extends Component {
return this.canInvite || this.canRemove;
}
- get actionAllowed() {
- return this.canRemove ? this.toggleEditing : this.args.showInvite;
- }
-
- get actionAllowedLabel() {
- if (this.canInvite && this.canRemove) {
- return "private_message_info.edit";
- }
- if (!this.canInvite && this.canRemove) {
- return "private_message_info.remove";
- }
- return "private_message_info.add";
- }
-
- @action
- toggleEditing() {
- this.isEditing = !this.isEditing;
- }
-
<template>
<div class={{this.participantsClasses}}>
{{#each @topicDetails.allowed_groups as |group|}}
<PmMapUserGroup
@model={{group}}
- @isEditing={{this.isEditing}}
@canRemoveAllowedUsers={{@topicDetails.can_remove_allowed_users}}
@removeAllowedGroup={{@removeAllowedGroup}}
/>
@@ -70,37 +44,26 @@ export default class PrivateMessageMap extends Component {
{{#each @topicDetails.allowed_users as |user|}}
<PmMapUser
@model={{user}}
- @isEditing={{this.isEditing}}
@canRemoveAllowedUsers={{@topicDetails.can_remove_allowed_users}}
@canRemoveSelfId={{@topicDetails.can_remove_self_id}}
@removeAllowedUser={{@removeAllowedUser}}
/>
{{/each}}
- </div>
- {{#if this.canShowControls}}
- <div class="controls">
+ {{#if this.canInvite}}
<DButton
- @action={{this.actionAllowed}}
- @label={{this.actionAllowedLabel}}
- class="btn-default add-remove-participant-btn"
+ @action={{@showInvite}}
+ @icon="plus"
+ class="btn-default btn-small add-participant-btn"
/>
-
- {{#if (and this.canInvite this.isEditing)}}
- <DButton
- @action={{@showInvite}}
- @icon="plus"
- class="btn-default add-participant-btn"
- />
- {{/if}}
- </div>
- {{/if}}
+ {{/if}}
+ </div>
</template>
}
class PmMapUserGroup extends Component {
get canRemoveLink() {
- return this.args.isEditing && this.args.canRemoveAllowedUsers;
+ return this.args.canRemoveAllowedUsers;
}
get groupUrl() {
@@ -124,23 +87,15 @@ class PmMapUserGroup extends Component {
}
class PmRemoveGroupLink extends Component {
- @service dialog;
-
@action
- showConfirmDialog() {
- this.dialog.deleteConfirm({
- message: i18n("private_message_info.remove_allowed_group", {
- name: this.args.model.name,
- }),
- confirmButtonLabel: "private_message_info.remove_group",
- didConfirm: () => this.args.removeAllowedGroup(this.args.model),
- });
+ removeGroup() {
+ this.args.removeAllowedGroup(this.args.model);
}
<template>
<DButton
- class="remove-invited"
- @action={{this.showConfirmDialog}}
+ class="remove-invited btn-small"
+ @action={{this.removeGroup}}
@icon="xmark"
/>
</template>
@@ -156,10 +111,7 @@ class PmMapUser extends Component {
}
get canRemoveLink() {
- return (
- this.args.isEditing &&
- (this.args.canRemoveAllowedUsers || this.isCurrentUser)
- );
+ return this.args.canRemoveAllowedUsers || this.isCurrentUser;
}
<template>
@@ -188,29 +140,15 @@ class PmMapUser extends Component {
}
class PmRemoveLink extends Component {
- @service dialog;
-
@action
- showConfirmDialog() {
- const messageKey = this.args.isCurrentUser
- ? "private_message_info.leave_message"
- : "private_message_info.remove_allowed_user";
-
- this.dialog.deleteConfirm({
- message: i18n(messageKey, {
- name: this.args.model.username,
- }),
- confirmButtonLabel: this.args.isCurrentUser
- ? "private_message_info.leave"
- : "private_message_info.remove_user",
- didConfirm: () => this.args.removeAllowedUser(this.args.model),
- });
+ removeUser() {
+ this.args.removeAllowedUser(this.args.model);
}
<template>
<DButton
- class="remove-invited"
- @action={{this.showConfirmDialog}}
+ class="remove-invited btn-small"
+ @action={{this.removeUser}}
@icon="xmark"
/>
</template>
diff --git a/frontend/discourse/app/controllers/topic.js b/frontend/discourse/app/controllers/topic.js
index 3f51bb7e280..2ba48ef7dde 100644
--- a/frontend/discourse/app/controllers/topic.js
+++ b/frontend/discourse/app/controllers/topic.js
@@ -623,14 +623,26 @@ export default class TopicController extends Controller {
}
@action
- removeAllowedUser(user) {
- return this.get("model.details")
- .removeAllowedUser(user)
- .then(() => {
- if (this.currentUser.id === user.id) {
- this.router.transitionTo("userPrivateMessages", user);
- }
+ async removeAllowedUser(user) {
+ if (this.currentUser.id === user.id) {
+ const isConfirmed = await this.dialog.yesNoConfirm({
+ message: i18n("post.controls.remove_yourself_from_pm"),
});
+
+ if (!isConfirmed) {
+ return;
+ }
+ }
+
+ try {
+ await this.get("model.details").removeAllowedUser(user);
+
+ if (this.currentUser.id === user.id) {
+ this.router.transitionTo("userPrivateMessages", user);
+ }
+ } catch (error) {
+ popupAjaxError(error);
+ }
}
@action
diff --git a/frontend/discourse/tests/acceptance/personal-message-test.js b/frontend/discourse/tests/acceptance/personal-message-test.js
index 7ed21c89e1a..b1a63f9f705 100644
--- a/frontend/discourse/tests/acceptance/personal-message-test.js
+++ b/frontend/discourse/tests/acceptance/personal-message-test.js
@@ -92,10 +92,7 @@ acceptance("Personal Message - invite", function (needs) {
test("can open invite modal", async function (assert) {
await visit("/t/pm-for-testing/12");
- await click(".add-remove-participant-btn");
- await click(
- ".topic-map__private-message-map .controls .add-participant-btn"
- );
+ await click(".topic-map__private-message-map .add-participant-btn");
assert
.dom(".d-modal.add-pm-participants .invite-user-control")
@@ -104,10 +101,7 @@ acceptance("Personal Message - invite", function (needs) {
test("shows errors correctly", async function (assert) {
await visit("/t/pm-for-testing/12");
- await click(".add-remove-participant-btn");
- await click(
- ".topic-map__private-message-map .controls .add-participant-btn"
- );
+ await click(".topic-map__private-message-map .add-participant-btn");
assert
.dom(".d-modal.add-pm-participants .invite-user-control")
@@ -117,7 +111,6 @@ acceptance("Personal Message - invite", function (needs) {
await input.expand();
await input.fillInFilter("example");
await input.selectRowByValue("example");
-
await click(".send-invite");
assert.dom(".d-modal.add-pm-participants .alert-error").exists();
diff --git a/frontend/discourse/tests/integration/components/dialog-holder-test.gjs b/frontend/discourse/tests/integration/components/dialog-holder-test.gjs
index e89b0bfd72f..ad464a58278 100644
--- a/frontend/discourse/tests/integration/components/dialog-holder-test.gjs
+++ b/frontend/discourse/tests/integration/components/dialog-holder-test.gjs
@@ -326,4 +326,51 @@ module("Integration | Component | dialog-holder", function (hooks) {
"correct message is shown in dialog"
);
});
+
+ test("confirm dialogs return a promise resolving to a boolean", async function (assert) {
+ await render(<template><DialogHolder /></template>);
+
+ const dialogMethods = [
+ "notice",
+ "alert",
+ "confirm",
+ "deleteConfirm",
+ "yesNoConfirm",
+ ];
+
+ for (const method of dialogMethods) {
+ // notice has no button
+ if (method !== "notice") {
+ // Test primary action button
+ const confirmPromise = this.dialog[method]({
+ message: "test",
+ });
+ await settled();
+ await click(".dialog-footer .btn-primary, .dialog-footer .btn-danger");
+ const isConfirmed = await confirmPromise;
+ assert.true(isConfirmed, `${method} promise resolved to true`);
+ }
+
+ // notice has no button
+ // alert has no cancel button
+ if (!["notice", "alert"].includes(method)) {
+ // Test cancel button
+ const cancelPromise = this.dialog[method]({ message: "test" });
+ await settled();
+ await click(".dialog-footer .btn-default");
+ const isCancelled = await cancelPromise;
+ assert.false(isCancelled, `${method} promise resolved to false`);
+ }
+
+ // Test backdrop click
+ const overlayCancelPromise = this.dialog[method]({ message: "test" });
+ await settled();
+ await click(".dialog-overlay");
+ const isOverlayCancelled = await overlayCancelPromise;
+ assert.false(
+ isOverlayCancelled,
+ `${method} promise resolved to false when modal cancelled`
+ );
+ }
+ });
});
diff --git a/plugins/styleguide/assets/javascripts/discourse/components/sections/molecules/dialog.gjs b/plugins/styleguide/assets/javascripts/discourse/components/sections/molecules/dialog.gjs
new file mode 100644
index 00000000000..51e3dbbefff
--- /dev/null
+++ b/plugins/styleguide/assets/javascripts/discourse/components/sections/molecules/dialog.gjs
@@ -0,0 +1,123 @@
+import Component from "@glimmer/component";
+import { tracked } from "@glimmer/tracking";
+import { fn, hash } from "@ember/helper";
+import { action } from "@ember/object";
+import { service } from "@ember/service";
+import DButton from "discourse/components/d-button";
+import StyleguideComponent from "discourse/plugins/styleguide/discourse/components/styleguide/component";
+import StyleguideExample from "discourse/plugins/styleguide/discourse/components/styleguide-example";
+
+export default class Dialogs extends Component {
+ @service dialog;
+
+ @tracked alertOutput = "";
+ @tracked deleteConfirmOutput = "";
+ @tracked noticeOutput = "";
+ @tracked confirmOutput = "";
+ @tracked yesNoConfirmOutput = "";
+
+ @action
+ async openDialog(dialog = {}) {
+ this[`${dialog.name}Output`] = "";
+ const confirmed = await this.dialog[dialog.name](dialog.options);
+ this[`${dialog.name}Output`] = `Confirmed: ${confirmed}`;
+ }
+
+ <template>
+ <StyleguideExample @title="Dialog service">
+ <StyleguideComponent @tag="alert">
+ <:actions>
+ <DButton
+ @translatedLabel="Trigger"
+ @action={{fn
+ this.openDialog
+ (hash
+ name="alert"
+ options=(hash
+ message="message"
+ title="title"
+ didConfirm=this.didConfirm
+ didCancel=this.didCancel
+ )
+ )
+ }}
+ />
+
+ <span>&nbsp;{{this.alertOutput}}</span>
+ </:actions>
+ </StyleguideComponent>
+ <StyleguideComponent @tag="notice">
+ <:actions>
+ <DButton
+ @translatedLabel="Trigger"
+ @action={{fn
+ this.openDialog
+ (hash name="notice" options="message")
+ }}
+ />
+ <span>&nbsp;{{this.noticeOutput}}</span>
+ </:actions>
+ </StyleguideComponent>
+ <StyleguideComponent @tag="yesNoConfirm">
+ <:actions>
+ <DButton
+ @translatedLabel="Trigger"
+ @action={{fn
+ this.openDialog
+ (hash
+ name="yesNoConfirm"
+ options=(hash
+ message="message"
+ title="title"
+ didConfirm=this.didConfirm
+ didCancel=this.didCancel
+ )
+ )
+ }}
+ />
+ <span>&nbsp;{{this.yesNoConfirmOutput}}</span>
+ </:actions>
+ </StyleguideComponent>
+ <StyleguideComponent @tag="deleteConfirm">
+ <:actions>
+ <DButton
+ @translatedLabel="Trigger"
+ @action={{fn
+ this.openDialog
+ (hash
+ name="deleteConfirm"
+ options=(hash
+ message="message"
+ title="title"
+ didConfirm=this.didConfirm
+ didCancel=this.didCancel
+ )
+ )
+ }}
+ />
+ <span>&nbsp;{{this.deleteConfirmOutput}}</span>
+ </:actions>
+ </StyleguideComponent>
+ <StyleguideComponent @tag="confirm">
+ <:actions>
+ <DButton
+ @translatedLabel="Trigger"
+ @action={{fn
+ this.openDialog
+ (hash
+ name="confirm"
+ options=(hash
+ message="message"
+ title="title"
+ didConfirm=this.didConfirm
+ didCancel=this.didCancel
+ )
+ )
+ }}
+ />
+ <span>&nbsp;{{this.confirmOutput}}</span>
+ </:actions>
+ </StyleguideComponent>
+ </StyleguideExample>
+ </template>
+}
diff --git a/plugins/styleguide/assets/javascripts/discourse/lib/styleguide.js b/plugins/styleguide/assets/javascripts/discourse/lib/styleguide.js
index 95ae9168efd..a02edd7d730 100644
--- a/plugins/styleguide/assets/javascripts/discourse/lib/styleguide.js
+++ b/plugins/styleguide/assets/javascripts/discourse/lib/styleguide.js
@@ -12,6 +12,7 @@ import topicStatuses from "../components/sections/atoms/topic-statuses";
import breadCrumbs from "../components/sections/molecules/bread-crumbs";
import categories from "../components/sections/molecules/categories";
import charCounter from "../components/sections/molecules/char-counter";
+import dialog from "../components/sections/molecules/dialog";
import emptyState from "../components/sections/molecules/empty-state";
import footerMessage from "../components/sections/molecules/footer-message";
import menus from "../components/sections/molecules/menus";
@@ -78,6 +79,7 @@ const SECTIONS = [
{ component: menus, category: "molecules", id: "menus" },
{ component: multiselect, category: "molecules", id: "multi-select" },
{ component: toasts, category: "molecules", id: "toasts" },
+ { component: dialog, category: "molecules", id: "dialog" },
{ component: signupCta, category: "molecules", id: "signup-cta" },
{ component: topicListItem, category: "molecules", id: "topic-list-item" },
{
diff --git a/plugins/styleguide/config/locales/client.en.yml b/plugins/styleguide/config/locales/client.en.yml
index 19a51844a90..9f316e5c9a0 100644
--- a/plugins/styleguide/config/locales/client.en.yml
+++ b/plugins/styleguide/config/locales/client.en.yml
@@ -34,6 +34,8 @@ en:
title: "Font System"
colors:
title: "Colors"
+ dialog:
+ title: "Dialog"
icons:
title: "Icons"
full_list: "See the full list of Font Awesome Icons"
diff --git a/plugins/styleguide/spec/system/smoke_test_spec.rb b/plugins/styleguide/spec/system/smoke_test_spec.rb
index 4d4f99425e8..34fa339c31e 100644
--- a/plugins/styleguide/spec/system/smoke_test_spec.rb
+++ b/plugins/styleguide/spec/system/smoke_test_spec.rb
@@ -32,6 +32,7 @@ RSpec.describe "Styleguide Smoke Test", type: :system do
{ href: "/molecules/signup-cta", title: "Signup CTA" },
{ href: "/molecules/multi-select", title: "Multi select" },
{ href: "/molecules/toasts", title: "Toasts" },
+ { href: "/molecules/dialog", title: "Dialog" },
{ href: "/molecules/tooltips", title: "Tooltips" },
{ href: "/molecules/topic-list-item", title: "Topic List Item" },
{ href: "/molecules/topic-notifications", title: "Topic Notifications" },
diff --git a/spec/system/pm_user_removal_spec.rb b/spec/system/pm_user_removal_spec.rb
index c96e252277e..6cb28fbd6e9 100644
--- a/spec/system/pm_user_removal_spec.rb
+++ b/spec/system/pm_user_removal_spec.rb
@@ -23,9 +23,7 @@ describe "PM user removal", type: :system do
topic_page.visit_topic(pm)
- find(".add-remove-participant-btn").click
find(".user[data-id='#{other_user.id}'] .remove-invited").click
- dialog.click_danger
expect(page).to have_selector(
".small-action-contents",
@@ -33,6 +31,20 @@ describe "PM user removal", type: :system do
)
end
+ it "removes yourself from the PM list" do
+ pm =
+ create_post(
+ user: current_user,
+ target_usernames: [other_user.username],
+ archetype: Archetype.private_message,
+ ).topic
+ topic_page.visit_topic(pm)
+ find(".user[data-id='#{current_user.id}'] .remove-invited").click
+ dialog.click_yes
+
+ expect(page).to have_current_path("/u/#{current_user.username}/messages")
+ end
+
it "removes a group from the PM list" do
group =
Fabricate(:group, messageable_level: Group::ALIAS_LEVELS[:everyone]).tap do |g|
@@ -48,9 +60,7 @@ describe "PM user removal", type: :system do
topic_page.visit_topic(pm)
- find(".add-remove-participant-btn").click
find(".group[data-id='#{group.id}'] .remove-invited").click
- dialog.click_danger
expect(page).to have_selector(
".small-action-contents",