mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-18 05:22:48 +01:00
19 lines
483 B
JavaScript
19 lines
483 B
JavaScript
'use strict';
|
|
|
|
const db = require('../database');
|
|
const utils = require('../utils');
|
|
|
|
module.exports = function (Topics) {
|
|
Topics.isOwner = async function (tid, uid) {
|
|
if (utils.isNumber(uid) && parseInt(uid, 10) <= 0) {
|
|
return false;
|
|
}
|
|
const author = await Topics.getTopicField(tid, 'uid');
|
|
return String(author) === String(uid);
|
|
};
|
|
|
|
Topics.getUids = async function (tid) {
|
|
return await db.getSortedSetRevRangeByScore(`tid:${tid}:posters`, 0, -1, '+inf', 1);
|
|
};
|
|
};
|