mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-12-22 16:30:34 +01:00
fix: post urls to use prefix instead of linking out directly to origin server, exposed encodeURIComponent as a template helper for themes
This commit is contained in:
@@ -27,6 +27,7 @@ module.exports = function (utils, Benchpress, relative_path) {
|
||||
increment,
|
||||
generateRepliedTo,
|
||||
generateWrote,
|
||||
encodeURIComponent: _encodeURIComponent,
|
||||
isoTimeToLocaleString,
|
||||
shouldHideReplyContainer,
|
||||
humanReadableNumber,
|
||||
@@ -340,13 +341,17 @@ module.exports = function (utils, Benchpress, relative_path) {
|
||||
post.parent.displayname : '[[global:guest]]';
|
||||
const isBeforeCutoff = post.timestamp < (Date.now() - (timeagoCutoff * oneDayInMs));
|
||||
const langSuffix = isBeforeCutoff ? 'on' : 'ago';
|
||||
return `[[topic:replied-to-user-${langSuffix}, ${post.toPid}, ${relative_path}/post/${post.toPid}, ${displayname}, ${relative_path}/post/${post.pid}, ${post.timestampISO}]]`;
|
||||
return `[[topic:replied-to-user-${langSuffix}, ${post.toPid}, ${relative_path}/post/${encodeURIComponent(post.toPid)}, ${displayname}, ${relative_path}/post/${encodeURIComponent(post.pid)}, ${post.timestampISO}]]`;
|
||||
}
|
||||
|
||||
function generateWrote(post, timeagoCutoff) {
|
||||
const isBeforeCutoff = post.timestamp < (Date.now() - (timeagoCutoff * oneDayInMs));
|
||||
const langSuffix = isBeforeCutoff ? 'on' : 'ago';
|
||||
return `[[topic:wrote-${langSuffix}, ${relative_path}/post/${post.pid}, ${post.timestampISO}]]`;
|
||||
return `[[topic:wrote-${langSuffix}, ${relative_path}/post/${encodeURIComponent(post.pid)}, ${post.timestampISO}]]`;
|
||||
}
|
||||
|
||||
function _encodeURIComponent(value) {
|
||||
return encodeURIComponent(value);
|
||||
}
|
||||
|
||||
function isoTimeToLocaleString(isoTime, locale = 'en-GB') {
|
||||
|
||||
Reference in New Issue
Block a user