From 1d7baf12171cffbd3af8914bef4e6297d1160d49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Fri, 13 Jan 2023 14:31:56 -0500 Subject: [PATCH] feat: add url to profile links route: 'info' url: /user//info used for comparison in harmony account sidebar --- src/controllers/accounts/helpers.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/controllers/accounts/helpers.js b/src/controllers/accounts/helpers.js index a70ba77580..29652794d7 100644 --- a/src/controllers/accounts/helpers.js +++ b/src/controllers/accounts/helpers.js @@ -14,6 +14,8 @@ const translator = require('../../translator'); const messaging = require('../../messaging'); const categories = require('../../categories'); +const relative_path = nconf.get('relative_path'); + const helpers = module.exports; helpers.getUserDataByUserSlug = async function (userslug, callerUID, query = {}) { @@ -229,11 +231,18 @@ async function getProfileMenu(uid, callerUID) { }); } - return await plugins.hooks.fire('filter:user.profileMenu', { + const data = await plugins.hooks.fire('filter:user.profileMenu', { uid: uid, callerUID: callerUID, links: links, }); + const userslug = await user.getUserField(uid, 'userslug'); + data.links.forEach((link) => { + if (!link.hasOwnProperty('url')) { + link.url = `${relative_path}/user/${userslug}/${link.route}`; + } + }); + return data; } async function parseAboutMe(userData) {