Skip to content

Node.js based forum software built for the modern web

fix: expose remote url in user object

Julian Lam78c9239b22c1
diff --git a/install/package.json b/install/package.json
index d9ebed0948..e65bf82273 100644
--- a/install/package.json
+++ b/install/package.json
@@ -108,7 +108,7 @@
"nodebb-plugin-spam-be-gone": "2.3.1",
"nodebb-plugin-web-push": "0.7.3",
"nodebb-rewards-essentials": "1.0.1",
- "nodebb-theme-harmony": "2.0.39",
+ "nodebb-theme-harmony": "2.0.40",
"nodebb-theme-lavender": "7.1.18",
"nodebb-theme-peace": "2.2.39",
"nodebb-theme-persona": "14.0.16",
diff --git a/public/language/en-GB/user.json b/public/language/en-GB/user.json
index 2810fbd3ab..42039d997f 100644
--- a/public/language/en-GB/user.json
+++ b/public/language/en-GB/user.json
@@ -61,6 +61,7 @@
"chat": "Chat",
"chat-with": "Continue chat with %1",
"new-chat-with": "Start new chat with %1",
+ "view-remote": "View Original",
"flag-profile": "Flag Profile",
"profile-flagged": "Already flagged",
"follow": "Follow",
diff --git a/src/user/data.js b/src/user/data.js
index c9d8cb5ae6..5a620c375a 100644
--- a/src/user/data.js
+++ b/src/user/data.js
@@ -21,7 +21,7 @@ const intFields = [
module.exports = function (User) {
const fieldWhitelist = [
- 'uid', 'username', 'userslug', 'email', 'email:confirmed', 'joindate',
+ 'uid', 'username', 'userslug', 'url', 'email', 'email:confirmed', 'joindate',
'lastonline', 'picture', 'icon:bgColor', 'fullname', 'birthday',
'aboutme', 'signature', 'uploadedpicture', 'profileviews', 'reputation',
'postcount', 'topiccount', 'lastposttime', 'banned', 'banned:expire',
@@ -235,6 +235,12 @@ module.exports = function (User) {
user.username = validator.escape(user.username ? user.username.toString() : '');
}
+ if (user.hasOwnProperty('url')) {
+ // works around renderOverride supplying `url` to templates
+ user.remoteUrl = user.url;
+ delete user.url;
+ }
+
if (user.hasOwnProperty('email')) {
user.email = validator.escape(user.email ? user.email.toString() : '');
}