mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: handles different cases of canInvite/canRemove states in PM (#10607)
This commit is contained in:
parent
2c66698470
commit
8413d27cf2
@ -158,15 +158,25 @@ export default createWidget("private-message-map", {
|
|||||||
const result = [h(`div.participants${hideNamesClass}`, participants)];
|
const result = [h(`div.participants${hideNamesClass}`, participants)];
|
||||||
const controls = [];
|
const controls = [];
|
||||||
|
|
||||||
if (
|
const canRemove = attrs.canRemoveAllowedUsers || attrs.canRemoveSelfId;
|
||||||
attrs.canInvite ||
|
|
||||||
attrs.canRemoveAllowedUsers ||
|
if (attrs.canInvite || canRemove) {
|
||||||
attrs.canRemoveSelfId
|
let key;
|
||||||
) {
|
let action = "toggleEditing";
|
||||||
|
|
||||||
|
if (attrs.canInvite && canRemove) {
|
||||||
|
key = "edit";
|
||||||
|
} else if (!attrs.canInvite && canRemove) {
|
||||||
|
key = "remove";
|
||||||
|
} else {
|
||||||
|
key = "add";
|
||||||
|
action = "showInvite";
|
||||||
|
}
|
||||||
|
|
||||||
controls.push(
|
controls.push(
|
||||||
this.attach("button", {
|
this.attach("button", {
|
||||||
action: "toggleEditing",
|
action,
|
||||||
label: "private_message_info.edit",
|
label: `private_message_info.${key}`,
|
||||||
className: "btn btn-default add-remove-participant-btn",
|
className: "btn btn-default add-remove-participant-btn",
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
@ -1586,6 +1586,8 @@ en:
|
|||||||
title: "Message"
|
title: "Message"
|
||||||
invite: "Invite Others ..."
|
invite: "Invite Others ..."
|
||||||
edit: "Add or Remove ..."
|
edit: "Add or Remove ..."
|
||||||
|
remove: "Remove ..."
|
||||||
|
add: "Add ..."
|
||||||
leave_message: "Do you really want to leave this message?"
|
leave_message: "Do you really want to leave this message?"
|
||||||
remove_allowed_user: "Do you really want to remove %{name} from this message?"
|
remove_allowed_user: "Do you really want to remove %{name} from this message?"
|
||||||
remove_allowed_group: "Do you really want to remove %{name} from this message?"
|
remove_allowed_group: "Do you really want to remove %{name} from this message?"
|
||||||
|
Loading…
Reference in New Issue
Block a user