changes for profile picture

This commit is contained in:
Barış Soner Uşaklı
2023-01-18 21:25:00 -05:00
parent 938496448e
commit 68f66223e7
5 changed files with 17 additions and 14 deletions

View File

@@ -100,10 +100,10 @@
"nodebb-plugin-ntfy": "1.0.8",
"nodebb-plugin-spam-be-gone": "2.0.4",
"nodebb-rewards-essentials": "0.2.1",
"nodebb-theme-harmony": "1.0.0-beta.16",
"nodebb-theme-harmony": "1.0.0-beta.17",
"nodebb-theme-lavender": "7.0.5",
"nodebb-theme-peace": "2.0.14",
"nodebb-theme-persona": "13.0.37",
"nodebb-theme-persona": "13.0.38",
"nodebb-widget-essentials": "7.0.2",
"nodemailer": "6.8.0",
"nprogress": "0.2.0",

View File

@@ -20,7 +20,6 @@ define('forum/account/edit', [
$('#groupTitle option[value=""]').attr('selected', true);
}
handleImageChange();
handleAccountDelete();
handleEmailConfirm();
updateSignature();
@@ -51,12 +50,7 @@ define('forum/account/edit', [
return false;
}
function handleImageChange() {
$('#changePictureBtn').on('click', function () {
picture.openChangeModal();
return false;
});
}
function handleAccountDelete() {
$('#deleteAccountBtn').on('click', function () {

View File

@@ -8,11 +8,12 @@ define('forum/account/header', [
'translator',
'accounts/delete',
'accounts/moderate',
'accounts/picture',
'api',
'bootbox',
'alerts',
], function (coverPhoto, pictureCropper, components, translator,
AccountsDelete, AccountsModerate, api, bootbox, alerts) {
AccountsDelete, AccountsModerate, AccountsPicture, api, bootbox, alerts) {
const AccountHeader = {};
let isAdminOrSelfOrGlobalMod;
@@ -21,6 +22,8 @@ define('forum/account/header', [
selectActivePill();
handleImageChange();
if (isAdminOrSelfOrGlobalMod) {
setupCoverPhoto();
}
@@ -68,6 +71,13 @@ define('forum/account/header', [
});
}
function handleImageChange() {
$('[component="profile/change/picture"]').on('click', function () {
AccountsPicture.openChangeModal();
return false;
});
}
function setupCoverPhoto() {
coverPhoto.init(
components.get('account/cover'),

View File

@@ -21,10 +21,6 @@ editController.get = async function (req, res, next) {
userData.maximumSignatureLength = meta.config.maximumSignatureLength;
userData.maximumAboutMeLength = meta.config.maximumAboutMeLength;
userData.maximumProfileImageSize = meta.config.maximumProfileImageSize;
userData.allowProfilePicture = !userData.isSelf || !!meta.config['reputation:disabled'] || userData.reputation >= meta.config['min:rep:profile-picture'];
userData.allowCoverPicture = !userData.isSelf || !!meta.config['reputation:disabled'] || userData.reputation >= meta.config['min:rep:cover-picture'];
userData.allowProfileImageUploads = meta.config.allowProfileImageUploads;
userData.allowedProfileImageExtensions = user.getAllowedProfileImageExtensions().map(ext => `.${ext}`).join(', ');
userData.allowMultipleBadges = meta.config.allowMultipleBadges === 1;
userData.allowAccountDelete = meta.config.allowAccountDelete === 1;
userData.allowWebsite = !userData.isSelf || !!meta.config['reputation:disabled'] || userData.reputation >= meta.config['min:rep:website'];

View File

@@ -79,7 +79,10 @@ helpers.getUserDataByUserSlug = async function (userslug, callerUID, query = {})
userData.isFollowing = results.isFollowing;
userData.hasPrivateChat = results.hasPrivateChat;
userData.showHidden = results.canEdit; // remove in v1.19.0
userData.allowProfilePicture = !userData.isSelf || !!meta.config['reputation:disabled'] || userData.reputation >= meta.config['min:rep:profile-picture'];
userData.allowCoverPicture = !userData.isSelf || !!meta.config['reputation:disabled'] || userData.reputation >= meta.config['min:rep:cover-picture'];
userData.allowProfileImageUploads = meta.config.allowProfileImageUploads;
userData.allowedProfileImageExtensions = user.getAllowedProfileImageExtensions().map(ext => `.${ext}`).join(', ');
userData.groups = Array.isArray(results.groups) && results.groups.length ? results.groups[0] : [];
userData.selectedGroup = userData.groups.filter(group => group && userData.groupTitleArray.includes(group.name))
.sort((a, b) => userData.groupTitleArray.indexOf(a.name) - userData.groupTitleArray.indexOf(b.name));