mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-07-04 15:19:10 +02:00
chore: eslint function-paren-newline
This commit is contained in:
committed by
Julian Lam
parent
dab3b23575
commit
62869bae3d
@@ -137,7 +137,8 @@ async function deleteOrRestore(caller, data, params) {
|
||||
async function deleteOrRestoreTopicOf(command, pid, caller) {
|
||||
const topic = await posts.getTopicFields(pid, ['tid', 'cid', 'deleted']);
|
||||
// command: delete/restore
|
||||
await apiHelpers.doTopicAction(command,
|
||||
await apiHelpers.doTopicAction(
|
||||
command,
|
||||
topic.deleted ? 'event:topic_restored' : 'event:topic_deleted',
|
||||
caller,
|
||||
{ tids: [topic.tid], cid: topic.cid }
|
||||
@@ -178,7 +179,9 @@ postsAPI.purge = async function (caller, data) {
|
||||
});
|
||||
|
||||
if (isMainAndLast) {
|
||||
await apiHelpers.doTopicAction('purge', 'event:topic_purged',
|
||||
await apiHelpers.doTopicAction(
|
||||
'purge',
|
||||
'event:topic_purged',
|
||||
caller,
|
||||
{ tids: [postData.tid], cid: topicData.cid }
|
||||
);
|
||||
|
||||
@@ -59,12 +59,13 @@ groupsController.get = async function (req, res, next) {
|
||||
|
||||
async function getGroupNames() {
|
||||
const groupNames = await db.getSortedSetRange('groups:createtime', 0, -1);
|
||||
return groupNames.filter(name => name !== 'registered-users' &&
|
||||
return groupNames.filter(name => (
|
||||
name !== 'registered-users' &&
|
||||
name !== 'verified-users' &&
|
||||
name !== 'unverified-users' &&
|
||||
name !== groups.BANNED_USERS &&
|
||||
!groups.isPrivilegeGroup(name)
|
||||
);
|
||||
));
|
||||
}
|
||||
|
||||
groupsController.getCSV = async function (req, res) {
|
||||
|
||||
@@ -368,8 +368,8 @@ postgresModule.info = async function (db) {
|
||||
const res = await db.query(`
|
||||
SELECT true "postgres",
|
||||
current_setting('server_version') "version",
|
||||
EXTRACT(EPOCH FROM NOW() - pg_postmaster_start_time()) * 1000 "uptime"`
|
||||
);
|
||||
EXTRACT(EPOCH FROM NOW() - pg_postmaster_start_time()) * 1000 "uptime"
|
||||
`);
|
||||
return res.rows[0];
|
||||
};
|
||||
|
||||
|
||||
@@ -18,7 +18,8 @@ module.exports = function (Groups) {
|
||||
}
|
||||
const keys = [];
|
||||
groupNames.forEach((groupName) => {
|
||||
keys.push(`group:${groupName}`,
|
||||
keys.push(
|
||||
`group:${groupName}`,
|
||||
`group:${groupName}:members`,
|
||||
`group:${groupName}:pending`,
|
||||
`group:${groupName}:invited`,
|
||||
|
||||
@@ -55,7 +55,8 @@ module.exports = function (Groups) {
|
||||
const visibleGroups = groupData.filter(groupData => groupData && !groupData.hidden);
|
||||
|
||||
if (visibleGroups.length) {
|
||||
await db.sortedSetAdd('groups:visible:memberCount',
|
||||
await db.sortedSetAdd(
|
||||
'groups:visible:memberCount',
|
||||
visibleGroups.map(groupData => groupData.memberCount),
|
||||
visibleGroups.map(groupData => groupData.name)
|
||||
);
|
||||
|
||||
@@ -43,7 +43,9 @@ module.exports = function (Groups) {
|
||||
promises.push(Groups.destroy, emptyPrivilegeGroups);
|
||||
}
|
||||
if (visibleGroups.length) {
|
||||
promises.push(db.sortedSetAdd, 'groups:visible:memberCount',
|
||||
promises.push(
|
||||
db.sortedSetAdd,
|
||||
'groups:visible:memberCount',
|
||||
visibleGroups.map(groupData => groupData.memberCount),
|
||||
visibleGroups.map(groupData => groupData.name)
|
||||
);
|
||||
|
||||
@@ -25,22 +25,26 @@ module.exports = {
|
||||
}
|
||||
});
|
||||
|
||||
await db.sortedSetAdd('topics:recent',
|
||||
await db.sortedSetAdd(
|
||||
'topics:recent',
|
||||
topicData.map(t => t.lastposttime || 0),
|
||||
topicData.map(t => t.tid)
|
||||
);
|
||||
|
||||
await db.sortedSetAdd('topics:views',
|
||||
await db.sortedSetAdd(
|
||||
'topics:views',
|
||||
topicData.map(t => t.viewcount || 0),
|
||||
topicData.map(t => t.tid)
|
||||
);
|
||||
|
||||
await db.sortedSetAdd('topics:posts',
|
||||
await db.sortedSetAdd(
|
||||
'topics:posts',
|
||||
topicData.map(t => t.postcount || 0),
|
||||
topicData.map(t => t.tid)
|
||||
);
|
||||
|
||||
await db.sortedSetAdd('topics:votes',
|
||||
await db.sortedSetAdd(
|
||||
'topics:votes',
|
||||
topicData.map(t => t.votes || 0),
|
||||
topicData.map(t => t.tid)
|
||||
);
|
||||
|
||||
@@ -79,8 +79,10 @@ async function getRoomMessages(uid, roomId) {
|
||||
let data = [];
|
||||
await batch.processSortedSet(`uid:${uid}:chat:room:${roomId}:mids`, async (mids) => {
|
||||
const messageData = await db.getObjects(mids.map(mid => `message:${mid}`));
|
||||
data = data.concat(messageData.filter(m => m && m.fromuid === uid && !m.system)
|
||||
.map(m => ({ content: m.content, timestamp: m.timestamp }))
|
||||
data = data.concat(
|
||||
messageData
|
||||
.filter(m => m && m.fromuid === uid && !m.system)
|
||||
.map(m => ({ content: m.content, timestamp: m.timestamp }))
|
||||
);
|
||||
}, { batch: 500, interval: 1000 });
|
||||
return data;
|
||||
|
||||
Reference in New Issue
Block a user