diff --git a/.nsprc b/.nsprc index 071431eff..583560bdd 100644 --- a/.nsprc +++ b/.nsprc @@ -1,5 +1,6 @@ { "exceptions": [ - "https://nodesecurity.io/advisories/531" + "https://nodesecurity.io/advisories/531", + "https://nodesecurity.io/advisories/532" ] -} \ No newline at end of file +} diff --git a/bin/cli-users b/bin/cli-users index cad663260..4cb2ac496 100755 --- a/bin/cli-users +++ b/bin/cli-users @@ -8,10 +8,13 @@ const program = require('./commander'); const inquirer = require('inquirer'); const UsersService = require('../services/users'); const UserModel = require('../models/user'); +const CommentModel = require('../models/comment'); +const ActionModel = require('../models/action'); const USER_ROLES = require('../models/enum/user_roles'); const mongoose = require('../services/mongoose'); const util = require('./util'); const Table = require('cli-table'); +const databaseVerifications = require('./verifications/database'); const validateRequired = (msg = 'Field is required', len = 1) => (input) => { if (input && input.length >= len) { @@ -113,26 +116,48 @@ async function createUser(options) { util.shutdown(); } catch (err) { console.error(err); - util.shutdown(); + util.shutdown(1); } } /** * Deletes a user. */ -function deleteUser(userID) { - UserModel - .findOneAndRemove({ - id: userID - }) - .then(() => { - console.log('Deleted user'); - util.shutdown(); - }) - .catch((err) => { - console.error(err); - util.shutdown(); - }); +async function deleteUser(userID) { + + try { + + // Find the user we're removing. + const user = await UserModel.findOne({id: userID}); + if (!user) { + throw new Error(`user with id ${userID} not found`); + } + + // Remove all the user's actions. + await ActionModel + .where({user_id: user.id}) + .setOptions({multi: true}) + .remove(); + + // Remove all the user's comments. + await CommentModel + .where({author_id: user.id}) + .setOptions({multi: true}) + .remove(); + + // Update the counts that might have changed. + for (const verification of databaseVerifications) { + await verification({fix: true, limit: Infinity, batch: 1000}); + } + + // Remove the user. + await user.remove(); + + util.shutdown(); + } catch (err) { + console.error(err); + util.shutdown(1); + } } /** diff --git a/client/coral-admin/src/components/ui/Header.js b/client/coral-admin/src/components/ui/Header.js index bd7fbcf0c..e199d5ded 100644 --- a/client/coral-admin/src/components/ui/Header.js +++ b/client/coral-admin/src/components/ui/Header.js @@ -87,7 +87,7 @@ const CoralHeader = ({ - + Report a bug or give feedback diff --git a/client/coral-admin/src/routes/Configure/components/StreamSettings.css b/client/coral-admin/src/routes/Configure/components/StreamSettings.css index 5ddd46bd2..628192de6 100644 --- a/client/coral-admin/src/routes/Configure/components/StreamSettings.css +++ b/client/coral-admin/src/routes/Configure/components/StreamSettings.css @@ -53,3 +53,6 @@ +.autoCloseWrapper { + display: flex; +} diff --git a/client/coral-admin/src/routes/Configure/components/StreamSettings.js b/client/coral-admin/src/routes/Configure/components/StreamSettings.js index 9c05711cb..ffaeed63b 100644 --- a/client/coral-admin/src/routes/Configure/components/StreamSettings.js +++ b/client/coral-admin/src/routes/Configure/components/StreamSettings.js @@ -180,22 +180,24 @@ class StreamSettings extends React.Component { onCheckbox={this.updateAutoClose} title={t('configure.close_after')} > - -
- - - - - +
+ +
+ + + + + +
{/* the above card should be the last one if at all possible because of z-index issues with the selects */} diff --git a/client/coral-admin/src/routes/Stories/components/Stories.js b/client/coral-admin/src/routes/Stories/components/Stories.js index 866defde4..933237ab9 100644 --- a/client/coral-admin/src/routes/Stories/components/Stories.js +++ b/client/coral-admin/src/routes/Stories/components/Stories.js @@ -48,7 +48,7 @@ class Stories extends Component {
{t('streams.filter_streams')}
{t('streams.stream_status')}
{t('streams.sort_by')}
+
+ +
- {highlightedComment && - } - {open ?