Skip to content

Commit

Permalink
hellooo
Browse files Browse the repository at this point in the history
  • Loading branch information
RDNoodles6 committed Sep 6, 2024
1 parent f26db06 commit 9a850cf
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 27 deletions.
60 changes: 34 additions & 26 deletions src/admin/manage/registration.js
Original file line number Diff line number Diff line change
@@ -1,54 +1,62 @@
'use strict';
define('admin/manage/registration', ['bootbox', 'alerts'],
function (bootbox, alerts) {

define(['jquery', 'socket', 'alerts', 'bootbox'], ($, socket, alerts, bootbox) => {

Check failure on line 3 in src/admin/manage/registration.js

View workflow job for this annotation

GitHub Actions / test

'define' is not defined
const Registration = {};
Registration.init =
function () {

Registration.init = () => {
$('.users-list').on('click', '[data-action]', function () {
const parent = $(this).parents('[data-username]');
const action = $(this).attr('data-action');
const username = parent.attr('data-username');
const method = action === 'accept' ? 'user.acceptRegistration' : 'user.rejectRegistration';
socket.emit(method, { username: username }, function (err) {

socket.emit(method, { username }, (err) => {
if (err) {
return alerts.error(err);
}
parent.remove();
});

return false;
});
$('.invites-list').on('click', '[data-action]',
function () {

$('.invites-list').on('click', '[data-action]', function () {
const parent = $(this).parents('[data-invitation-mail][data-invited-by]');
const email = parent.attr('data-invitation-mail');
const invitedBy = parent.attr('data-invited-by');
const action = $(this).attr('data-action');
const method = 'user.deleteInvitation';
const removeRow = function () {
const nextRow = parent.next();
const thisRowinvitedBy = parent.find('.invited-by');
const nextRowInvitedBy = nextRow.find('.invited-by');
if (nextRowInvitedBy.html() !== undefined && nextRowInvitedBy.html().length < 2) {
nextRowInvitedBy.html(thisRowinvitedBy.html());
}
parent.remove();
};

if (action === 'delete') {
bootbox.confirm('[[admin/manage/registration:invitations.confirm-delete]]', helper(confirm, email, invitedBy, method, removeRow))
bootbox.confirm('[[admin/manage/registration:invitations.confirm-delete]]', (confirm) => {
helper(confirm, email, invitedBy, method, () => {
const nextRow = parent.next();
const thisRowInvitedBy = parent.find('.invited-by');
const nextRowInvitedBy = nextRow.find('.invited-by');

if (nextRowInvitedBy.html() && nextRowInvitedBy.html().length < 2) {
nextRowInvitedBy.html(thisRowInvitedBy.html());
}

parent.remove();
});
});
}

return false;
});
};

return Registration;
});

function helper(confirm, email, invitedBy, method, removeRow) {
if (confirm) {
socket.emit(method, { email: email, invitedBy: invitedBy }, function (err) {
if (err) {
return alerts.error(err);
}
removeRow();
});
}
}
if (confirm) {
socket.emit(method, { email, invitedBy }, (err) => {

Check failure on line 55 in src/admin/manage/registration.js

View workflow job for this annotation

GitHub Actions / test

'socket' is not defined
if (err) {
return alerts.error(err);

Check failure on line 57 in src/admin/manage/registration.js

View workflow job for this annotation

GitHub Actions / test

'alerts' is not defined
}
removeRow();
});
}
}
2 changes: 1 addition & 1 deletion src/upgrades/1.1.1/upload_privileges.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ module.exports = {
}, callback);
});
},
};
};

0 comments on commit 9a850cf

Please sign in to comment.