mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 19:37:55 +08:00
UX: Users must confirm when leaving a private group
This commit is contained in:
parent
4089607b40
commit
0d08eac1c7
|
@ -31,6 +31,14 @@ export default Component.extend({
|
|||
$.cookie("destination_url", window.location.href);
|
||||
},
|
||||
|
||||
removeFromGroup() {
|
||||
this.model
|
||||
.removeMember(this.currentUser)
|
||||
.then(() => this.model.set("is_group_user", false))
|
||||
.catch(popupAjaxError)
|
||||
.finally(() => this.set("updatingMembership", false));
|
||||
},
|
||||
|
||||
actions: {
|
||||
joinGroup() {
|
||||
if (this.currentUser) {
|
||||
|
@ -53,17 +61,21 @@ export default Component.extend({
|
|||
|
||||
leaveGroup() {
|
||||
this.set("updatingMembership", true);
|
||||
const model = this.model;
|
||||
|
||||
model
|
||||
.removeMember(this.currentUser)
|
||||
.then(() => {
|
||||
model.set("is_group_user", false);
|
||||
})
|
||||
.catch(popupAjaxError)
|
||||
.finally(() => {
|
||||
this.set("updatingMembership", false);
|
||||
});
|
||||
if (this.model.public_admission) {
|
||||
this.removeFromGroup();
|
||||
} else {
|
||||
return bootbox.confirm(
|
||||
I18n.t("groups.confirm_leave"),
|
||||
I18n.t("no_value"),
|
||||
I18n.t("yes_value"),
|
||||
result => {
|
||||
result
|
||||
? this.removeFromGroup()
|
||||
: this.set("updatingMembership", false);
|
||||
}
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
showRequestMembershipForm() {
|
||||
|
|
|
@ -646,6 +646,7 @@ en:
|
|||
leave: "Leave"
|
||||
request: "Request"
|
||||
message: "Message"
|
||||
confirm_leave: "Are you sure you want to leave this group?"
|
||||
allow_membership_requests: "Allow users to send membership requests to group owners"
|
||||
membership_request_template: "Custom template to display to users when sending a membership request"
|
||||
membership_request:
|
||||
|
|
Loading…
Reference in New Issue
Block a user