mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-02 03:55:55 +01:00
feat: add read topics route
remove counts that were no longer displayed up themes
This commit is contained in:
@@ -107,10 +107,10 @@
|
||||
"nodebb-plugin-ntfy": "1.7.7",
|
||||
"nodebb-plugin-spam-be-gone": "2.2.2",
|
||||
"nodebb-rewards-essentials": "1.0.0",
|
||||
"nodebb-theme-harmony": "1.2.72",
|
||||
"nodebb-theme-harmony": "1.2.73",
|
||||
"nodebb-theme-lavender": "7.1.8",
|
||||
"nodebb-theme-peace": "2.2.7",
|
||||
"nodebb-theme-persona": "13.3.37",
|
||||
"nodebb-theme-persona": "13.3.38",
|
||||
"nodebb-widget-essentials": "7.0.29",
|
||||
"nodemailer": "6.9.15",
|
||||
"nprogress": "0.2.0",
|
||||
|
||||
@@ -60,6 +60,7 @@
|
||||
"account/settings-of": "Changing settings of %1",
|
||||
"account/watched": "Topics watched by %1",
|
||||
"account/ignored": "Topics ignored by %1",
|
||||
"account/read": "Topics read by %1",
|
||||
"account/upvoted": "Posts upvoted by %1",
|
||||
"account/downvoted": "Posts downvoted by %1",
|
||||
"account/best": "Best posts made by %1",
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
"change-all": "Change All",
|
||||
"watched": "Watched",
|
||||
"ignored": "Ignored",
|
||||
"read": "Read",
|
||||
"default-category-watch-state": "Default category watch state",
|
||||
"followers": "Followers",
|
||||
"following": "Following",
|
||||
@@ -121,6 +122,7 @@
|
||||
"has-no-topics": "This user hasn't posted any topics yet.",
|
||||
"has-no-watched-topics": "This user hasn't watched any topics yet.",
|
||||
"has-no-ignored-topics": "This user hasn't ignored any topics yet.",
|
||||
"has-no-read-topics": "This user hasn't read any topics yet.",
|
||||
"has-no-upvoted-posts": "This user hasn't upvoted any posts yet.",
|
||||
"has-no-downvoted-posts": "This user hasn't downvoted any posts yet.",
|
||||
"has-no-controversial-posts": "This user does not have any downvoted posts yet.",
|
||||
|
||||
@@ -387,38 +387,24 @@ UserObjectFull:
|
||||
counts:
|
||||
type: object
|
||||
properties:
|
||||
best:
|
||||
type: number
|
||||
controversial:
|
||||
type: number
|
||||
blocks:
|
||||
type: number
|
||||
bookmarks:
|
||||
type: number
|
||||
categoriesWatched:
|
||||
type: number
|
||||
tagsWatched:
|
||||
type: number
|
||||
downvoted:
|
||||
type: number
|
||||
followers:
|
||||
type: number
|
||||
following:
|
||||
type: number
|
||||
groups:
|
||||
type: number
|
||||
ignored:
|
||||
type: number
|
||||
posts:
|
||||
type: number
|
||||
topics:
|
||||
type: number
|
||||
uploaded:
|
||||
type: number
|
||||
upvoted:
|
||||
type: number
|
||||
watched:
|
||||
type: number
|
||||
isBlocked:
|
||||
type: boolean
|
||||
blocksCount:
|
||||
|
||||
@@ -282,6 +282,8 @@ paths:
|
||||
$ref: 'read/user/userslug/watched.yaml'
|
||||
"/api/user/{userslug}/ignored":
|
||||
$ref: 'read/user/userslug/ignored.yaml'
|
||||
"/api/user/{userslug}/read":
|
||||
$ref: 'read/user/userslug/read.yaml'
|
||||
"/api/user/{userslug}/upvoted":
|
||||
$ref: 'read/user/userslug/upvoted.yaml'
|
||||
"/api/user/{userslug}/downvoted":
|
||||
|
||||
47
public/openapi/read/user/userslug/read.yaml
Normal file
47
public/openapi/read/user/userslug/read.yaml
Normal file
@@ -0,0 +1,47 @@
|
||||
get:
|
||||
tags:
|
||||
- users
|
||||
summary: Get a user's read topics
|
||||
parameters:
|
||||
- name: userslug
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
example: admin
|
||||
responses:
|
||||
"200":
|
||||
description: ""
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: ../../../components/schemas/UserObject.yaml#/UserObjectFull
|
||||
- type: object
|
||||
properties:
|
||||
topics:
|
||||
type: array
|
||||
items:
|
||||
$ref: ../../../components/schemas/TopicObject.yaml#/TopicObject
|
||||
nextStart:
|
||||
type: number
|
||||
noItemsFoundKey:
|
||||
type: string
|
||||
title:
|
||||
type: string
|
||||
showSort:
|
||||
type: boolean
|
||||
sortOptions:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
properties:
|
||||
url:
|
||||
type: string
|
||||
name:
|
||||
type: string
|
||||
selected:
|
||||
type: boolean
|
||||
- $ref: ../../../components/schemas/Pagination.yaml#/Pagination
|
||||
- $ref: ../../../components/schemas/Breadcrumbs.yaml#/Breadcrumbs
|
||||
- $ref: ../../../components/schemas/CommonProps.yaml#/CommonProps
|
||||
14
public/src/client/account/read.js
Normal file
14
public/src/client/account/read.js
Normal file
@@ -0,0 +1,14 @@
|
||||
'use strict';
|
||||
|
||||
|
||||
define('forum/account/read', ['forum/account/header', 'forum/account/topics'], function (header, topics) {
|
||||
const AccountRead = {};
|
||||
|
||||
AccountRead.init = function () {
|
||||
header.init();
|
||||
|
||||
topics.handleInfiniteScroll('account/read');
|
||||
};
|
||||
|
||||
return AccountRead;
|
||||
});
|
||||
@@ -184,16 +184,9 @@ async function getCounts(userData, callerUID) {
|
||||
const cids = await categories.getCidsByPrivilege('categories:cid', callerUID, 'topics:read');
|
||||
const promises = {
|
||||
posts: db.sortedSetsCardSum(cids.map(c => `cid:${c}:uid:${uid}:pids`)),
|
||||
best: db.sortedSetsCardSum(cids.map(c => `cid:${c}:uid:${uid}:pids:votes`), 1, '+inf'),
|
||||
controversial: db.sortedSetsCardSum(cids.map(c => `cid:${c}:uid:${uid}:pids:votes`), '-inf', -1),
|
||||
topics: db.sortedSetsCardSum(cids.map(c => `cid:${c}:uid:${uid}:tids`)),
|
||||
};
|
||||
if (userData.isAdmin || userData.isSelf) {
|
||||
promises.ignored = db.sortedSetCard(`uid:${uid}:ignored_tids`);
|
||||
promises.watched = db.sortedSetCard(`uid:${uid}:followed_tids`);
|
||||
promises.upvoted = db.sortedSetCard(`uid:${uid}:upvote`);
|
||||
promises.downvoted = db.sortedSetCard(`uid:${uid}:downvote`);
|
||||
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`);
|
||||
|
||||
@@ -126,6 +126,14 @@ const templateToData = {
|
||||
return `uid:${userData.uid}:ignored_tids`;
|
||||
},
|
||||
},
|
||||
'account/read': {
|
||||
type: 'topics',
|
||||
noItemsFoundKey: '[[user:has-no-read-topics]]',
|
||||
crumb: '[[user:read]]',
|
||||
getSets: function (callerUid, userData) {
|
||||
return `uid:${userData.uid}:tids_read`;
|
||||
},
|
||||
},
|
||||
'account/topics': {
|
||||
type: 'topics',
|
||||
noItemsFoundKey: '[[user:has-no-topics]]',
|
||||
@@ -169,6 +177,10 @@ postsController.getIgnoredTopics = async function (req, res, next) {
|
||||
await getPostsFromUserSet('account/ignored', req, res, next);
|
||||
};
|
||||
|
||||
postsController.getReadTopics = async function (req, res, next) {
|
||||
await getPostsFromUserSet('account/read', req, res, next);
|
||||
};
|
||||
|
||||
postsController.getTopics = async function (req, res, next) {
|
||||
await getPostsFromUserSet('account/topics', req, res, next);
|
||||
};
|
||||
|
||||
@@ -35,6 +35,7 @@ module.exports = function (app, name, middleware, controllers) {
|
||||
setupPageRoute(app, `/${name}/:userslug/bookmarks`, accountMiddlewares, controllers.accounts.posts.getBookmarks);
|
||||
setupPageRoute(app, `/${name}/:userslug/watched`, accountMiddlewares, controllers.accounts.posts.getWatchedTopics);
|
||||
setupPageRoute(app, `/${name}/:userslug/ignored`, accountMiddlewares, controllers.accounts.posts.getIgnoredTopics);
|
||||
setupPageRoute(app, `/${name}/:userslug/read`, accountMiddlewares, controllers.accounts.posts.getReadTopics);
|
||||
setupPageRoute(app, `/${name}/:userslug/upvoted`, accountMiddlewares, controllers.accounts.posts.getUpVotedPosts);
|
||||
setupPageRoute(app, `/${name}/:userslug/downvoted`, accountMiddlewares, controllers.accounts.posts.getDownVotedPosts);
|
||||
setupPageRoute(app, `/${name}/:userslug/edit`, accountMiddlewares, controllers.accounts.edit.get);
|
||||
|
||||
Reference in New Issue
Block a user