mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 03:26:04 +01:00
chore: eslint function-paren-newline
This commit is contained in:
committed by
Julian Lam
parent
dab3b23575
commit
62869bae3d
@@ -57,8 +57,7 @@
|
||||
// "object-curly-newline": ["error", { "consistent": true, "multiline": true }],
|
||||
"object-curly-newline": "off",
|
||||
// require consistent linebreaks inline function parenthesis (arguments or params)
|
||||
// "function-paren-newline": ["error", "consistent"],
|
||||
"function-paren-newline": "off",
|
||||
"function-paren-newline": ["error", "consistent"],
|
||||
// only require const if all parts of destructuring can be const
|
||||
"prefer-const": ["error", { "destructuring": "all" }],
|
||||
// don't require destructuring when assigning
|
||||
|
||||
@@ -305,13 +305,15 @@ define('admin/manage/users', [
|
||||
|
||||
bootbox.confirm(confirmMsg, function (confirm) {
|
||||
if (confirm) {
|
||||
Promise.all(uids.map(uid => api.del(`/users/${uid}${path}`, {})
|
||||
.then(() => {
|
||||
Promise.all(
|
||||
uids.map(
|
||||
uid => api.del(`/users/${uid}${path}`, {}).then(() => {
|
||||
if (path !== '/content') {
|
||||
removeRow(uid);
|
||||
}
|
||||
})
|
||||
)).then(() => {
|
||||
)
|
||||
).then(() => {
|
||||
if (path !== '/content') {
|
||||
app.alertSuccess('[[admin/manage/users:alerts.delete-success]]');
|
||||
} else {
|
||||
|
||||
@@ -321,10 +321,11 @@ define('forum/topic/threadTools', [
|
||||
var icon = $('.topic-header [component="topic/pinned"]');
|
||||
icon.toggleClass('hidden', !data.pinned);
|
||||
if (data.pinned) {
|
||||
icon.translateAttr('title', data.pinExpiry && data.pinExpiryISO ?
|
||||
icon.translateAttr('title', (
|
||||
data.pinExpiry && data.pinExpiryISO ?
|
||||
'[[topic:pinned-with-expiry, ' + data.pinExpiryISO + ']]' :
|
||||
'[[topic:pinned]]'
|
||||
);
|
||||
));
|
||||
}
|
||||
ajaxify.data.pinned = data.pinned;
|
||||
|
||||
|
||||
@@ -12,10 +12,11 @@ define('api', () => {
|
||||
function doAjax(cb) {
|
||||
$.ajax(options)
|
||||
.done((res) => {
|
||||
cb(null,
|
||||
res && res.hasOwnProperty('status') && res.hasOwnProperty('response') ?
|
||||
res.response : (res || {})
|
||||
);
|
||||
cb(null, (
|
||||
res &&
|
||||
res.hasOwnProperty('status') &&
|
||||
res.hasOwnProperty('response') ? res.response : (res || {})
|
||||
));
|
||||
})
|
||||
.fail((ev) => {
|
||||
let errMessage;
|
||||
|
||||
@@ -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,7 +79,9 @@ 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)
|
||||
data = data.concat(
|
||||
messageData
|
||||
.filter(m => m && m.fromuid === uid && !m.system)
|
||||
.map(m => ({ content: m.content, timestamp: m.timestamp }))
|
||||
);
|
||||
}, { batch: 500, interval: 1000 });
|
||||
|
||||
Reference in New Issue
Block a user