feat: #12935, show 'shared this to x' in topic event when moving topics out of cid -1

This commit is contained in:
Julian Lam
2024-12-11 13:07:46 -05:00
parent 050acb4f85
commit fcf0f79987
3 changed files with 7 additions and 1 deletions

View File

@@ -66,6 +66,8 @@
"user-restored-topic-on": "%1 restored this topic on %2",
"user-moved-topic-from-ago": "%1 moved this topic from %2 %3",
"user-moved-topic-from-on": "%1 moved this topic from %2 on %3",
"user-shared-topic-ago": "%1 shared this topic %2",
"user-shared-topic-on": "%1 shared this topic on %2",
"user-queued-post-ago": "%1 <a href=\"%2\">queued</a> post for approval %3",
"user-queued-post-on": "%1 <a href=\"%2\">queued</a> post for approval on %3",
"user-referenced-topic-ago": "%1 <a href=\"%2\">referenced</a> this topic %3",

View File

@@ -56,6 +56,10 @@ Events._types = {
icon: 'fa-arrow-circle-right',
translation: async (event, language) => translateEventArgs(event, language, 'topic:user-moved-topic-from', renderUser(event), `${event.fromCategory.name}`, renderTimeago(event)),
},
share: {
icon: 'fa-share-alt',
translation: async (event, language) => translateEventArgs(event, language, 'topic:user-shared-topic', renderUser(event), renderTimeago(event)),
},
'post-queue': {
icon: 'fa-history',
translation: async (event, language) => translateEventArgs(event, language, 'topic:user-queued-post', renderUser(event), `${relative_path}${event.href}`, renderTimeago(event)),

View File

@@ -283,7 +283,7 @@ module.exports = function (Topics) {
oldCid: oldCid,
}),
Topics.updateCategoryTagsCount([oldCid, cid], tags),
Topics.events.log(tid, { type: 'move', uid: data.uid, fromCid: oldCid }),
Topics.events.log(tid, { type: oldCid === -1 ? 'share' : 'move', uid: data.uid, fromCid: oldCid }),
]);
// Update entry in recent topics zset — must come after hash update