mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-17 19:21:04 +01:00
test: fix assert.reject calls
fix tests
This commit is contained in:
@@ -388,6 +388,9 @@ postsAPI.deleteDiff = async (caller, { pid, timestamp }) => {
|
||||
};
|
||||
|
||||
postsAPI.getReplies = async (caller, { pid }) => {
|
||||
if (!utils.isNumber(pid)) {
|
||||
throw new Error('[[error:invalid-data]]');
|
||||
}
|
||||
const { uid } = caller;
|
||||
const canRead = await privileges.posts.can('topics:read', pid, caller.uid);
|
||||
if (!canRead) {
|
||||
|
||||
@@ -279,11 +279,17 @@ topicsAPI.markRead = async (caller, { tid }) => {
|
||||
};
|
||||
|
||||
topicsAPI.markUnread = async (caller, { tid }) => {
|
||||
if (!tid || caller.uid <= 0) {
|
||||
throw new Error('[[error:invalid-data]]');
|
||||
}
|
||||
await topics.markUnread(tid, caller.uid);
|
||||
topics.pushUnreadCount(caller.uid);
|
||||
};
|
||||
|
||||
topicsAPI.bump = async (caller, { tid }) => {
|
||||
if (!tid) {
|
||||
throw new Error('[[error:invalid-tid]]');
|
||||
}
|
||||
const isAdminOrMod = await privileges.topics.isAdminOrMod(tid, caller.uid);
|
||||
if (!isAdminOrMod) {
|
||||
throw new Error('[[error:no-privileges]]');
|
||||
|
||||
Reference in New Issue
Block a user