Commit 20d59efc authored by Curtis Adam's avatar Curtis Adam

Fix Backend user editor not updating all settings

parent d190e334
......@@ -207,37 +207,31 @@ Meteor.users.deny({
});
Meteor.methods({
updateUsersVisibility: function (visible) {
updateUsersVisibility: function (visible, id) {
check(visible, Boolean);
check(id, String);
Meteor.users.update(Meteor.userId(), {
if (!UserPermissions.gotBackendAccess()) {
id = Meteor.userId();
}
Meteor.users.update(id, {
$set: {
visible: visible
}
});
},
updateUsersEmail: function (email) {
updateUsersEmail: function (email, id) {
check(email, String);
Meteor.users.update(Meteor.userId(), {
check(id, String);
if (!UserPermissions.gotBackendAccess()) {
id = Meteor.userId();
}
Meteor.users.update(id, {
$set: {
email: email
}
});
},
updateUsersName: function (name, id) {
check(name, String);
check(id, String);
if (UserPermissions.gotBackendAccess()) {
Meteor.users.update(id, {
$set: {
"profile.name": name
}
});
}
},
updateUsersTitle: function (title, id) {
check(title, String);
check(id, String);
......
......@@ -198,9 +198,7 @@ Template.admin_user.events({
$('#helpEditUserBlockedtextAdmin').css('color', '#b94a48');
}
}
if ((Session.get('userBlocked') && $('#editUserBlockedtextAdmin').val() !== "" || !Session.get('userBlocked')) &&
(check === true || email === "") && (pro && visible || !pro) &&
(lecturer && visible || !lecturer)) {
if ((Session.get('userBlocked') && $('#editUserBlockedtextAdmin').val() !== "" || !Session.get('userBlocked'))) {
if ('true' === tmpl.find('#editUserProAdmin > .active > input').value) {
Meteor.call('updateRoles', user_id, 'pro');
} else {
......@@ -235,10 +233,12 @@ Template.admin_user.events({
Meteor.call('updateUser', user_id, visible, email, blockedtext);
Meteor.call('updateUsersTitle', title, user_id);
Meteor.call('updateUsersBirthName', birthname, user_id);
Meteor.call('updateUsersEmail', email, user_id);
Meteor.call('updateUsersGivenName', givenname, user_id);
Meteor.call('updateUsersProfileState',
(email !== "" && birthname !== "" && givenname !== "") ? true : false,
user_id);
Meteor.call('updateUsersVisibility', visible, user_id);
window.history.go(-1);
}
},
......
......@@ -73,10 +73,10 @@ Template.profileSettings.onCreated(function () {
Template.profileSettings.events({
"click #profilepublicoption1": function () {
Meteor.call("updateUsersVisibility", true);
Meteor.call("updateUsersVisibility", true, Meteor.userId());
},
"click #profilepublicoption2": function () {
Meteor.call("updateUsersVisibility", false);
Meteor.call("updateUsersVisibility", false, Meteor.userId());
},
"keyup #inputEmail": function () {
var re = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
......@@ -242,7 +242,7 @@ Template.profileSettings.events({
$('#inputEmailValidationForm').addClass("hidden");
Session.set("profileSettingsSave", true);
Session.set("profileSettingsCancel", true);
Meteor.call("updateUsersEmail", email);
Meteor.call("updateUsersEmail", email, user_id);
Meteor.call("updateUsersBirthName", birthname, user_id);
Meteor.call("updateUsersGivenName", givenname, user_id);
Meteor.call("updateUsersProfileState", true, user_id);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment