mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 11:35:55 +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": ["error", { "consistent": true, "multiline": true }],
|
||||||
"object-curly-newline": "off",
|
"object-curly-newline": "off",
|
||||||
// require consistent linebreaks inline function parenthesis (arguments or params)
|
// require consistent linebreaks inline function parenthesis (arguments or params)
|
||||||
// "function-paren-newline": ["error", "consistent"],
|
"function-paren-newline": ["error", "consistent"],
|
||||||
"function-paren-newline": "off",
|
|
||||||
// only require const if all parts of destructuring can be const
|
// only require const if all parts of destructuring can be const
|
||||||
"prefer-const": ["error", { "destructuring": "all" }],
|
"prefer-const": ["error", { "destructuring": "all" }],
|
||||||
// don't require destructuring when assigning
|
// don't require destructuring when assigning
|
||||||
|
|||||||
@@ -305,13 +305,15 @@ define('admin/manage/users', [
|
|||||||
|
|
||||||
bootbox.confirm(confirmMsg, function (confirm) {
|
bootbox.confirm(confirmMsg, function (confirm) {
|
||||||
if (confirm) {
|
if (confirm) {
|
||||||
Promise.all(uids.map(uid => api.del(`/users/${uid}${path}`, {})
|
Promise.all(
|
||||||
.then(() => {
|
uids.map(
|
||||||
|
uid => api.del(`/users/${uid}${path}`, {}).then(() => {
|
||||||
if (path !== '/content') {
|
if (path !== '/content') {
|
||||||
removeRow(uid);
|
removeRow(uid);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
)).then(() => {
|
)
|
||||||
|
).then(() => {
|
||||||
if (path !== '/content') {
|
if (path !== '/content') {
|
||||||
app.alertSuccess('[[admin/manage/users:alerts.delete-success]]');
|
app.alertSuccess('[[admin/manage/users:alerts.delete-success]]');
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -321,10 +321,11 @@ define('forum/topic/threadTools', [
|
|||||||
var icon = $('.topic-header [component="topic/pinned"]');
|
var icon = $('.topic-header [component="topic/pinned"]');
|
||||||
icon.toggleClass('hidden', !data.pinned);
|
icon.toggleClass('hidden', !data.pinned);
|
||||||
if (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-with-expiry, ' + data.pinExpiryISO + ']]' :
|
||||||
'[[topic:pinned]]'
|
'[[topic:pinned]]'
|
||||||
);
|
));
|
||||||
}
|
}
|
||||||
ajaxify.data.pinned = data.pinned;
|
ajaxify.data.pinned = data.pinned;
|
||||||
|
|
||||||
|
|||||||
@@ -12,10 +12,11 @@ define('api', () => {
|
|||||||
function doAjax(cb) {
|
function doAjax(cb) {
|
||||||
$.ajax(options)
|
$.ajax(options)
|
||||||
.done((res) => {
|
.done((res) => {
|
||||||
cb(null,
|
cb(null, (
|
||||||
res && res.hasOwnProperty('status') && res.hasOwnProperty('response') ?
|
res &&
|
||||||
res.response : (res || {})
|
res.hasOwnProperty('status') &&
|
||||||
);
|
res.hasOwnProperty('response') ? res.response : (res || {})
|
||||||
|
));
|
||||||
})
|
})
|
||||||
.fail((ev) => {
|
.fail((ev) => {
|
||||||
let errMessage;
|
let errMessage;
|
||||||
|
|||||||
@@ -137,7 +137,8 @@ async function deleteOrRestore(caller, data, params) {
|
|||||||
async function deleteOrRestoreTopicOf(command, pid, caller) {
|
async function deleteOrRestoreTopicOf(command, pid, caller) {
|
||||||
const topic = await posts.getTopicFields(pid, ['tid', 'cid', 'deleted']);
|
const topic = await posts.getTopicFields(pid, ['tid', 'cid', 'deleted']);
|
||||||
// command: delete/restore
|
// command: delete/restore
|
||||||
await apiHelpers.doTopicAction(command,
|
await apiHelpers.doTopicAction(
|
||||||
|
command,
|
||||||
topic.deleted ? 'event:topic_restored' : 'event:topic_deleted',
|
topic.deleted ? 'event:topic_restored' : 'event:topic_deleted',
|
||||||
caller,
|
caller,
|
||||||
{ tids: [topic.tid], cid: topic.cid }
|
{ tids: [topic.tid], cid: topic.cid }
|
||||||
@@ -178,7 +179,9 @@ postsAPI.purge = async function (caller, data) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (isMainAndLast) {
|
if (isMainAndLast) {
|
||||||
await apiHelpers.doTopicAction('purge', 'event:topic_purged',
|
await apiHelpers.doTopicAction(
|
||||||
|
'purge',
|
||||||
|
'event:topic_purged',
|
||||||
caller,
|
caller,
|
||||||
{ tids: [postData.tid], cid: topicData.cid }
|
{ tids: [postData.tid], cid: topicData.cid }
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -59,12 +59,13 @@ groupsController.get = async function (req, res, next) {
|
|||||||
|
|
||||||
async function getGroupNames() {
|
async function getGroupNames() {
|
||||||
const groupNames = await db.getSortedSetRange('groups:createtime', 0, -1);
|
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 !== 'verified-users' &&
|
||||||
name !== 'unverified-users' &&
|
name !== 'unverified-users' &&
|
||||||
name !== groups.BANNED_USERS &&
|
name !== groups.BANNED_USERS &&
|
||||||
!groups.isPrivilegeGroup(name)
|
!groups.isPrivilegeGroup(name)
|
||||||
);
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
groupsController.getCSV = async function (req, res) {
|
groupsController.getCSV = async function (req, res) {
|
||||||
|
|||||||
@@ -368,8 +368,8 @@ postgresModule.info = async function (db) {
|
|||||||
const res = await db.query(`
|
const res = await db.query(`
|
||||||
SELECT true "postgres",
|
SELECT true "postgres",
|
||||||
current_setting('server_version') "version",
|
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];
|
return res.rows[0];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,8 @@ module.exports = function (Groups) {
|
|||||||
}
|
}
|
||||||
const keys = [];
|
const keys = [];
|
||||||
groupNames.forEach((groupName) => {
|
groupNames.forEach((groupName) => {
|
||||||
keys.push(`group:${groupName}`,
|
keys.push(
|
||||||
|
`group:${groupName}`,
|
||||||
`group:${groupName}:members`,
|
`group:${groupName}:members`,
|
||||||
`group:${groupName}:pending`,
|
`group:${groupName}:pending`,
|
||||||
`group:${groupName}:invited`,
|
`group:${groupName}:invited`,
|
||||||
|
|||||||
@@ -55,7 +55,8 @@ module.exports = function (Groups) {
|
|||||||
const visibleGroups = groupData.filter(groupData => groupData && !groupData.hidden);
|
const visibleGroups = groupData.filter(groupData => groupData && !groupData.hidden);
|
||||||
|
|
||||||
if (visibleGroups.length) {
|
if (visibleGroups.length) {
|
||||||
await db.sortedSetAdd('groups:visible:memberCount',
|
await db.sortedSetAdd(
|
||||||
|
'groups:visible:memberCount',
|
||||||
visibleGroups.map(groupData => groupData.memberCount),
|
visibleGroups.map(groupData => groupData.memberCount),
|
||||||
visibleGroups.map(groupData => groupData.name)
|
visibleGroups.map(groupData => groupData.name)
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -43,7 +43,9 @@ module.exports = function (Groups) {
|
|||||||
promises.push(Groups.destroy, emptyPrivilegeGroups);
|
promises.push(Groups.destroy, emptyPrivilegeGroups);
|
||||||
}
|
}
|
||||||
if (visibleGroups.length) {
|
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.memberCount),
|
||||||
visibleGroups.map(groupData => groupData.name)
|
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.lastposttime || 0),
|
||||||
topicData.map(t => t.tid)
|
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.viewcount || 0),
|
||||||
topicData.map(t => t.tid)
|
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.postcount || 0),
|
||||||
topicData.map(t => t.tid)
|
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.votes || 0),
|
||||||
topicData.map(t => t.tid)
|
topicData.map(t => t.tid)
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -79,7 +79,9 @@ async function getRoomMessages(uid, roomId) {
|
|||||||
let data = [];
|
let data = [];
|
||||||
await batch.processSortedSet(`uid:${uid}:chat:room:${roomId}:mids`, async (mids) => {
|
await batch.processSortedSet(`uid:${uid}:chat:room:${roomId}:mids`, async (mids) => {
|
||||||
const messageData = await db.getObjects(mids.map(mid => `message:${mid}`));
|
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 }))
|
.map(m => ({ content: m.content, timestamp: m.timestamp }))
|
||||||
);
|
);
|
||||||
}, { batch: 500, interval: 1000 });
|
}, { batch: 500, interval: 1000 });
|
||||||
|
|||||||
Reference in New Issue
Block a user