You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
422 B
JavaScript
19 lines
422 B
JavaScript
'use strict';
|
|
|
|
const db = require('../database');
|
|
|
|
module.exports = function (Topics) {
|
|
Topics.isOwner = async function (tid, uid) {
|
|
uid = parseInt(uid, 10);
|
|
if (uid <= 0) {
|
|
return false;
|
|
}
|
|
const author = await Topics.getTopicField(tid, 'uid');
|
|
return author === uid;
|
|
};
|
|
|
|
Topics.getUids = async function (tid) {
|
|
return await db.getSortedSetRevRangeByScore(`tid:${tid}:posters`, 0, -1, '+inf', 1);
|
|
};
|
|
};
|