|
|
|
@ -64,16 +64,9 @@ define('forum/groups/details', [
|
|
|
|
|
|
|
|
|
|
switch (action) {
|
|
|
|
|
case 'toggleOwnership':
|
|
|
|
|
socket.emit('groups.' + (isOwner ? 'rescind' : 'grant'), {
|
|
|
|
|
toUid: uid,
|
|
|
|
|
groupName: groupName,
|
|
|
|
|
}, function (err) {
|
|
|
|
|
if (!err) {
|
|
|
|
|
ownerFlagEl.toggleClass('invisible');
|
|
|
|
|
} else {
|
|
|
|
|
app.alertError(err.message);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
api[isOwner ? 'del' : 'put'](`/groups/${ajaxify.data.group.slug}/ownership/${uid}`, {}).then(() => {
|
|
|
|
|
ownerFlagEl.toggleClass('invisible');
|
|
|
|
|
}).catch(app.alertError);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'kick':
|
|
|
|
@ -83,16 +76,7 @@ define('forum/groups/details', [
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
socket.emit('groups.kick', {
|
|
|
|
|
uid: uid,
|
|
|
|
|
groupName: groupName,
|
|
|
|
|
}, function (err) {
|
|
|
|
|
if (!err) {
|
|
|
|
|
userRow.slideUp().remove();
|
|
|
|
|
} else {
|
|
|
|
|
app.alertError(err.message);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
api.del(`/groups/${ajaxify.data.group.slug}/membership/${uid}`, undefined).then(() => userRow.slideUp().remove()).catch(app.alertError);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
break;
|
|
|
|
@ -203,7 +187,7 @@ define('forum/groups/details', [
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
api.put(`/groups/${slugify(groupName)}`, settings).then(() => {
|
|
|
|
|
api.put(`/groups/${ajaxify.data.group.slug}`, settings).then(() => {
|
|
|
|
|
if (settings.name) {
|
|
|
|
|
var pathname = window.location.pathname;
|
|
|
|
|
pathname = pathname.substr(1, pathname.lastIndexOf('/'));
|
|
|
|
@ -222,7 +206,7 @@ define('forum/groups/details', [
|
|
|
|
|
if (confirm) {
|
|
|
|
|
bootbox.prompt('Please enter the name of this group in order to delete it:', function (response) {
|
|
|
|
|
if (response === groupName) {
|
|
|
|
|
api.del(`/groups/${slugify(groupName)}`, {}).then(() => {
|
|
|
|
|
api.del(`/groups/${ajaxify.data.group.slug}`, {}).then(() => {
|
|
|
|
|
app.alertSuccess('[[groups:event.deleted, ' + utils.escapeHTML(groupName) + ']]');
|
|
|
|
|
ajaxify.go('groups');
|
|
|
|
|
}).catch(app.alertError);
|
|
|
|
|