Skip to content

Node.js based forum software built for the modern web

add remove user from group confirmation

Joshf14ad11dd021
diff --git a/public/src/forum/admin/groups.js b/public/src/forum/admin/groups.js
index 2a7d256364..94817826b0 100644
--- a/public/src/forum/admin/groups.js
+++ b/public/src/forum/admin/groups.js
@@ -2,7 +2,8 @@ define(function() {
var Groups = {};
Groups.init = function() {
- var createEl = document.getElementById('create'),
+ var yourid = templates.get('yourid'),
+ createEl = document.getElementById('create'),
createModal = $('#create-modal'),
createSubmitBtn = document.getElementById('create-modal-go'),
createNameEl = $('#create-group-name'),
@@ -171,13 +172,16 @@ define(function() {
groupMembersEl.on('click', 'li[data-uid]', function() {
var uid = this.getAttribute('data-uid'),
gid = detailsModal.attr('data-gid');
-
- socket.emit('admin.groups.leave', {
- gid: gid,
- uid: uid
- }, function(err, data) {
- if (!err) {
- groupMembersEl.find('li[data-uid="' + uid + '"]').remove();
+ bootbox.confirm('Are you sure you want to remove this user?', function(confirm) {
+ if (confirm){
+ socket.emit('admin.groups.leave', {
+ gid: gid,
+ uid: uid
+ }, function(err, data) {
+ if (!err) {
+ groupMembersEl.find('li[data-uid="' + uid + '"]').remove();
+ }
+ });
}
});
});
diff --git a/public/templates/admin/groups.tpl b/public/templates/admin/groups.tpl
index fa23608102..6984e97254 100644
--- a/public/templates/admin/groups.tpl
+++ b/public/templates/admin/groups.tpl
@@ -96,3 +96,4 @@
</div>
</div>
</div>
+<input type="hidden" template-variable="yourid" value="{yourid}" />
\ No newline at end of file
diff --git a/src/routes/admin.js b/src/routes/admin.js
index 0b23680cd0..d7c1c7863f 100644
--- a/src/routes/admin.js
+++ b/src/routes/admin.js
@@ -429,7 +429,8 @@ var nconf = require('nconf'),
expand: true
}, function (err, groups) {
res.json(200, {
- groups: groups
+ groups: groups,
+ yourid: req.user.uid
});
});
});