mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 08:36:12 +01:00
fix: Topic.isOwner check to handle remote users
This commit is contained in:
@@ -1,15 +1,15 @@
|
||||
'use strict';
|
||||
|
||||
const db = require('../database');
|
||||
const utils = require('../utils');
|
||||
|
||||
module.exports = function (Topics) {
|
||||
Topics.isOwner = async function (tid, uid) {
|
||||
uid = parseInt(uid, 10);
|
||||
if (uid <= 0) {
|
||||
if (utils.isNumber(uid) && parseInt(uid, 10) <= 0) {
|
||||
return false;
|
||||
}
|
||||
const author = await Topics.getTopicField(tid, 'uid');
|
||||
return author === uid;
|
||||
return String(author) === String(uid);
|
||||
};
|
||||
|
||||
Topics.getUids = async function (tid) {
|
||||
|
||||
Reference in New Issue
Block a user