fix update cover to use correct uid

v1.18.x
barisusakli 9 years ago
parent b82670e005
commit 63f147786c

@ -8,13 +8,9 @@ define('forum/account/header', [
'translator' 'translator'
], function(coverPhoto, uploader, components, translator) { ], function(coverPhoto, uploader, components, translator) {
var AccountHeader = {}; var AccountHeader = {};
var yourid;
var theirid;
var isAdminOrSelfOrGlobalMod; var isAdminOrSelfOrGlobalMod;
AccountHeader.init = function() { AccountHeader.init = function() {
yourid = ajaxify.data.yourid;
theirid = ajaxify.data.theirid;
isAdminOrSelfOrGlobalMod = ajaxify.data.isAdmin || ajaxify.data.isSelf || ajaxify.data.isGlobalModerator; isAdminOrSelfOrGlobalMod = ajaxify.data.isAdmin || ajaxify.data.isSelf || ajaxify.data.isGlobalModerator;
hidePrivateLinks(); hidePrivateLinks();
@ -33,14 +29,14 @@ define('forum/account/header', [
}); });
components.get('account/chat').on('click', function() { components.get('account/chat').on('click', function() {
socket.emit('modules.chats.hasPrivateChat', theirid, function(err, roomId) { socket.emit('modules.chats.hasPrivateChat', ajaxify.data.uid, function(err, roomId) {
if (err) { if (err) {
return app.alertError(err.message); return app.alertError(err.message);
} }
if (roomId) { if (roomId) {
app.openChat(roomId); app.openChat(roomId);
} else { } else {
app.newChat(theirid); app.newChat(ajaxify.data.uid);
} }
}); });
}); });
@ -71,7 +67,7 @@ define('forum/account/header', [
coverPhoto.init(components.get('account/cover'), coverPhoto.init(components.get('account/cover'),
function(imageData, position, callback) { function(imageData, position, callback) {
socket.emit('user.updateCover', { socket.emit('user.updateCover', {
uid: yourid, uid: ajaxify.data.uid,
imageData: imageData, imageData: imageData,
position: position position: position
}, callback); }, callback);
@ -80,7 +76,7 @@ define('forum/account/header', [
uploader.show({ uploader.show({
title: '[[user:upload_cover_picture]]', title: '[[user:upload_cover_picture]]',
route: config.relative_path + '/api/user/' + ajaxify.data.userslug + '/uploadcover', route: config.relative_path + '/api/user/' + ajaxify.data.userslug + '/uploadcover',
params: {uid: yourid }, params: {uid: ajaxify.data.uid },
accept: '.png,.jpg,.bmp' accept: '.png,.jpg,.bmp'
}, function(imageUrlOnServer) { }, function(imageUrlOnServer) {
components.get('account/cover').css('background-image', 'url(' + imageUrlOnServer + '?v=' + Date.now() + ')'); components.get('account/cover').css('background-image', 'url(' + imageUrlOnServer + '?v=' + Date.now() + ')');
@ -92,7 +88,7 @@ define('forum/account/header', [
function toggleFollow(type) { function toggleFollow(type) {
socket.emit('user.' + type, { socket.emit('user.' + type, {
uid: theirid uid: ajaxify.data.uid
}, function(err) { }, function(err) {
if (err) { if (err) {
return app.alertError(err.message); return app.alertError(err.message);

Loading…
Cancel
Save