Tag follow (#12041)

* feat: tag follow

* on tag delete remove it from following users

* feat: on tag rename update user followed tags

and move the

* add new filter on /notifications

* feat: openapi updates

* chore: up themes

* chore: up peace

* refactor: remove unused title
This commit is contained in:
Barış Soner Uşaklı
2023-09-27 10:57:00 -04:00
committed by GitHub
parent cf50b0fe49
commit 40d290c1a9
30 changed files with 443 additions and 19 deletions

View File

@@ -21,6 +21,7 @@ const Notifications = module.exports;
Notifications.baseTypes = [
'notificationType_upvote',
'notificationType_new-topic',
'notificationType_new-topic-with-tag',
'notificationType_new-reply',
'notificationType_post-edit',
'notificationType_follow',
@@ -395,10 +396,10 @@ Notifications.merge = async function (notifications) {
}, []);
differentiators.forEach((differentiator) => {
function typeFromUsernames(usernames) {
if (usernames.length === 2) {
function typeFromLength(items) {
if (items.length === 2) {
return 'dual';
} else if (usernames.length === 3) {
} else if (items.length === 3) {
return 'triple';
}
return 'multiple';
@@ -419,9 +420,9 @@ Notifications.merge = async function (notifications) {
case 'notifications:user_posted_in_public_room': {
const usernames = _.uniq(set.map(notifObj => notifObj && notifObj.user && notifObj.user.displayname));
if (usernames.length === 2 || usernames.length === 3) {
notifObj.bodyShort = `[[${mergeId}_${typeFromUsernames(usernames)}, ${usernames.join(', ')}, ${notifObj.roomIcon}, ${notifObj.roomName}]]`;
notifObj.bodyShort = `[[${mergeId}_${typeFromLength(usernames)}, ${usernames.join(', ')}, ${notifObj.roomIcon}, ${notifObj.roomName}]]`;
} else if (usernames.length > 3) {
notifObj.bodyShort = `[[${mergeId}_${typeFromUsernames(usernames)}, ${usernames.slice(0, 2).join(', ')}, ${usernames.length - 2}, ${notifObj.roomIcon}, ${notifObj.roomName}]]`;
notifObj.bodyShort = `[[${mergeId}_${typeFromLength(usernames)}, ${usernames.slice(0, 2).join(', ')}, ${usernames.length - 2}, ${notifObj.roomIcon}, ${notifObj.roomName}]]`;
}
notifObj.path = set[set.length - 1].path;
@@ -440,9 +441,9 @@ Notifications.merge = async function (notifications) {
titleEscaped = titleEscaped ? (`, ${titleEscaped}`) : '';
if (numUsers === 2 || numUsers === 3) {
notifications[modifyIndex].bodyShort = `[[${mergeId}_${typeFromUsernames(usernames)}, ${usernames.join(', ')}${titleEscaped}]]`;
notifications[modifyIndex].bodyShort = `[[${mergeId}_${typeFromLength(usernames)}, ${usernames.join(', ')}${titleEscaped}]]`;
} else if (numUsers > 2) {
notifications[modifyIndex].bodyShort = `[[${mergeId}_${typeFromUsernames(usernames)}, ${usernames.slice(0, 2).join(', ')}, ${numUsers - 2}${titleEscaped}]]`;
notifications[modifyIndex].bodyShort = `[[${mergeId}_${typeFromLength(usernames)}, ${usernames.slice(0, 2).join(', ')}, ${numUsers - 2}${titleEscaped}]]`;
}
notifications[modifyIndex].path = set[set.length - 1].path;