mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-18 03:31:03 +01:00
fix image upload for other users
This commit is contained in:
@@ -74,7 +74,10 @@ define('forum/account/edit', ['forum/account/header', 'uploader', 'translator'],
|
|||||||
function handleImageChange() {
|
function handleImageChange() {
|
||||||
|
|
||||||
$('#changePictureBtn').on('click', function() {
|
$('#changePictureBtn').on('click', function() {
|
||||||
socket.emit('user.getProfilePictures', function(err, pictures) {
|
socket.emit('user.getProfilePictures', {uid: ajaxify.data.uid}, function(err, pictures) {
|
||||||
|
if (err) {
|
||||||
|
return app.alertError(err.message);
|
||||||
|
}
|
||||||
templates.parse('partials/modals/change_picture_modal', {
|
templates.parse('partials/modals/change_picture_modal', {
|
||||||
pictures: pictures,
|
pictures: pictures,
|
||||||
uploaded: !!ajaxify.data.uploadedpicture
|
uploaded: !!ajaxify.data.uploadedpicture
|
||||||
@@ -115,13 +118,6 @@ define('forum/account/edit', ['forum/account/header', 'uploader', 'translator'],
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// if (uploadedPicture) {
|
|
||||||
// modal.find('#user-uploaded-picture').attr('src', uploadedPicture);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// modal.find('#uploaded-box').toggle(!!uploadedPicture);
|
|
||||||
// modal.find('#default-box .fa-check').toggle(currentPicture !== uploadedPicture);
|
|
||||||
// modal.find('#uploaded-box .fa-check').toggle(currentPicture === uploadedPicture);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function selectImageType() {
|
function selectImageType() {
|
||||||
@@ -141,40 +137,6 @@ define('forum/account/edit', ['forum/account/header', 'uploader', 'translator'],
|
|||||||
ajaxify.refresh();
|
ajaxify.refresh();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// var modal = $(html);
|
|
||||||
// modal.on('hidden.bs.modal', function() {
|
|
||||||
// modal.remove();
|
|
||||||
// });
|
|
||||||
// selectedImageType = '';
|
|
||||||
// updateImages();
|
|
||||||
|
|
||||||
// modal.modal('show');
|
|
||||||
|
|
||||||
// modal.find('#default-box').on('click', function() {
|
|
||||||
// selectImageType('default');
|
|
||||||
// });
|
|
||||||
|
|
||||||
// modal.find('#uploaded-box').on('click', function() {
|
|
||||||
// selectImageType('uploaded');
|
|
||||||
// });
|
|
||||||
|
|
||||||
// modal.find('#savePictureChangesBtn').on('click', function() {
|
|
||||||
|
|
||||||
// modal.modal('hide');
|
|
||||||
|
|
||||||
// if (!selectedImageType) {
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// changeUserPicture(selectedImageType, function(err) {
|
|
||||||
// if (err) {
|
|
||||||
// return app.alertError(err.message);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// updateHeader(selectedImageType === 'uploaded' ? uploadedPicture : '');
|
|
||||||
// ajaxify.refresh();
|
|
||||||
// });
|
|
||||||
// });
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -100,12 +100,16 @@ module.exports = function(SocketUser) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
SocketUser.getProfilePictures = function(socket, data, callback) {
|
SocketUser.getProfilePictures = function(socket, data, callback) {
|
||||||
|
if (!data || !data.uid) {
|
||||||
|
return callback(new Error('[[error:invalid-data]]'));
|
||||||
|
}
|
||||||
|
|
||||||
async.parallel({
|
async.parallel({
|
||||||
list: async.apply(plugins.fireHook, 'filter:user.listPictures', {
|
list: async.apply(plugins.fireHook, 'filter:user.listPictures', {
|
||||||
uid: socket.uid,
|
uid: data.uid,
|
||||||
pictures: []
|
pictures: []
|
||||||
}),
|
}),
|
||||||
uploaded: async.apply(user.getUserField, socket.uid, 'uploadedpicture')
|
uploaded: async.apply(user.getUserField, data.uid, 'uploadedpicture')
|
||||||
}, function(err, data) {
|
}, function(err, data) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return callback(err);
|
return callback(err);
|
||||||
|
|||||||
Reference in New Issue
Block a user