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

@@ -178,6 +178,7 @@ async function getCounts(userData, callerUID) {
promises.bookmarks = db.sortedSetCard(`uid:${uid}:bookmarks`);
promises.uploaded = db.sortedSetCard(`uid:${uid}:uploads`);
promises.categoriesWatched = user.getWatchedCategories(uid);
promises.tagsWatched = db.sortedSetCard(`uid:${uid}:followed_tags`);
promises.blocks = user.getUserField(userData.uid, 'blocksCount');
}
const counts = await utils.promiseParallel(promises);

View File

@@ -12,6 +12,7 @@ notificationsController.get = async function (req, res, next) {
{ name: '[[notifications:all]]', filter: '' },
{ name: '[[global:topics]]', filter: 'new-topic' },
{ name: '[[notifications:replies]]', filter: 'new-reply' },
{ name: '[[notifications:tags]]', filter: 'new-topic-with-tag' },
{ name: '[[notifications:chat]]', filter: 'new-chat' },
{ name: '[[notifications:group-chat]]', filter: 'new-group-chat' },
{ name: '[[notifications:public-chat]]', filter: 'new-public-chat' },

View File

@@ -0,0 +1,25 @@
'use strict';
const db = require('../../database');
const user = require('../../user');
const helpers = require('../helpers');
const tagsController = module.exports;
tagsController.get = async function (req, res) {
if (req.uid !== res.locals.uid) {
return helpers.notAllowed(req, res);
}
const { username, userslug } = await user.getUserFields(res.locals.uid, ['username', 'userslug']);
const tagData = await db.getSortedSetRange(`uid:${res.locals.uid}:followed_tags`, 0, -1);
const payload = {};
payload.tags = tagData;
payload.title = `[[pages:account/watched-tags, ${username}]]`;
payload.breadcrumbs = helpers.buildBreadcrumbs([
{ text: username, url: `/user/${userslug}` },
{ text: '[[pages:tags]]' },
]);
res.render('account/tags', payload);
};