mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-07-09 11:23:23 +02:00
Update user account removeFn
As I did not realise both groups and users call the same coverPhoto lib, the removeFn has to be in the user client js, and not in the coverPhoto lib. ... of course, it *could* be in there, but it would be hacky.
This commit is contained in:
@@ -68,7 +68,8 @@ define('forum/account/header', [
|
||||
uploader.open(RELATIVE_PATH + '/api/user/' + ajaxify.data.userslug + '/uploadcover', { uid: yourid }, 0, function(imageUrlOnServer) {
|
||||
components.get('account/cover').css('background-image', 'url(' + imageUrlOnServer + ')');
|
||||
});
|
||||
}
|
||||
},
|
||||
removeCover
|
||||
);
|
||||
}
|
||||
|
||||
@@ -132,5 +133,17 @@ define('forum/account/header', [
|
||||
});
|
||||
}
|
||||
|
||||
function removeCover() {
|
||||
socket.emit('user.removeCover', {
|
||||
uid: ajaxify.data.uid
|
||||
}, function(err) {
|
||||
if (!err) {
|
||||
ajaxify.refresh();
|
||||
} else {
|
||||
app.alertError(err.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return AccountHeader;
|
||||
});
|
||||
|
||||
@@ -10,7 +10,7 @@ define('coverPhoto', [
|
||||
saveFn: null
|
||||
};
|
||||
|
||||
coverPhoto.init = function(coverEl, saveFn, uploadFn) {
|
||||
coverPhoto.init = function(coverEl, saveFn, uploadFn, removeFn) {
|
||||
coverPhoto.coverEl = coverEl;
|
||||
coverPhoto.saveFn = saveFn;
|
||||
|
||||
@@ -23,7 +23,7 @@ define('coverPhoto', [
|
||||
units: 'percent'
|
||||
});
|
||||
});
|
||||
coverEl.find('.remove').on('click', coverPhoto.remove);
|
||||
coverEl.find('.remove').on('click', removeFn);
|
||||
|
||||
coverEl
|
||||
.on('dragover', coverPhoto.onDragOver)
|
||||
@@ -80,17 +80,5 @@ define('coverPhoto', [
|
||||
});
|
||||
};
|
||||
|
||||
coverPhoto.remove = function() {
|
||||
socket.emit('user.removeCover', {
|
||||
uid: ajaxify.data.uid
|
||||
}, function(err) {
|
||||
if (!err) {
|
||||
ajaxify.refresh();
|
||||
} else {
|
||||
app.alertError(err.message);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
return coverPhoto;
|
||||
});
|
||||
Reference in New Issue
Block a user