mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-02-04 21:59:51 +01:00
In the process of adding the delete button to the invitation panel. Apparently, the delete method doesn't work with the invitation items, so I might need to add some extra logic.
This commit is contained in:
@@ -22,6 +22,24 @@ define('admin/manage/registration', function() {
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
$('.invites-list').on('click', '[data-action]', function(ev) {
|
||||
var $this = this;
|
||||
var parent = $(this).parents('[data-invitation-mail]');
|
||||
var email = parent.attr('data-invitation-mail');
|
||||
var action = $(this).attr('data-action');
|
||||
var method = 'admin.user.deleteInvitation';
|
||||
|
||||
if (action === 'delete') {
|
||||
socket.emit(method, {email: email}, function(err) {
|
||||
if (err) {
|
||||
return app.alertError(err.message);
|
||||
}
|
||||
parent.remove();
|
||||
});
|
||||
}
|
||||
return false;
|
||||
});
|
||||
};
|
||||
|
||||
return Registration;
|
||||
|
||||
@@ -212,6 +212,10 @@ User.search = function(socket, data, callback) {
|
||||
});
|
||||
};
|
||||
|
||||
User.deleteInvitation = function(socket, data, callback) {
|
||||
user.deleteInvitation(data.email, callback);
|
||||
};
|
||||
|
||||
User.acceptRegistration = function(socket, data, callback) {
|
||||
user.acceptRegistration(data.username, callback);
|
||||
};
|
||||
@@ -221,4 +225,4 @@ User.rejectRegistration = function(socket, data, callback) {
|
||||
};
|
||||
|
||||
|
||||
module.exports = User;
|
||||
module.exports = User;
|
||||
|
||||
@@ -122,6 +122,7 @@ module.exports = function(User) {
|
||||
|
||||
User.deleteInvitation = function(email, callback) {
|
||||
callback = callback || function() {};
|
||||
console.log('invitation:email:' + email);
|
||||
db.delete('invitation:email:' + email, callback);
|
||||
};
|
||||
|
||||
|
||||
@@ -66,18 +66,23 @@
|
||||
<br><br>
|
||||
The username will be displayed to the right of the emails for users who have redeemed their invitations.
|
||||
</p>
|
||||
<table class="table table-striped users-list">
|
||||
<table class="table table-striped invites-list">
|
||||
<tr>
|
||||
<th>Inviter Username</th>
|
||||
<th>Invitee Email</th>
|
||||
<th>Invitee Username (if registered)</th>
|
||||
</tr>
|
||||
<!-- BEGIN invites -->
|
||||
<tr>
|
||||
<!-- BEGIN invites.invitations -->
|
||||
<!-- BEGIN invites.invitations -->
|
||||
<tr data-invitation-mail="{invites.invitations.email}">
|
||||
<!-- TODO: Upon deletion, this will result in an incorrect visual state until page is reloaded -->
|
||||
<td><!-- IF @first -->{invites.username}<!-- ENDIF @first --></td>
|
||||
<td>{invites.invitations.email}</td>
|
||||
<td>{invites.invitations.username}</td>
|
||||
<td>{invites.invitations.username}
|
||||
<div class="btn-group pull-right">
|
||||
<button class="btn btn-danger btn-xs" data-action="delete"><i class="fa fa-times"></i></button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- END invites.invitations -->
|
||||
<!-- END invites -->
|
||||
|
||||
Reference in New Issue
Block a user