chore: eslint function-paren-newline

This commit is contained in:
Peter Jaszkowiak
2021-02-04 00:12:32 -07:00
committed by Julian Lam
parent dab3b23575
commit 62869bae3d
12 changed files with 49 additions and 32 deletions

View File

@@ -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 }
);

View File

@@ -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) {

View File

@@ -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];
};

View File

@@ -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`,

View File

@@ -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)
);

View File

@@ -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)
);

View File

@@ -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)
);

View File

@@ -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;