From 24f3bd99c2801016c782e553251a575e137067ff Mon Sep 17 00:00:00 2001
From: Mikael Korpela
Date: Sat, 4 Jan 2020 18:50:33 +0200
Subject: [PATCH 1/2] Eslint: add comma-dangle always multi-line rule
---
.eslintrc.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.eslintrc.js b/.eslintrc.js
index 19367eb94b..496751dd5e 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -4,7 +4,7 @@ const semver = require('semver');
const reactVersion = semver.coerce(require('./package.json').dependencies.react).version;
const defaultRules = {
- 'comma-dangle': [2, 'never'],
+ 'comma-dangle': [2, 'always-multiline'],
'comma-spacing': [2, { before: false, after: true }],
curly: [2, 'multi-line'],
eqeqeq: [2, 'smart'],
From e1f4e508ca06fb377cb68daa83df3049c1e0564f Mon Sep 17 00:00:00 2001
From: Mikael Korpela
Date: Sat, 4 Jan 2020 18:51:59 +0200
Subject: [PATCH 2/2] Apply Eslint `comma-dangle` fix
Generated by running `npm run lint -- --fix`
---
babel.config.js | 8 +-
.../archive-done-agenda-jobs.js | 4 +-
bin/fillTestData/Messages.js | 4 +-
bin/fillTestData/Tribes.js | 4 +-
bin/fillTestData/Users.js | 2 +-
bin/install-deps.js | 4 +-
config/assets/default.js | 14 +-
config/assets/development.js | 8 +-
config/assets/production.js | 10 +-
config/assets/test.js | 8 +-
config/client/i18n.js | 12 +-
config/config.js | 10 +-
config/env/default.js | 56 ++--
config/env/development.js | 16 +-
config/env/local.docker.js | 10 +-
config/env/production.js | 8 +-
config/env/test.js | 22 +-
config/languages/generate.js | 2 +-
config/lib/agenda.js | 4 +-
config/lib/exponent-notifications.js | 6 +-
config/lib/express.js | 56 ++--
config/lib/firebase-messaging.js | 2 +-
config/lib/mongoose.js | 24 +-
config/lib/render.js | 2 +-
config/lib/worker.js | 48 ++--
.../entries/pushMessagingServiceWorker.js | 2 +-
config/webpack/webpack.config.js | 62 ++---
.../webpack.push-messaging-sw.config.js | 16 +-
config/webpack/webpack.shims.js | 20 +-
gulpfile.js | 44 +--
jest.config.js | 6 +-
karma.conf.js | 12 +-
.../1420751949-add-user-avatarUploaded.js | 4 +-
.../1429124257492-add-user-displayUsername.js | 2 +-
.../1479386133911-refactor-contacts.js | 16 +-
.../1479386133912-refactor-messages.js | 12 +-
.../archived/1526109429319-tags-to-tribes.js | 8 +-
.../AdminAcquisitionStories.component.js | 2 +-
.../components/AdminAuditLog.component.js | 2 +-
.../components/AdminMessages.component.js | 4 +-
.../components/AdminSearchUsers.component.js | 4 +-
.../client/components/AdminUser.component.js | 2 +-
.../admin/client/components/Json.component.js | 2 +-
.../UserEmailConfirmLink.component.js | 2 +-
.../client/components/UserLink.component.js | 2 +-
.../client/components/UserState.component.js | 6 +-
.../ZendeskInboxSearch.component.js | 2 +-
.../client/config/admin.client.routes.js | 24 +-
...n.acquisition-stories.server.controller.js | 4 +-
.../admin.audit-log.server.controller.js | 6 +-
.../admin.messages.server.controller.js | 10 +-
.../admin.users.server.controller.js | 44 +--
.../server/models/audit-log.server.model.js | 6 +-
.../server/policies/admin.server.policy.js | 8 +-
.../admin.messages.server.routes.tests.js | 14 +-
.../server/admin.users.server.routes.tests.js | 8 +-
modules/contacts/client/components/Contact.js | 4 +-
.../components/ContactList.component.js | 4 +-
.../components/ContactListPresentational.js | 6 +-
.../components/ContactPresentational.js | 2 +-
.../components/ContactsCommon.component.js | 6 +-
.../client/components/RemoveContact.js | 2 +-
.../components/RemoveContactContainer.js | 2 +-
.../client/config/contacts.client.routes.js | 14 +-
.../add-contact.client.controller.js | 4 +-
.../confirm-contact.client.controller.js | 2 +-
.../remove-contact.client.controller.js | 2 +-
.../tr-contact-remove.client.directive.js | 6 +-
.../directives/tr-contact.client.directive.js | 4 +-
.../services/contact-by.client.service.js | 6 +-
.../client/services/contact.client.service.js | 10 +-
.../services/contacts-list.client.service.js | 2 +-
.../controllers/contacts.server.controller.js | 84 +++---
.../server/models/contacts.server.model.js | 10 +-
.../server/policies/contacts.server.policy.js | 30 +--
.../add-contact.client.controller.tests.js | 8 +-
.../remove-contact.client.controller.tests.js | 6 +-
.../server/contact.server.model.tests.js | 6 +-
.../server/contact.server.routes.tests.js | 20 +-
modules/core/client/app/config.js | 4 +-
modules/core/client/app/init.js | 10 +-
.../components/LanguageSwitch.component.js | 2 +-
.../components/LanguageSwitchContainer.js | 4 +-
.../LanguageSwitchPresentational.js | 2 +-
.../core/client/config/core.client.config.js | 2 +-
.../core/client/config/core.client.routes.js | 4 +-
.../controllers/app.client.controller.js | 28 +-
.../message-center.client.directive.js | 2 +-
.../tr-board-credits.client.directive.js | 2 +-
.../directives/tr-boards.client.directive.js | 6 +-
.../tr-date-select.client.directive.js | 10 +-
.../directives/tr-editor.client.directive.js | 4 +-
.../tr-flashcards.client.directive.js | 12 +-
.../tr-focustip.client.directive.js | 4 +-
.../tr-highlight-on-focus.client.directive.js | 2 +-
.../tr-languages.client.directive.js | 6 +-
.../tr-location.client.directive.js | 4 +-
.../tr-page-title.client.directive.js | 2 +-
.../tr-placeholder.client.directive.js | 2 +-
.../tr-share-fb.client.directive.js | 2 +-
.../tr-share-twitter.client.directive.js | 2 +-
.../directives/tr-spinner.client.directive.js | 2 +-
.../directives/tr-switch.client.directive.js | 2 +-
.../directives/tr-time.client.directive.js | 4 +-
.../tr-window-blur.client.directive.js | 2 +-
.../tr-window-focus.client.directive.js | 2 +-
.../services/facebook.client.service.js | 6 +-
.../firebase-messaging.client.service.js | 6 +-
.../services/languages.client.service.js | 2 +-
.../services/location.client.service.js | 16 +-
.../services/maplayers.client.service.js | 26 +-
.../services/mapmarkers.client.service.js | 10 +-
.../services/message-center-client.service.js | 8 +-
.../native-app-bridge.client.service.js | 8 +-
.../core/client/services/photos.service.js | 44 +--
.../client/services/push.client.service.js | 10 +-
.../services/settings.client.service.js | 6 +-
.../analytics.server.controller.js | 2 +-
.../controllers/core.server.controller.js | 8 +-
.../core/server/jobs/send-email.server.job.js | 4 +-
.../send-facebook-notification.server.job.js | 8 +-
.../jobs/send-push-message.server.job.js | 20 +-
.../server/services/email.server.service.js | 78 +++---
.../server/services/error.server.service.js | 6 +-
.../facebook-notification.server.service.js | 4 +-
.../server/services/file-upload.service.js | 10 +-
.../server/services/push.server.service.js | 14 +-
.../server/services/text.server.service.js | 18 +-
.../client/app.client.controller.tests.js | 8 +-
.../tests/client/push.client.service.tests.js | 28 +-
.../tests/server/core.server.config.tests.js | 6 +-
.../tests/server/core.server.routes.tests.js | 4 +-
.../jobs/send-email.server.job.tests.js | 8 +-
.../send-push-message.server.job.tests.js | 72 ++---
.../services/email.server.service.tests.js | 46 ++--
...ebook-notification.server.service.tests.js | 76 +++---
.../services/push.server.service.tests.js | 36 +--
.../services/text.server.service.tests.js | 14 +-
modules/core/tests/server/worker.tests.js | 18 +-
.../client/config/messages.client.routes.js | 10 +-
.../controllers/inbox.client.controller.js | 2 +-
.../controllers/thread.client.controller.js | 14 +-
.../thread-dimensions.client.directive.js | 6 +-
.../directives/threads.client.directive.js | 2 +-
.../unread-count.client.directive.js | 2 +-
.../messages-count-poll.client.service.js | 2 +-
.../services/messages-read.client.service.js | 6 +-
.../services/messages.client.service.js | 8 +-
.../controllers/messages.server.controller.js | 132 ++++-----
.../server/jobs/message-unread.server.job.js | 28 +-
.../models/message-stat.server.model.js | 16 +-
.../server/models/message.server.model.js | 14 +-
.../server/models/thread.server.model.js | 12 +-
.../server/policies/messages.server.policy.js | 30 +--
.../services/message-stat.server.service.js | 40 +--
.../message-to-stats.server.service.js | 22 +-
.../jobs/message-unread.server.job.tests.js | 12 +-
...e-stat-integration.server.service.tests.js | 10 +-
.../server/message-stat.server.model.tests.js | 10 +-
.../message-stat.server.routes.tests.js | 6 +-
.../message-stat.server.service.tests.js | 84 +++---
...-stats-integration.server.service.tests.js | 12 +-
.../message-to-stats.server.service.tests.js | 14 +-
.../server/message.server.model.tests.js | 6 +-
.../server/message.server.routes.tests.js | 32 +--
.../components/OfferLocation.component.js | 4 +-
.../components/OfferLocationPresentational.js | 4 +-
.../client/config/offers.client.routes.js | 36 +--
.../offer-host-edit.client.controller.js | 4 +-
.../offer-host-view.client.controller.js | 2 +-
.../offer-meet-add.client.controller.js | 4 +-
.../offer-meet-edit.client.controller.js | 2 +-
.../offer-meet-list.client.controller.js | 4 +-
.../controllers/offer.client.controller.js | 10 +-
.../tr-offer-host-view.client.directive.js | 6 +-
.../tr-offer-valid-until.client.directive.js | 8 +-
.../services/offers-by.client.service.js | 6 +-
.../client/services/offers.client.service.js | 14 +-
.../controllers/offers.server.controller.js | 138 +++++-----
.../jobs/reactivate-hosts.server.job.js | 14 +-
.../server/models/offer.server.model.js | 26 +-
.../server/policies/offers.server.policy.js | 22 +-
.../jobs/reactivate-hosts.server.job.tests.js | 6 +-
.../offer-search.server.routes.tests.js | 68 ++---
.../tests/server/offer.server.model.tests.js | 6 +-
.../tests/server/offer.server.routes.tests.js | 62 ++---
.../client/config/pages.client.routes.js | 68 ++---
.../controllers/home.client.controller.js | 8 +-
.../reference-thread.client.directive.js | 10 +-
.../reference-thread.client.service.js | 6 +-
.../reference-thread.server.controller.js | 46 ++--
.../models/reference-thread.server.model.js | 12 +-
.../reference-thread.server.policy.js | 18 +-
.../reference-thread.server.model.tests.js | 10 +-
.../reference-thread.server.routes.tests.js | 18 +-
.../references/client/api/references.api.js | 2 +-
.../components/CreateReference.component.js | 12 +-
.../components/create-reference/Info.js | 6 +-
.../create-reference/Interaction.js | 2 +-
.../components/create-reference/Navigation.js | 2 +-
.../components/create-reference/Recommend.js | 4 +-
.../components/create-reference/Report.js | 2 +-
.../reference.server.controller.js | 28 +-
.../jobs/references-publish.server.job.js | 2 +-
.../server/models/reference.server.model.js | 20 +-
.../policies/references.server.policy.js | 8 +-
.../CreateReference.client.component.test.js | 18 +-
.../Navigation.client.component.test.js | 10 +-
.../reference-create.server.routes.tests.js | 148 +++++-----
...reference-read-many.server.routes.tests.js | 14 +-
.../reference-read-one.server.routes.tests.js | 22 +-
.../server/reference.server.jobs.tests.js | 4 +-
.../server/reference.server.model.tests.js | 28 +-
.../components/SearchUsers.component.js | 4 +-
modules/search/client/components/UsersList.js | 6 +-
.../client/config/search.client.routes.js | 30 +--
.../search-map.client.controller.js | 46 ++--
.../search-signup.client.controller.js | 8 +-
.../controllers/search.client.controller.js | 2 +-
.../tr-my-tribes-toggle.client.directive.js | 4 +-
.../tr-tribes-toggle.client.directive.js | 4 +-
.../tr-types-toggle.client.directive.js | 10 +-
.../client/services/filters.client.service.js | 8 +-
.../services/search-map.client.service.js | 4 +-
.../sparkpost-webhooks.server.controller.js | 18 +-
...rkpost-webhooks.server.controller.tests.js | 14 +-
.../server/sparkpost.server.routes.tests.js | 8 +-
.../client/config/statistics.client.routes.js | 6 +-
.../statistics.client.controller.js | 2 +-
.../statistics.server.controller.js | 46 ++--
.../jobs/daily-statistics.server.job.js | 40 +--
.../jobs/daily-statistics.server.job.tests.js | 12 +-
.../server/statistics.server.routes.tests.js | 30 +--
.../server/services/influx.server.service.js | 12 +-
.../server/services/stats.server.service.js | 10 +-
.../services/influx.server.service.tests.js | 22 +-
.../services/stathat.server.service.tests.js | 30 +--
.../services/stats.server.service.tests.js | 12 +-
.../stats-api-integration.server.tests.js | 62 ++---
.../components/ReportMemberLink.component.js | 2 +-
.../client/config/support.client.routes.js | 8 +-
.../controllers/support.client.controller.js | 2 +-
.../controllers/support.server.controller.js | 20 +-
.../server/models/support.server.model.js | 16 +-
.../tests/server/model.server.model.tests.js | 6 +-
.../server/support.server.routes.tests.js | 8 +-
.../client/config/tribes.client.config.js | 16 +-
.../tr-tribe-badge.client.directive.js | 4 +-
.../tr-tribe-join-button.client.directive.js | 18 +-
.../tr-tribe-styles.client.directive.js | 4 +-
.../tr-tribes-in-common.client.directive.js | 4 +-
.../client/services/tribe.client.service.js | 10 +-
.../client/services/tribes.client.service.js | 6 +-
.../controllers/tribes.server.controller.js | 22 +-
.../server/models/tribe.server.model.js | 36 +--
.../server/policies/tribes.server.policy.js | 22 +-
.../tests/server/tribes.server.model.tests.js | 6 +-
.../tests/server/tribes.server.routes.test.js | 8 +-
.../client/components/AboutMe.component.js | 6 +-
.../client/components/Avatar.component.js | 2 +-
.../components/AvatarNameMobile.component.js | 2 +-
.../BottomNavigationSmall.component.js | 12 +-
.../InterfaceLanguagePanel.component.js | 2 +-
.../components/ProfileOverview.component.js | 2 +-
.../client/components/ProfileViewBasics.js | 6 +-
.../client/config/users.client.config.js | 4 +-
.../client/config/users.client.routes.js | 124 ++++-----
.../authentication.client.controller.js | 6 +-
.../avatar-editor.client.controller.js | 6 +-
.../confirm-email.client.controller.js | 2 +-
.../password-forgot.client.controller.js | 4 +-
.../password-reset.client.controller.js | 2 +-
.../profile-edit-account.client.controller.js | 6 +-
...profile-edit-networks.client.controller.js | 2 +-
.../profile-edit-photo.client.controller.js | 6 +-
.../profile-edit.client.controller.js | 2 +-
.../controllers/remove.client.controller.js | 2 +-
.../controllers/signup.client.controller.js | 28 +-
.../directives/tr-avatar.client.directive.js | 6 +-
.../tr-confirm-password.client.directive.js | 4 +-
.../tr-memberships-list.client.directive.js | 4 +-
.../tr-monkeybox.client.directive.js | 4 +-
.../tr-validate-username.client.directive.js | 2 +-
.../services/authentication.client.service.js | 2 +-
.../services/invitation.client.service.js | 8 +-
.../signup-validation.client.service.js | 4 +-
.../users-memberships.client.service.js | 10 +-
.../services/users-mini.client.service.js | 6 +-
.../services/users-profile.client.service.js | 6 +-
.../client/services/users.client.service.js | 16 +-
.../server/config/strategies/facebook.js | 8 +-
.../users/server/config/strategies/github.js | 4 +-
.../users/server/config/strategies/local.js | 8 +-
.../users/server/config/strategies/twitter.js | 4 +-
.../server/config/users.config.server.js | 2 +-
.../users.authentication.server.controller.js | 98 +++----
.../users.password.server.controller.js | 60 ++---
.../users.profile.server.controller.js | 252 +++++++++---------
.../users.suspended.server.controller.js | 6 +-
.../jobs/user-finish-signup.server.job.js | 30 +--
.../user-welcome-sequence-first.server.job.js | 18 +-
...user-welcome-sequence-second.server.job.js | 18 +-
.../user-welcome-sequence-third.server.job.js | 18 +-
.../users/server/models/user.server.model.js | 108 ++++----
.../server/policies/users.server.policy.js | 70 ++---
.../users/server/routes/auth.server.routes.js | 8 +-
.../authentication.client.controller.tests.js | 16 +-
...password-forgot.client.controller.tests.js | 14 +-
.../password-reset.client.controller.tests.js | 14 +-
...le-edit-account.client.controller.tests.js | 18 +-
.../user-finish-signup.server.job.tests.js | 6 +-
...welcome-sequence-first.server.job.tests.js | 4 +-
...elcome-sequence-second.server.job.tests.js | 4 +-
...welcome-sequence-third.server.job.tests.js | 4 +-
.../search-users.server.routes.tests.js | 40 +--
.../server/user-invite.server.routes.tests.js | 4 +-
.../server/user-lastseen.server.tests.js | 2 +-
.../user-password.server.routes.tests.js | 30 +--
.../user-profile.server.routes.tests.js | 22 +-
.../user-removal.server.routes.tests.js | 36 +--
...ser-signup-validate.server.routes.tests.js | 22 +-
.../server/user-signup.server.routes.tests.js | 10 +-
.../server/user-tribe.server.routes.tests.js | 12 +-
.../tests/server/user.server.model.tests.js | 6 +-
testutils/server/data.server.testutil.js | 10 +-
testutils/server/server.testutil.js | 2 +-
worker.js | 4 +-
327 files changed, 2581 insertions(+), 2581 deletions(-)
diff --git a/babel.config.js b/babel.config.js
index 58cc97d8ee..ce6357bd44 100644
--- a/babel.config.js
+++ b/babel.config.js
@@ -7,15 +7,15 @@ module.exports = {
['@babel/preset-env', {
corejs: 2,
modules: 'commonjs',
- useBuiltIns: 'usage'
+ useBuiltIns: 'usage',
}],
- ['@babel/preset-react']
+ ['@babel/preset-react'],
],
plugins: compact([
'@babel/plugin-proposal-nullish-coalescing-operator',
'@babel/plugin-proposal-object-rest-spread',
'@babel/plugin-proposal-optional-chaining',
'angularjs-annotate',
- isDevelopment && 'react-refresh/babel'
- ])
+ isDevelopment && 'react-refresh/babel',
+ ]),
};
diff --git a/bin/db-maintenance/archive-done-agenda-jobs.js b/bin/db-maintenance/archive-done-agenda-jobs.js
index 4534a3ddf1..9393192ea0 100644
--- a/bin/db-maintenance/archive-done-agenda-jobs.js
+++ b/bin/db-maintenance/archive-done-agenda-jobs.js
@@ -173,7 +173,7 @@ async.waterfall([
process.stdout.clearLine();
process.stdout.cursorTo(0);
process.stdout.write(
- '~' + progressPercent + '% (' + progress + '/' + total + ')'
+ '~' + progressPercent + '% (' + progress + '/' + total + ')',
);
}
++progress;
@@ -239,7 +239,7 @@ async.waterfall([
countTotals(function () {
done(null, progress);
});
- }
+ },
], function (err, totalProcessed) {
if (err) {
diff --git a/bin/fillTestData/Messages.js b/bin/fillTestData/Messages.js
index 2d182267b6..4803475804 100644
--- a/bin/fillTestData/Messages.js
+++ b/bin/fillTestData/Messages.js
@@ -20,11 +20,11 @@ const argv = yargs.usage('$0 ',
return yargs
.positional('numberOfThreads', {
describe: 'Number of threads to add',
- type: 'number'
+ type: 'number',
})
.positional('maxMessages', {
describe: 'Maximum number of messages per thread to add',
- type: 'number'
+ type: 'number',
})
.boolean('debug')
.boolean('limit')
diff --git a/bin/fillTestData/Tribes.js b/bin/fillTestData/Tribes.js
index 178b131c92..e8b8262a78 100644
--- a/bin/fillTestData/Tribes.js
+++ b/bin/fillTestData/Tribes.js
@@ -17,7 +17,7 @@ const argv = yargs.usage('$0 ', 'Seed database with number of tr
return yargs
.positional('numberOfTribes', {
describe: 'Number of tribes to add',
- type: 'number'
+ type: 'number',
})
.boolean('debug')
.boolean('limit')
@@ -66,7 +66,7 @@ const tribeImageUUIDs = [
'0ce0abdf-6898-4191-9a86-4f03807291b5',
'0ebcabec-2bc5-4eee-ab17-991b9dd52eae',
'4f7805e7-b5e6-4b40-bb32-3aafbe1bbc74',
- '69a500a4-a16e-4c4d-9981-84fbe310d531'
+ '69a500a4-a16e-4c4d-9981-84fbe310d531',
];
/**
diff --git a/bin/fillTestData/Users.js b/bin/fillTestData/Users.js
index 1e9ea61f36..4aedac3240 100644
--- a/bin/fillTestData/Users.js
+++ b/bin/fillTestData/Users.js
@@ -22,7 +22,7 @@ const argv = yargs.usage('$0 ', 'Seed database with number of tri
return yargs
.positional('numberOfUsers', {
describe: 'Number of users to add',
- type: 'number'
+ type: 'number',
})
.array('userNames')
.boolean('debug')
diff --git a/bin/install-deps.js b/bin/install-deps.js
index 85cddaf609..7955093bd9 100644
--- a/bin/install-deps.js
+++ b/bin/install-deps.js
@@ -16,7 +16,7 @@ if (!fs.existsSync('node_modules')) {
console.log('No "node_modules" present, installing NPM dependencies...');
const installResult = spawnSync('npm', [ 'ci' ], {
shell: true,
- stdio: 'inherit'
+ stdio: 'inherit',
}).status;
if (installResult) {
process.exit(installResult);
@@ -45,7 +45,7 @@ if (!fs.existsSync('node_modules')) {
console.log('NPM dependencies out of date. Updating...');
const installResult = spawnSync('npm', [ 'ci' ], {
shell: true,
- stdio: 'inherit'
+ stdio: 'inherit',
}).status;
if (installResult) {
process.exit(installResult);
diff --git a/config/assets/default.js b/config/assets/default.js
index 600ea8deac..eada77f981 100644
--- a/config/assets/default.js
+++ b/config/assets/default.js
@@ -9,7 +9,7 @@ module.exports = {
'progressbar',
'tabs',
'tooltip',
- 'typeahead'
+ 'typeahead',
],
js: [
// Non minified versions
@@ -56,18 +56,18 @@ module.exports = {
'node_modules/angular-mailcheck/angular-mailcheck.js',
'node_modules/angular-locker/dist/angular-locker.js',
'node_modules/angular-confirm/angular-confirm.js',
- 'node_modules/angulargrid/angulargrid.js'
+ 'node_modules/angulargrid/angulargrid.js',
],
- tests: ['node_modules/angular-mocks/angular-mocks.js']
+ tests: ['node_modules/angular-mocks/angular-mocks.js'],
},
js: [
'modules/core/client/app/config.js',
'modules/core/client/app/init.js',
'modules/*/client/*.js',
'modules/*/client/controllers/*.js',
- 'modules/*/client/**/*.js'
+ 'modules/*/client/**/*.js',
],
- views: ['modules/*/client/views/**/*.html']
+ views: ['modules/*/client/views/**/*.html'],
},
server: {
fontelloConfig: 'modules/core/client/fonts/fontello/config.json',
@@ -79,6 +79,6 @@ module.exports = {
config: 'modules/*/server/config/*.js',
policies: 'modules/*/server/policies/*.js',
views: 'modules/*/server/views/*.html',
- migrations: 'migrations/*.js'
- }
+ migrations: 'migrations/*.js',
+ },
};
diff --git a/config/assets/development.js b/config/assets/development.js
index 6e1b4d89fc..df9e5af92e 100644
--- a/config/assets/development.js
+++ b/config/assets/development.js
@@ -8,11 +8,11 @@ module.exports = {
lib: {
uibModuleTemplates: defaultAssets.client.lib.uibModuleTemplates,
js: _.union(defaultAssets.client.lib.js, [
- 'node_modules/angulartics/src/angulartics-debug.js'
+ 'node_modules/angulartics/src/angulartics-debug.js',
]),
- tests: defaultAssets.client.lib.tests
+ tests: defaultAssets.client.lib.tests,
},
js: defaultAssets.client.js,
- views: defaultAssets.client.views
- }
+ views: defaultAssets.client.views,
+ },
};
diff --git a/config/assets/production.js b/config/assets/production.js
index 43f622ec68..ff8bcfeddd 100644
--- a/config/assets/production.js
+++ b/config/assets/production.js
@@ -8,14 +8,14 @@ module.exports = {
lib: {
uibModuleTemplates: defaultAssets.client.lib.uibModuleTemplates,
js: _.union(defaultAssets.client.lib.js, [
- 'node_modules/angulartics-google-analytics/lib/angulartics-ga.js'
+ 'node_modules/angulartics-google-analytics/lib/angulartics-ga.js',
]),
- tests: defaultAssets.client.lib.tests
+ tests: defaultAssets.client.lib.tests,
},
js: _.union(defaultAssets.client.js, [
'public/dist/uib-templates.js',
- 'public/dist/templates.js'
+ 'public/dist/templates.js',
]),
- views: defaultAssets.client.views
- }
+ views: defaultAssets.client.views,
+ },
};
diff --git a/config/assets/test.js b/config/assets/test.js
index 7d9cff6745..d37364c1a5 100644
--- a/config/assets/test.js
+++ b/config/assets/test.js
@@ -9,13 +9,13 @@ module.exports = {
uibModuleTemplates: defaultAssets.client.lib.uibModuleTemplates,
css: defaultAssets.client.lib.css,
js: _.union(defaultAssets.client.lib.js, [
- 'testutils/client/angulartics-null.testutil.js'
+ 'testutils/client/angulartics-null.testutil.js',
]),
less: defaultAssets.client.lib.less,
- tests: defaultAssets.client.lib.tests
+ tests: defaultAssets.client.lib.tests,
},
less: defaultAssets.client.less,
js: defaultAssets.client.js,
- views: defaultAssets.client.views
- }
+ views: defaultAssets.client.views,
+ },
};
diff --git a/config/client/i18n.js b/config/client/i18n.js
index eb6f631595..72c454e3e4 100644
--- a/config/client/i18n.js
+++ b/config/client/i18n.js
@@ -64,8 +64,8 @@ i18n
.init({
...(isTest ? {
resources: {
- en: {}
- }
+ en: {},
+ },
} : {}),
fallbackLng: 'en', // a default app locale
// allow keys to be phrases having `:`, `.`
@@ -74,16 +74,16 @@ i18n
// saveMissing: true, // @TODO send not translated keys to endpoint
interpolation: {
escapeValue: false, // react already safes from xss
- format
+ format,
},
detection: {
lookupCookie: 'i18n',
order: ['cookie'],
- caches: ['cookie']
+ caches: ['cookie'],
},
react: {
- useSuspense: false
- }
+ useSuspense: false,
+ },
// saveMissingPlurals: true,
// debug: true // show missing translation keys in console.log
});
diff --git a/config/config.js b/config/config.js
index 52278fb21d..d77d7956d2 100644
--- a/config/config.js
+++ b/config/config.js
@@ -76,7 +76,7 @@ const initGlobalConfigFolders = function (config) {
// Appending files
config.folders = {
server: {},
- client: {}
+ client: {},
};
// Setting globbed client paths
@@ -91,9 +91,9 @@ const initGlobalConfigFiles = function (config, assets) {
config.files = {
server: {},
client: {
- lib: {}
+ lib: {},
},
- webpack: {}
+ webpack: {},
};
// Setting Globbed model files
@@ -154,7 +154,7 @@ const initGlobalConfig = function () {
*/
let config = _.extend(
require(path.join(process.cwd(), 'config/env/default')),
- require(path.join(process.cwd(), 'config/env/', process.env.NODE_ENV)) || {}
+ require(path.join(process.cwd(), 'config/env/', process.env.NODE_ENV)) || {},
);
config = _.merge(config, (fs.existsSync('./config/env/local.js') && require('./env/local.js')) || {});
@@ -166,7 +166,7 @@ const initGlobalConfig = function () {
// Expose configuration utilities
config.utils = {
- getGlobbedPaths: getGlobbedPaths
+ getGlobbedPaths: getGlobbedPaths,
};
return config;
diff --git a/config/env/default.js b/config/env/default.js
index a41f762e5c..50bfbd3d58 100644
--- a/config/env/default.js
+++ b/config/env/default.js
@@ -13,11 +13,11 @@
module.exports = {
featureFlags: {
reference: false,
- i18n: false
+ i18n: false,
},
app: {
title: 'Trustroots',
- description: 'Travellers community for sharing, hosting and getting people together. We want a world that encourages trust and adventure.'
+ description: 'Travellers community for sharing, hosting and getting people together. We want a world that encourages trust and adventure.',
},
// Is site invitation only?
invitations: {
@@ -29,7 +29,7 @@ module.exports = {
maitreId: 'MF930c37aeb3',
// These codes are always valid
// ONLY lower case
- alwaysValidCodes: ['trustroots']
+ alwaysValidCodes: ['trustroots'],
},
// Appears on top of every page for authenticated users.
@@ -39,7 +39,7 @@ module.exports = {
enabled: false,
// Can contain HTML
// You can access user object like this: `{{app.user.displayName}}`
- message: ''
+ message: '',
},
maxUploadSize: 10 * 1024 * 1024, // 10MB. Remember to change this to Nginx configs as well
imageProcessor: 'graphicsmagick', // graphicsmagick|imagemagick
@@ -59,13 +59,13 @@ module.exports = {
illegalStrings: ['trustroots', 'trust', 'roots', 're', 're:', 'fwd', 'fwd:', 'reply', 'admin', 'administrator', 'password',
'username', 'unknown', 'anonymous', 'null', 'undefined', 'home', 'signup', 'signin', 'login', 'user',
'edit', 'settings', 'username', 'user', 'demo', 'test', 'support', 'networks', 'profile', 'avatar', 'mini',
- 'photo', 'account', 'api', 'modify', 'feedback', 'security', 'accounts', 'tribe', 'tag', 'community', 'remove'
+ 'photo', 'account', 'api', 'modify', 'feedback', 'security', 'accounts', 'tribe', 'tag', 'community', 'remove',
],
// SparkPost webhook API endpoint configuration (`/api/sparkpost/webhook`)
sparkpostWebhook: {
enabled: true,
username: 'sparkpost',
- password: 'sparkpost'
+ password: 'sparkpost',
},
influxdb: {
enabled: false,
@@ -75,14 +75,14 @@ module.exports = {
protocol: 'http', // default 'http'
// username: '',
// password: '',
- database: 'trustroots'
- }
+ database: 'trustroots',
+ },
},
// Configuration of stathat.
// www.stathat.com is a tool/service for tracking statistics
stathat: {
enabled: false,
- key: ''
+ key: '',
},
limits: {
// Messages shorter than this will be tagged 'short' in influxdb,
@@ -110,10 +110,10 @@ module.exports = {
welcomeSequence: {
first: { minutes: 0 },
second: { hours: 24 },
- third: { days: 14 }
+ third: { days: 14 },
},
// Up to how many days in future can meet offers be visible
- maxOfferValidFromNow: { days: 30 }
+ maxOfferValidFromNow: { days: 30 },
},
mailer: {
from: 'trustroots@localhost',
@@ -121,9 +121,9 @@ module.exports = {
service: false,
auth: {
user: false,
- pass: false
- }
- }
+ pass: false,
+ },
+ },
},
// Mapbox is publicly exposed to the frontend
mapbox: {
@@ -131,21 +131,21 @@ module.exports = {
streets: {
map: 'streets-v9',
user: 'mapbox',
- legacy: false
+ legacy: false,
},
satellite: {
map: 'satellite-streets-v9',
user: 'mapbox',
- legacy: false
+ legacy: false,
},
outdoors: {
map: 'outdoors-v9',
user: 'mapbox',
- legacy: false
- }
+ legacy: false,
+ },
},
user: '',
- publicKey: ''
+ publicKey: '',
},
facebook: {
page: '',
@@ -153,29 +153,29 @@ module.exports = {
clientSecret: false,
clientAccessToken: false,
callbackURL: '/api/auth/facebook/callback',
- notificationsEnabled: false
+ notificationsEnabled: false,
},
twitter: {
username: '',
clientID: '',
clientSecret: '',
- callbackURL: '/api/auth/twitter/callback'
+ callbackURL: '/api/auth/twitter/callback',
},
google: {
- page: ''
+ page: '',
},
fcm: {
senderId: '',
- serviceAccount: false
+ serviceAccount: false,
},
github: {
clientID: '',
clientSecret: '',
- callbackURL: '/api/auth/github/callback'
+ callbackURL: '/api/auth/github/callback',
},
googleAnalytics: {
enabled: false,
- code: ''
+ code: '',
},
log: {
papertrail: {
@@ -184,7 +184,7 @@ module.exports = {
port: false,
level: 'debug',
program: 'production',
- inlineMeta: true
- }
- }
+ inlineMeta: true,
+ },
+ },
};
diff --git a/config/env/development.js b/config/env/development.js
index 88f4936291..dd2ff4d663 100644
--- a/config/env/development.js
+++ b/config/env/development.js
@@ -11,7 +11,7 @@
module.exports = {
featureFlags: {
reference: true,
- i18n: false
+ i18n: false,
},
// in dev we have webpack-dev-server on 3000, and the real server on 3001
port: 3001,
@@ -19,8 +19,8 @@ module.exports = {
uri: 'mongodb://' + (process.env.DB_1_PORT_27017_TCP_ADDR || 'localhost') + '/trustroots-dev',
options: {
auth: {
- authMechanism: ''
- }
+ authMechanism: '',
+ },
// user: '',
// pass: ''
},
@@ -30,11 +30,11 @@ module.exports = {
// Mongoose calls createIndex on each Model's index when staring the app
autoIndex: true,
// Check for MongoDB version compatibility on start
- checkCompatibility: true
+ checkCompatibility: true,
},
app: {
title: 'Trustroots Development version',
- description: 'Trustroots development version.'
+ description: 'Trustroots development version.',
},
// Configuration to work with default MailDev dev setup
// https://github.com/djfarrelly/MailDev
@@ -45,7 +45,7 @@ module.exports = {
port: 1025,
ignoreTLS: true,
auth: false,
- pool: true
- }
- }
+ pool: true,
+ },
+ },
};
diff --git a/config/env/local.docker.js b/config/env/local.docker.js
index e96f56865d..1f60e11cba 100644
--- a/config/env/local.docker.js
+++ b/config/env/local.docker.js
@@ -27,8 +27,8 @@ module.exports = {
host: 'maildev',
port: 25,
ignoreTLS: true,
- auth: false
- }
+ auth: false,
+ },
},
/**
@@ -42,9 +42,9 @@ module.exports = {
protocol: 'http',
username: 'root',
password: 'root',
- database: 'trustroots'
- }
- }
+ database: 'trustroots',
+ },
+ },
// See config/env/local.sample.js for how to configure mapbox layers, sending emails via Gmail etc
diff --git a/config/env/production.js b/config/env/production.js
index 9db6dd85bf..1fd2b774e9 100644
--- a/config/env/production.js
+++ b/config/env/production.js
@@ -13,8 +13,8 @@ module.exports = {
uri: 'mongodb://' + (process.env.DB_1_PORT_27017_TCP_ADDR || 'localhost') + '/trustroots',
options: {
auth: {
- authMechanism: ''
- }
+ authMechanism: '',
+ },
// user: '',
// pass: ''
},
@@ -24,6 +24,6 @@ module.exports = {
// Mongoose calls createIndex on each Model's index when staring the app
autoIndex: false,
// Check for MongoDB version compatibility on start
- checkCompatibility: false
- }
+ checkCompatibility: false,
+ },
};
diff --git a/config/env/test.js b/config/env/test.js
index ec385277e1..99cc09d437 100644
--- a/config/env/test.js
+++ b/config/env/test.js
@@ -11,14 +11,14 @@
module.exports = {
featureFlags: {
reference: true,
- i18n: true
+ i18n: true,
},
db: {
uri: 'mongodb://' + (process.env.DB_1_PORT_27017_TCP_ADDR || 'localhost') + '/trustroots-test',
options: {
auth: {
- authMechanism: ''
- }
+ authMechanism: '',
+ },
// user: '',
// pass: ''
},
@@ -28,14 +28,14 @@ module.exports = {
// Mongoose calls createIndex on each Model's index when staring the app
autoIndex: true,
// Check for MongoDB version compatibility on start
- checkCompatibility: false
+ checkCompatibility: false,
},
maxUploadSize: 10000, // =10kb in bytes. Set ridiculously small just for tests
port: 3001,
illegalStrings: ['trustroots', 'trust', 'roots'],
app: {
title: 'Trustroots test environment.',
- description: 'Trustroots test environment.'
+ description: 'Trustroots test environment.',
},
influxdb: {
enabled: false,
@@ -43,14 +43,14 @@ module.exports = {
host: 'localhost',
port: 8086,
protocol: 'http',
- database: 'trustroots-test'
- }
+ database: 'trustroots-test',
+ },
},
// Configuration of stathat.
// www.stathat.com is a tool/service for tracking statistics
stathat: {
enabled: false,
- key: ''
+ key: '',
},
mapbox: {
// Mapbox is publicly exposed to the frontend
@@ -58,8 +58,8 @@ module.exports = {
map: {
default: false,
satellite: false,
- hitchmap: false
+ hitchmap: false,
},
- publicKey: 'pk.eyJ1IjoidHJ1c3Ryb290cyIsImEiOiJVWFFGa19BIn0.4e59q4-7e8yvgvcd1jzF4g'
- }
+ publicKey: 'pk.eyJ1IjoidHJ1c3Ryb290cyIsImEiOiJVWFFGa19BIn0.4e59q4-7e8yvgvcd1jzF4g',
+ },
};
diff --git a/config/languages/generate.js b/config/languages/generate.js
index 386f7deda1..e00fd74da5 100644
--- a/config/languages/generate.js
+++ b/config/languages/generate.js
@@ -43,7 +43,7 @@ function includeLanguage(language) {
// significant "hobbyist" community around them
if ([
'grc', // Ancient Greek
- 'lat' // Latin
+ 'lat', // Latin
].indexOf(language.iso_639_2b) > -1) {
return true;
}
diff --git a/config/lib/agenda.js b/config/lib/agenda.js
index 31fe3c8b42..e1e41528ac 100644
--- a/config/lib/agenda.js
+++ b/config/lib/agenda.js
@@ -4,6 +4,6 @@ const config = require('../config');
module.exports = new Agenda({
db: {
address: config.db.uri,
- collection: 'agendaJobs'
- }
+ collection: 'agendaJobs',
+ },
});
diff --git a/config/lib/exponent-notifications.js b/config/lib/exponent-notifications.js
index 21f6cd7073..d5b86156dd 100644
--- a/config/lib/exponent-notifications.js
+++ b/config/lib/exponent-notifications.js
@@ -22,7 +22,7 @@ exports.sendToDevice = function sendToDevice(tokens, notification) {
if (!token || !Expo.isExpoPushToken(token)) {
log('error', 'Invalid or missing Expo push notification token #mg9hwf', {
- token: token
+ token: token,
});
return;
}
@@ -78,8 +78,8 @@ exports.sendToDevice = function sendToDevice(tokens, notification) {
*/
data: {
// Action URL
- url: notification.click_action
- }
+ url: notification.click_action,
+ },
});
});
diff --git a/config/lib/express.js b/config/lib/express.js
index 26aa3b5d8b..225ed8c932 100644
--- a/config/lib/express.js
+++ b/config/lib/express.js
@@ -49,7 +49,7 @@ module.exports.initLocalVariables = function (app) {
app.locals.appSettings.maitreId = config.invitations.enabled ? config.invitations.maitreId : false;
app.locals.appSettings.fcmSenderId = config.fcm.senderId;
app.locals.appSettings.limits = {
- maxOfferValidFromNow: config.limits.maxOfferValidFromNow
+ maxOfferValidFromNow: config.limits.maxOfferValidFromNow,
};
app.locals.siteAnnouncement = config.siteAnnouncement || { enabled: false };
@@ -106,7 +106,7 @@ module.exports.initMiddleware = function (app) {
filter: function (req, res) {
return (/json|text|javascript|css|font|svg/).test(res.getHeader('Content-Type'));
},
- level: 9
+ level: 9,
}));
// Initialize pagination middleware
@@ -129,7 +129,7 @@ module.exports.initMiddleware = function (app) {
// Request body parsing middleware should be above methodOverride
app.use(bodyParser.urlencoded({
- extended: true
+ extended: true,
}));
app.use(bodyParser.json({
type: [
@@ -138,8 +138,8 @@ module.exports.initMiddleware = function (app) {
// - Chrome sends application/csp-report
// - Firefox sends application/json
// - it seems chrome is doing it well: https://w3c.github.io/webappsec/specs/content-security-policy/
- 'application/csp-report'
- ]
+ 'application/csp-report',
+ ],
}));
app.use(methodOverride());
@@ -159,7 +159,7 @@ module.exports.initViewEngine = function (app) {
nunjucks.configure('./modules/core/server/views', {
express: app,
watch: false,
- noCache: true
+ noCache: true,
});
// app.engine('nunjucks', nunjucks);
@@ -188,12 +188,12 @@ module.exports.initSession = function (app, connection) {
// By default cookie.maxAge is null, meaning no "expires" parameter is
// set so the cookie becomes a browser-session cookie. When the user
// closes the browser the cookie (and session) will be removed.
- maxAge: 2419200000 // (in milliseconds) 28 days
+ maxAge: 2419200000, // (in milliseconds) 28 days
},
store: new MongoStore({
mongooseConnection: connection,
- collection: config.sessionCollection
- })
+ collection: config.sessionCollection,
+ }),
}));
};
@@ -230,7 +230,7 @@ module.exports.initHelmetHeaders = function (app) {
// put your own pages in iframes, but nobody else can.
//
// action `deny` will prevent anyone from putting this page in an iframe.
- action: 'sameorigin'
+ action: 'sameorigin',
};
/**
@@ -238,7 +238,7 @@ module.exports.initHelmetHeaders = function (app) {
* @link https://helmetjs.github.io/docs/csp/
*/
let cspFrameAncestors = [
- '\'none\''
+ '\'none\'',
];
/**
@@ -262,10 +262,10 @@ module.exports.initHelmetHeaders = function (app) {
if (facebookNotificationService.isNotificationsEnabled()) {
frameguardOptions = {
action: 'allow-from',
- domain: 'https://apps.facebook.com'
+ domain: 'https://apps.facebook.com',
};
cspFrameAncestors = [
- 'apps.facebook.com'
+ 'apps.facebook.com',
];
}
@@ -284,7 +284,7 @@ module.exports.initHelmetHeaders = function (app) {
app.use(helmet.contentSecurityPolicy({
directives: {
defaultSrc: [
- '\'self\''
+ '\'self\'',
],
// Defines the origins from which scripts can be loaded.
@@ -308,19 +308,19 @@ module.exports.initHelmetHeaders = function (app) {
// @link https://helmetjs.github.io/docs/csp/#generating-nonces
function (req, res) {
return '\'nonce-' + res.locals.nonce + '\''; // 'nonce-614d9122-d5b0-4760-aecf-3a5d17cf0ac9'
- }
+ },
],
// Specifies the origins that can serve web fonts.
fontSrc: [
'\'self\'',
- 'data:' // Inline fonts (`src: url('data:...')`)
+ 'data:', // Inline fonts (`src: url('data:...')`)
],
// Defines the origins from which stylesheets can be loaded.
styleSrc: [
'\'self\'',
- '\'unsafe-inline\''
+ '\'unsafe-inline\'',
],
// Defines the origins from which images can be loaded.
@@ -344,7 +344,7 @@ module.exports.initHelmetHeaders = function (app) {
'i1.wp.com', // Gravatar (WordPress.com)
'i2.wp.com', // Gravatar (WordPress.com)
'ucarecdn.com', // Our Tribe image CDN "Uploadcare.com"
- 'data:' // Inline images (`
`)
+ 'data:', // Inline images (`
`)
],
// Limits the origins that you can connect to
@@ -355,23 +355,23 @@ module.exports.initHelmetHeaders = function (app) {
'api.mapbox.com',
'fcm.googleapis.com',
'maitreapp.co', // Signup waiting list feature
- 'www.facebook.com'
+ 'www.facebook.com',
],
// Allows control over Flash and other plugins.
objectSrc: [
- '\'self\''
+ '\'self\'',
],
// Allows control of media elements, e.g. HTML5 `
'
+ '',
);
$analytics.eventTrack('messages.hostingreply.' + reply, {
category: 'messages.hostingreply',
- label: 'Message hosting hosting reply "' + reply + '"'
+ label: 'Message hosting hosting reply "' + reply + '"',
});
}
@@ -218,7 +218,7 @@
function fetchMessages() {
return (
vm.messageHandler.fetchMessages({
- userId: userTo._id
+ userId: userTo._id,
})
);
}
@@ -266,7 +266,7 @@
$analytics.eventTrack('thread-pagination', {
category: 'messages.thread',
- label: 'Message thread page ' + (vm.messageHandler.nextPage ? vm.messageHandler.nextPage.page : 0)
+ label: 'Message thread page ' + (vm.messageHandler.nextPage ? vm.messageHandler.nextPage.page : 0),
});
}
}
@@ -302,7 +302,7 @@
*/
function syncRead() {
MessagesRead.query({
- messageIds: flaggedAsRead
+ messageIds: flaggedAsRead,
}, function () {
flaggedAsRead = [];
// Tell app controller to sync this counter
@@ -357,7 +357,7 @@
const message = new vm.messageHandler.ajaxCall({
content: msg,
userTo: userTo._id,
- read: false
+ read: false,
});
message.$save(function (response) {
@@ -374,7 +374,7 @@
$analytics.eventTrack('message.send', {
category: 'messages',
- label: 'Message send'
+ label: 'Message send',
});
// $timeout ensures scroll happens only after DOM has finished rendering
diff --git a/modules/messages/client/directives/thread-dimensions.client.directive.js b/modules/messages/client/directives/thread-dimensions.client.directive.js
index 1fa3a1cfee..67b87b09da 100644
--- a/modules/messages/client/directives/thread-dimensions.client.directive.js
+++ b/modules/messages/client/directives/thread-dimensions.client.directive.js
@@ -88,14 +88,14 @@
const combinedHeight = elemReplyHeight + (elemReplyHeight / 3);
elemQuickReply.css({
- bottom: combinedHeight
+ bottom: combinedHeight,
});
elemThread.css({
// container has 15px padding on both sides when window is bigger than screen-sm-max (768px)
width: elemContainerWidth - elemContainerPadding,
// Bottom part of the message thread should touch top part of textarea
- bottom: combinedHeight + elemQuickReply.height()
+ bottom: combinedHeight + elemQuickReply.height(),
});
// Reply area has always padding 30 on the right
@@ -122,7 +122,7 @@
activateScrollToBottom();
scope.$emit('threadDimensinsLoaded');
- } // link()
+ }, // link()
};
}
}());
diff --git a/modules/messages/client/directives/threads.client.directive.js b/modules/messages/client/directives/threads.client.directive.js
index 218b40dd2a..f9f56522f9 100644
--- a/modules/messages/client/directives/threads.client.directive.js
+++ b/modules/messages/client/directives/threads.client.directive.js
@@ -14,7 +14,7 @@
scope.$apply(attr.moremessages);
}
});
- }
+ },
};
}
}());
diff --git a/modules/messages/client/directives/unread-count.client.directive.js b/modules/messages/client/directives/unread-count.client.directive.js
index cde43df7c3..321e5bb197 100644
--- a/modules/messages/client/directives/unread-count.client.directive.js
+++ b/modules/messages/client/directives/unread-count.client.directive.js
@@ -20,7 +20,7 @@
replace: true,
scope: true,
template: '',
- link: link
+ link: link,
};
return directive;
diff --git a/modules/messages/client/services/messages-count-poll.client.service.js b/modules/messages/client/services/messages-count-poll.client.service.js
index 7e349f925c..4130bf6c4d 100644
--- a/modules/messages/client/services/messages-count-poll.client.service.js
+++ b/modules/messages/client/services/messages-count-poll.client.service.js
@@ -23,7 +23,7 @@
setFrequency: setFrequency,
getUnreadCount: getUnreadCount,
initPolling: initPolling,
- poll: poll
+ poll: poll,
};
/**
diff --git a/modules/messages/client/services/messages-read.client.service.js b/modules/messages/client/services/messages-read.client.service.js
index 4bc9e98ced..4fb39b483e 100644
--- a/modules/messages/client/services/messages-read.client.service.js
+++ b/modules/messages/client/services/messages-read.client.service.js
@@ -7,14 +7,14 @@
/* @ngInject */
function MessagesRead($resource) {
return $resource('/api/messages-read', {
- messageIds: '@messageIds'
+ messageIds: '@messageIds',
}, {
query: {
method: 'POST',
isArray: false,
cache: false,
- ignoreLoadingBar: true
- }
+ ignoreLoadingBar: true,
+ },
});
}
}());
diff --git a/modules/messages/client/services/messages.client.service.js b/modules/messages/client/services/messages.client.service.js
index 9d02543975..7e7c8d2c54 100644
--- a/modules/messages/client/services/messages.client.service.js
+++ b/modules/messages/client/services/messages.client.service.js
@@ -20,7 +20,7 @@
if (header) {
return {
page: /<.*\/[^<>]*\?.*page=(\d*).*>;.*/.exec(header)[1],
- limit: /<.*\/[^<>]*\?.*limit=(\d*).*>;.*/.exec(header)[1]
+ limit: /<.*\/[^<>]*\?.*limit=(\d*).*>;.*/.exec(header)[1],
};
} else {
return header;
@@ -50,14 +50,14 @@
function () {
that.paginationTimeout = false;
that.resolved = false;
- }
+ },
);
}
},
ajaxCall: $resource('/api/messages/:userId',
{ userId: '@_id' },
- { update: { method: 'PUT' } }
- )
+ { update: { method: 'PUT' } },
+ ),
};
return MessageHandler;
}
diff --git a/modules/messages/server/controllers/messages.server.controller.js b/modules/messages/server/controllers/messages.server.controller.js
index 66301bad0e..268799556e 100644
--- a/modules/messages/server/controllers/messages.server.controller.js
+++ b/modules/messages/server/controllers/messages.server.controller.js
@@ -25,7 +25,7 @@ const messageFields = [
'created',
'read',
'userFrom',
- 'userTo'
+ 'userTo',
].join(' ');
// Allowed fields of thread object to be set over API
@@ -35,7 +35,7 @@ const threadFields = [
'read',
'updated',
'userFrom',
- 'userTo'
+ 'userTo',
].join(' ');
/**
@@ -88,7 +88,7 @@ function sanitizeThreads(threads, authenticatedUserId) {
} else {
// Ensure this works even if messages couldn't be found for some reason
thread.message = {
- excerpt: '…'
+ excerpt: '…',
};
}
@@ -123,7 +123,7 @@ const setLinkHeader = function (req, res, pageCount) {
const url = (config.https ? 'https' : 'http') + '://' + config.domain;
const nextPage = url + res.locals.paginate.href({ page: req.query.page + 1 });
res.links({
- next: nextPage
+ next: nextPage,
// last: ''
});
}
@@ -137,7 +137,7 @@ exports.inbox = function (req, res) {
// No user
if (!req.user) {
return res.status(403).send({
- message: errorService.getErrorMessageByKey('forbidden')
+ message: errorService.getErrorMessageByKey('forbidden'),
});
}
@@ -146,8 +146,8 @@ exports.inbox = function (req, res) {
// Returns only threads where currently authenticated user is participating member
$or: [
{ userFrom: req.user },
- { userTo: req.user }
- ]
+ { userTo: req.user },
+ ],
},
{
page: req.query.page || 1,
@@ -156,14 +156,14 @@ exports.inbox = function (req, res) {
select: threadFields,
populate: {
path: 'userFrom userTo message',
- select: 'content ' + userProfile.userMiniProfileFields
- }
+ select: 'content ' + userProfile.userMiniProfileFields,
+ },
},
function (err, data) {
if (err) {
return res.status(400).send({
- message: errorService.getErrorMessage(err)
+ message: errorService.getErrorMessage(err),
});
} else {
@@ -174,7 +174,7 @@ exports.inbox = function (req, res) {
res.json(threads);
}
- }
+ },
);
};
@@ -186,35 +186,35 @@ exports.send = function (req, res) {
// No user
if (!req.user) {
return res.status(403).send({
- message: errorService.getErrorMessageByKey('forbidden')
+ message: errorService.getErrorMessageByKey('forbidden'),
});
}
// No receiver
if (!req.body.userTo) {
return res.status(400).send({
- message: 'Missing `userTo` field.'
+ message: 'Missing `userTo` field.',
});
}
// Not a valid ObjectId
if (!mongoose.Types.ObjectId.isValid(req.body.userTo)) {
return res.status(400).send({
- message: errorService.getErrorMessageByKey('invalid-id')
+ message: errorService.getErrorMessageByKey('invalid-id'),
});
}
// Don't allow sending messages to myself
if (req.user._id.equals(req.body.userTo)) {
return res.status(403).send({
- message: 'Recepient cannot be currently authenticated user.'
+ message: 'Recepient cannot be currently authenticated user.',
});
}
// No content or test if content is actually empty (when html is stripped out)
if (!req.body.content || textService.isEmpty(req.body.content)) {
return res.status(400).send({
- message: 'Please write a message.'
+ message: 'Please write a message.',
});
}
@@ -226,7 +226,7 @@ exports.send = function (req, res) {
// If we were unable to find the receiver, return the error and stop here
if (err || !receiver || !receiver.public) {
return res.status(404).send({
- message: 'Member you are writing to does not exist.'
+ message: 'Member you are writing to does not exist.',
});
}
done();
@@ -240,13 +240,13 @@ exports.send = function (req, res) {
$or: [
{
userTo: req.user._id,
- userFrom: req.body.userTo
+ userFrom: req.body.userTo,
},
{
userTo: req.body.userTo,
- userFrom: req.user._id
- }
- ]
+ userFrom: req.user._id,
+ },
+ ],
},
function (err, thread) {
done(err, thread);
@@ -272,7 +272,7 @@ exports.send = function (req, res) {
return res.status(400).send({
error: 'empty-profile',
limit: config.profileMinimumLength,
- message: (descriptionLength === 0) ? 'Please fill out your profile description before you send messages.' : 'Please write longer profile description before you send messages.'
+ message: (descriptionLength === 0) ? 'Please fill out your profile description before you send messages.' : 'Please write longer profile description before you send messages.',
});
}
@@ -330,13 +330,13 @@ exports.send = function (req, res) {
$or: [
{
userTo: upsertData.userTo,
- userFrom: upsertData.userFrom
+ userFrom: upsertData.userFrom,
},
{
userTo: upsertData.userFrom,
- userFrom: upsertData.userTo
- }
- ]
+ userFrom: upsertData.userTo,
+ },
+ ],
},
upsertData,
{ upsert: true },
@@ -370,11 +370,11 @@ exports.send = function (req, res) {
message
.populate({
path: 'userFrom',
- select: userProfile.userMiniProfileFields
+ select: userProfile.userMiniProfileFields,
})
.populate({
path: 'userTo',
- select: userProfile.userMiniProfileFields
+ select: userProfile.userMiniProfileFields,
}, function (err, message) {
if (err) {
return done(err);
@@ -389,13 +389,13 @@ exports.send = function (req, res) {
// Finally return saved message
return res.json(message);
});
- }
+ },
], function (err) {
if (err) {
return res.status(400).send({
- message: errorService.getErrorMessage(err)
+ message: errorService.getErrorMessage(err),
});
}
});
@@ -422,14 +422,14 @@ exports.threadByUser = function (req, res, next, userId) {
if (!req.user) {
return res.status(403).send({
- message: errorService.getErrorMessageByKey('forbidden')
+ message: errorService.getErrorMessageByKey('forbidden'),
});
}
// Not user id or its not a valid ObjectId
if (!userId || !mongoose.Types.ObjectId.isValid(userId)) {
return res.status(400).send({
- message: errorService.getErrorMessageByKey('invalid-id')
+ message: errorService.getErrorMessageByKey('invalid-id'),
});
}
@@ -437,8 +437,8 @@ exports.threadByUser = function (req, res, next, userId) {
{
$or: [
{ userFrom: req.user._id, userTo: userId },
- { userTo: req.user._id, userFrom: userId }
- ]
+ { userTo: req.user._id, userFrom: userId },
+ ],
},
{
page: req.query.page || 1,
@@ -447,8 +447,8 @@ exports.threadByUser = function (req, res, next, userId) {
select: messageFields,
populate: {
path: 'userFrom userTo',
- select: userProfile.userMiniProfileFields
- }
+ select: userProfile.userMiniProfileFields,
+ },
},
function (err, data) {
if (err) {
@@ -465,7 +465,7 @@ exports.threadByUser = function (req, res, next, userId) {
}
done(err, data.docs);
- }
+ },
);
},
@@ -495,18 +495,18 @@ exports.threadByUser = function (req, res, next, userId) {
Thread.update(
{
userTo: req.user._id,
- userFrom: userId
+ userFrom: userId,
},
{
- read: true
+ read: true,
},
// Options:
{
- multi: false
+ multi: false,
},
function (err) {
done(err);
- }
+ },
);
} else {
@@ -517,12 +517,12 @@ exports.threadByUser = function (req, res, next, userId) {
done(null);
}
- }
+ },
], function (err) {
if (err) {
return res.status(400).send({
- message: errorService.getErrorMessage(err)
+ message: errorService.getErrorMessage(err),
});
} else {
return next();
@@ -540,7 +540,7 @@ exports.markRead = function (req, res) {
if (!req.user) {
return res.status(403).send({
- message: errorService.getErrorMessageByKey('forbidden')
+ message: errorService.getErrorMessageByKey('forbidden'),
});
}
@@ -554,30 +554,30 @@ exports.markRead = function (req, res) {
// Although this isn't in index, but it ensures
// user has access to update only his/hers own messages
- userTo: req.user.id
+ userTo: req.user.id,
});
});
// Mark messages read
Message.update(
{
- $or: messages
+ $or: messages,
},
{
- read: true
+ read: true,
},
{
- multi: true
+ multi: true,
},
function (err) {
if (err) {
return res.status(400).send({
- message: errorService.getErrorMessage(err)
+ message: errorService.getErrorMessage(err),
});
} else {
res.status(200).send();
}
- }
+ },
);
};
@@ -590,17 +590,17 @@ exports.messagesCount = function (req, res) {
if (!req.user) {
return res.status(403).send({
- message: errorService.getErrorMessageByKey('forbidden')
+ message: errorService.getErrorMessageByKey('forbidden'),
});
}
Thread.countDocuments({
read: false,
- userTo: req.user._id
+ userTo: req.user._id,
}, function (err, unreadCount) {
if (err) {
return res.status(400).send({
- message: errorService.getErrorMessage(err)
+ message: errorService.getErrorMessage(err),
});
}
return res.json({ unread: unreadCount ? parseInt(unreadCount, 10) : 0 });
@@ -614,14 +614,14 @@ exports.sync = function (req, res) {
if (!req.user) {
return res.status(403).send({
- message: errorService.getErrorMessageByKey('forbidden')
+ message: errorService.getErrorMessageByKey('forbidden'),
});
}
// Root object to be sent out from this API endpoint
const data = {
messages: [],
- users: []
+ users: [],
};
async.waterfall([
@@ -640,7 +640,7 @@ exports.sync = function (req, res) {
// Validate `dateFrom`
if (!dateFrom.isValid()) {
return res.status(400).send({
- message: 'Invalid `dateFrom`.'
+ message: 'Invalid `dateFrom`.',
});
}
@@ -653,7 +653,7 @@ exports.sync = function (req, res) {
// Validate `dateTo`
if (!dateTo.isValid()) {
return res.status(400).send({
- message: 'Invalid `dateTo`.'
+ message: 'Invalid `dateTo`.',
});
}
@@ -664,7 +664,7 @@ exports.sync = function (req, res) {
// Validate correct order of dates
if (dateFrom && dateTo && dateFrom.isAfter(dateTo)) {
return res.status(400).send({
- message: 'Invalid dates: `dateFrom` cannot be later than `dateTo`'
+ message: 'Invalid dates: `dateFrom` cannot be later than `dateTo`',
});
}
@@ -675,8 +675,8 @@ exports.sync = function (req, res) {
const queryUsers = {
$or: [
{ userFrom: req.user._id },
- { userTo: req.user._id }
- ]
+ { userTo: req.user._id },
+ ],
};
// Filter only by user or also by date?
@@ -685,8 +685,8 @@ exports.sync = function (req, res) {
query = {
$and: [
queryUsers,
- queryDate
- ]
+ queryDate,
+ ],
};
} else {
// Construct query without date limit
@@ -736,8 +736,8 @@ exports.sync = function (req, res) {
// Get objects for users based on above user ids
User.find({
_id: {
- $in: userIds
- }
+ $in: userIds,
+ },
})
.select(userProfile.userMiniProfileFields)
.exec(function (err, users) {
@@ -749,12 +749,12 @@ exports.sync = function (req, res) {
// Return the package
function () {
return res.json(data);
- }
+ },
], function (err) {
if (err) {
return res.status(400).send({
- message: errorService.getErrorMessage(err)
+ message: errorService.getErrorMessage(err),
});
}
});
diff --git a/modules/messages/server/jobs/message-unread.server.job.js b/modules/messages/server/jobs/message-unread.server.job.js
index 4c6d993ed8..4c1ae97698 100644
--- a/modules/messages/server/jobs/message-unread.server.job.js
+++ b/modules/messages/server/jobs/message-unread.server.job.js
@@ -69,7 +69,7 @@ module.exports = function (job, agendaDone) {
// remapped config for nth notifications, more comfortable for further use
return {
order: index, // nth notification
- timing: value // when to send the notification
+ timing: value, // when to send the notification
};
}));
@@ -109,8 +109,8 @@ function sendUnreadMessageReminders(reminder, callback) {
// second reminder is sent when notificationCount is 0 or 1
// etc...
notificationCount: { $lte: reminderOrder },
- created: { $lt: createdTimeAgo }
- }
+ created: { $lt: createdTimeAgo },
+ },
},
{
$group: {
@@ -118,7 +118,7 @@ function sendUnreadMessageReminders(reminder, callback) {
// Group separate emails
_id: {
'userTo': '$userTo',
- 'userFrom': '$userFrom'
+ 'userFrom': '$userFrom',
},
// Collect unread messages count
@@ -130,9 +130,9 @@ function sendUnreadMessageReminders(reminder, callback) {
// did we already send some notifications for the last unseen message?
// the last unseen message has the minimum notification count
// we'll use the value to determine whether the notification is the first one, or not; to change wording of the reminder
- notificationCount: { $min: '$notificationCount' }
- }
- }
+ notificationCount: { $min: '$notificationCount' },
+ },
+ },
], function (err, notifications) {
done(err, notifications);
});
@@ -160,7 +160,7 @@ function sendUnreadMessageReminders(reminder, callback) {
// count messages in the other direction
Message.countDocuments({
userFrom: notification._id.userTo,
- userTo: notification._id.userFrom
+ userTo: notification._id.userFrom,
}, function (err, count) {
const isThreadReplied = count > 0;
@@ -218,8 +218,8 @@ function sendUnreadMessageReminders(reminder, callback) {
// Used for FB notifications:
'additionalProvidersData.facebook.id',
'additionalProvidersData.facebook.accessToken',
- 'additionalProvidersData.facebook.accessTokenExpires'
- ].join(' ')
+ 'additionalProvidersData.facebook.accessTokenExpires',
+ ].join(' '),
)
.exec(function (err, users) {
@@ -281,7 +281,7 @@ function sendUnreadMessageReminders(reminder, callback) {
},
push: function (callback) {
pushService.notifyMessagesUnread(userFrom, userTo, notification, callback);
- }
+ },
}, notificationCallback);
}, 5); // How many notifications to process simultaneously?
@@ -297,7 +297,7 @@ function sendUnreadMessageReminders(reminder, callback) {
if (err) {
// Log the failure to send the notification
log('error', 'Sending unread message notifications caused an error. #j38vax', {
- error: err
+ error: err,
});
}
done(null, notifications);
@@ -345,14 +345,14 @@ function sendUnreadMessageReminders(reminder, callback) {
if (err) {
// Log the failure to send the notification
log('error', 'Error while marking messages as notified. #9ehvbn', {
- error: err
+ error: err,
});
}
// Now fail the job if error happens
done(err);
});
- }
+ },
], function (err) {
// Wrap it up
diff --git a/modules/messages/server/models/message-stat.server.model.js b/modules/messages/server/models/message-stat.server.model.js
index a0c18eba53..684cfa99e5 100644
--- a/modules/messages/server/models/message-stat.server.model.js
+++ b/modules/messages/server/models/message-stat.server.model.js
@@ -12,22 +12,22 @@ const messageStatSchema = new Schema({
firstMessageUserFrom: {
type: Schema.ObjectId,
ref: 'User',
- index: true
+ index: true,
},
// The id of the user who received the first message of the thread
firstMessageUserTo: {
type: Schema.ObjectId,
ref: 'User',
- index: true
+ index: true,
},
// The Date when the first message was sent
firstMessageCreated: {
type: Date,
- index: true
+ index: true,
},
// The length of the first message
firstMessageLength: {
- type: Number
+ type: Number,
},
// The Date when the reply was sent
// The reply is the first message which was sent from firstMessageUserTo
@@ -35,20 +35,20 @@ const messageStatSchema = new Schema({
// message was sent.
firstReplyCreated: {
type: Date,
- default: null
+ default: null,
},
// The length of the first reply
firstReplyLength: {
type: Number,
- default: null
+ default: null,
},
// Number of milliseconds from the creation of the first message
// (firstMessageCreated) till the creation of the first reply (firstReplyCreated)
// In theory this could be removed. It is easily retrieved from the database
timeToFirstReply: {
type: Number,
- default: null
- }
+ default: null,
+ },
});
// ensure uniqueness of a MessageStat document per Thread (only in 1 direction)
diff --git a/modules/messages/server/models/message.server.model.js b/modules/messages/server/models/message.server.model.js
index 11defe44e9..9ded4cc73d 100644
--- a/modules/messages/server/models/message.server.model.js
+++ b/modules/messages/server/models/message.server.model.js
@@ -11,35 +11,35 @@ const Schema = mongoose.Schema;
const MessageSchema = new Schema({
created: {
type: Date,
- default: Date.now
+ default: Date.now,
},
content: {
type: String,
default: '',
trim: true,
- required: 'Message cannot be blank'
+ required: 'Message cannot be blank',
},
userFrom: {
type: Schema.ObjectId,
ref: 'User',
- index: true
+ index: true,
},
userTo: {
type: Schema.ObjectId,
ref: 'User',
- index: true
+ index: true,
},
read: {
type: Boolean,
- default: false
+ default: false,
},
/* Count and the latest date of notifications sent to `userTo`
about unread messages (`read:false`) */
notificationCount: {
type: Number,
default: 0,
- required: true
- }
+ required: true,
+ },
});
MessageSchema.index({ read: 1, created: 1, notificationSent: 1 });
diff --git a/modules/messages/server/models/thread.server.model.js b/modules/messages/server/models/thread.server.model.js
index 8c19468fdf..f2d3809b74 100644
--- a/modules/messages/server/models/thread.server.model.js
+++ b/modules/messages/server/models/thread.server.model.js
@@ -11,27 +11,27 @@ const Schema = mongoose.Schema;
const ThreadSchema = new Schema({
updated: {
type: Date,
- default: Date.now
+ default: Date.now,
},
userFrom: {
type: Schema.ObjectId,
ref: 'User',
- index: true
+ index: true,
},
userTo: {
type: Schema.ObjectId,
ref: 'User',
- index: true
+ index: true,
},
// This points to the latest message inn this thread
message: {
type: Schema.ObjectId,
- ref: 'Message'
+ ref: 'Message',
},
read: {
type: Boolean,
- default: false
- }
+ default: false,
+ },
});
ThreadSchema.plugin(mongoosePaginate);
diff --git a/modules/messages/server/policies/messages.server.policy.js b/modules/messages/server/policies/messages.server.policy.js
index 3e003a797f..f34f556406 100644
--- a/modules/messages/server/policies/messages.server.policy.js
+++ b/modules/messages/server/policies/messages.server.policy.js
@@ -16,38 +16,38 @@ exports.invokeRolesPolicies = function () {
roles: ['admin'],
allows: [{
resources: '/api/messages',
- permissions: []
+ permissions: [],
}, {
resources: '/api/messages/:messageUserId',
- permissions: []
+ permissions: [],
}, {
resources: '/api/messages-read',
- permissions: []
+ permissions: [],
}, {
resources: '/api/messages-count',
- permissions: []
+ permissions: [],
}, {
resources: '/api/messages-sync',
- permissions: []
- }]
+ permissions: [],
+ }],
}, {
roles: ['user'],
allows: [{
resources: '/api/messages',
- permissions: ['get', 'post']
+ permissions: ['get', 'post'],
}, {
resources: '/api/messages/:messageUserId',
- permissions: ['get']
+ permissions: ['get'],
}, {
resources: '/api/messages-read',
- permissions: ['post']
+ permissions: ['post'],
}, {
resources: '/api/messages-count',
- permissions: ['get']
+ permissions: ['get'],
}, {
resources: '/api/messages-sync',
- permissions: ['get']
- }]
+ permissions: ['get'],
+ }],
}]);
};
@@ -60,7 +60,7 @@ exports.isAllowed = function (req, res, next) {
// No messages feature for un-published users
if (req.user && req.user.public !== true) {
return res.status(403).json({
- message: errorService.getErrorMessageByKey('forbidden')
+ message: errorService.getErrorMessageByKey('forbidden'),
});
}
@@ -70,7 +70,7 @@ exports.isAllowed = function (req, res, next) {
if (err) {
// An authorization error occurred.
return res.status(500).json({
- message: 'Unexpected authorization error'
+ message: 'Unexpected authorization error',
});
} else {
if (isAllowed) {
@@ -78,7 +78,7 @@ exports.isAllowed = function (req, res, next) {
return next();
} else {
return res.status(403).json({
- message: errorService.getErrorMessageByKey('forbidden')
+ message: errorService.getErrorMessageByKey('forbidden'),
});
}
}
diff --git a/modules/messages/server/services/message-stat.server.service.js b/modules/messages/server/services/message-stat.server.service.js
index 050f654b46..a5c9a5df3c 100644
--- a/modules/messages/server/services/message-stat.server.service.js
+++ b/modules/messages/server/services/message-stat.server.service.js
@@ -13,7 +13,7 @@ function createMessageStat(message, done) {
firstMessageUserFrom: message.userFrom,
firstMessageUserTo: message.userTo,
firstMessageCreated: message.created,
- firstMessageLength: message.content.length
+ firstMessageLength: message.content.length,
});
messageStat.save(function (err) {
@@ -30,14 +30,14 @@ function addFirstReplyInfo(messageStat, message, done) {
MessageStat.findOneAndUpdate({
firstMessageUserFrom: message.userTo,
firstMessageUserTo: message.userFrom,
- firstReplyCreated: null
+ firstReplyCreated: null,
}, {
$set: {
firstReplyCreated: message.created,
firstReplyLength: message.content.length,
timeToFirstReply: message.created.getTime()
- - messageStat.firstMessageCreated.getTime()
- }
+ - messageStat.firstMessageCreated.getTime(),
+ },
})
.exec(done);
}
@@ -70,13 +70,13 @@ exports.updateMessageStat = function (message, callback) {
$or: [
{
firstMessageUserFrom: message.userFrom,
- firstMessageUserTo: message.userTo
+ firstMessageUserTo: message.userTo,
},
{
firstMessageUserFrom: message.userTo,
- firstMessageUserTo: message.userFrom
- }
- ]
+ firstMessageUserTo: message.userFrom,
+ },
+ ],
}).exec(function (err, messageStat) {
done(err, messageStat);
});
@@ -102,7 +102,7 @@ exports.updateMessageStat = function (message, callback) {
// No MessageStat was found, let's create a new one
findMessagesCreateMessageStat(done);
}
- }
+ },
], function (err, response) {
if (err) return callback(err);
@@ -121,13 +121,13 @@ exports.updateMessageStat = function (message, callback) {
$or: [
{
userFrom: message.userFrom,
- userTo: message.userTo
+ userTo: message.userTo,
},
{
userFrom: message.userTo,
- userTo: message.userFrom
- }
- ]
+ userTo: message.userFrom,
+ },
+ ],
})
// Sort by the `created` field to find the first message
// sent or received between these two users
@@ -159,7 +159,7 @@ exports.updateMessageStat = function (message, callback) {
response = 'first';
}
return done(null, response);
- }
+ },
], cb);
}
@@ -176,7 +176,7 @@ exports.updateMessageStat = function (message, callback) {
// recipient and to the sender, that will be the first reply.
Message.findOne({
userFrom: messageStat.firstMessageUserTo,
- userTo: messageStat.firstMessageUserFrom
+ userTo: messageStat.firstMessageUserFrom,
})
// Sort by `created` to get the *first* reply
.sort({ created: 1 })
@@ -196,7 +196,7 @@ exports.updateMessageStat = function (message, callback) {
} else {
return done(null, 'other');
}
- }
+ },
], cb);
}
};
@@ -236,8 +236,8 @@ exports.readMessageStatsOfUser = function (userId, timeNow, callback) {
firstMessageUserTo: userId,
firstMessageCreated: {
$lte: new Date(timeNow),
- $gt: new Date(timeNow - 90 * DAY)
- }
+ $gt: new Date(timeNow - 90 * DAY),
+ },
})
.sort({ firstMessageCreated: -1 })
.exec(function (err, resp) {
@@ -323,7 +323,7 @@ exports.readMessageStatsOfUser = function (userId, timeNow, callback) {
}(chosenStats));
return done(null, stats);
- }
+ },
], function (err, stats) {
if (err) return callback(err);
@@ -393,6 +393,6 @@ exports.readFormattedMessageStatsOfUser = function (userId, timeNow, callback) {
function (stats, done) {
const formatted = exports.formatStats(stats);
return done(null, formatted);
- }
+ },
], callback);
};
diff --git a/modules/messages/server/services/message-to-stats.server.service.js b/modules/messages/server/services/message-to-stats.server.service.js
index 19c442d47e..847642c532 100644
--- a/modules/messages/server/services/message-to-stats.server.service.js
+++ b/modules/messages/server/services/message-to-stats.server.service.js
@@ -96,7 +96,7 @@ module.exports.save = function (message, callback) {
module.exports.send(statObject, function (err) {
return done(err);
});
- }
+ },
], function (err) {
if (err) {
log('error', 'Saving message stats failed.', err);
@@ -139,13 +139,13 @@ module.exports.process = function (message, callback) {
$or: [
{
userTo: userTo,
- userFrom: userFrom
+ userFrom: userFrom,
},
{
userTo: userFrom,
- userFrom: userTo
- }
- ]
+ userFrom: userTo,
+ },
+ ],
})
.sort({ created: 1 })
.exec(done);
@@ -171,7 +171,7 @@ module.exports.process = function (message, callback) {
if (canBeTheFirstReply) {
return Message.findOne({
userTo: firstMessage.userFrom,
- userFrom: firstMessage.userTo
+ userFrom: firstMessage.userTo,
})
.sort({ created: 1 })
.exec(function (err, firstReply) {
@@ -213,20 +213,20 @@ module.exports.process = function (message, callback) {
const statObject = {
namespace: 'messages',
counts: {
- sent: 1
+ sent: 1,
},
values: {},
tags: {
position: position, // position (first|firstReply|other)
- messageLengthType: msgLenType // (short|long) content (shortness defined in a config)
+ messageLengthType: msgLenType, // (short|long) content (shortness defined in a config)
},
meta: {
messageId: String(message._id),
userFrom: String(userFrom), // id of sender
userTo: String(userTo), // id of receiver
- messageLength: msgLen // length of the content
+ messageLength: msgLen, // length of the content
},
- time: message.created
+ time: message.created,
};
// we measure the reply time only for the first replies (time since the
@@ -236,7 +236,7 @@ module.exports.process = function (message, callback) {
}
return done(null, statObject);
- }
+ },
], callback);
};
diff --git a/modules/messages/tests/server/jobs/message-unread.server.job.tests.js b/modules/messages/tests/server/jobs/message-unread.server.job.tests.js
index 70ff4d1f7b..7c8b5cf286 100644
--- a/modules/messages/tests/server/jobs/message-unread.server.job.tests.js
+++ b/modules/messages/tests/server/jobs/message-unread.server.job.tests.js
@@ -43,7 +43,7 @@ describe('Job: message unread', function () {
email: 'userfrom@test.com',
username: 'userfrom',
password: 'M3@n.jsI$Aw3$0m4',
- provider: 'local'
+ provider: 'local',
};
userFrom = new User(_userFrom);
@@ -66,7 +66,7 @@ describe('Job: message unread', function () {
email: 'userto@test.com',
username: 'userto',
password: 'M3@n.jsI$Aw3$0m4',
- provider: 'local'
+ provider: 'local',
};
userTo = new User(_userTo);
@@ -86,7 +86,7 @@ describe('Job: message unread', function () {
userTo: userToId,
content: 'a message',
read: false,
- notificationCount: 0
+ notificationCount: 0,
};
message = new Message(_message);
@@ -165,7 +165,7 @@ describe('Job: message unread', function () {
email: 'user3@test.com',
username: 'user3',
password: 'M3@n.jsI$Aw3$0m4',
- provider: 'local'
+ provider: 'local',
};
const user3 = new User(_user3);
user3.save(function (err, user) {
@@ -317,7 +317,7 @@ describe('Job: message unread', function () {
userTo: _message.userFrom,
content: 'a message before',
read: true,
- notificationCount: 0
+ notificationCount: 0,
});
messageBefore.save(function (err) {
@@ -365,7 +365,7 @@ describe('Job: message unread', function () {
userTo: _message.userTo,
content: 'a message before',
read: true,
- notificationCount: 0
+ notificationCount: 0,
});
messageBefore.save(function (err) {
diff --git a/modules/messages/tests/server/message-stat-integration.server.service.tests.js b/modules/messages/tests/server/message-stat-integration.server.service.tests.js
index 9b3d00898f..1cd076e7b0 100644
--- a/modules/messages/tests/server/message-stat-integration.server.service.tests.js
+++ b/modules/messages/tests/server/message-stat-integration.server.service.tests.js
@@ -48,7 +48,7 @@ describe('Integration of the MessageStat service', function () {
password: 'password123',
provider: 'local',
public: true,
- description: _.repeat('.', config.profileMinimumLength)
+ description: _.repeat('.', config.profileMinimumLength),
});
user2 = new User({
@@ -59,7 +59,7 @@ describe('Integration of the MessageStat service', function () {
username: 'username2',
password: 'password123',
provider: 'local',
- public: true
+ public: true,
});
// save those users to mongoDB
@@ -97,12 +97,12 @@ describe('Integration of the MessageStat service', function () {
const req = {
user: {
- _id: user1._id
+ _id: user1._id,
},
body: {
userTo: String(user2._id),
- content: _.repeat('.', config.limits.longMessageMinimumLength - 1)
- }
+ content: _.repeat('.', config.limits.longMessageMinimumLength - 1),
+ },
};
const res = new Res();
diff --git a/modules/messages/tests/server/message-stat.server.model.tests.js b/modules/messages/tests/server/message-stat.server.model.tests.js
index 7270ec713e..97433744c5 100644
--- a/modules/messages/tests/server/message-stat.server.model.tests.js
+++ b/modules/messages/tests/server/message-stat.server.model.tests.js
@@ -27,7 +27,7 @@ describe('MessageStats Model', function () {
email: 'test1@test.com',
username: 'username1',
password: 'password123',
- provider: 'local'
+ provider: 'local',
});
user1 = new User({
@@ -37,14 +37,14 @@ describe('MessageStats Model', function () {
email: 'test2@test.com',
username: 'username2',
password: 'password123',
- provider: 'local'
+ provider: 'local',
});
message = new Message({
content: 'Message content',
userFrom: user0._id,
userTo: user1._id,
- read: false
+ read: false,
});
});
@@ -57,7 +57,7 @@ describe('MessageStats Model', function () {
firstMessageUserFrom: user0._id,
firstMessageUserTo: user1._id,
firstMessageCreated: message.created,
- firstMessageLength: message.content.length
+ firstMessageLength: message.content.length,
});
messageStat.should.have.property('_id');
@@ -83,7 +83,7 @@ describe('MessageStats Model', function () {
firstMessageUserFrom: user0._id,
firstMessageUserTo: user1._id,
firstMessageCreated: message.created,
- firstMessageLength: message.content.length
+ firstMessageLength: message.content.length,
});
messageStat.save(function (err) {
diff --git a/modules/messages/tests/server/message-stat.server.routes.tests.js b/modules/messages/tests/server/message-stat.server.routes.tests.js
index ebe312bc73..b02af41781 100644
--- a/modules/messages/tests/server/message-stat.server.routes.tests.js
+++ b/modules/messages/tests/server/message-stat.server.routes.tests.js
@@ -36,7 +36,7 @@ describe('Display Message Statistics in User Route', function () {
username: 'username' + i,
password: password,
provider: 'local',
- public: true
+ public: true,
}));
}
@@ -72,7 +72,7 @@ describe('Display Message Statistics in User Route', function () {
firstMessageLength: 100,
firstReplyCreated: i < repliedCount ? new Date(firstCreated + replyTime) : null,
firstReplyLength: i < repliedCount ? 50 : null,
- timeToFirstReply: i < repliedCount ? replyTime : null
+ timeToFirstReply: i < repliedCount ? replyTime : null,
}));
// increment the userFrom
@@ -105,7 +105,7 @@ describe('Display Message Statistics in User Route', function () {
},
function (cb) {
MessageStat.deleteMany().exec(cb);
- }
+ },
], done);
});
diff --git a/modules/messages/tests/server/message-stat.server.service.tests.js b/modules/messages/tests/server/message-stat.server.service.tests.js
index f7bef62106..4ff0629253 100644
--- a/modules/messages/tests/server/message-stat.server.service.tests.js
+++ b/modules/messages/tests/server/message-stat.server.service.tests.js
@@ -19,7 +19,7 @@ describe('Convert Message Statistics to human readable form', function () {
it('should convert null values correctly', function () {
const converted = messageStatService.formatStats({
replyRate: null,
- replyTime: null
+ replyTime: null,
});
converted.should.have.property('replyRate', '');
@@ -29,7 +29,7 @@ describe('Convert Message Statistics to human readable form', function () {
it('should convert finite values correctly', function () {
const converted = messageStatService.formatStats({
replyRate: 0.37631,
- replyTime: 3600 * 1000 * 3.7
+ replyTime: 3600 * 1000 * 3.7,
});
converted.should.have.property('replyRate', '38%');
@@ -54,7 +54,7 @@ describe('Count Message Statistics of User', function () {
username: 'username' + i,
password: 'password123',
provider: 'local',
- public: true
+ public: true,
}));
}
@@ -89,7 +89,7 @@ describe('Count Message Statistics of User', function () {
firstMessageLength: 100,
firstReplyCreated: i < repliedCount ? new Date(firstCreated + replyTime) : null,
firstReplyLength: i < repliedCount ? 50 : null,
- timeToFirstReply: i < repliedCount ? replyTime : null
+ timeToFirstReply: i < repliedCount ? replyTime : null,
}));
// increment the userFrom
++userno;
@@ -125,7 +125,7 @@ describe('Count Message Statistics of User', function () {
},
function (cb) {
MessageStat.deleteMany().exec(cb);
- }
+ },
], done);
});
@@ -240,7 +240,7 @@ describe('MessageStat Creation & Updating Test', function () {
username: 'username1',
password: 'password123',
provider: 'local',
- public: true
+ public: true,
});
// create the receiver (User)
@@ -252,7 +252,7 @@ describe('MessageStat Creation & Updating Test', function () {
username: 'username2',
password: 'password123',
provider: 'local',
- public: true
+ public: true,
});
// create a first message
@@ -260,14 +260,14 @@ describe('MessageStat Creation & Updating Test', function () {
content: 'Message content',
userFrom: initiator._id,
userTo: receiver._id,
- created: new Date('2016-01-01')
+ created: new Date('2016-01-01'),
});
// create a first reply
firstReply = new Message({
content: 'Message content',
userFrom: receiver._id,
userTo: initiator._id,
- created: new Date('2016-01-02')
+ created: new Date('2016-01-02'),
});
// create a message by initiator
@@ -275,14 +275,14 @@ describe('MessageStat Creation & Updating Test', function () {
content: 'Message content',
userFrom: initiator._id,
userTo: receiver._id,
- created: new Date('2016-01-03')
+ created: new Date('2016-01-03'),
});
// create a message by receiver
receiverMessage = new Message({
content: 'Message content',
userFrom: receiver._id,
userTo: initiator._id,
- created: new Date('2016-01-04')
+ created: new Date('2016-01-04'),
});
});
@@ -297,7 +297,7 @@ describe('MessageStat Creation & Updating Test', function () {
},
function (cb) {
MessageStat.deleteMany().exec(cb);
- }
+ },
], done);
});
@@ -329,13 +329,13 @@ describe('MessageStat Creation & Updating Test', function () {
$or: [
{
firstMessageUserFrom: initiator._id,
- firstMessageUserTo: receiver._id
+ firstMessageUserTo: receiver._id,
},
{
firstMessageUserFrom: receiver._id,
- firstMessageUserTo: initiator._id
- }
- ]
+ firstMessageUserTo: initiator._id,
+ },
+ ],
}, cb);
} catch (e) {
cb(e);
@@ -354,7 +354,7 @@ describe('MessageStat Creation & Updating Test', function () {
} catch (e) {
if (e) return cb(e);
}
- }
+ },
], done);
});
@@ -399,13 +399,13 @@ describe('MessageStat Creation & Updating Test', function () {
$or: [
{
firstMessageUserFrom: initiator._id,
- firstMessageUserTo: receiver._id
+ firstMessageUserTo: receiver._id,
},
{
firstMessageUserFrom: receiver._id,
- firstMessageUserTo: initiator._id
- }
- ]
+ firstMessageUserTo: initiator._id,
+ },
+ ],
}, cb);
} catch (e) {
cb(e);
@@ -428,7 +428,7 @@ describe('MessageStat Creation & Updating Test', function () {
} catch (e) {
if (e) return cb(e);
}
- }
+ },
], done);
});
@@ -473,13 +473,13 @@ describe('MessageStat Creation & Updating Test', function () {
$or: [
{
firstMessageUserFrom: initiator._id,
- firstMessageUserTo: receiver._id
+ firstMessageUserTo: receiver._id,
},
{
firstMessageUserFrom: receiver._id,
- firstMessageUserTo: initiator._id
- }
- ]
+ firstMessageUserTo: initiator._id,
+ },
+ ],
}, cb);
} catch (e) {
cb(e);
@@ -501,7 +501,7 @@ describe('MessageStat Creation & Updating Test', function () {
} catch (e) {
if (e) return cb(e);
}
- }
+ },
], done);
});
@@ -558,13 +558,13 @@ describe('MessageStat Creation & Updating Test', function () {
$or: [
{
firstMessageUserFrom: initiator._id,
- firstMessageUserTo: receiver._id
+ firstMessageUserTo: receiver._id,
},
{
firstMessageUserFrom: receiver._id,
- firstMessageUserTo: initiator._id
- }
- ]
+ firstMessageUserTo: initiator._id,
+ },
+ ],
}, cb);
} catch (e) {
cb(e);
@@ -584,7 +584,7 @@ describe('MessageStat Creation & Updating Test', function () {
} catch (e) {
if (e) return cb(e);
}
- }
+ },
], done);
});
@@ -640,13 +640,13 @@ describe('MessageStat Creation & Updating Test', function () {
$or: [
{
firstMessageUserFrom: initiator._id,
- firstMessageUserTo: receiver._id
+ firstMessageUserTo: receiver._id,
},
{
firstMessageUserFrom: receiver._id,
- firstMessageUserTo: initiator._id
- }
- ]
+ firstMessageUserTo: initiator._id,
+ },
+ ],
}, cb);
} catch (e) {
cb(e);
@@ -666,7 +666,7 @@ describe('MessageStat Creation & Updating Test', function () {
} catch (e) {
if (e) return cb(e);
}
- }
+ },
], done);
});
@@ -706,13 +706,13 @@ describe('MessageStat Creation & Updating Test', function () {
$or: [
{
firstMessageUserFrom: initiator._id,
- firstMessageUserTo: receiver._id
+ firstMessageUserTo: receiver._id,
},
{
firstMessageUserFrom: receiver._id,
- firstMessageUserTo: initiator._id
- }
- ]
+ firstMessageUserTo: initiator._id,
+ },
+ ],
}, cb);
} catch (e) {
cb(e);
@@ -728,7 +728,7 @@ describe('MessageStat Creation & Updating Test', function () {
} catch (e) {
if (e) return cb(e);
}
- }
+ },
], done);
});
diff --git a/modules/messages/tests/server/message-to-stats-integration.server.service.tests.js b/modules/messages/tests/server/message-to-stats-integration.server.service.tests.js
index 274837dab2..6fc6d695c7 100644
--- a/modules/messages/tests/server/message-to-stats-integration.server.service.tests.js
+++ b/modules/messages/tests/server/message-to-stats-integration.server.service.tests.js
@@ -51,7 +51,7 @@ describe('Message to Stats API server service Integration Test', function () {
password: 'password123',
provider: 'local',
public: true,
- description: _.repeat('.', config.profileMinimumLength)
+ description: _.repeat('.', config.profileMinimumLength),
});
user2 = new User({
@@ -62,7 +62,7 @@ describe('Message to Stats API server service Integration Test', function () {
username: 'username2',
password: 'password123',
provider: 'local',
- public: true
+ public: true,
});
// save those users to mongoDB
@@ -105,12 +105,12 @@ describe('Message to Stats API server service Integration Test', function () {
const req = {
user: {
- _id: user1._id
+ _id: user1._id,
},
body: {
userTo: String(user2._id),
- content: _.repeat('.', config.limits.longMessageMinimumLength - 1)
- }
+ content: _.repeat('.', config.limits.longMessageMinimumLength - 1),
+ },
};
const res = new Res();
@@ -127,7 +127,7 @@ describe('Message to Stats API server service Integration Test', function () {
host: 'localhost',
port: 4242,
protocol: 'http',
- database: 'will-never-be-reached'
+ database: 'will-never-be-reached',
});
});
diff --git a/modules/messages/tests/server/message-to-stats.server.service.tests.js b/modules/messages/tests/server/message-to-stats.server.service.tests.js
index 91eb9c37dd..feb3a7a548 100644
--- a/modules/messages/tests/server/message-to-stats.server.service.tests.js
+++ b/modules/messages/tests/server/message-to-stats.server.service.tests.js
@@ -32,7 +32,7 @@ describe('Message to stats server service Unit Tests:', function () {
email: 'user1@test.com',
username: 'username1',
password: 'password123',
- provider: 'local'
+ provider: 'local',
});
user2 = new User({
@@ -42,7 +42,7 @@ describe('Message to stats server service Unit Tests:', function () {
email: 'user2@test.com',
username: 'username2',
password: 'password123',
- provider: 'local'
+ provider: 'local',
});
// save those users to mongoDB
@@ -84,7 +84,7 @@ describe('Message to stats server service Unit Tests:', function () {
message1to2 = new Message({
userFrom: user1._id,
userTo: user2._id,
- content: 'message content'
+ content: 'message content',
});
done();
}, 2);
@@ -95,7 +95,7 @@ describe('Message to stats server service Unit Tests:', function () {
message2to1 = new Message({
userFrom: user2._id,
userTo: user1._id,
- content: 'message content'
+ content: 'message content',
});
done();
}, 2);
@@ -106,7 +106,7 @@ describe('Message to stats server service Unit Tests:', function () {
shortMessage = new Message({
userFrom: user1._id,
userTo: user2._id,
- content: shortMsgContent
+ content: shortMsgContent,
});
done();
}, 2);
@@ -117,7 +117,7 @@ describe('Message to stats server service Unit Tests:', function () {
longMessage = new Message({
userFrom: user2._id,
userTo: user1._id,
- content: longMsgContent
+ content: longMsgContent,
});
done();
}, 2);
@@ -129,7 +129,7 @@ describe('Message to stats server service Unit Tests:', function () {
function (msg, callback) {
msg.save(callback);
}, done);
- }
+ },
], done);
});
diff --git a/modules/messages/tests/server/message.server.model.tests.js b/modules/messages/tests/server/message.server.model.tests.js
index 86765106fc..25d7a1dead 100644
--- a/modules/messages/tests/server/message.server.model.tests.js
+++ b/modules/messages/tests/server/message.server.model.tests.js
@@ -27,7 +27,7 @@ describe('Message Model Unit Tests:', function () {
email: 'test1@test.com',
username: 'username1',
password: 'password123',
- provider: 'local'
+ provider: 'local',
});
userTo = new User({
firstName: 'Full',
@@ -36,7 +36,7 @@ describe('Message Model Unit Tests:', function () {
email: 'test2@test.com',
username: 'username2',
password: 'password123',
- provider: 'local'
+ provider: 'local',
});
// Create users
@@ -48,7 +48,7 @@ describe('Message Model Unit Tests:', function () {
message = new Message({
content: 'Message content',
userTo: userTo._id,
- read: false
+ read: false,
});
return done();
});
diff --git a/modules/messages/tests/server/message.server.routes.tests.js b/modules/messages/tests/server/message.server.routes.tests.js
index 887c4f529c..6658cc0c96 100644
--- a/modules/messages/tests/server/message.server.routes.tests.js
+++ b/modules/messages/tests/server/message.server.routes.tests.js
@@ -40,7 +40,7 @@ describe('Message CRUD tests', function () {
// Create userFrom credentials
credentials = {
username: 'username1',
- password: 'password123'
+ password: 'password123',
};
// Create a new user
@@ -53,7 +53,7 @@ describe('Message CRUD tests', function () {
password: credentials.password,
provider: 'local',
description: _.repeat('.', config.profileMinimumLength),
- public: true
+ public: true,
});
userTo = new User({
@@ -65,7 +65,7 @@ describe('Message CRUD tests', function () {
password: 'password123',
provider: 'local',
description: _.repeat('.', config.profileMinimumLength),
- public: true
+ public: true,
});
// Save users to the test db and create new message
@@ -78,7 +78,7 @@ describe('Message CRUD tests', function () {
// Create message
message = {
content: 'Message content',
- userTo: userToId
+ userTo: userToId,
};
return done();
});
@@ -402,7 +402,7 @@ describe('Message CRUD tests', function () {
}
});
- }
+ },
);
});
@@ -569,7 +569,7 @@ describe('Message CRUD tests', function () {
userTo: userFromId,
created: new Date(),
read: true,
- notified: true
+ notified: true,
});
newMessage.save(function (newMessageErr, newMessageRes) {
@@ -582,7 +582,7 @@ describe('Message CRUD tests', function () {
userTo: userFromId,
updated: new Date(),
message: newMessageRes._id,
- read: true
+ read: true,
});
newThread.save(function (newThreadErr) {
@@ -674,7 +674,7 @@ describe('Message CRUD tests', function () {
userTo: userFromId,
created: new Date(),
read: false,
- notified: true
+ notified: true,
});
const newMessage2 = new Message({
content: 'Another one!',
@@ -682,7 +682,7 @@ describe('Message CRUD tests', function () {
userTo: userFromId,
created: new Date(),
read: false,
- notified: true
+ notified: true,
});
newMessage1.save(function (newMessage1Err) {
@@ -700,7 +700,7 @@ describe('Message CRUD tests', function () {
userTo: userFromId,
updated: new Date(),
message: newMessage2Res._id,
- read: false
+ read: false,
});
newThread.save(function (newThreadErr) {
@@ -756,7 +756,7 @@ describe('Message CRUD tests', function () {
userTo: userToId,
created: moment('2016-06-06 19:00:00.174Z').toDate(),
read: false,
- notified: true
+ notified: true,
});
const newMessage2 = new Message({
content: 'Two',
@@ -764,7 +764,7 @@ describe('Message CRUD tests', function () {
userTo: userToId,
created: moment('2016-06-06 19:00:00.174Z').add(30, 'minutes').toDate(),
read: false,
- notified: true
+ notified: true,
});
newMessage1.save(function (newMessage1Err) {
@@ -782,7 +782,7 @@ describe('Message CRUD tests', function () {
userTo: userToId,
updated: moment('2016-06-06 19:00:00.174Z').add(30, 'minutes').toDate(),
message: newMessage2Res._id,
- read: false
+ read: false,
});
newThread.save(function (newThreadErr) {
@@ -859,7 +859,7 @@ describe('Message CRUD tests', function () {
userTo: userFromId,
created: moment('2016-06-06 19:00:00.174Z').toDate(),
read: false,
- notified: true
+ notified: true,
});
const newMessage2 = new Message({
content: 'Two',
@@ -867,7 +867,7 @@ describe('Message CRUD tests', function () {
userTo: userFromId,
created: moment('2016-06-06 19:00:00.174Z').add(30, 'minutes').toDate(),
read: false,
- notified: true
+ notified: true,
});
newMessage1.save(function (newMessage1Err) {
@@ -885,7 +885,7 @@ describe('Message CRUD tests', function () {
userTo: userFromId,
updated: new Date(),
message: newMessage2Res._id,
- read: false
+ read: false,
});
newThread.save(function (newThreadErr) {
diff --git a/modules/offers/client/components/OfferLocation.component.js b/modules/offers/client/components/OfferLocation.component.js
index 40e011900e..1813388314 100644
--- a/modules/offers/client/components/OfferLocation.component.js
+++ b/modules/offers/client/components/OfferLocation.component.js
@@ -10,7 +10,7 @@ export default class OfferLocation extends React.Component {
this.state = {
zoom: 13,
- windowWidth: 0
+ windowWidth: 0,
};
this.handleChangeZoom = this.handleChangeZoom.bind(this);
@@ -52,7 +52,7 @@ export default class OfferLocation extends React.Component {
}
OfferLocation.propTypes = {
- offer: PropTypes.object.isRequired
+ offer: PropTypes.object.isRequired,
};
function getOfferMarkerType(offer) {
diff --git a/modules/offers/client/components/OfferLocationPresentational.js b/modules/offers/client/components/OfferLocationPresentational.js
index 8d13f0b9e0..d68ac560e7 100644
--- a/modules/offers/client/components/OfferLocationPresentational.js
+++ b/modules/offers/client/components/OfferLocationPresentational.js
@@ -101,7 +101,7 @@ function getIcon(marker, windowWidth) {
iconRetinaUrl: getMarkerUrl(marker),
iconAnchor: [iconSize / 2, iconSize / 2],
iconSize: [iconSize, iconSize],
- ariaLabel: getAriaLabel(marker)
+ ariaLabel: getAriaLabel(marker),
});
}
@@ -110,5 +110,5 @@ OfferLocationPresentational.propTypes = {
location: PropTypes.array.isRequired,
onChangeZoom: PropTypes.func.isRequired,
marker: PropTypes.string,
- windowWidth: PropTypes.number.isRequired
+ windowWidth: PropTypes.number.isRequired,
};
diff --git a/modules/offers/client/config/offers.client.routes.js b/modules/offers/client/config/offers.client.routes.js
index c1baec11dc..062a4ef53e 100644
--- a/modules/offers/client/config/offers.client.routes.js
+++ b/modules/offers/client/config/offers.client.routes.js
@@ -26,8 +26,8 @@
defaultLocation: function (LocationService) {
// Returns `{lat: Float, lng: Float, zoom: 4}`
return LocationService.getDefaultLocation(4);
- }
- }
+ },
+ },
}).
state('offer.host', {
url: '/host',
@@ -43,10 +43,10 @@
offers: function (OffersByService, Authentication) {
return OffersByService.query({
userId: Authentication.user._id,
- types: 'host'
+ types: 'host',
});
- }
- }
+ },
+ },
}).
state('offer.host.edit', {
url: '?status',
@@ -56,8 +56,8 @@
controller: 'OfferHostEditController',
controllerAs: 'offerHostEdit',
data: {
- pageTitle: 'Host travellers'
- }
+ pageTitle: 'Host travellers',
+ },
}).
state('offer.meet', {
url: '/meet',
@@ -65,7 +65,7 @@
requiresAuth: true,
template: '',
controller: 'OfferController',
- controllerAs: 'offer'
+ controllerAs: 'offer',
}).
state('offer.meet.list', {
url: '',
@@ -74,7 +74,7 @@
controller: 'OfferListMeetController',
controllerAs: 'offerListMeet',
data: {
- pageTitle: 'Meet'
+ pageTitle: 'Meet',
},
resolve: {
// A string value resolves to a service
@@ -83,10 +83,10 @@
offers: function (OffersByService, Authentication) {
return OffersByService.query({
userId: Authentication.user._id,
- types: 'meet'
+ types: 'meet',
});
- }
- }
+ },
+ },
}).
state('offer.meet.add', {
url: '/add',
@@ -96,8 +96,8 @@
controller: 'OfferMeetAddController',
controllerAs: 'offerMeet',
data: {
- pageTitle: 'Add meeting offer'
- }
+ pageTitle: 'Add meeting offer',
+ },
}).
state('offer.meet.edit', {
url: '/:offerId',
@@ -107,17 +107,17 @@
controller: 'OfferMeetEditController',
controllerAs: 'offerMeet',
data: {
- pageTitle: 'Edit meeting offer'
+ pageTitle: 'Edit meeting offer',
},
resolve: {
- offer: getOffer
- }
+ offer: getOffer,
+ },
});
/* @ngInject */
function getOffer($stateParams, OffersService) {
return OffersService.get({
- offerId: $stateParams.offerId
+ offerId: $stateParams.offerId,
}).$promise;
}
diff --git a/modules/offers/client/controllers/offer-host-edit.client.controller.js b/modules/offers/client/controllers/offer-host-edit.client.controller.js
index 2c497b0588..c371b0c83c 100644
--- a/modules/offers/client/controllers/offer-host-edit.client.controller.js
+++ b/modules/offers/client/controllers/offer-host-edit.client.controller.js
@@ -34,7 +34,7 @@
description: '',
noOfferDescription: '',
location: defaultLocation,
- maxGuests: 1
+ maxGuests: 1,
};
// Make sure offer is there
@@ -133,7 +133,7 @@
$analytics.eventTrack('offer-modified', {
category: 'offer.edit',
label: 'Modified offer',
- value: vm.offer.status
+ value: vm.offer.status,
});
if ($window.innerWidth < 768) {
$state.go('profile.accommodation', { username: Authentication.user.username });
diff --git a/modules/offers/client/controllers/offer-host-view.client.controller.js b/modules/offers/client/controllers/offer-host-view.client.controller.js
index b733f873ae..01cebec80a 100644
--- a/modules/offers/client/controllers/offer-host-view.client.controller.js
+++ b/modules/offers/client/controllers/offer-host-view.client.controller.js
@@ -29,7 +29,7 @@
if ($scope.profileCtrl.profile && $scope.profileCtrl.profile.$resolved && $scope.profileCtrl.profile._id) {
OffersByService.query({
userId: $scope.profileCtrl.profile._id,
- types: 'host'
+ types: 'host',
}, function (offers) {
if (!offers || !offers.length) {
return;
diff --git a/modules/offers/client/controllers/offer-meet-add.client.controller.js b/modules/offers/client/controllers/offer-meet-add.client.controller.js
index de242d3895..7504a83f85 100644
--- a/modules/offers/client/controllers/offer-meet-add.client.controller.js
+++ b/modules/offers/client/controllers/offer-meet-add.client.controller.js
@@ -38,7 +38,7 @@
type: 'meet',
description: vm.offer.description,
location: [parseFloat(vm.mapCenter.lat), parseFloat(vm.mapCenter.lng)],
- validUntil: vm.offer.validUntil
+ validUntil: vm.offer.validUntil,
});
newOffer.$save(function () {
@@ -46,7 +46,7 @@
vm.isLoading = false;
$analytics.eventTrack('offer-modified', {
category: 'offer.meet.add',
- label: 'Added meet offer'
+ label: 'Added meet offer',
});
$state.go('offer.meet.list');
}, function (err) {
diff --git a/modules/offers/client/controllers/offer-meet-edit.client.controller.js b/modules/offers/client/controllers/offer-meet-edit.client.controller.js
index 859027f0d8..3b83e3cae2 100644
--- a/modules/offers/client/controllers/offer-meet-edit.client.controller.js
+++ b/modules/offers/client/controllers/offer-meet-edit.client.controller.js
@@ -67,7 +67,7 @@
// Done!
$analytics.eventTrack('offer-modified', {
category: 'offer.meet.update',
- label: 'Updated meet offer'
+ label: 'Updated meet offer',
});
// If offer already has id, add it to URL
diff --git a/modules/offers/client/controllers/offer-meet-list.client.controller.js b/modules/offers/client/controllers/offer-meet-list.client.controller.js
index 297b4ca6b9..b7868cf92b 100644
--- a/modules/offers/client/controllers/offer-meet-list.client.controller.js
+++ b/modules/offers/client/controllers/offer-meet-list.client.controller.js
@@ -47,14 +47,14 @@
// title: 'Are you sure?',
text: 'Are you sure you want to remove this?',
ok: 'Remove',
- cancel: 'Cancel'
+ cancel: 'Cancel',
})
// If user pressed "continue", create another state go
.then(function () {
new OffersService(offer).$delete(function () {
$analytics.eventTrack('offer-delete', {
category: 'offer.meet.delete',
- label: 'Removed meet offer'
+ label: 'Removed meet offer',
});
// Remove `offer` from `vm.offers` array
diff --git a/modules/offers/client/controllers/offer.client.controller.js b/modules/offers/client/controllers/offer.client.controller.js
index 196c93a3c9..6c2ab72bd6 100644
--- a/modules/offers/client/controllers/offer.client.controller.js
+++ b/modules/offers/client/controllers/offer.client.controller.js
@@ -28,8 +28,8 @@
baselayers: MapLayersFactory.getLayers({
streets: true,
satellite: false,
- outdoors: false
- })
+ outdoors: false,
+ }),
};
vm.mapDefaults = {
scrollWheelZoom: false,
@@ -40,9 +40,9 @@
layers: {
visible: false,
position: 'bottomleft',
- collapsed: false
- }
- }
+ collapsed: false,
+ },
+ },
};
}
diff --git a/modules/offers/client/directives/tr-offer-host-view.client.directive.js b/modules/offers/client/directives/tr-offer-host-view.client.directive.js
index de8a6ba1be..b8cc20ad48 100644
--- a/modules/offers/client/directives/tr-offer-host-view.client.directive.js
+++ b/modules/offers/client/directives/tr-offer-host-view.client.directive.js
@@ -10,11 +10,11 @@
replace: true,
scope: {
profile: '=trOfferHostView', // Profile who's offer to load
- authUser: '=trOfferHostViewAuthUser' // Currently authenticated user
+ authUser: '=trOfferHostViewAuthUser', // Currently authenticated user
},
templateUrl: '/modules/offers/views/directives/tr-offer-host-view.client.view.html',
controller: trOfferHostViewDirectiveController,
- controllerAs: 'trOfferHost'
+ controllerAs: 'trOfferHost',
};
return directive;
@@ -60,7 +60,7 @@
OffersByService.query({
userId: String(profile._id),
- types: 'host'
+ types: 'host',
}, function (offers) {
if (!offers || !offers.length) {
diff --git a/modules/offers/client/directives/tr-offer-valid-until.client.directive.js b/modules/offers/client/directives/tr-offer-valid-until.client.directive.js
index 5f27e6c1ab..4e499fa909 100644
--- a/modules/offers/client/directives/tr-offer-valid-until.client.directive.js
+++ b/modules/offers/client/directives/tr-offer-valid-until.client.directive.js
@@ -13,11 +13,11 @@
restrict: 'A',
replace: false,
scope: {
- validUntil: '=trOfferValidUntil'
+ validUntil: '=trOfferValidUntil',
},
templateUrl: '/modules/offers/views/directives/tr-offer-valid-until.view.client.html',
controller: trOfferValidUntilDirectiveController,
- controllerAs: 'trOfferValidUntil'
+ controllerAs: 'trOfferValidUntil',
};
return directive;
@@ -40,7 +40,7 @@
'A week': 7,
'Two weeks': 14,
'Three weeks': 23,
- 'A month': 30
+ 'A month': 30,
};
// Options for Angular-UI Bootstrap datepicker
@@ -50,7 +50,7 @@
maxDate: moment().add(appSettings.limits.maxOfferValidFromNow || { days: 30 }).toDate(),
minDate: new Date(), // @TODO: this could be server date instead of client date
startingDay: 1, // Start week on Monday
- maxMode: 'month' // Disable year selector
+ maxMode: 'month', // Disable year selector
};
activate();
diff --git a/modules/offers/client/services/offers-by.client.service.js b/modules/offers/client/services/offers-by.client.service.js
index 7d3aa77b3e..7aee3d40fd 100644
--- a/modules/offers/client/services/offers-by.client.service.js
+++ b/modules/offers/client/services/offers-by.client.service.js
@@ -9,12 +9,12 @@
/* @ngInject */
function OffersByService($resource) {
return $resource('/api/offers-by/:userId', {
- userId: '@id'
+ userId: '@id',
}, {
query: {
method: 'GET',
- isArray: true
- }
+ isArray: true,
+ },
});
}
}());
diff --git a/modules/offers/client/services/offers.client.service.js b/modules/offers/client/services/offers.client.service.js
index 42946419af..232b4e93b2 100644
--- a/modules/offers/client/services/offers.client.service.js
+++ b/modules/offers/client/services/offers.client.service.js
@@ -7,28 +7,28 @@
/* @ngInject */
function OffersService($resource) {
const Offer = $resource('/api/offers/:offerId', {
- offerId: '@_id'
+ offerId: '@_id',
}, {
get: {
method: 'GET',
- cancellable: true
+ cancellable: true,
},
update: {
- method: 'PUT'
+ method: 'PUT',
},
save: {
- method: 'POST'
+ method: 'POST',
},
delete: {
- method: 'DELETE'
- }
+ method: 'DELETE',
+ },
});
angular.extend(Offer.prototype, {
createOrUpdate: function () {
const offer = this;
return createOrUpdate(offer);
- }
+ },
});
return Offer;
diff --git a/modules/offers/server/controllers/offers.server.controller.js b/modules/offers/server/controllers/offers.server.controller.js
index 868a0cd786..6feb667b35 100644
--- a/modules/offers/server/controllers/offers.server.controller.js
+++ b/modules/offers/server/controllers/offers.server.controller.js
@@ -27,7 +27,7 @@ const publicOfferFields = [
'maxGuests',
'location',
'updated',
- 'validUntil'
+ 'validUntil',
];
// Offer fields users can modify
@@ -37,7 +37,7 @@ const allowedOfferFields = [
'noOfferDescription',
'maxGuests',
'location',
- 'validUntil'
+ 'validUntil',
];
/**
@@ -173,21 +173,21 @@ function isValidUntil(validUntil) {
exports.create = function (req, res) {
if (!req.user) {
return res.status(403).send({
- message: errorService.getErrorMessageByKey('forbidden')
+ message: errorService.getErrorMessageByKey('forbidden'),
});
}
// Validate type
if (!req.body.type || !isValidOfferType(req.body.type)) {
return res.status(400).send({
- message: 'Missing or invalid offer type.'
+ message: 'Missing or invalid offer type.',
});
}
// Missing required fields
if (!req.body.location) {
return res.status(400).send({
- message: 'Missing offer location.'
+ message: 'Missing offer location.',
});
}
@@ -218,12 +218,12 @@ exports.create = function (req, res) {
offer.save(function (err) {
if (err) {
return res.status(400).send({
- message: 'Failed to save offer.'
+ message: 'Failed to save offer.',
});
}
res.json({
- message: 'Offer saved.'
+ message: 'Offer saved.',
});
});
};
@@ -240,21 +240,21 @@ exports.update = function (req, res) {
// User can modify only their own offers
if (!req.user || !req.offer.user._id.equals(req.user._id)) {
return res.status(403).send({
- message: errorService.getErrorMessageByKey('forbidden')
+ message: errorService.getErrorMessageByKey('forbidden'),
});
}
// Missing required fields
if (!req.body.location) {
return res.status(400).send({
- message: 'Missing offer location.'
+ message: 'Missing offer location.',
});
}
// Attempting to change offer type yelds error
if (req.body.type && req.body.type !== req.offer.type) {
return res.status(400).send({
- message: 'You cannot update offer type.'
+ message: 'You cannot update offer type.',
});
}
@@ -305,14 +305,14 @@ exports.update = function (req, res) {
// Done!
function () {
return res.json({
- message: 'Offer updated.'
+ message: 'Offer updated.',
});
- }
+ },
], function (err) {
if (err) {
return res.status(400).send({
- message: errorService.getErrorMessage(err)
+ message: errorService.getErrorMessage(err),
});
}
});
@@ -328,22 +328,22 @@ exports.delete = function (req, res) {
// User can remove only their own offers
if (!req.user || !req.offer.user._id.equals(req.user._id)) {
return res.status(403).send({
- message: errorService.getErrorMessageByKey('forbidden')
+ message: errorService.getErrorMessageByKey('forbidden'),
});
}
Offer.findOneAndRemove({
_id: req.offer._id,
- user: req.user._id
+ user: req.user._id,
}, function (err) {
if (err) {
return res.status(400).send({
- message: errorService.getErrorMessage(err)
+ message: errorService.getErrorMessage(err),
});
}
res.json({
- message: 'Offer removed.'
+ message: 'Offer removed.',
});
});
};
@@ -355,7 +355,7 @@ exports.list = function (req, res) {
if (!req.user) {
return res.status(403).send({
- message: errorService.getErrorMessageByKey('forbidden')
+ message: errorService.getErrorMessageByKey('forbidden'),
});
}
@@ -383,7 +383,7 @@ exports.list = function (req, res) {
if (!isCoordinatesValid) {
return res.status(400).send({
message: 'Invalid or missing coordinate. ' +
- 'Required coordinates: ' + coordinateKeys.join(', ') + '.'
+ 'Required coordinates: ' + coordinateKeys.join(', ') + '.',
});
}
@@ -395,7 +395,7 @@ exports.list = function (req, res) {
// Could not parse filters json string into object
if (!filters) {
return res.status(400).send({
- message: 'Could not parse filters.'
+ message: 'Could not parse filters.',
});
}
}
@@ -418,11 +418,11 @@ exports.list = function (req, res) {
// -> It's latitude first as in the database, not longitude first as in the documentation
$box: [
[parseFloat(req.query.southWestLat), parseFloat(req.query.southWestLng)],
- [parseFloat(req.query.northEastLat), parseFloat(req.query.northEastLng)]
- ]
- }
- }
- }
+ [parseFloat(req.query.northEastLat), parseFloat(req.query.northEastLng)],
+ ],
+ },
+ },
+ },
}];
// Status filter
@@ -432,9 +432,9 @@ exports.list = function (req, res) {
$or: [
{ status: 'yes' },
{ status: 'maybe' },
- { status: { $exists: false } }
- ]
- }
+ { status: { $exists: false } },
+ ],
+ },
});
// Don't return outdated offers
@@ -442,9 +442,9 @@ exports.list = function (req, res) {
$match: {
$or: [
{ validUntil: { $gte: new Date() } },
- { validUntil: { $exists: false } }
- ]
- }
+ { validUntil: { $exists: false } },
+ ],
+ },
});
// Types filter
@@ -461,9 +461,9 @@ exports.list = function (req, res) {
query.push({
$match: {
type: {
- $in: filterTypes
- }
- }
+ $in: filterTypes,
+ },
+ },
});
}
}
@@ -475,13 +475,13 @@ exports.list = function (req, res) {
from: 'users',
localField: 'user',
foreignField: '_id',
- as: 'user'
- }
+ as: 'user',
+ },
});
// Because above `$lookup` returns an array with one user
// `[{userObject}]`, we have to unwind it back to `{userObject}`
query.push({
- $unwind: '$user'
+ $unwind: '$user',
});
}
@@ -490,9 +490,9 @@ exports.list = function (req, res) {
query.push({
$match: {
'user.seen': {
- $gte: moment().subtract(filters.seen).toDate()
- }
- }
+ $gte: moment().subtract(filters.seen).toDate(),
+ },
+ },
});
}
@@ -514,9 +514,9 @@ exports.list = function (req, res) {
query.push({
$match: {
'user.languages': {
- $in: filterLanguages
- }
- }
+ $in: filterLanguages,
+ },
+ },
});
}
}
@@ -529,13 +529,13 @@ exports.list = function (req, res) {
// Return failure if tribe id is invalid, otherwise add id to query array
return mongoose.Types.ObjectId.isValid(tribeId) &&
tribeQueries.push({
- 'user.member.tribe': new mongoose.Types.ObjectId(tribeId)
+ 'user.member.tribe': new mongoose.Types.ObjectId(tribeId),
});
});
if (!isTribeFilterValid) {
return res.status(400).send({
- message: errorService.getErrorMessageByKey('invalid-id')
+ message: errorService.getErrorMessageByKey('invalid-id'),
});
}
@@ -544,13 +544,13 @@ exports.list = function (req, res) {
// Match multible tribes
query.push({
$match: {
- $or: tribeQueries
- }
+ $or: tribeQueries,
+ },
});
} else {
// Just one tribe
query.push({
- $match: tribeQueries[0]
+ $match: tribeQueries[0],
});
}
}
@@ -561,8 +561,8 @@ exports.list = function (req, res) {
_id: '$_id',
location: '$locationFuzzy',
status: '$status',
- type: '$type'
- }
+ type: '$type',
+ },
});
Offer
@@ -573,10 +573,10 @@ exports.list = function (req, res) {
}, function (err) {
// Log the failure
log('error', 'Querying for offers caused an error. #g28fb1', {
- error: err
+ error: err,
});
return res.status(400).send({
- message: errorService.getErrorMessage(err)
+ message: errorService.getErrorMessage(err),
});
});
};
@@ -601,7 +601,7 @@ exports.getOffer = function (req, res) {
// Don't proceed if offer doesn't have user
if (!req.offer || !req.offer.user || !req.offer.location) {
return res.status(404).send({
- message: errorService.getErrorMessageByKey('not-found')
+ message: errorService.getErrorMessageByKey('not-found'),
});
}
@@ -619,7 +619,7 @@ exports.getOffer = function (req, res) {
User.populate(offer.user, {
path: 'member.tribe',
select: tribes.tribeFields,
- model: 'Tribe'
+ model: 'Tribe',
// Not possible at the moment due bug in Mongoose
// http://mongoosejs.com/docs/faq.html#populate_sort_order
// https://github.com/Automattic/mongoose/issues/2202
@@ -638,16 +638,16 @@ exports.getOffer = function (req, res) {
offer = sanitizeOffer(offer, req.user._id);
res.json(offer);
- }
+ },
], function (err) {
if (err) {
// Something's wrong and we weren't prepared for itx
log('error', 'Failed to load offer. #g34gss', {
- error: err
+ error: err,
});
return res.status(400).send({
- message: errorService.getErrorMessageByKey('default')
+ message: errorService.getErrorMessageByKey('default'),
});
}
});
@@ -660,14 +660,14 @@ exports.offersByUserId = function (req, res, next, userId) {
// Authenticated user required
if (!req.user) {
return res.status(403).send({
- message: errorService.getErrorMessageByKey('forbidden')
+ message: errorService.getErrorMessageByKey('forbidden'),
});
}
// Validate userId is valid ObjectId
if (!mongoose.Types.ObjectId.isValid(userId)) {
return res.status(400).send({
- message: errorService.getErrorMessageByKey('invalid-id')
+ message: errorService.getErrorMessageByKey('invalid-id'),
});
}
@@ -676,8 +676,8 @@ exports.offersByUserId = function (req, res, next, userId) {
user: userId,
$or: [
{ validUntil: { $gte: new Date() } },
- { validUntil: { $exists: false } }
- ]
+ { validUntil: { $exists: false } },
+ ],
};
// Validate optional type parameter
@@ -726,7 +726,7 @@ exports.offersByUserId = function (req, res, next, userId) {
if (!offers || offers.length === 0) {
return res.status(404).send({
- message: errorService.getErrorMessageByKey('not-found')
+ message: errorService.getErrorMessageByKey('not-found'),
});
}
@@ -745,14 +745,14 @@ exports.offerById = function (req, res, next, offerId) {
// Require user
if (!req.user) {
return res.status(403).send({
- message: errorService.getErrorMessageByKey('forbidden')
+ message: errorService.getErrorMessageByKey('forbidden'),
});
}
// Not a valid ObjectId
if (!mongoose.Types.ObjectId.isValid(offerId)) {
return res.status(400).send({
- message: errorService.getErrorMessageByKey('invalid-id')
+ message: errorService.getErrorMessageByKey('invalid-id'),
});
}
@@ -767,13 +767,13 @@ exports.offerById = function (req, res, next, offerId) {
// No offer
if (err) {
log('error', 'Getting offer by id caused an error. #2kg3g3', {
- error: err
+ error: err,
});
}
if (err || !offer) {
return res.status(404).send({
- message: errorService.getErrorMessageByKey('not-found')
+ message: errorService.getErrorMessageByKey('not-found'),
});
}
@@ -787,12 +787,12 @@ exports.offerById = function (req, res, next, offerId) {
req.offer = offer;
done();
- }
+ },
], function (err) {
if (err) {
log('error', 'Getting offer by id caused an error. #g34gj3', {
- error: err
+ error: err,
});
}
return next(err);
@@ -805,7 +805,7 @@ exports.offerById = function (req, res, next, offerId) {
*/
exports.removeAllByUserId = function (userId, callback) {
Offer.deleteMany({
- user: userId
+ user: userId,
}, function (err) {
if (callback) {
callback(err);
diff --git a/modules/offers/server/jobs/reactivate-hosts.server.job.js b/modules/offers/server/jobs/reactivate-hosts.server.job.js
index 1897932bd6..b6d698e2eb 100644
--- a/modules/offers/server/jobs/reactivate-hosts.server.job.js
+++ b/modules/offers/server/jobs/reactivate-hosts.server.job.js
@@ -34,12 +34,12 @@ module.exports = function (job, agendaDone) {
type: 'host',
status: 'no',
updated: {
- $lt: updatedTimeAgo
+ $lt: updatedTimeAgo,
},
// Only offers we didn't notify yet
reactivateReminderSent: {
- $exists: false
- }
+ $exists: false,
+ },
})
.populate('user', 'public email firstName displayName')
.exec(function (err, offers) {
@@ -65,12 +65,12 @@ module.exports = function (job, agendaDone) {
offer._id,
{
$set: {
- reactivateReminderSent: new Date()
- }
+ reactivateReminderSent: new Date(),
+ },
},
function (err) {
callback(err);
- }
+ },
);
}
});
@@ -78,7 +78,7 @@ module.exports = function (job, agendaDone) {
done(err);
});
- }
+ },
], function (err) {
if (err) {
diff --git a/modules/offers/server/models/offer.server.model.js b/modules/offers/server/models/offer.server.model.js
index 83015e4b1a..740003bbb7 100644
--- a/modules/offers/server/models/offer.server.model.js
+++ b/modules/offers/server/models/offer.server.model.js
@@ -100,62 +100,62 @@ const OfferSchema = new Schema({
type: {
type: String,
enum: ['host', 'meet'],
- default: 'meet'
+ default: 'meet',
},
status: {
type: String,
enum: ['yes', 'maybe', 'no'],
- default: 'yes'
+ default: 'yes',
},
description: {
type: String,
default: '',
trim: true,
- set: textService.html
+ set: textService.html,
},
// This is shown on profiles when users say they are not hosting
noOfferDescription: {
type: String,
default: '',
trim: true,
- set: textService.html
+ set: textService.html,
},
maxGuests: {
type: Number,
min: 0,
max: 99,
- default: 1
+ default: 1,
},
// Actual location user has marked
location: {
type: [Number],
required: true,
validate: [validateLocation, 'Invalid coordinates for location.'],
- set: setLocation
+ set: setLocation,
},
// This is sent publicly to frontend;
// some 50-200m fuzzy presentation of actual location
locationFuzzy: {
- type: [Number]
+ type: [Number],
},
updated: {
type: Date,
- default: Date.now
+ default: Date.now,
},
createdAt: {
type: Date,
- default: Date.now
+ default: Date.now,
},
validUntil: {
- type: Date
+ type: Date,
},
user: {
type: Schema.ObjectId,
- ref: 'User'
+ ref: 'User',
},
reactivateReminderSent: {
- type: Date
- }
+ type: Date,
+ },
});
// Geospatial index (lat,lon)
diff --git a/modules/offers/server/policies/offers.server.policy.js b/modules/offers/server/policies/offers.server.policy.js
index a8643de1e7..ac4b5ff058 100644
--- a/modules/offers/server/policies/offers.server.policy.js
+++ b/modules/offers/server/policies/offers.server.policy.js
@@ -16,26 +16,26 @@ exports.invokeRolesPolicies = function () {
roles: ['admin'],
allows: [{
resources: '/api/offers',
- permissions: '*'
+ permissions: '*',
}, {
resources: '/api/offers-by/:offerUserId',
- permissions: '*'
+ permissions: '*',
}, {
resources: '/api/offers/:offerId',
- permissions: '*'
- }]
+ permissions: '*',
+ }],
}, {
roles: ['user'],
allows: [{
resources: '/api/offers',
- permissions: ['get', 'post']
+ permissions: ['get', 'post'],
}, {
resources: '/api/offers-by/:offerUserId',
- permissions: ['get']
+ permissions: ['get'],
}, {
resources: '/api/offers/:offerId',
- permissions: ['get', 'put', 'delete']
- }]
+ permissions: ['get', 'put', 'delete'],
+ }],
}]);
};
@@ -48,7 +48,7 @@ exports.isAllowed = function (req, res, next) {
// No offers for non-authenticated nor for authenticated but un-published users
if (!req.user || (req.user && !req.user.public)) {
return res.status(403).send({
- message: errorService.getErrorMessageByKey('forbidden')
+ message: errorService.getErrorMessageByKey('forbidden'),
});
}
@@ -64,7 +64,7 @@ exports.isAllowed = function (req, res, next) {
if (err) {
// An authorization error occurred.
return res.status(500).send({
- message: 'Unexpected authorization error'
+ message: 'Unexpected authorization error',
});
} else {
if (isAllowed) {
@@ -72,7 +72,7 @@ exports.isAllowed = function (req, res, next) {
return next();
} else {
return res.status(403).json({
- message: errorService.getErrorMessageByKey('forbidden')
+ message: errorService.getErrorMessageByKey('forbidden'),
});
}
}
diff --git a/modules/offers/tests/server/jobs/reactivate-hosts.server.job.tests.js b/modules/offers/tests/server/jobs/reactivate-hosts.server.job.tests.js
index 8758b7b375..ac612f383b 100644
--- a/modules/offers/tests/server/jobs/reactivate-hosts.server.job.tests.js
+++ b/modules/offers/tests/server/jobs/reactivate-hosts.server.job.tests.js
@@ -39,7 +39,7 @@ describe('Job: reactivate members with hosting offer status set to "no"', functi
email: 'test@test.com',
username: 'jobtester',
password: 'M3@n.jsI$Aw3$0m3',
- provider: 'local'
+ provider: 'local',
};
user = new User(_user);
@@ -60,7 +60,7 @@ describe('Job: reactivate members with hosting offer status set to "no"', functi
maxGuests: 1,
updated: moment().subtract(moment.duration(config.limits.timeToReactivateHosts)),
location: [52.498981209298776, 13.418329954147339],
- locationFuzzy: [52.50155039101136, 13.42255019882177]
+ locationFuzzy: [52.50155039101136, 13.42255019882177],
};
offerHost = new Offer(_offerHost);
@@ -171,7 +171,7 @@ describe('Job: reactivate members with hosting offer status set to "no"', functi
user: user._id,
updated: moment().subtract(moment.duration(config.limits.timeToReactivateHosts)),
location: [52.498981209298776, 13.418329954147339],
- locationFuzzy: [52.50155039101136, 13.42255019882177]
+ locationFuzzy: [52.50155039101136, 13.42255019882177],
};
const offerMeet = new Offer(_offerMeet);
diff --git a/modules/offers/tests/server/offer-search.server.routes.tests.js b/modules/offers/tests/server/offer-search.server.routes.tests.js
index 04ab56fc0d..dfb63e6ac1 100644
--- a/modules/offers/tests/server/offer-search.server.routes.tests.js
+++ b/modules/offers/tests/server/offer-search.server.routes.tests.js
@@ -40,7 +40,7 @@ const testLocations = {
'&northEastLng=18.73318142361111' +
'&southWestLat=44.66407507240992' +
'&southWestLng=3.689914279513889',
- location: [52.48556355813466, 13.489011526107788]
+ location: [52.48556355813466, 13.489011526107788],
},
'China': {
queryBoundingBox:
@@ -48,7 +48,7 @@ const testLocations = {
'&northEastLng=151.23828125000003' +
'&southWestLat=-3.9332268264771106' +
'&southWestLng=61.63281250000001',
- location: [34.632532, 103.767519]
+ location: [34.632532, 103.767519],
},
'US': {
queryBoundingBox:
@@ -56,7 +56,7 @@ const testLocations = {
'&northEastLng=-48.44921875000001' +
'&southWestLat=0.021065118766989688' +
'&southWestLng=-138.05468750000003',
- location: [40.514402, -88.990735]
+ location: [40.514402, -88.990735],
},
'NorthPole': {
queryBoundingBox:
@@ -64,8 +64,8 @@ const testLocations = {
'&northEastLng=145.61328125000003' +
'&southWestLat=78.02765497223292' +
'&southWestLng=56.00781250000001',
- location: [80.912672, 79.732322]
- }
+ location: [80.912672, 79.732322],
+ },
};
@@ -86,13 +86,13 @@ describe('Offer search tests', function () {
// Create user credentials
credentials = {
username: 'loremipsum',
- password: 'Password123!'
+ password: 'Password123!',
};
// Create user2 credentials
credentials2 = {
username: 'loremipsum2',
- password: 'Password123!'
+ password: 'Password123!',
};
// Create a new user
@@ -106,7 +106,7 @@ describe('Offer search tests', function () {
password: credentials.password,
provider: 'local',
public: true,
- seen: new Date()
+ seen: new Date(),
});
// Create a new user
@@ -121,7 +121,7 @@ describe('Offer search tests', function () {
languages: ['fin', 'ita'],
provider: 'local',
public: true,
- seen: new Date()
+ seen: new Date(),
});
// Create a new user
@@ -135,7 +135,7 @@ describe('Offer search tests', function () {
languages: ['ita'],
provider: 'local',
public: true,
- seen: new Date()
+ seen: new Date(),
});
// Used only for sending via POST and thus doesn't include some data
@@ -145,7 +145,7 @@ describe('Offer search tests', function () {
description: '1 I can host! :)
',
noOfferDescription: '1 I cannot host... :(
',
maxGuests: 5,
- location: testLocations.Europe.location
+ location: testLocations.Europe.location,
};
offer2 = new Offer({
@@ -155,7 +155,7 @@ describe('Offer search tests', function () {
noOfferDescription: '2 I cannot host... :(
',
maxGuests: 3,
updated: new Date(),
- location: [52.498981209298776, 13.418329954147339]
+ location: [52.498981209298776, 13.418329954147339],
});
offer3 = new Offer({
@@ -165,7 +165,7 @@ describe('Offer search tests', function () {
noOfferDescription: '3 I cannot host... :(
',
maxGuests: 1,
updated: new Date(),
- location: [52.498981209298775, 13.418329954147338]
+ location: [52.498981209298775, 13.418329954147338],
});
offerMeet = new Offer({
@@ -173,7 +173,7 @@ describe('Offer search tests', function () {
description: 'Dinner party!
',
validUntil: moment().add(30, 'day').toDate(),
updated: new Date(),
- location: [52.498981209298887, 13.418329954147449]
+ location: [52.498981209298887, 13.418329954147449],
});
tribe1 = new Tribe({
@@ -182,7 +182,7 @@ describe('Offer search tests', function () {
'color': '111111',
'tribe': true,
'count': 1,
- 'public': true
+ 'public': true,
});
tribe2 = new Tribe({
@@ -190,7 +190,7 @@ describe('Offer search tests', function () {
'label': 'tribe2',
'color': '222222',
'count': 1,
- 'public': true
+ 'public': true,
});
// Save data to the test db
@@ -219,7 +219,7 @@ describe('Offer search tests', function () {
function (done) {
user2.member = [{
tribe: tribe2Id,
- since: new Date()
+ since: new Date(),
}];
user2.save(function (err, user2res) {
user2Id = user2res._id;
@@ -230,7 +230,7 @@ describe('Offer search tests', function () {
function (done) {
user3.member = [{
tribe: tribe1Id,
- since: new Date()
+ since: new Date(),
}];
user3.save(function (err, user3res) {
user3Id = user3res._id;
@@ -252,7 +252,7 @@ describe('Offer search tests', function () {
offer3Id = offer3._id;
done(err);
});
- }
+ },
], function (err) {
should.not.exist(err);
doneBeforeEach(err);
@@ -272,7 +272,7 @@ describe('Offer search tests', function () {
'?northEastLat=32.89472514359572' +
'&northEastLng=25.598493303571427' +
'&southWestLat=-20.49068931208608' +
- '&southWestLng=-12.986188616071427'
+ '&southWestLng=-12.986188616071427',
)
.expect(200)
.end(function (offersGetErr, offersGetRes) {
@@ -302,7 +302,7 @@ describe('Offer search tests', function () {
'?northEastLat=+55.31212135084999' +
'&northEastLng=+18.73318142361111' +
'&southWestLat=+44.66407507240992' +
- '&southWestLng=+3.689914279513889'
+ '&southWestLng=+3.689914279513889',
)
.expect(200)
.end(function (offersGetErr, offersGetRes) {
@@ -331,7 +331,7 @@ describe('Offer search tests', function () {
agent.get('/api/offers' +
'?northEastLat=32.89472514359572' +
'&northEastLng=25.598493303571427' +
- '&southWestLat=-20.49068931208608'
+ '&southWestLat=-20.49068931208608',
)
.expect(400)
.end(done);
@@ -352,7 +352,7 @@ describe('Offer search tests', function () {
'?northEastLat=25.' + '1'.repeat(30) + 'foo' + // `foo` starts at 31
'&northEastLng=25.598493303571427' +
'&southWestLat=-20.49068931208608' +
- '&southWestLng=-12.986188616071427'
+ '&southWestLng=-12.986188616071427',
)
.expect(400)
.end(done);
@@ -373,7 +373,7 @@ describe('Offer search tests', function () {
'?northEastLat=FAIL' +
'&northEastLng=25.598493303571427' +
'&southWestLat=-20.49068931208608' +
- '&southWestLng=-12.986188616071427'
+ '&southWestLng=-12.986188616071427',
)
.expect(400)
.end(done);
@@ -581,7 +581,7 @@ describe('Offer search tests', function () {
// Get offers (around Berlin)
const filters = {
- types: ['host']
+ types: ['host'],
};
agent.get('/api/offers' + testLocations.Europe.queryBoundingBox + '&filters=' + encodeURIComponent(JSON.stringify(filters)))
.expect(200)
@@ -623,7 +623,7 @@ describe('Offer search tests', function () {
// Get offers (around Berlin)
const filters = {
- types: ['meet']
+ types: ['meet'],
};
agent.get('/api/offers' + testLocations.Europe.queryBoundingBox + '&filters=' + encodeURIComponent(JSON.stringify(filters)))
.expect(200)
@@ -656,7 +656,7 @@ describe('Offer search tests', function () {
// Get offers (around Berlin)
const filters = {
- types: ['foobar']
+ types: ['foobar'],
};
agent.get('/api/offers' + testLocations.Europe.queryBoundingBox + '&filters=' + encodeURIComponent(JSON.stringify(filters)))
.expect(200)
@@ -697,7 +697,7 @@ describe('Offer search tests', function () {
// Get offers (around Berlin)
const filters = {
- languages: ['fin']
+ languages: ['fin'],
};
agent.get('/api/offers' + testLocations.Europe.queryBoundingBox + '&filters=' + encodeURIComponent(JSON.stringify(filters)))
@@ -727,7 +727,7 @@ describe('Offer search tests', function () {
// Get offers (around Berlin)
const filters = {
- languages: ['fin', 'ita']
+ languages: ['fin', 'ita'],
};
agent.get('/api/offers' + testLocations.Europe.queryBoundingBox + '&filters=' + encodeURIComponent(JSON.stringify(filters)))
@@ -769,7 +769,7 @@ describe('Offer search tests', function () {
// Get offers (around Berlin)
const filters = {
- tribes: [tribe2Id]
+ tribes: [tribe2Id],
};
agent.get('/api/offers' + testLocations.Europe.queryBoundingBox + '&filters=' + encodeURIComponent(JSON.stringify(filters)))
.expect(200)
@@ -807,7 +807,7 @@ describe('Offer search tests', function () {
// Get offers (around Berlin)
const filters = {
- tribes: [tribe1Id, tribe2Id]
+ tribes: [tribe1Id, tribe2Id],
};
agent.get('/api/offers' + testLocations.Europe.queryBoundingBox + '&filters=' + encodeURIComponent(JSON.stringify(filters)))
.expect(200)
@@ -840,7 +840,7 @@ describe('Offer search tests', function () {
// Get offers (around Berlin)
const filters = {
- tribes: [tribe1Id, tribe2Id]
+ tribes: [tribe1Id, tribe2Id],
};
agent.get('/api/offers' + testLocations.Europe.queryBoundingBox + '&filters=' + encodeURIComponent(JSON.stringify(filters)))
.expect(200)
@@ -953,8 +953,8 @@ describe('Offer search tests', function () {
const filters = {
seen: {
- 'months': 1
- }
+ 'months': 1,
+ },
};
agent.get('/api/offers' + testLocations.Europe.queryBoundingBox + '&filters=' + encodeURIComponent(JSON.stringify(filters)))
diff --git a/modules/offers/tests/server/offer.server.model.tests.js b/modules/offers/tests/server/offer.server.model.tests.js
index 08d60df56a..f029794d2f 100644
--- a/modules/offers/tests/server/offer.server.model.tests.js
+++ b/modules/offers/tests/server/offer.server.model.tests.js
@@ -27,7 +27,7 @@ describe('Offer Model Unit Tests:', function () {
email: 'test1@test.com',
username: 'username1',
password: 'password123',
- provider: 'local'
+ provider: 'local',
});
// Save user and hosting offer
@@ -43,7 +43,7 @@ describe('Offer Model Unit Tests:', function () {
maxGuests: 1,
updated: new Date(),
location: [52.498981209298776, 13.418329954147339],
- locationFuzzy: [52.50155039101136, 13.42255019882177]
+ locationFuzzy: [52.50155039101136, 13.42255019882177],
});
offerMeet = new Offer({
@@ -53,7 +53,7 @@ describe('Offer Model Unit Tests:', function () {
updated: new Date(),
validUntil: new Date(),
location: [52.498981209298776, 13.418329954147339],
- locationFuzzy: [52.50155039101136, 13.42255019882177]
+ locationFuzzy: [52.50155039101136, 13.42255019882177],
});
return done();
diff --git a/modules/offers/tests/server/offer.server.routes.tests.js b/modules/offers/tests/server/offer.server.routes.tests.js
index 6d6918e647..2708565be9 100644
--- a/modules/offers/tests/server/offer.server.routes.tests.js
+++ b/modules/offers/tests/server/offer.server.routes.tests.js
@@ -39,7 +39,7 @@ const testLocations = {
'&northEastLng=18.73318142361111' +
'&southWestLat=44.66407507240992' +
'&southWestLng=3.689914279513889',
- location: [52.48556355813466, 13.489011526107788]
+ location: [52.48556355813466, 13.489011526107788],
},
'China': {
queryBoundingBox:
@@ -47,7 +47,7 @@ const testLocations = {
'&northEastLng=151.23828125000003' +
'&southWestLat=-3.9332268264771106' +
'&southWestLng=61.63281250000001',
- location: [34.632532, 103.767519]
+ location: [34.632532, 103.767519],
},
'US': {
queryBoundingBox:
@@ -55,7 +55,7 @@ const testLocations = {
'&northEastLng=-48.44921875000001' +
'&southWestLat=0.021065118766989688' +
'&southWestLng=-138.05468750000003',
- location: [40.514402, -88.990735]
+ location: [40.514402, -88.990735],
},
'NorthPole': {
queryBoundingBox:
@@ -63,8 +63,8 @@ const testLocations = {
'&northEastLng=145.61328125000003' +
'&southWestLat=78.02765497223292' +
'&southWestLng=56.00781250000001',
- location: [80.912672, 79.732322]
- }
+ location: [80.912672, 79.732322],
+ },
};
@@ -85,13 +85,13 @@ describe('Offer CRUD tests', function () {
// Create user credentials
credentials = {
username: 'loremipsum',
- password: 'Password123!'
+ password: 'Password123!',
};
// Create user2 credentials
credentials2 = {
username: 'loremipsum2',
- password: 'Password123!'
+ password: 'Password123!',
};
// Create a new user
@@ -104,7 +104,7 @@ describe('Offer CRUD tests', function () {
username: credentials.username,
password: credentials.password,
provider: 'local',
- public: true
+ public: true,
});
// Create a new user
@@ -118,7 +118,7 @@ describe('Offer CRUD tests', function () {
password: credentials2.password,
languages: ['fin', 'ita'],
provider: 'local',
- public: true
+ public: true,
});
// Create a new user
@@ -131,7 +131,7 @@ describe('Offer CRUD tests', function () {
password: credentials.password,
languages: ['ita'],
provider: 'local',
- public: true
+ public: true,
});
// Used only for sending via POST and thus doesn't include some data
@@ -141,7 +141,7 @@ describe('Offer CRUD tests', function () {
description: '1 I can host! :)
',
noOfferDescription: '1 I cannot host... :(
',
maxGuests: 5,
- location: testLocations.Europe.location
+ location: testLocations.Europe.location,
};
offer2 = new Offer({
@@ -151,7 +151,7 @@ describe('Offer CRUD tests', function () {
noOfferDescription: '2 I cannot host... :(
',
maxGuests: 3,
updated: new Date(),
- location: [52.498981209298776, 13.418329954147339]
+ location: [52.498981209298776, 13.418329954147339],
});
offer3 = new Offer({
@@ -161,7 +161,7 @@ describe('Offer CRUD tests', function () {
noOfferDescription: '3 I cannot host... :(
',
maxGuests: 1,
updated: new Date(),
- location: [52.498981209298775, 13.418329954147338]
+ location: [52.498981209298775, 13.418329954147338],
});
offerMeet = new Offer({
@@ -169,7 +169,7 @@ describe('Offer CRUD tests', function () {
description: 'Dinner party!
',
validUntil: moment().add(30, 'day').toDate(),
updated: new Date(),
- location: [52.498981209298887, 13.418329954147449]
+ location: [52.498981209298887, 13.418329954147449],
});
tribe1 = new Tribe({
@@ -178,7 +178,7 @@ describe('Offer CRUD tests', function () {
'color': '111111',
'tribe': true,
'count': 1,
- 'public': true
+ 'public': true,
});
tribe2 = new Tribe({
@@ -186,7 +186,7 @@ describe('Offer CRUD tests', function () {
'label': 'tribe2',
'color': '222222',
'count': 1,
- 'public': true
+ 'public': true,
});
// Save data to the test db
@@ -216,7 +216,7 @@ describe('Offer CRUD tests', function () {
function (done) {
user2.member = [{
tribe: tribe2Id,
- since: new Date()
+ since: new Date(),
}];
user2.save(function (err, user2res) {
user2Id = user2res._id;
@@ -227,7 +227,7 @@ describe('Offer CRUD tests', function () {
function (done) {
user3.member = [{
tribe: tribe1Id,
- since: new Date()
+ since: new Date(),
}];
user3.save(function (err, user3res) {
user3Id = user3res._id;
@@ -248,7 +248,7 @@ describe('Offer CRUD tests', function () {
offer3.save(function (err) {
done(err);
});
- }
+ },
], function (err) {
should.not.exist(err);
doneBeforeEach(err);
@@ -426,7 +426,7 @@ describe('Offer CRUD tests', function () {
if (offerSaveErr) return done(offerSaveErr);
Offer.findOne({
- _id: offer2Id
+ _id: offer2Id,
}, function (err, offer) {
should.not.exist(err);
should.exist(offer);
@@ -454,7 +454,7 @@ describe('Offer CRUD tests', function () {
if (offerSaveErr) return done(offerSaveErr);
Offer.findOne({
- _id: offer2Id
+ _id: offer2Id,
}, function (err, offer) {
should.not.exist(err);
should.not.exist(offer);
@@ -799,7 +799,7 @@ describe('Offer CRUD tests', function () {
// Get id for offer we just saved
Offer.findOne({
- user: user1Id
+ user: user1Id,
}, function (offerFindErr, offer) {
// Handle error
if (offerFindErr) return done(offerFindErr);
@@ -822,7 +822,7 @@ describe('Offer CRUD tests', function () {
offerPutRes.body.message.should.equal('Offer updated.');
Offer.findOne({
- _id: offer._id
+ _id: offer._id,
}, function (err, offerNew) {
offerNew.description.should.equal('MODIFIED');
offerNew.noOfferDescription.should.equal('MODIFIED');
@@ -854,7 +854,7 @@ describe('Offer CRUD tests', function () {
if (offerSaveErr) return done(offerSaveErr);
Offer.findOne({
- _id: offer2Id
+ _id: offer2Id,
}, function (err, offer) {
should.not.exist(err);
offer.description.should.not.equal(offer2.description);
@@ -883,7 +883,7 @@ describe('Offer CRUD tests', function () {
// Get id for offer we just saved
Offer.findOne({
- user: user1Id
+ user: user1Id,
}, function (offerFindErr, offer) {
// Handle error
if (offerFindErr) return done(offerFindErr);
@@ -903,7 +903,7 @@ describe('Offer CRUD tests', function () {
offerSaveRes.body.message.should.equal('You cannot update offer type.');
Offer.find({
- user: user1Id
+ user: user1Id,
}, function (err, offers) {
offers.length.should.equal(1);
offers[0].type.should.equal('host');
@@ -948,7 +948,7 @@ describe('Offer CRUD tests', function () {
if (offerPutErr) return done(offerPutErr);
Offer.findOne({
- _id: offerMeetSaved._id
+ _id: offerMeetSaved._id,
}, function (err, offerNew) {
moment(offerNew.validUntil).diff(now, 'days').should.equal(30);
@@ -989,7 +989,7 @@ describe('Offer CRUD tests', function () {
if (offerPutErr) return done(offerPutErr);
Offer.findOne({
- _id: offerMeetSaved._id
+ _id: offerMeetSaved._id,
}, function (err, offerNew) {
moment(offerNew.validUntil).diff(now, 'days').should.equal(2);
@@ -1034,7 +1034,7 @@ describe('Offer CRUD tests', function () {
if (offerPutErr) return done(offerPutErr);
Offer.findOne({
- _id: offerMeetSaved._id
+ _id: offerMeetSaved._id,
}, function (err, offerNew) {
// We set it to 32, but it should default to 30 days
@@ -1080,7 +1080,7 @@ describe('Offer CRUD tests', function () {
if (offerPutErr) return done(offerPutErr);
Offer.findOne({
- _id: offerMeetSaved._id
+ _id: offerMeetSaved._id,
}, function (err, offerNew) {
// We set it to -2 days, but it should default to 30 days
@@ -1116,7 +1116,7 @@ describe('Offer CRUD tests', function () {
if (offerSaveErr) return done(offerSaveErr);
Offer.findOne({
- user: user2Id
+ user: user2Id,
}, function (err, offer) {
should.not.exist(offer.reactivateReminderSent);
return done(err);
diff --git a/modules/pages/client/config/pages.client.routes.js b/modules/pages/client/config/pages.client.routes.js
index a90749519c..7600c60d84 100755
--- a/modules/pages/client/config/pages.client.routes.js
+++ b/modules/pages/client/config/pages.client.routes.js
@@ -15,50 +15,50 @@
requiresAuth: true,
footerHidden: true,
data: {
- pageTitle: 'Navigation'
- }
+ pageTitle: 'Navigation',
+ },
}).
state('rules', {
url: '/rules',
templateUrl: '/modules/pages/views/rules.client.view.html',
data: {
- pageTitle: 'Rules'
- }
+ pageTitle: 'Rules',
+ },
}).
state('team', {
url: '/team',
templateUrl: '/modules/pages/views/team.client.view.html',
data: {
- pageTitle: 'Team'
- }
+ pageTitle: 'Team',
+ },
}).
state('privacy', {
url: '/privacy',
templateUrl: '/modules/pages/views/privacy.client.view.html',
data: {
- pageTitle: 'Privacy policy'
- }
+ pageTitle: 'Privacy policy',
+ },
}).
state('donate', {
url: '/donate',
templateUrl: '/modules/pages/views/donate.client.view.html',
data: {
- pageTitle: 'Donate'
- }
+ pageTitle: 'Donate',
+ },
}).
state('donate-help', {
url: '/donate/help',
templateUrl: '/modules/pages/views/donate-help.client.view.html',
data: {
- pageTitle: 'Donation help'
- }
+ pageTitle: 'Donation help',
+ },
}).
state('donate-policy', {
url: '/donate/policy',
templateUrl: '/modules/pages/views/donate-policy.client.view.html',
data: {
- pageTitle: 'Donation policy'
- }
+ pageTitle: 'Donation policy',
+ },
}).
state('faq', {
url: '/faq',
@@ -67,64 +67,64 @@
controller: 'FaqController',
controllerAs: 'faq',
data: {
- pageTitle: 'FAQ'
- }
+ pageTitle: 'FAQ',
+ },
}).
state('faq.general', {
url: '',
templateUrl: '/modules/pages/views/faq-general.client.view.html',
data: {
- pageTitle: 'FAQ - Site & community'
- }
+ pageTitle: 'FAQ - Site & community',
+ },
}).
state('faq.tribes', {
url: '/tribes',
templateUrl: '/modules/pages/views/faq-tribes.client.view.html',
data: {
- pageTitle: 'FAQ - Tribes'
- }
+ pageTitle: 'FAQ - Tribes',
+ },
}).
state('faq.foundation', {
url: '/foundation',
templateUrl: '/modules/pages/views/faq-foundation.client.view.html',
data: {
- pageTitle: 'FAQ - Foundation'
- }
+ pageTitle: 'FAQ - Foundation',
+ },
}).
state('faq.technology', {
url: '/technology',
templateUrl: '/modules/pages/views/faq-technology.client.view.html',
data: {
- pageTitle: 'FAQ - Technology'
- }
+ pageTitle: 'FAQ - Technology',
+ },
}).
state('foundation', {
url: '/foundation',
templateUrl: '/modules/pages/views/foundation.client.view.html',
data: {
- pageTitle: 'Foundation'
- }
+ pageTitle: 'Foundation',
+ },
}).
state('media', {
url: '/media',
templateUrl: '/modules/pages/views/media.client.view.html',
data: {
- pageTitle: 'Media'
- }
+ pageTitle: 'Media',
+ },
}).
state('volunteering', {
url: '/volunteering',
template: '',
data: {
- pageTitle: 'Volunteering'
- }
+ pageTitle: 'Volunteering',
+ },
}).
state('guide', {
url: '/guide',
templateUrl: '/modules/pages/views/guide.client.view.html',
data: {
- pageTitle: 'Guide'
- }
+ pageTitle: 'Guide',
+ },
}).
// Redirect to home:
@@ -136,7 +136,7 @@
function ($state) {
$state.go('home');
},
- controllerAs: 'about'
+ controllerAs: 'about',
});
/**
@@ -150,7 +150,7 @@
templateUrl: '/modules/pages/views/home.client.view.html',
controller: 'HomeController',
controllerAs: 'home',
- footerHidden: true
+ footerHidden: true,
});
} else {
$stateProvider.state('home', { url: '/' });
diff --git a/modules/pages/client/controllers/home.client.controller.js b/modules/pages/client/controllers/home.client.controller.js
index b3ac1cf011..9cfe797ce1 100644
--- a/modules/pages/client/controllers/home.client.controller.js
+++ b/modules/pages/client/controllers/home.client.controller.js
@@ -46,7 +46,7 @@
'desertgirl',
'hitchgirl1',
'hitchgirl2',
- 'hitchtruck'
+ 'hitchtruck',
];
} else {
vm.boards = [
@@ -56,7 +56,7 @@
'hitchgirl1',
'wavewatching',
'sahara-backpacker',
- 'hitchtruck'
+ 'hitchtruck',
];
}
@@ -72,12 +72,12 @@
// Load suggested tribes
vm.tribes = TribesService.query({
- limit: 3
+ limit: 3,
}, function () {
// Got those three tribes, now fetch one more if requested
if ($stateParams.tribe && !isTribeLoaded($stateParams.tribe)) {
TribeService.get({
- tribeSlug: $stateParams.tribe
+ tribeSlug: $stateParams.tribe,
}).then(function (tribe) {
// If tribe was found, put it to the beginning of `vm.tribes` array
if (tribe && tribe._id) {
diff --git a/modules/references-thread/client/directives/reference-thread.client.directive.js b/modules/references-thread/client/directives/reference-thread.client.directive.js
index 7c05481b22..d678497baf 100644
--- a/modules/references-thread/client/directives/reference-thread.client.directive.js
+++ b/modules/references-thread/client/directives/reference-thread.client.directive.js
@@ -21,11 +21,11 @@
replace: true,
templateUrl: '/modules/references-thread/views/directives/tr-reference-thread.client.view.html',
scope: {
- trReferenceThread: '='
+ trReferenceThread: '=',
},
controller: trReferenceThreadDirectiveController,
controllerAs: 'vm',
- bindToController: true // because the scope is isolated
+ bindToController: true, // because the scope is isolated
};
return directive;
@@ -53,7 +53,7 @@
*/
function activate() {
ReferenceThreadService.get({
- userToId: vm.userTo
+ userToId: vm.userTo,
}, function (referenceThread) {
vm.isLoading = false;
if (referenceThread) {
@@ -73,7 +73,7 @@
function createReference(reference) {
const newReference = new ReferenceThreadService({
userTo: vm.userTo,
- reference: String(reference)
+ reference: String(reference),
});
vm.reference = newReference;
@@ -83,7 +83,7 @@
messageCenterService.add('success', 'Thank you!');
$analytics.eventTrack('reference-thread-give-' + String(reference), {
category: 'reference.thread',
- label: 'Give ' + String(reference) + ' thread reference'
+ label: 'Give ' + String(reference) + ' thread reference',
});
}, function () {
vm.reference = false;
diff --git a/modules/references-thread/client/services/reference-thread.client.service.js b/modules/references-thread/client/services/reference-thread.client.service.js
index c057cc68a1..57d1035a2f 100644
--- a/modules/references-thread/client/services/reference-thread.client.service.js
+++ b/modules/references-thread/client/services/reference-thread.client.service.js
@@ -8,11 +8,11 @@
/* @ngInject */
function ReferenceThreadService($resource) {
return $resource('/api/references-thread/:userToId', {
- userToId: '@_id'
+ userToId: '@_id',
}, {
get: {
- method: 'GET'
- }
+ method: 'GET',
+ },
});
}
}());
diff --git a/modules/references-thread/server/controllers/reference-thread.server.controller.js b/modules/references-thread/server/controllers/reference-thread.server.controller.js
index de22e784a4..2e8aa3be35 100644
--- a/modules/references-thread/server/controllers/reference-thread.server.controller.js
+++ b/modules/references-thread/server/controllers/reference-thread.server.controller.js
@@ -17,14 +17,14 @@ const ReferenceThread = mongoose.model('ReferenceThread');
exports.createReferenceThread = function (req, res) {
if (!req.user || (req.user && !req.user.public)) {
return res.status(403).send({
- message: errorService.getErrorMessageByKey('forbidden')
+ message: errorService.getErrorMessageByKey('forbidden'),
});
}
// Validate userTo ID
if (!mongoose.Types.ObjectId.isValid(req.body.userTo)) {
return res.status(400).send({
- message: errorService.getErrorMessageByKey('invalid-id')
+ message: errorService.getErrorMessageByKey('invalid-id'),
});
}
@@ -38,14 +38,14 @@ exports.createReferenceThread = function (req, res) {
{
$or: [
{ userFrom: req.user._id, userTo: req.body.userTo },
- { userTo: req.user._id, userFrom: req.body.userTo }
- ]
+ { userTo: req.user._id, userFrom: req.body.userTo },
+ ],
},
'userTo userFrom',
function (err, thread) {
if (err || !thread) {
return res.status(400).send({
- message: 'Thread does not exist.'
+ message: 'Thread does not exist.',
});
}
@@ -58,10 +58,10 @@ exports.createReferenceThread = function (req, res) {
} else {
// Currently authenticated user is not participating in this thread!
return res.status(403).send({
- message: errorService.getErrorMessageByKey('forbidden')
+ message: errorService.getErrorMessageByKey('forbidden'),
});
}
- }
+ },
);
},
@@ -72,7 +72,7 @@ exports.createReferenceThread = function (req, res) {
Message.findOne(
{
userFrom: referenceUserTo,
- userTo: req.user._id
+ userTo: req.user._id,
},
'userFrom userTo',
function (err, message) {
@@ -80,17 +80,17 @@ exports.createReferenceThread = function (req, res) {
if (err || !message) {
// Log
log('error', 'Thread reference: Not allowed per message rules. #158472', {
- error: err || null
+ error: err || null,
});
return res.status(403).send({
- message: 'Referenced person has not sent messages to to you.'
+ message: 'Referenced person has not sent messages to to you.',
});
}
// All good, continue
done(null, threadId, referenceUserTo);
- }
+ },
);
},
@@ -109,7 +109,7 @@ exports.createReferenceThread = function (req, res) {
// Handle errors
if (err) {
return res.status(400).send({
- message: errorService.getErrorMessage(err)
+ message: errorService.getErrorMessage(err),
});
}
@@ -121,24 +121,24 @@ exports.createReferenceThread = function (req, res) {
statService.stat({
namespace: 'threadReference',
counts: {
- count: 1
+ count: 1,
},
tags: {
// References are `yes` or `no`
// (defined at the `ReferenceThread` model)
- reference: referenceThread.reference
- }
+ reference: referenceThread.reference,
+ },
}, function () {
done();
});
});
- }
+ },
], function (err) {
if (err) {
return res.status(400).send({
- message: errorService.getErrorMessage(err)
+ message: errorService.getErrorMessage(err),
});
}
});
@@ -159,14 +159,14 @@ exports.readReferenceThreadById = function (req, res, next, userToId) {
// Check if user is authenticated
if (!req.user) {
return res.status(403).send({
- message: errorService.getErrorMessageByKey('forbidden')
+ message: errorService.getErrorMessageByKey('forbidden'),
});
}
// Not a valid ObjectId
if (!mongoose.Types.ObjectId.isValid(userToId)) {
return res.status(400).send({
- message: errorService.getErrorMessageByKey('invalid-id')
+ message: errorService.getErrorMessageByKey('invalid-id'),
});
}
@@ -176,7 +176,7 @@ exports.readReferenceThreadById = function (req, res, next, userToId) {
function (done) {
ReferenceThread.findOne({
userTo: userToId,
- userFrom: req.user._id // Ensure we get only references we are allowed to read
+ userFrom: req.user._id, // Ensure we get only references we are allowed to read
})
.sort('-created') // Latest first
.exec(function (err, referenceThread) {
@@ -198,17 +198,17 @@ exports.readReferenceThreadById = function (req, res, next, userToId) {
function (done) {
Message.findOne({
userFrom: userToId,
- userTo: req.user._id
+ userTo: req.user._id,
}, function (err, message) {
if (err) return done(err);
// Return 404, but also let client know if we would allow creating a referenceThread
return res.status(404).send({
message: errorService.getErrorMessageByKey('not-found'),
- allowCreatingReference: Boolean(message)
+ allowCreatingReference: Boolean(message),
});
});
- }
+ },
], function (err) {
if (err) {
return next(err);
diff --git a/modules/references-thread/server/models/reference-thread.server.model.js b/modules/references-thread/server/models/reference-thread.server.model.js
index 0adc63ff86..1249fe01e4 100644
--- a/modules/references-thread/server/models/reference-thread.server.model.js
+++ b/modules/references-thread/server/models/reference-thread.server.model.js
@@ -13,27 +13,27 @@ const ReferenceThreadSchema = new Schema({
thread: {
type: Schema.ObjectId,
ref: 'Thread',
- required: true
+ required: true,
},
userFrom: {
type: Schema.ObjectId,
ref: 'User',
- required: true
+ required: true,
},
userTo: {
type: Schema.ObjectId,
ref: 'User',
- required: true
+ required: true,
},
reference: {
type: String,
enum: ['yes', 'no'],
- required: true
+ required: true,
},
created: {
type: Date,
- default: Date.now
- }
+ default: Date.now,
+ },
});
/**
diff --git a/modules/references-thread/server/policies/reference-thread.server.policy.js b/modules/references-thread/server/policies/reference-thread.server.policy.js
index b1a3f08ee3..80788e588b 100644
--- a/modules/references-thread/server/policies/reference-thread.server.policy.js
+++ b/modules/references-thread/server/policies/reference-thread.server.policy.js
@@ -16,20 +16,20 @@ exports.invokeRolesPolicies = function () {
roles: ['admin'],
allows: [{
resources: '/api/references-thread',
- permissions: ['post']
+ permissions: ['post'],
}, {
resources: '/api/references-thread/:referenceThreadUserToId',
- permissions: ['get']
- }]
+ permissions: ['get'],
+ }],
}, {
roles: ['user'],
allows: [{
resources: '/api/references-thread',
- permissions: ['post']
+ permissions: ['post'],
}, {
resources: '/api/references-thread/:referenceThreadUserToId',
- permissions: ['get']
- }]
+ permissions: ['get'],
+ }],
}]);
};
@@ -42,7 +42,7 @@ exports.isAllowed = function (req, res, next) {
// No reference writing for authenticated but un-published users, except if they're reading existing reference
if (!req.user || (req.user && !req.user.public && req.method.toLowerCase() !== 'get')) {
return res.status(403).send({
- message: errorService.getErrorMessageByKey('forbidden')
+ message: errorService.getErrorMessageByKey('forbidden'),
});
}
@@ -58,7 +58,7 @@ exports.isAllowed = function (req, res, next) {
if (err) {
// An authorization error occurred.
return res.status(500).send({
- message: 'Unexpected authorization error'
+ message: 'Unexpected authorization error',
});
} else {
if (isAllowed) {
@@ -66,7 +66,7 @@ exports.isAllowed = function (req, res, next) {
return next();
} else {
return res.status(403).json({
- message: errorService.getErrorMessageByKey('forbidden')
+ message: errorService.getErrorMessageByKey('forbidden'),
});
}
}
diff --git a/modules/references-thread/tests/server/reference-thread.server.model.tests.js b/modules/references-thread/tests/server/reference-thread.server.model.tests.js
index 138b77eb3b..80c61cc3b0 100644
--- a/modules/references-thread/tests/server/reference-thread.server.model.tests.js
+++ b/modules/references-thread/tests/server/reference-thread.server.model.tests.js
@@ -31,7 +31,7 @@ describe('Reference Thread Model Unit Tests:', function () {
email: 'test1@test.com',
username: 'username1',
password: 'password123',
- provider: 'local'
+ provider: 'local',
});
user2 = new User({
@@ -41,7 +41,7 @@ describe('Reference Thread Model Unit Tests:', function () {
email: 'test2@test.com',
username: 'username2',
password: 'password123',
- provider: 'local'
+ provider: 'local',
});
message = {
@@ -50,7 +50,7 @@ describe('Reference Thread Model Unit Tests:', function () {
userTo: null,
userFrom: null,
read: true,
- created: new Date()
+ created: new Date(),
};
thread = {
@@ -58,7 +58,7 @@ describe('Reference Thread Model Unit Tests:', function () {
userTo: null,
userFrom: null,
read: true,
- updated: new Date()
+ updated: new Date(),
};
referenceThread = {
@@ -66,7 +66,7 @@ describe('Reference Thread Model Unit Tests:', function () {
userFrom: null,
userTo: null,
reference: 'yes',
- created: new Date()
+ created: new Date(),
};
// Create users and reference
diff --git a/modules/references-thread/tests/server/reference-thread.server.routes.tests.js b/modules/references-thread/tests/server/reference-thread.server.routes.tests.js
index 6082d8789e..3d199d88e5 100644
--- a/modules/references-thread/tests/server/reference-thread.server.routes.tests.js
+++ b/modules/references-thread/tests/server/reference-thread.server.routes.tests.js
@@ -46,12 +46,12 @@ describe('Reference Thread CRUD tests', function () {
// Create userFrom credentials
referenceUserFromCredentials = {
username: 'user_from',
- password: 'password123!'
+ password: 'password123!',
};
referenceUserNonpublicCredentials = {
username: 'user_non_public',
- password: 'password123!'
+ password: 'password123!',
};
userFrom = new User({
@@ -62,7 +62,7 @@ describe('Reference Thread CRUD tests', function () {
username: referenceUserFromCredentials.username,
password: referenceUserFromCredentials.password,
provider: 'local',
- public: true
+ public: true,
});
userTo = new User({
@@ -73,7 +73,7 @@ describe('Reference Thread CRUD tests', function () {
username: 'user_to',
password: 'password123!',
provider: 'local',
- public: true
+ public: true,
});
userNonPublic = new User({
@@ -84,7 +84,7 @@ describe('Reference Thread CRUD tests', function () {
username: referenceUserNonpublicCredentials.username,
password: referenceUserNonpublicCredentials.password,
provider: 'local',
- public: false
+ public: false,
});
message = {
@@ -93,7 +93,7 @@ describe('Reference Thread CRUD tests', function () {
userTo: null,
userFrom: null,
read: true,
- created: new Date()
+ created: new Date(),
};
thread = {
@@ -101,7 +101,7 @@ describe('Reference Thread CRUD tests', function () {
userTo: null,
userFrom: null,
read: true,
- updated: new Date()
+ updated: new Date(),
};
referenceThread = {
@@ -109,7 +109,7 @@ describe('Reference Thread CRUD tests', function () {
// userFrom: null,
// userTo: null,
reference: 'yes',
- created: new Date()
+ created: new Date(),
};
// Create users, messages and prepare references
@@ -177,7 +177,7 @@ describe('Reference Thread CRUD tests', function () {
return done(err);
});
});
- }
+ },
], function (err) {
if (err) {
diff --git a/modules/references/client/api/references.api.js b/modules/references/client/api/references.api.js
index a2cfb647b5..746447a3f9 100644
--- a/modules/references/client/api/references.api.js
+++ b/modules/references/client/api/references.api.js
@@ -33,7 +33,7 @@ const referenceMapping = [
['hostedThem', 'interactions.hostedThem'],
['recommend', 'recommend'],
['userTo', 'userTo'],
- ['public', 'public']
+ ['public', 'public'],
];
/**
diff --git a/modules/references/client/components/CreateReference.component.js b/modules/references/client/components/CreateReference.component.js
index cfea9f97d4..57700c7d69 100644
--- a/modules/references/client/components/CreateReference.component.js
+++ b/modules/references/client/components/CreateReference.component.js
@@ -27,7 +27,7 @@ export class CreateReference extends React.Component {
isSubmitting: false,
isDuplicate: false,
isSubmitted: false,
- isPublic: false
+ isPublic: false,
};
// bind methods
@@ -51,7 +51,7 @@ export class CreateReference extends React.Component {
handleTabSwitch(move) {
this.setState(state => ({
- tab: state.tab + move
+ tab: state.tab + move,
}));
}
@@ -82,13 +82,13 @@ export class CreateReference extends React.Component {
// save the reference
const [savedReference] = await Promise.all([
api.references.create({ ...reference, userTo: this.props.userTo._id }),
- recommend === 'no' && report ? api.references.report(this.props.userTo, reportMessage) : null
+ recommend === 'no' && report ? api.references.report(this.props.userTo, reportMessage) : null,
]);
this.setState(() => ({
isSubmitting: false,
isSubmitted: true,
- isPublic: savedReference.public
+ isPublic: savedReference.public,
}));
}
@@ -112,7 +112,7 @@ export class CreateReference extends React.Component {
onChangeRecommend={this.handleChangeRecommend}
onChangeReport={this.handleChangeReport}
onChangeReportMessage={this.handleChangeReportMessage}
- />
+ />,
];
const tabDone = (recommend) ? 1 : (hostedMe || hostedThem || met) ? 0 : -1;
@@ -166,7 +166,7 @@ export class CreateReference extends React.Component {
CreateReference.propTypes = {
userFrom: PropTypes.object.isRequired,
userTo: PropTypes.object.isRequired,
- t: PropTypes.func.isRequired
+ t: PropTypes.func.isRequired,
};
export default withTranslation('reference')(CreateReference);
diff --git a/modules/references/client/components/create-reference/Info.js b/modules/references/client/components/create-reference/Info.js
index fc419e8689..96ebab0154 100644
--- a/modules/references/client/components/create-reference/Info.js
+++ b/modules/references/client/components/create-reference/Info.js
@@ -15,7 +15,7 @@ function UserLink({ user }) {
}
UserLink.propTypes = {
- user: PropTypes.object.isRequired
+ user: PropTypes.object.isRequired,
};
/**
@@ -41,7 +41,7 @@ export const DuplicateInfo = withTranslation('reference')(function ({ userTo })
});
DuplicateInfo.propTypes = {
- userTo: PropTypes.object.isRequired
+ userTo: PropTypes.object.isRequired,
};
/**
@@ -76,5 +76,5 @@ SubmittedInfo.propTypes = {
userFrom: PropTypes.object.isRequired,
userTo: PropTypes.object.isRequired,
isReported: PropTypes.bool.isRequired,
- isPublic: PropTypes.bool.isRequired
+ isPublic: PropTypes.bool.isRequired,
};
diff --git a/modules/references/client/components/create-reference/Interaction.js b/modules/references/client/components/create-reference/Interaction.js
index 38f959a94f..aab9aa7803 100644
--- a/modules/references/client/components/create-reference/Interaction.js
+++ b/modules/references/client/components/create-reference/Interaction.js
@@ -52,7 +52,7 @@ const Interaction = withTranslation('reference')(function ({ t, interactions, on
Interaction.propTypes = {
onChange: PropTypes.func.isRequired,
- interactions: PropTypes.object.isRequired
+ interactions: PropTypes.object.isRequired,
};
export default Interaction;
diff --git a/modules/references/client/components/create-reference/Navigation.js b/modules/references/client/components/create-reference/Navigation.js
index fae53a627a..6cb291db38 100644
--- a/modules/references/client/components/create-reference/Navigation.js
+++ b/modules/references/client/components/create-reference/Navigation.js
@@ -61,7 +61,7 @@ Navigation.propTypes = {
disabled: PropTypes.bool,
tab: PropTypes.number.isRequired, // current tab index - indexed from 0
tabs: PropTypes.number.isRequired, // amount of tabs to display
- tabDone: PropTypes.number.isRequired // which tab is already filled
+ tabDone: PropTypes.number.isRequired, // which tab is already filled
};
export default withTranslation('reference')(Navigation);
diff --git a/modules/references/client/components/create-reference/Recommend.js b/modules/references/client/components/create-reference/Recommend.js
index e42e389aa4..9313e99ccd 100644
--- a/modules/references/client/components/create-reference/Recommend.js
+++ b/modules/references/client/components/create-reference/Recommend.js
@@ -10,7 +10,7 @@ const Recommend = withTranslation('reference')(function ({ t, primaryInteraction
const recommendQuestions = {
hostedMe: t('Would you recommend others to stay with them?'),
hostedThem: t('Would you recommend others to host them?'),
- met: t('Would you recommend others to meet them?')
+ met: t('Would you recommend others to meet them?'),
};
const question = recommendQuestions[primaryInteraction];
@@ -74,7 +74,7 @@ Recommend.propTypes = {
reportMessage: PropTypes.string.isRequired,
onChangeRecommend: PropTypes.func.isRequired,
onChangeReport: PropTypes.func.isRequired,
- onChangeReportMessage: PropTypes.func.isRequired
+ onChangeReportMessage: PropTypes.func.isRequired,
};
export default Recommend;
diff --git a/modules/references/client/components/create-reference/Report.js b/modules/references/client/components/create-reference/Report.js
index bbac496863..92ab5269bf 100644
--- a/modules/references/client/components/create-reference/Report.js
+++ b/modules/references/client/components/create-reference/Report.js
@@ -42,7 +42,7 @@ Report.propTypes = {
report: PropTypes.bool.isRequired,
reportMessage: PropTypes.string.isRequired,
onChangeReport: PropTypes.func.isRequired,
- onChangeReportMessage: PropTypes.func.isRequired
+ onChangeReportMessage: PropTypes.func.isRequired,
};
export default Report;
diff --git a/modules/references/server/controllers/reference.server.controller.js b/modules/references/server/controllers/reference.server.controller.js
index cac2b8a420..49d07e9a60 100644
--- a/modules/references/server/controllers/reference.server.controller.js
+++ b/modules/references/server/controllers/reference.server.controller.js
@@ -83,14 +83,14 @@ const nonpublicReferenceFields = [
'public',
'userFrom',
'userTo',
- 'created'
+ 'created',
];
const referenceFields = nonpublicReferenceFields.concat([
'interactions.met',
'interactions.hostedMe',
'interactions.hostedThem',
- 'recommend'
+ 'recommend',
]);
/**
@@ -168,9 +168,9 @@ async function isUserToPublic(req) {
body: {
errType: 'not-found',
details: {
- userTo: 'not found'
- }
- }
+ userTo: 'not found',
+ },
+ },
});
}
@@ -184,9 +184,9 @@ function validateReplyToPublicReference(otherReference, req) {
body: {
errType: 'bad-request',
details: {
- recommend: '\'yes\' expected - response to public'
- }
- }
+ recommend: '\'yes\' expected - response to public',
+ },
+ },
});
}
}
@@ -243,7 +243,7 @@ exports.create = async function (req, res, next) {
const savedReference = await saveNewReference({
...req.body,
userFrom: req.user._id,
- public: !!otherReference
+ public: !!otherReference,
});
// ...and if this is a reference reply, make the other reference public, too
@@ -258,7 +258,7 @@ exports.create = async function (req, res, next) {
// finally, respond
throw new ResponseError({
status: 201,
- body: formatReference(savedReference, true)
+ body: formatReference(savedReference, true),
});
} catch (e) {
@@ -347,7 +347,7 @@ exports.readMany = async function readMany(req, res, next) {
// when userFrom is self, we can see the nonpublic references in their full form
throw new ResponseError({
status: 200,
- body: references.map(reference => formatReference(reference, isSelfUserFrom))
+ body: references.map(reference => formatReference(reference, isSelfUserFrom)),
});
} catch (e) {
processResponses(res, next, e);
@@ -403,9 +403,9 @@ exports.referenceById = async function referenceById(req, res, next, id) { // es
body: {
errType: 'not-found',
details: {
- reference: 'not found'
- }
- }
+ reference: 'not found',
+ },
+ },
});
}
diff --git a/modules/references/server/jobs/references-publish.server.job.js b/modules/references/server/jobs/references-publish.server.job.js
index ad96f8f3bc..970fddedd6 100644
--- a/modules/references/server/jobs/references-publish.server.job.js
+++ b/modules/references/server/jobs/references-publish.server.job.js
@@ -12,6 +12,6 @@ const Reference = mongoose.model('Reference');
module.exports = function (job, agendaDone) {
Reference.updateMany({
created: { $lt: moment().subtract(config.limits.timeToReplyReference) },
- public: false
+ public: false,
}, { public: true }).exec(agendaDone);
};
diff --git a/modules/references/server/models/reference.server.model.js b/modules/references/server/models/reference.server.model.js
index c3ee845415..8e949ebe17 100644
--- a/modules/references/server/models/reference.server.model.js
+++ b/modules/references/server/models/reference.server.model.js
@@ -12,7 +12,7 @@ const ReferenceSchema = new Schema({
created: {
type: Date,
default: () => Date.now(), // Date.now is wrapped for sinon.useFakeTimers()
- required: true
+ required: true,
},
/*
modified: {
@@ -23,41 +23,41 @@ const ReferenceSchema = new Schema({
public: {
type: Boolean,
default: false,
- required: true
+ required: true,
},
userFrom: {
type: Schema.ObjectId,
ref: 'User',
- required: true
+ required: true,
},
userTo: {
type: Schema.ObjectId,
ref: 'User',
- required: true
+ required: true,
},
interactions: {
met: {
type: Boolean,
default: false,
- required: true
+ required: true,
},
hostedMe: {
type: Boolean,
default: false,
- required: true
+ required: true,
},
hostedThem: {
type: Boolean,
default: false,
- required: true
- }
+ required: true,
+ },
},
recommend: {
type: String,
enum: ['yes', 'no', 'unknown'],
default: 'unknown',
- required: true
- }/* ,
+ required: true,
+ }, /* ,
feedbackPublic: {
type: String,
trim: true
diff --git a/modules/references/server/policies/references.server.policy.js b/modules/references/server/policies/references.server.policy.js
index ab76c7ccb4..75d0ee88ac 100644
--- a/modules/references/server/policies/references.server.policy.js
+++ b/modules/references/server/policies/references.server.policy.js
@@ -9,11 +9,11 @@ exports.invokeRolesPolicies = function () {
roles: ['user', 'admin'],
allows: [{
resources: '/api/references',
- permissions: ['get', 'post']
+ permissions: ['get', 'post'],
}, {
resources: '/api/references/:referenceId',
- permissions: ['get']
- }]
+ permissions: ['get'],
+ }],
}]);
};
@@ -29,7 +29,7 @@ exports.isAllowed = async function (req, res, next) {
}
return res.status(403).json({
- message: errorService.getErrorMessageByKey('forbidden')
+ message: errorService.getErrorMessageByKey('forbidden'),
});
} catch (e) {
return next(e);
diff --git a/modules/references/tests/client/components/CreateReference.client.component.test.js b/modules/references/tests/client/components/CreateReference.client.component.test.js
index b58e9e31d1..21a23fc5c8 100644
--- a/modules/references/tests/client/components/CreateReference.client.component.test.js
+++ b/modules/references/tests/client/components/CreateReference.client.component.test.js
@@ -4,7 +4,7 @@ import {
fireEvent,
waitForElement,
waitForElementToBeRemoved,
- screen
+ screen,
} from '@testing-library/react';
import '@testing-library/jest-dom/extend-expect';
@@ -57,7 +57,7 @@ describe('', () => {
for (const label of [
'Met in person',
'I hosted them',
- 'They hosted me'
+ 'They hosted me',
]) {
expect(queryByLabelText(label)).toBeInTheDocument();
}
@@ -71,7 +71,7 @@ describe('', () => {
getByText,
getByLabelText,
queryByLabelText,
- queryByRole
+ queryByRole,
} = render();
await waitForLoader();
@@ -91,12 +91,12 @@ describe('', () => {
hostedMe: true,
hostedThem: false,
recommend: 'yes',
- userTo: userTo._id
+ userTo: userTo._id,
});
const alert = await waitForElement(() => queryByRole('alert'));
expect(alert).toHaveTextContent(
- `Your reference will become public when ${userTo.username} gives you a reference back, or in 14 days.`
+ `Your reference will become public when ${userTo.username} gives you a reference back, or in 14 days.`,
);
});
@@ -108,7 +108,7 @@ describe('', () => {
getByText,
getByLabelText,
queryByLabelText,
- queryByRole
+ queryByRole,
} = render();
await waitForLoader();
@@ -131,17 +131,17 @@ describe('', () => {
hostedMe: true,
hostedThem: false,
recommend: 'no',
- userTo: userTo._id
+ userTo: userTo._id,
});
expect(api.references.report).toHaveBeenCalledWith(userTo, 'they were mean to me');
const alert = await waitForElement(() => queryByRole('alert'));
expect(alert).toHaveTextContent(
- `Your reference will become public when ${userTo.username} gives you a reference back, or in 14 days.`
+ `Your reference will become public when ${userTo.username} gives you a reference back, or in 14 days.`,
);
expect(alert).toHaveTextContent(
- `Also, ${userTo.username} was reported.`
+ `Also, ${userTo.username} was reported.`,
);
});
});
diff --git a/modules/references/tests/client/components/Navigation.client.component.test.js b/modules/references/tests/client/components/Navigation.client.component.test.js
index 110ee70228..62de6086c0 100644
--- a/modules/references/tests/client/components/Navigation.client.component.test.js
+++ b/modules/references/tests/client/components/Navigation.client.component.test.js
@@ -1,7 +1,7 @@
import React from 'react';
import {
render,
- fireEvent
+ fireEvent,
} from '@testing-library/react';
import '@testing-library/jest-dom/extend-expect';
@@ -15,7 +15,7 @@ describe('Navigation through 3 tabs', () => {
const handlers = {
onBack: f,
onNext: f,
- onSubmit: f
+ onSubmit: f,
};
/**
@@ -24,7 +24,7 @@ describe('Navigation through 3 tabs', () => {
[
{ tab: 0, tabs: 3, buttons: ['Next'] },
{ tab: 1, tabs: 3, buttons: ['Back', 'Next'] },
- { tab: 2, tabs: 3, buttons: ['Back', 'Submit'] }
+ { tab: 2, tabs: 3, buttons: ['Back', 'Submit'] },
].forEach(({ tab, tabs, buttons }) => {
it(`when tab=${tab} and tabs=${3} there is only ${buttons.join(' and ')} button`, () => {
const { getAllByRole } = render( {
{ tab: 1, tabs: 3, tabDone: 0, buttons: [{ name: 'Back', disabled: false }, { name: 'Next', disabled: true }] },
{ tab: 1, tabs: 3, tabDone: 1, buttons: [{ name: 'Back', disabled: false }, { name: 'Next', disabled: false }] },
{ tab: 2, tabs: 3, tabDone: 1, buttons: [{ name: 'Back', disabled: false }, { name: 'Submit', disabled: true }] },
- { tab: 2, tabs: 3, tabDone: 2, buttons: [{ name: 'Back', disabled: false }, { name: 'Submit', disabled: false }] }
+ { tab: 2, tabs: 3, tabDone: 2, buttons: [{ name: 'Back', disabled: false }, { name: 'Submit', disabled: false }] },
].forEach(({ tab, tabs, tabDone, buttons }) => {
const expectations = buttons.map(({ name, disabled }) => `the ${name} button should be ${(disabled) ? 'disabled' : 'enabled'}`);
@@ -80,7 +80,7 @@ describe('Navigation through 3 tabs', () => {
[
{ tab: 1, tabDone: 0, tabs: 3, button: 'Back', buttonIndex: 0, testTrigger: 'onBack' },
{ tab: 1, tabDone: 1, tabs: 3, button: 'Next', buttonIndex: 1, testTrigger: 'onNext' },
- { tab: 2, tabDone: 2, tabs: 3, button: 'Submit', buttonIndex: 1, testTrigger: 'onSubmit' }
+ { tab: 2, tabDone: 2, tabs: 3, button: 'Submit', buttonIndex: 1, testTrigger: 'onSubmit' },
].forEach(({ tab, tabs, tabDone, button, buttonIndex, testTrigger }) => {
it(`when ${button} button is clicked, the ${testTrigger} should be triggered`, () => {
const handler = jest.fn();
diff --git a/modules/references/tests/server/reference-create.server.routes.tests.js b/modules/references/tests/server/reference-create.server.routes.tests.js
index 7fc0916835..5b10ee0cfb 100644
--- a/modules/references/tests/server/reference-create.server.routes.tests.js
+++ b/modules/references/tests/server/reference-create.server.routes.tests.js
@@ -36,7 +36,7 @@ describe('Create a reference', () => {
const _usersNonpublic = utils.generateUsers(1, {
public: false,
username: 'nonpublic',
- email: 'nonpublic@example.com'
+ email: 'nonpublic@example.com',
});
const _users = [..._usersPublic, ..._usersNonpublic];
@@ -70,9 +70,9 @@ describe('Create a reference', () => {
interactions: {
met: true,
hostedMe: true,
- hostedThem: true
+ hostedThem: true,
},
- recommend: 'yes'
+ recommend: 'yes',
})
.expect(201);
@@ -84,10 +84,10 @@ describe('Create a reference', () => {
interactions: {
met: true,
hostedMe: true,
- hostedThem: true
+ hostedThem: true,
},
recommend: 'yes',
- _id: /^[0-9a-f]{24}$/
+ _id: /^[0-9a-f]{24}$/,
});
});
@@ -103,9 +103,9 @@ describe('Create a reference', () => {
interactions: {
met: true,
hostedMe: true,
- hostedThem: true
+ hostedThem: true,
},
- recommend: 'yes'
+ recommend: 'yes',
})
.expect(201);
@@ -118,8 +118,8 @@ describe('Create a reference', () => {
interactions: {
met: true,
hostedMe: true,
- hostedThem: true
- }
+ hostedThem: true,
+ },
});
});
@@ -132,9 +132,9 @@ describe('Create a reference', () => {
interactions: {
met: true,
hostedMe: true,
- hostedThem: true
+ hostedThem: true,
},
- recommend: 'yes'
+ recommend: 'yes',
})
.expect(201);
@@ -145,9 +145,9 @@ describe('Create a reference', () => {
interactions: {
met: false,
hostedMe: true,
- hostedThem: false
+ hostedThem: false,
},
- recommend: 'no'
+ recommend: 'no',
})
.expect(409);
});
@@ -159,17 +159,17 @@ describe('Create a reference', () => {
interactions: {
met: false,
hostedMe: true,
- hostedThem: false
+ hostedThem: false,
},
- recommend: 'no'
+ recommend: 'no',
})
.expect(400);
should(body).match({
message: 'Bad request.',
details: {
- userTo: 'self'
- }
+ userTo: 'self',
+ },
});
});
@@ -180,17 +180,17 @@ describe('Create a reference', () => {
interactions: {
met: false,
hostedMe: true,
- hostedThem: false
+ hostedThem: false,
},
- recommend: 'no'
+ recommend: 'no',
})
.expect(404);
should(body).match({
message: 'Not found.',
details: {
- userTo: 'not found'
- }
+ userTo: 'not found',
+ },
});
});
@@ -201,17 +201,17 @@ describe('Create a reference', () => {
interactions: {
met: false,
hostedMe: true,
- hostedThem: false
+ hostedThem: false,
},
- recommend: 'no'
+ recommend: 'no',
})
.expect(404);
should(body).match({
message: 'Not found.',
details: {
- userTo: 'not found'
- }
+ userTo: 'not found',
+ },
});
});
});
@@ -225,9 +225,9 @@ describe('Create a reference', () => {
interactions: {
met: true,
hostedMe: true,
- hostedThem: true
+ hostedThem: true,
},
- recommend: 'yes'
+ recommend: 'yes',
})
.expect(201);
@@ -247,9 +247,9 @@ describe('Create a reference', () => {
interactions: {
met: true,
hostedMe: true,
- hostedThem: true
+ hostedThem: true,
},
- recommend: 'yes'
+ recommend: 'yes',
})
.expect(201);
@@ -274,9 +274,9 @@ describe('Create a reference', () => {
interactions: {
met: true,
hostedMe: true,
- hostedThem: true
+ hostedThem: true,
},
- recommend: 'yes'
+ recommend: 'yes',
})
.expect(201);
@@ -303,7 +303,7 @@ describe('Create a reference', () => {
userTo: user1._id,
met: true,
recommend: 'no',
- public: false
+ public: false,
});
await reference.save();
@@ -316,9 +316,9 @@ describe('Create a reference', () => {
interactions: {
met: true,
hostedMe: true,
- hostedThem: true
+ hostedThem: true,
},
- recommend: 'yes'
+ recommend: 'yes',
})
.expect(201);
@@ -339,7 +339,7 @@ describe('Create a reference', () => {
userTo: user1._id,
met: true,
recommend: 'no',
- public: true
+ public: true,
});
await reference.save();
@@ -353,17 +353,17 @@ describe('Create a reference', () => {
interactions: {
met: true,
hostedMe: true,
- hostedThem: true
+ hostedThem: true,
},
- recommend: 'no'
+ recommend: 'no',
})
.expect(400);
should(body).match({
message: 'Bad request.',
details: {
- recommend: '\'yes\' expected - response to public'
- }
+ recommend: '\'yes\' expected - response to public',
+ },
});
// create a response reference with recommend: 'yes'
@@ -374,9 +374,9 @@ describe('Create a reference', () => {
interactions: {
met: true,
hostedMe: true,
- hostedThem: true
+ hostedThem: true,
},
- recommend: 'yes'
+ recommend: 'yes',
})
.expect(201);
});
@@ -389,7 +389,7 @@ describe('Create a reference', () => {
userFrom: user2._id,
userTo: user1._id,
met: true,
- recommend: 'no'
+ recommend: 'no',
});
await reference.save();
@@ -400,9 +400,9 @@ describe('Create a reference', () => {
interactions: {
met: true,
hostedMe: true,
- hostedThem: true
+ hostedThem: true,
},
- recommend: 'yes'
+ recommend: 'yes',
})
.expect(201);
@@ -430,9 +430,9 @@ describe('Create a reference', () => {
userFrom: user2._id,
userTo: user1._id,
interaction: {
- met: true
+ met: true,
},
- recommend: 'no'
+ recommend: 'no',
});
await reference.save();
@@ -443,9 +443,9 @@ describe('Create a reference', () => {
interactions: {
met: true,
hostedMe: true,
- hostedThem: true
+ hostedThem: true,
},
- recommend: 'yes'
+ recommend: 'yes',
})
.expect(201);
@@ -471,9 +471,9 @@ describe('Create a reference', () => {
userTo: user2._id,
interactions: {
met: 'met',
- hostedMe: false
+ hostedMe: false,
},
- recommend: 'unknown'
+ recommend: 'unknown',
})
.expect(400);
@@ -481,9 +481,9 @@ describe('Create a reference', () => {
message: 'Bad request.',
details: {
interactions: {
- met: 'boolean expected'
- }
- }
+ met: 'boolean expected',
+ },
+ },
});
});
@@ -493,17 +493,17 @@ describe('Create a reference', () => {
userTo: user2._id,
interactions: {
met: true,
- hostedMe: false
+ hostedMe: false,
},
- recommend: 'invalid'
+ recommend: 'invalid',
})
.expect(400);
should(body).match({
message: 'Bad request.',
details: {
- recommend: 'one of \'yes\', \'no\', \'unknown\' expected'
- }
+ recommend: 'one of \'yes\', \'no\', \'unknown\' expected',
+ },
});
});
@@ -512,17 +512,17 @@ describe('Create a reference', () => {
.send({
userTo: 'hello',
interactions: {
- hostedMe: true
+ hostedMe: true,
},
- recommend: 'yes'
+ recommend: 'yes',
})
.expect(400);
should(body).match({
message: 'Bad request.',
details: {
- userTo: 'userId expected'
- }
+ userTo: 'userId expected',
+ },
});
});
@@ -530,17 +530,17 @@ describe('Create a reference', () => {
const { body } = await agent.post('/api/references')
.send({
interactions: {
- hostedMe: true
+ hostedMe: true,
},
- recommend: 'yes'
+ recommend: 'yes',
})
.expect(400);
should(body).match({
message: 'Bad request.',
details: {
- userTo: 'missing'
- }
+ userTo: 'missing',
+ },
});
});
@@ -549,18 +549,18 @@ describe('Create a reference', () => {
.send({
userTo: user2._id,
interactions: {
- hostedMe: true
+ hostedMe: true,
},
recommend: 'yes',
- foo: 'bar'
+ foo: 'bar',
})
.expect(400);
should(body).match({
message: 'Bad request.',
details: {
- fields: 'unexpected'
- }
+ fields: 'unexpected',
+ },
});
});
@@ -570,9 +570,9 @@ describe('Create a reference', () => {
userTo: user2._id,
met: false,
interactions: {
- hostedMe: false
+ hostedMe: false,
},
- recommend: 'yes'
+ recommend: 'yes',
})
.expect(400);
@@ -580,9 +580,9 @@ describe('Create a reference', () => {
message: 'Bad request.',
details: {
interactions: {
- any: 'missing'
- }
- }
+ any: 'missing',
+ },
+ },
});
});
});
diff --git a/modules/references/tests/server/reference-read-many.server.routes.tests.js b/modules/references/tests/server/reference-read-many.server.routes.tests.js
index 41d11bdcc8..747a3a5941 100644
--- a/modules/references/tests/server/reference-read-many.server.routes.tests.js
+++ b/modules/references/tests/server/reference-read-many.server.routes.tests.js
@@ -25,7 +25,7 @@ describe('Read references by userFrom Id or userTo Id', () => {
const _usersPrivate = utils.generateUsers(3, {
public: false,
username: 'nonpublic',
- email: 'nonpublic@example.com'
+ email: 'nonpublic@example.com',
});
const _users = [..._usersPublic, ..._usersPrivate];
@@ -65,7 +65,7 @@ describe('Read references by userFrom Id or userTo Id', () => {
[2, 0], [2, 3], [2, 4, { public: false }], [2, 5],
[3, 0], [3, 2, { public: false }],
[4, 0, { public: false }],
- [5, 0]
+ [5, 0],
];
beforeEach(async () => {
@@ -164,7 +164,7 @@ describe('Read references by userFrom Id or userTo Id', () => {
should(nonpublic).be.Array().of.length(1);
should(nonpublic[0]).match({
public: false,
- created: new Date().toISOString()
+ created: new Date().toISOString(),
});
should(nonpublic[0]).have.only.keys('_id', 'userFrom', 'userTo', 'created', 'public');
});
@@ -178,8 +178,8 @@ describe('Read references by userFrom Id or userTo Id', () => {
message: 'Bad request.',
details: {
userFrom: 'missing',
- userTo: 'missing'
- }
+ userTo: 'missing',
+ },
});
});
@@ -192,8 +192,8 @@ describe('Read references by userFrom Id or userTo Id', () => {
message: 'Bad request.',
details: {
userFrom: 'invalid',
- userTo: 'invalid'
- }
+ userTo: 'invalid',
+ },
});
});
});
diff --git a/modules/references/tests/server/reference-read-one.server.routes.tests.js b/modules/references/tests/server/reference-read-one.server.routes.tests.js
index dd538216ec..fd557af931 100644
--- a/modules/references/tests/server/reference-read-one.server.routes.tests.js
+++ b/modules/references/tests/server/reference-read-one.server.routes.tests.js
@@ -53,7 +53,7 @@ describe('Read a single reference by reference id', () => {
const referenceData = [
[0, 1], [0, 2, { public: false }],
[1, 0, { public: false }], [1, 2],
- [2, 0], [2, 1, { public: false }]
+ [2, 0], [2, 1, { public: false }],
];
beforeEach(async () => {
@@ -89,9 +89,9 @@ describe('Read a single reference by reference id', () => {
interactions: {
met: references[3].interactions.met,
hostedMe: references[3].interactions.hostedMe,
- hostedThem: references[3].interactions.hostedThem
+ hostedThem: references[3].interactions.hostedThem,
},
- recommend: references[3].recommend
+ recommend: references[3].recommend,
});
});
@@ -102,7 +102,7 @@ describe('Read a single reference by reference id', () => {
should(body).match({
public: false,
- _id: references[1]._id.toString()
+ _id: references[1]._id.toString(),
});
});
@@ -114,7 +114,7 @@ describe('Read a single reference by reference id', () => {
should(body).match({
public: false,
_id: references[2]._id.toString(),
- created: new Date().toISOString()
+ created: new Date().toISOString(),
});
should(body).have.only.keys('userFrom', 'userTo', '_id', 'public', 'created');
@@ -128,8 +128,8 @@ describe('Read a single reference by reference id', () => {
should(body).eql({
message: 'Not found.',
details: {
- reference: 'not found'
- }
+ reference: 'not found',
+ },
});
});
@@ -141,8 +141,8 @@ describe('Read a single reference by reference id', () => {
should(body).eql({
message: 'Not found.',
details: {
- reference: 'not found'
- }
+ reference: 'not found',
+ },
});
});
@@ -154,8 +154,8 @@ describe('Read a single reference by reference id', () => {
should(body).eql({
message: 'Bad request.',
details: {
- referenceId: 'invalid'
- }
+ referenceId: 'invalid',
+ },
});
});
});
diff --git a/modules/references/tests/server/reference.server.jobs.tests.js b/modules/references/tests/server/reference.server.jobs.tests.js
index 56603c5546..47ced47c78 100644
--- a/modules/references/tests/server/reference.server.jobs.tests.js
+++ b/modules/references/tests/server/reference.server.jobs.tests.js
@@ -33,9 +33,9 @@ describe('Job: Set reference to public after a given period of time', () => {
interactions: {
met: true,
hostedMe: false,
- hostedThem: true
+ hostedThem: true,
},
- recommend: 'yes'
+ recommend: 'yes',
};
}
diff --git a/modules/references/tests/server/reference.server.model.tests.js b/modules/references/tests/server/reference.server.model.tests.js
index 8ef9f8a6c4..caaa0de0fe 100644
--- a/modules/references/tests/server/reference.server.model.tests.js
+++ b/modules/references/tests/server/reference.server.model.tests.js
@@ -26,9 +26,9 @@ describe('Reference Model Unit Tests', () => {
interactions: {
met: true,
hostedMe: true,
- hostedThem: false
+ hostedThem: false,
},
- recommend: 'no'
+ recommend: 'no',
});
const reference2 = new Reference({
@@ -37,9 +37,9 @@ describe('Reference Model Unit Tests', () => {
interactions: {
met: true,
hostedMe: false,
- hostedThem: true
+ hostedThem: true,
},
- recommend: 'yes'
+ recommend: 'yes',
});
await should(reference1.save()).be.resolved();
@@ -53,9 +53,9 @@ describe('Reference Model Unit Tests', () => {
interactions: {
met: true,
hostedMe: true,
- hostedThem: false
+ hostedThem: false,
},
- recommend: 'no'
+ recommend: 'no',
});
const reference2 = new Reference({
@@ -64,9 +64,9 @@ describe('Reference Model Unit Tests', () => {
interactions: {
met: true,
hostedMe: false,
- hostedThem: true
+ hostedThem: true,
},
- recommend: 'yes'
+ recommend: 'yes',
});
await should(reference1.save()).be.resolved();
@@ -80,9 +80,9 @@ describe('Reference Model Unit Tests', () => {
interactions: {
met: 'foo',
hostedMe: 'foolme',
- hostedThem: 'foolthem'
+ hostedThem: 'foolthem',
},
- recommend: 'bar'
+ recommend: 'bar',
});
const err = await should(reference.save()).be.rejected();
@@ -90,19 +90,19 @@ describe('Reference Model Unit Tests', () => {
'interactions.met': { value: 'foo', kind: 'Boolean' },
'interactions.hostedMe': { value: 'foolme', kind: 'Boolean' },
'interactions.hostedThem': { value: 'foolthem', kind: 'Boolean' },
- recommend: { value: 'bar', kind: 'enum' }
+ recommend: { value: 'bar', kind: 'enum' },
} });
});
it('show error when saving duplicate reference (reference (from, to) already exists)', async () => {
const reference1 = new Reference({
userFrom: user2._id,
- userTo: user1._id
+ userTo: user1._id,
});
const reference2 = new Reference({
userFrom: user2._id,
- userTo: user1._id
+ userTo: user1._id,
});
// the first reference should be successfully saved
@@ -112,7 +112,7 @@ describe('Reference Model Unit Tests', () => {
const err = await should(reference2.save()).be.rejected();
should(err).have.property('errors').match({
userFrom: { kind: 'unique' },
- userTo: { kind: 'unique' }
+ userTo: { kind: 'unique' },
});
});
});
diff --git a/modules/search/client/components/SearchUsers.component.js b/modules/search/client/components/SearchUsers.component.js
index 9ee479b900..e2eed60870 100644
--- a/modules/search/client/components/SearchUsers.component.js
+++ b/modules/search/client/components/SearchUsers.component.js
@@ -46,7 +46,7 @@ function UsersResults({ users }) {
}
UsersResults.propTypes = {
- users: PropTypes.array
+ users: PropTypes.array,
};
class SearchUsers extends React.Component {
@@ -59,7 +59,7 @@ class SearchUsers extends React.Component {
this.state = {
searchQuery: '',
- isSearching: false
+ isSearching: false,
};
}
diff --git a/modules/search/client/components/UsersList.js b/modules/search/client/components/UsersList.js
index 1895bb5d65..4fa32b409f 100644
--- a/modules/search/client/components/UsersList.js
+++ b/modules/search/client/components/UsersList.js
@@ -20,7 +20,7 @@ const User = ({ userData }) => {
};
User.propTypes = {
- userData: PropTypes.object
+ userData: PropTypes.object,
};
@@ -57,9 +57,9 @@ export default function UsersList({ users }) {
}
UsersList.defaultProps = {
- users: []
+ users: [],
};
UsersList.propTypes = {
- users: PropTypes.array
+ users: PropTypes.array,
};
diff --git a/modules/search/client/config/search.client.routes.js b/modules/search/client/config/search.client.routes.js
index 49e650b73b..fe04f09282 100644
--- a/modules/search/client/config/search.client.routes.js
+++ b/modules/search/client/config/search.client.routes.js
@@ -11,7 +11,7 @@
url: '/search?' + [
'location',
'offer',
- 'tribe'
+ 'tribe',
].join('?'),
templateUrl: '/modules/search/views/search.client.view.html',
abstract: true,
@@ -26,7 +26,7 @@
offer: function ($stateParams, OffersService) {
if ($stateParams.offer && $stateParams.offer.length === 24) {
return OffersService.get({
- offerId: $stateParams.offer
+ offerId: $stateParams.offer,
});
} else {
return false;
@@ -38,35 +38,35 @@
tribe: function (TribeService, $stateParams) {
if ($stateParams.tribe && $stateParams.tribe.length) {
return TribeService.get({
- tribeSlug: $stateParams.tribe
+ tribeSlug: $stateParams.tribe,
});
} else {
return false;
}
- }
+ },
},
data: {
- pageTitle: 'Search'
- }
+ pageTitle: 'Search',
+ },
}).
state('search.map', {
url: '',
requiresAuth: true,
footerHidden: true,
data: {
- pageTitle: 'Search'
+ pageTitle: 'Search',
},
views: {
'map': {
templateUrl: '/modules/search/views/search-map.client.view.html',
controller: 'SearchMapController',
- controllerAs: 'searchMap'
+ controllerAs: 'searchMap',
},
'sidebar': {
- templateUrl: '/modules/search/views/search-sidebar.client.view.html'
- }
- }
+ templateUrl: '/modules/search/views/search-sidebar.client.view.html',
+ },
+ },
}).
state('search-signin', {
url: '/search?location?offer?tribe',
@@ -76,8 +76,8 @@
controller: 'SearchSignupController',
controllerAs: 'searchSignup',
data: {
- pageTitle: 'Search'
- }
+ pageTitle: 'Search',
+ },
}).
state('search-users', {
url: '/search/members',
@@ -85,8 +85,8 @@
requiresAuth: true,
footerHidden: true,
data: {
- pageTitle: 'Search members'
- }
+ pageTitle: 'Search members',
+ },
});
}
}());
diff --git a/modules/search/client/controllers/search-map.client.controller.js b/modules/search/client/controllers/search-map.client.controller.js
index d6ea695f97..fd31cf95e0 100644
--- a/modules/search/client/controllers/search-map.client.controller.js
+++ b/modules/search/client/controllers/search-map.client.controller.js
@@ -22,7 +22,7 @@
vm.notFound = false;
vm.mapCenter = false;
vm.currentSelection = MapMarkersFactory.getOfferCircle({
- layer: 'selectedOffers'
+ layer: 'selectedOffers',
});
vm.mapMinimumZoom = 4;
@@ -33,9 +33,9 @@
selectedOffers: {
name: 'Selected hosts',
type: 'group',
- visible: false
- }
- }
+ visible: false,
+ },
+ },
};
vm.mapDefaults = {
attributionControl: false, // Adding this manually below
@@ -46,12 +46,12 @@
layers: {
visible: true,
position: 'bottomleft',
- collapsed: true
- }
- }
+ collapsed: true,
+ },
+ },
};
vm.mapPaths = {
- selected: vm.currentSelection
+ selected: vm.currentSelection,
};
/**
* Catch map events:
@@ -63,14 +63,14 @@
vm.mapEvents = {
map: {
enable: ['click', 'moveend', 'load', 'baselayerchange'],
- logic: 'emit'
- }
+ logic: 'emit',
+ },
};
vm.mapLastBounds = {
northEastLng: 0,
northEastLat: 0,
southWestLng: 0,
- southWestLat: 0
+ southWestLat: 0,
};
// Init
@@ -91,18 +91,18 @@
// Add map scale
map.addControl(L.control.scale({
- position: 'bottomright'
+ position: 'bottomright',
}));
// Add map zoom control (+/- buttons)
map.addControl(L.control.zoom({
- position: 'bottomright'
+ position: 'bottomright',
}));
// Add map attribution
map.addControl(L.control.attribution({
position: 'bottomright',
- prefix: ''
+ prefix: '',
}));
// Set active area to accommodate sidebar
@@ -204,12 +204,12 @@
// See above explanation for using `$event` coordinates
lat: $event && $event.latlng ? $event.latlng.lat : offer.location[0],
lng: $event && $event.latlng ? $event.latlng.lng : offer.location[1],
- zoom: 13
+ zoom: 13,
};
}
$analytics.eventTrack('offer.preview', {
category: 'search.map',
- label: 'Preview offer'
+ label: 'Preview offer',
});
}
}
@@ -234,8 +234,8 @@
location: true, // will update the url in the location bar,
inherit: true, // will inherit url parameters from current url.
notify: false, // will not broadcast $stateChangeStart and $stateChangeSuccess events.
- reload: false // will not force transition even if no state or params have changed
- }
+ reload: false, // will not force transition even if no state or params have changed
+ },
);
}
@@ -277,7 +277,7 @@
northEastLng: vm.mapBounds.northEast.lng + boundingDelta,
northEastLat: vm.mapBounds.northEast.lat + boundingDelta,
southWestLng: vm.mapBounds.southWest.lng - boundingDelta,
- southWestLat: vm.mapBounds.southWest.lat - boundingDelta
+ southWestLat: vm.mapBounds.southWest.lat - boundingDelta,
};
vm.lastZoom = vm.mapCenter.zoom;
@@ -290,7 +290,7 @@
northEastLat: vm.mapLastBounds.northEastLat,
southWestLng: vm.mapLastBounds.southWestLng,
southWestLat: vm.mapLastBounds.southWestLat,
- filters: FiltersService.get()
+ filters: FiltersService.get(),
}, function (offers) {
// Remove last markers
@@ -302,7 +302,7 @@
for (let i = -1, len = offers.length; ++i < len;) {
const marker = new PruneCluster.Marker(
offers[i].location[0],
- offers[i].location[1]
+ offers[i].location[1],
);
marker.data.icon = MapMarkersFactory.getIcon(offers[i]);
@@ -363,7 +363,7 @@
northEastLng: 0,
northEastLat: 0,
southWestLng: 0,
- southWestLat: 0
+ southWestLat: 0,
};
}
@@ -376,7 +376,7 @@
function onBaseLayerChange(event, layer) {
$analytics.eventTrack('baselayerchange', {
category: 'search.map',
- label: layer.leafletEvent.name
+ label: layer.leafletEvent.name,
});
// Determine currently selected baselayer style 'TRStyle' has to be
// set when defining layers. Possible values are: street, satellite
diff --git a/modules/search/client/controllers/search-signup.client.controller.js b/modules/search/client/controllers/search-signup.client.controller.js
index 8f85f76f08..58fdbfa66f 100644
--- a/modules/search/client/controllers/search-signup.client.controller.js
+++ b/modules/search/client/controllers/search-signup.client.controller.js
@@ -12,7 +12,7 @@
// Variables passed to leaflet directive at init
vm.mapCenter = LocationService.getDefaultLocation(3);
vm.mapLayers = {
- baselayers: MapLayersFactory.getLayers({ streets: false, satellite: true, outdoors: false })
+ baselayers: MapLayersFactory.getLayers({ streets: false, satellite: true, outdoors: false }),
};
vm.mapDefaults = {
attributionControl: false,
@@ -21,9 +21,9 @@
zoomControl: false,
controls: {
layers: {
- visible: false
- }
- }
+ visible: false,
+ },
+ },
};
/**
diff --git a/modules/search/client/controllers/search.client.controller.js b/modules/search/client/controllers/search.client.controller.js
index d6d46549fa..46c05aa7de 100644
--- a/modules/search/client/controllers/search.client.controller.js
+++ b/modules/search/client/controllers/search.client.controller.js
@@ -98,7 +98,7 @@
messageCenterService.add('danger', 'Sorry, we did not find what you are looking for.');
$analytics.eventTrack('offer-not-found', {
category: 'search.map',
- label: 'Offer not found'
+ label: 'Offer not found',
});
}
diff --git a/modules/search/client/directives/tr-my-tribes-toggle.client.directive.js b/modules/search/client/directives/tr-my-tribes-toggle.client.directive.js
index 1f4d24a043..a53fdbac3d 100644
--- a/modules/search/client/directives/tr-my-tribes-toggle.client.directive.js
+++ b/modules/search/client/directives/tr-my-tribes-toggle.client.directive.js
@@ -16,11 +16,11 @@
restrict: 'A',
replace: true,
scope: {
- tribeIds: '=trMyTribesToggle'
+ tribeIds: '=trMyTribesToggle',
},
templateUrl: '/modules/search/views/directives/tr-my-tribes-toggle.client.view.html',
controller: trMyTribesToggleController,
- controllerAs: 'myTribesToggle'
+ controllerAs: 'myTribesToggle',
};
return directive;
diff --git a/modules/search/client/directives/tr-tribes-toggle.client.directive.js b/modules/search/client/directives/tr-tribes-toggle.client.directive.js
index 35ef2aecc2..150dbc8aaf 100644
--- a/modules/search/client/directives/tr-tribes-toggle.client.directive.js
+++ b/modules/search/client/directives/tr-tribes-toggle.client.directive.js
@@ -21,11 +21,11 @@
restrict: 'A',
replace: true,
scope: {
- tribeIds: '=trTribesToggle'
+ tribeIds: '=trTribesToggle',
},
templateUrl: '/modules/search/views/directives/tr-tribes-toggle.client.view.html',
controller: trTribesToggleDirectiveController,
- controllerAs: 'trTribesToggle'
+ controllerAs: 'trTribesToggle',
};
return directive;
diff --git a/modules/search/client/directives/tr-types-toggle.client.directive.js b/modules/search/client/directives/tr-types-toggle.client.directive.js
index e089a2d7ee..217a5e75e1 100644
--- a/modules/search/client/directives/tr-types-toggle.client.directive.js
+++ b/modules/search/client/directives/tr-types-toggle.client.directive.js
@@ -21,11 +21,11 @@
restrict: 'A',
replace: true,
scope: {
- types: '=trTypesToggle'
+ types: '=trTypesToggle',
},
templateUrl: '/modules/search/views/directives/tr-types-toggle.client.view.html',
controller: trTypesToggleDirectiveController,
- controllerAs: 'trTypesToggle'
+ controllerAs: 'trTypesToggle',
};
return directive;
@@ -40,12 +40,12 @@
vm.types = [
{
id: 'host',
- label: 'Hosts'
+ label: 'Hosts',
},
{
id: 'meet',
- label: 'Meetups'
- }
+ label: 'Meetups',
+ },
];
// States of toggle switches inside this directive
diff --git a/modules/search/client/services/filters.client.service.js b/modules/search/client/services/filters.client.service.js
index b2810d77cb..4568bfdd67 100644
--- a/modules/search/client/services/filters.client.service.js
+++ b/modules/search/client/services/filters.client.service.js
@@ -14,12 +14,12 @@
tribes: [],
types: [
'host',
- 'meet'
+ 'meet',
],
languages: [],
seen: {
- months: 24
- }
+ months: 24,
+ },
};
// Make cache id unique for this user
@@ -36,7 +36,7 @@
const service = {
set: set,
- get: get
+ get: get,
};
return service;
diff --git a/modules/search/client/services/search-map.client.service.js b/modules/search/client/services/search-map.client.service.js
index c1c87b462f..754c3eede0 100644
--- a/modules/search/client/services/search-map.client.service.js
+++ b/modules/search/client/services/search-map.client.service.js
@@ -18,7 +18,7 @@
const service = {
getMapCenter: getMapCenter,
- cacheMapCenter: cacheMapCenter
+ cacheMapCenter: cacheMapCenter,
};
return service;
@@ -82,7 +82,7 @@
'lat': location.lat,
'lng': location.lng,
'zoom': location.zoom,
- 'date': new Date()
+ 'date': new Date(),
});
}
}
diff --git a/modules/sparkpost/server/controllers/sparkpost-webhooks.server.controller.js b/modules/sparkpost/server/controllers/sparkpost-webhooks.server.controller.js
index df67cbfa7e..465f8c4d7a 100644
--- a/modules/sparkpost/server/controllers/sparkpost-webhooks.server.controller.js
+++ b/modules/sparkpost/server/controllers/sparkpost-webhooks.server.controller.js
@@ -38,7 +38,7 @@ const config = require(path.resolve('./config/config'));
exports.receiveBatch = function (req, res) {
if (!_.isArray(req.body) || !req.body.length) {
return res.status(400).send({
- message: errorService.getErrorMessageByKey('bad-request')
+ message: errorService.getErrorMessageByKey('bad-request'),
});
}
@@ -61,7 +61,7 @@ exports.processAndSendMetrics = function (event, callback) {
// only numbers can be saved as count/value in stathat, so every string value must be either tag (saved) or meta (ignored)
const meta = {
country: '',
- campaignId: ''
+ campaignId: '',
};
const tags = {};
@@ -73,7 +73,7 @@ exports.processAndSendMetrics = function (event, callback) {
'relay_event',
'track_event',
'gen_event',
- 'unsubscribe_event'
+ 'unsubscribe_event',
];
// Validate against these event types
@@ -98,7 +98,7 @@ exports.processAndSendMetrics = function (event, callback) {
'relay_tempfail',
'relay_permfail',
'open',
- 'click'
+ 'click',
];
// Get what's in first key of `msys` object
@@ -123,7 +123,7 @@ exports.processAndSendMetrics = function (event, callback) {
if (!tags.category || !tags.type) {
log('error', 'Could not validate SparkPost event webhook.', {
type: eventType,
- category: eventCategory
+ category: eventCategory,
});
return callback();
}
@@ -136,7 +136,7 @@ exports.processAndSendMetrics = function (event, callback) {
meta.campaignId = speakingurl(campaignId, {
separator: '-', // char that replaces the whitespaces
maintainCase: false, // don't maintain case
- truncate: 255 // truncate to 255 chars
+ truncate: 255, // truncate to 255 chars
});
}
@@ -149,10 +149,10 @@ exports.processAndSendMetrics = function (event, callback) {
const statObj = {
namespace: 'transactionalEmailEvent',
counts: {
- count: 1
+ count: 1,
},
tags: tags,
- meta: meta
+ meta: meta,
};
// Set `time` field to event's timestamp
@@ -185,7 +185,7 @@ exports.basicAuthenticate = function (req, res, next) {
res.set('WWW-Authenticate', 'Basic realm="Knock Knock"');
return res.status(401).send({
- message: 'Access denied'
+ message: 'Access denied',
});
}
diff --git a/modules/sparkpost/tests/server/sparkpost-webhooks.server.controller.tests.js b/modules/sparkpost/tests/server/sparkpost-webhooks.server.controller.tests.js
index 2c0f7b307b..b5baa007b4 100644
--- a/modules/sparkpost/tests/server/sparkpost-webhooks.server.controller.tests.js
+++ b/modules/sparkpost/tests/server/sparkpost-webhooks.server.controller.tests.js
@@ -26,7 +26,7 @@ describe('Sparkpost Webhooks - Integration Test', function () {
influx.InfluxDB.prototype.writeMeasurement.returns(
new Promise(function (resolve) {
process.nextTick(resolve());
- })
+ }),
);
// provide config options for influxdb
@@ -34,7 +34,7 @@ describe('Sparkpost Webhooks - Integration Test', function () {
host: 'localhost',
port: 8086,
protocol: 'http',
- database: 'trustroots-test'
+ database: 'trustroots-test',
});
// stub the stathat endpoints
@@ -47,12 +47,12 @@ describe('Sparkpost Webhooks - Integration Test', function () {
message_event: {
type: 'click',
geo_ip: {
- country: 'abc'
+ country: 'abc',
},
timestamp: 1234567890,
- campaign_id: 'this is a campaign id'
- }
- }
+ campaign_id: 'this is a campaign id',
+ },
+ },
};
context('influxdb configured', function () {
@@ -124,7 +124,7 @@ describe('Sparkpost Webhooks - Integration Test', function () {
_.forEach([
'transactionalEmailEvent.count',
'transactionalEmailEvent.count.category.message_event',
- 'transactionalEmailEvent.count.type.click'
+ 'transactionalEmailEvent.count.type.click',
], function (value) {
should(groupedArgs[1]).containEql(value);
});
diff --git a/modules/sparkpost/tests/server/sparkpost.server.routes.tests.js b/modules/sparkpost/tests/server/sparkpost.server.routes.tests.js
index 224d517966..aa25c86179 100644
--- a/modules/sparkpost/tests/server/sparkpost.server.routes.tests.js
+++ b/modules/sparkpost/tests/server/sparkpost.server.routes.tests.js
@@ -30,10 +30,10 @@ describe('Sparkpost CRUD tests', function () {
'message_event': {
'type': 'delivery',
'campaign_id': 'example',
- 'timestamp': '1454442600'
- }
- }
- }
+ 'timestamp': '1454442600',
+ },
+ },
+ },
];
done();
diff --git a/modules/statistics/client/config/statistics.client.routes.js b/modules/statistics/client/config/statistics.client.routes.js
index 64ab1ca064..efd6c7ab74 100644
--- a/modules/statistics/client/config/statistics.client.routes.js
+++ b/modules/statistics/client/config/statistics.client.routes.js
@@ -18,11 +18,11 @@
SettingsService: 'Statistics',
statisticsData: function (Statistics) {
return Statistics.get();
- }
+ },
},
data: {
- pageTitle: 'Statistics'
- }
+ pageTitle: 'Statistics',
+ },
});
}
diff --git a/modules/statistics/client/controllers/statistics.client.controller.js b/modules/statistics/client/controllers/statistics.client.controller.js
index c5754b3106..8b4b494d74 100644
--- a/modules/statistics/client/controllers/statistics.client.controller.js
+++ b/modules/statistics/client/controllers/statistics.client.controller.js
@@ -46,7 +46,7 @@
angular.forEach(data.connected, function (count, network) {
vm.connections.push({
network: network,
- count: count
+ count: count,
});
});
diff --git a/modules/statistics/server/controllers/statistics.server.controller.js b/modules/statistics/server/controllers/statistics.server.controller.js
index abaac28dfa..a830e38993 100644
--- a/modules/statistics/server/controllers/statistics.server.controller.js
+++ b/modules/statistics/server/controllers/statistics.server.controller.js
@@ -75,8 +75,8 @@ exports.getMeetOffersCount = function (callback) {
type: 'meet',
$or: [
{ validUntil: { $gte: new Date() } },
- { validUntil: { $exists: false } }
- ]
+ { validUntil: { $exists: false } },
+ ],
}, function (err, count) {
if (err) {
return callback(err);
@@ -93,17 +93,17 @@ exports.getHostOffersCount = function (callback) {
Offer.aggregate([
{
$match: {
- type: 'host'
- }
+ type: 'host',
+ },
},
{
$group: {
_id: '$status',
count: {
- $sum: 1
- }
- }
- }
+ $sum: 1,
+ },
+ },
+ },
],
function (err, counters) {
if (err) {
@@ -129,7 +129,7 @@ exports.getHostOffersCount = function (callback) {
const values = {
yes: 0,
maybe: 0,
- no: 0
+ no: 0,
};
if (counters && counters.length > 0) {
@@ -150,7 +150,7 @@ exports.getHostOffersCount = function (callback) {
exports.getNewsletterSubscriptionsCount = function (callback) {
User.countDocuments({
newsletter: true,
- public: true
+ public: true,
},
function (err, count) {
if (err) {
@@ -169,8 +169,8 @@ exports.getPushRegistrationCount = function (callback) {
pushRegistration: {
$exists: true,
// `pushRegistration` array should not be empty
- $not: { $size: 0 }
- }
+ $not: { $size: 0 },
+ },
}, function (err, count) {
if (err) {
return callback(err);
@@ -185,8 +185,8 @@ exports.getPushRegistrationCount = function (callback) {
exports.getLastSeenStatistic = function (since, callback) {
const query = {
seen: {
- '$gte': moment().subtract(since).toDate()
- }
+ '$gte': moment().subtract(since).toDate(),
+ },
};
User.countDocuments(query, function (err, count) {
@@ -203,7 +203,7 @@ exports.getLastSeenStatistic = function (since, callback) {
exports.getPublicStatistics = function (req, res) {
req.statistics = {
connected: {},
- hosting: {}
+ hosting: {},
};
async.waterfall([
@@ -311,13 +311,13 @@ exports.getPublicStatistics = function (req, res) {
// Done!
function () {
return res.json(req.statistics);
- }
+ },
],
function (err) {
if (err) {
res.status(400).send({
- message: errorService.getErrorMessage(err)
+ message: errorService.getErrorMessage(err),
});
}
});
@@ -345,7 +345,7 @@ exports.collectStatistics = function (req, res) {
.header('x-tr-update-needed', updateMsg)
.status(400)
.send({
- message: 'Missing or invalid `stats`.'
+ message: 'Missing or invalid `stats`.',
});
}
@@ -354,7 +354,7 @@ exports.collectStatistics = function (req, res) {
.header('x-tr-update-needed', updateMsg)
.status(400)
.send({
- message: 'Missing or invalid `collection`.'
+ message: 'Missing or invalid `collection`.',
});
}
@@ -367,21 +367,21 @@ exports.collectStatistics = function (req, res) {
const stats = {
namespace: 'mobileAppInit',
counts: {
- count: 1
+ count: 1,
},
tags: {
// Trustroots app version (e.g. "0.2.0")
version: appVersion,
// Device year class, e.g. "2012"
// @link https://github.com/facebook/device-year-class
- deviceYearClass: String(_.get(req, 'body.stats.deviceYearClass', 'unknown'))
+ deviceYearClass: String(_.get(req, 'body.stats.deviceYearClass', 'unknown')),
},
meta: {
// Device OS (e.g. "android")
os: String(_.get(req, 'body.stats.os', 'unknown')),
// Expo SDK version
- expoVersion: String(_.get(req, 'body.stats.expoVersion', 'unknown'))
- }
+ expoVersion: String(_.get(req, 'body.stats.expoVersion', 'unknown')),
+ },
};
// Send validation result to stats
diff --git a/modules/statistics/server/jobs/daily-statistics.server.job.js b/modules/statistics/server/jobs/daily-statistics.server.job.js
index 899787ee6f..2f6a88904e 100644
--- a/modules/statistics/server/jobs/daily-statistics.server.job.js
+++ b/modules/statistics/server/jobs/daily-statistics.server.job.js
@@ -35,11 +35,11 @@ module.exports = function (job, agendaDone) {
writeDailyStat({
namespace: 'members',
values: {
- count: count
+ count: count,
},
tags: {
- members: 'members'
- }
+ members: 'members',
+ },
}, done);
});
},
@@ -56,11 +56,11 @@ module.exports = function (job, agendaDone) {
writeDailyStat({
namespace: 'pushRegistrations',
values: {
- count: count
+ count: count,
},
tags: {
- type: 'all'
- }
+ type: 'all',
+ },
}, done);
});
@@ -100,12 +100,12 @@ module.exports = function (job, agendaDone) {
namespace: 'offers',
values: {
count: count,
- percentage: count / totalUserCount * 100
+ percentage: count / totalUserCount * 100,
},
tags: {
type: 'host',
- status: String(offerStatus) // `yes|maybe|no`
- }
+ status: String(offerStatus), // `yes|maybe|no`
+ },
}, doneStatus);
}, done);
@@ -124,11 +124,11 @@ module.exports = function (job, agendaDone) {
writeDailyStat({
namespace: 'offers',
values: {
- count: count
+ count: count,
},
tags: {
- type: 'meet'
- }
+ type: 'meet',
+ },
}, done);
});
},
@@ -141,7 +141,7 @@ module.exports = function (job, agendaDone) {
'bewelcome',
'facebook',
'twitter',
- 'github'
+ 'github',
];
// Loop trough each network in series
@@ -158,15 +158,15 @@ module.exports = function (job, agendaDone) {
namespace: 'membersInNetworks',
values: {
count: count,
- percentage: count / totalUserCount * 100
+ percentage: count / totalUserCount * 100,
},
tags: {
- network: networkName
- }
+ network: networkName,
+ },
}, doneNetwork);
});
}, done);
- }
+ },
], function (err) {
if (err) {
@@ -223,11 +223,11 @@ function collectLastSeen(seenSinceDays, namespace, totalUserCount, callback) {
namespace: namespace,
values: {
count: count,
- percentage: count / totalUserCount * 100
+ percentage: count / totalUserCount * 100,
},
tags: {
- access: 'members'
- }
+ access: 'members',
+ },
}, callback);
});
}
diff --git a/modules/statistics/tests/server/jobs/daily-statistics.server.job.tests.js b/modules/statistics/tests/server/jobs/daily-statistics.server.job.tests.js
index 754bed8152..5b7d3114ca 100644
--- a/modules/statistics/tests/server/jobs/daily-statistics.server.job.tests.js
+++ b/modules/statistics/tests/server/jobs/daily-statistics.server.job.tests.js
@@ -25,7 +25,7 @@ describe('Daily Statistics Job - Unit Test', function () {
influx.InfluxDB.prototype.writeMeasurement.returns(
new Promise(function (resolve) {
process.nextTick(resolve());
- })
+ }),
);
// provide config options for influxdb
@@ -33,7 +33,7 @@ describe('Daily Statistics Job - Unit Test', function () {
host: 'localhost',
port: 8086,
protocol: 'http',
- database: 'trustroots-test'
+ database: 'trustroots-test',
});
// stub the stathat endpoints
@@ -113,13 +113,13 @@ describe('Daily Statistics Job - Unit Test', function () {
// `getCall(0)` and `getCall(1)` contain calls for member count
const memberGroupedArgs = _.zip.apply(this, [
stathat.trackEZValue.getCall(0).args,
- stathat.trackEZValue.getCall(1).args
+ stathat.trackEZValue.getCall(1).args,
]);
// `getCall(2)` and `getCall(3)` contain calls for push registration count
const pushGroupedArgs = _.zip.apply(this, [
stathat.trackEZValue.getCall(2).args,
- stathat.trackEZValue.getCall(3).args
+ stathat.trackEZValue.getCall(3).args,
]);
// the first argument to the endpoint should be the stathat key
@@ -129,14 +129,14 @@ describe('Daily Statistics Job - Unit Test', function () {
// the 2nd argument to the endpoint should be the name
_.forEach([
'members.count',
- 'members.count.members.members' // with the members tag
+ 'members.count.members.members', // with the members tag
], function (value) {
should(memberGroupedArgs[1]).containEql(value);
});
_.forEach([
'pushRegistrations.count',
- 'pushRegistrations.count.type.all' // with the members tag
+ 'pushRegistrations.count.type.all', // with the members tag
], function (value) {
should(pushGroupedArgs[1]).containEql(value);
});
diff --git a/modules/statistics/tests/server/statistics.server.routes.tests.js b/modules/statistics/tests/server/statistics.server.routes.tests.js
index e43d89ceb7..06ecef5bc2 100644
--- a/modules/statistics/tests/server/statistics.server.routes.tests.js
+++ b/modules/statistics/tests/server/statistics.server.routes.tests.js
@@ -34,7 +34,7 @@ describe('Statistics CRUD tests', function () {
// Create user credentials
credentials = {
username: 'loremipsum',
- password: 'Password123!'
+ password: 'Password123!',
};
// Create a new user NON-public user
@@ -50,7 +50,7 @@ describe('Statistics CRUD tests', function () {
public: false,
extSitesCS: 'username1',
extSitesBW: 'username1',
- extSitesWS: '1231231'
+ extSitesWS: '1231231',
});
// Create a new user public user
@@ -66,7 +66,7 @@ describe('Statistics CRUD tests', function () {
public: true,
extSitesCS: 'username2',
extSitesBW: 'username2',
- extSitesWS: '12312312'
+ extSitesWS: '12312312',
});
// Create a new user public user without extSites and without newsletter
@@ -83,16 +83,16 @@ describe('Statistics CRUD tests', function () {
extSitesCS: 'username3',
additionalProvidersData: {
facebook: {
- username: 'username3'
+ username: 'username3',
},
twitter: {
- username: 'username3'
+ username: 'username3',
},
github: {
- username: 'username3'
- }
+ username: 'username3',
+ },
},
- extSitesBW: ''
+ extSitesBW: '',
});
offer = {
@@ -102,7 +102,7 @@ describe('Statistics CRUD tests', function () {
type: 'host',
updated: new Date(),
location: [52.498981209298776, 13.418329954147339],
- locationFuzzy: [52.50155039101136, 13.42255019882177]
+ locationFuzzy: [52.50155039101136, 13.42255019882177],
};
// Save users and offers to the test db
@@ -214,8 +214,8 @@ describe('Statistics CRUD tests', function () {
version: '1.0.0',
deviceYearClass: '2015',
expoVersion: '21.0.0',
- os: 'android'
- }
+ os: 'android',
+ },
})
// .expect(200)
.end(function (statsWriteErr, statsWriteRes) {
@@ -242,8 +242,8 @@ describe('Statistics CRUD tests', function () {
version: '1.0.0',
deviceYearClass: '2015',
expoVersion: '21.0.0',
- os: 'android'
- }
+ os: 'android',
+ },
})
.expect(400)
.end(function (statsWriteErr, statsWriteRes) {
@@ -271,8 +271,8 @@ describe('Statistics CRUD tests', function () {
version: '0.1.0',
deviceYearClass: '2015',
expoVersion: '21.0.0',
- os: 'android'
- }
+ os: 'android',
+ },
})
.expect(200)
.end(function (statsWriteErr, statsWriteRes) {
diff --git a/modules/stats/server/services/influx.server.service.js b/modules/stats/server/services/influx.server.service.js
index 4fbc5deedc..a072ca2c37 100644
--- a/modules/stats/server/services/influx.server.service.js
+++ b/modules/stats/server/services/influx.server.service.js
@@ -65,7 +65,7 @@ const writeMeasurement = function (measurementName, fields, tags, callback) {
errorMessage = 'InfluxDB Service: no `fields` defined. #ghugGJ';
// Log the failure
log('error', errorMessage, {
- measurement: measurementName
+ measurement: measurementName,
});
return callback(new Error(errorMessage));
}
@@ -74,7 +74,7 @@ const writeMeasurement = function (measurementName, fields, tags, callback) {
errorMessage = 'InfluxDB Service: no `tags` defined. #ghj3ig';
// Log the failure
log('error', errorMessage, {
- measurement: measurementName
+ measurement: measurementName,
});
return callback(new Error(errorMessage));
}
@@ -82,7 +82,7 @@ const writeMeasurement = function (measurementName, fields, tags, callback) {
// the point is the IPoint we'll send to node-influx's writeMeasurement
const point = {
fields: fields,
- tags: tags
+ tags: tags,
};
// deal with the time
@@ -93,7 +93,7 @@ const writeMeasurement = function (measurementName, fields, tags, callback) {
// Log the failure
log('error', errorMessage, {
measurement: measurementName,
- time: fields.time
+ time: fields.time,
});
// callback with error
@@ -111,7 +111,7 @@ const writeMeasurement = function (measurementName, fields, tags, callback) {
}
client.writeMeasurement(measurementName, [
- point
+ point,
])
.then(function () {
if (callback) return callback();
@@ -122,7 +122,7 @@ const writeMeasurement = function (measurementName, fields, tags, callback) {
error: err,
measurement: measurementName,
fields: fields,
- tags: tags
+ tags: tags,
});
return callback(err);
diff --git a/modules/stats/server/services/stats.server.service.js b/modules/stats/server/services/stats.server.service.js
index 32ca6245ef..7df91a980b 100644
--- a/modules/stats/server/services/stats.server.service.js
+++ b/modules/stats/server/services/stats.server.service.js
@@ -103,8 +103,8 @@ function count(name, count, time, callback) {
const statObject = {
namespace: name,
counts: {
- count: count
- }
+ count: count,
+ },
};
if (time) { statObject.time = time; }
@@ -134,8 +134,8 @@ function value(name, value, time, callback) {
const statObject = {
namespace: name,
values: {
- value: value
- }
+ value: value,
+ },
};
if (time) statObject.time = time;
@@ -302,7 +302,7 @@ function stat(stat, callback) {
finalErr.errors = {
influx: influxErr,
- stathat: stathatErr
+ stathat: stathatErr,
};
return callback(finalErr);
diff --git a/modules/stats/tests/server/services/influx.server.service.tests.js b/modules/stats/tests/server/services/influx.server.service.tests.js
index 7da621d6d7..aa515f4ee9 100644
--- a/modules/stats/tests/server/services/influx.server.service.tests.js
+++ b/modules/stats/tests/server/services/influx.server.service.tests.js
@@ -45,8 +45,8 @@ describe('Service: influx', function () {
host: 'example.com',
port: 9876,
protocol: 'https',
- database: 'example'
- }
+ database: 'example',
+ },
});
// stub the influx.writeMeasurement method
@@ -56,7 +56,7 @@ describe('Service: influx', function () {
influx.InfluxDB.prototype.writeMeasurement.returns(
new Promise(function (resolve) {
process.nextTick(resolve());
- })
+ }),
);
});
@@ -138,19 +138,19 @@ describe('Service: influx', function () {
const validData = {
namespace: 'messages',
counts: {
- sent: 1
+ sent: 1,
},
values: {
- timeToFirstReply: 27364
+ timeToFirstReply: 27364,
},
tags: {
position: 'firstMessage',
- messageLengthType: 'long'
+ messageLengthType: 'long',
},
meta: {
messageId: 'aabbccddee',
- messageLength: 345
- }
+ messageLength: 345,
+ },
};
influxService.stat(validData, function (e) {
@@ -189,12 +189,12 @@ describe('Service: influx', function () {
const validData = {
namespace: 'messages',
counts: {
- sent: 1
+ sent: 1,
},
values: {
- value: 334
+ value: 334,
},
- time: new Date('2001-10-02')
+ time: new Date('2001-10-02'),
};
influxService.stat(validData, function (e) {
diff --git a/modules/stats/tests/server/services/stathat.server.service.tests.js b/modules/stats/tests/server/services/stathat.server.service.tests.js
index 09dcdbdac2..96ceba8972 100644
--- a/modules/stats/tests/server/services/stathat.server.service.tests.js
+++ b/modules/stats/tests/server/services/stathat.server.service.tests.js
@@ -39,8 +39,8 @@ describe('Stathat Service Unit Test', function () {
const stat = {
namespace: 'testCount',
counts: {
- count: 2
- }
+ count: 2,
+ },
};
stathatService.stat(stat, function (e) {
@@ -64,9 +64,9 @@ describe('Stathat Service Unit Test', function () {
const stat = {
namespace: 'testCountWithTime',
counts: {
- count: 2
+ count: 2,
},
- time: new Date('2033-07-13')
+ time: new Date('2033-07-13'),
};
stathatService.stat(stat, function (e) {
@@ -90,8 +90,8 @@ describe('Stathat Service Unit Test', function () {
const stat = {
namespace: 'testValue',
values: {
- value: 2
- }
+ value: 2,
+ },
};
stathatService.stat(stat, function (e) {
@@ -115,9 +115,9 @@ describe('Stathat Service Unit Test', function () {
const stat = {
namespace: 'testValueWithTime',
values: {
- value: 3
+ value: 3,
},
- time: new Date('2033-07-15 12:03:05.332')
+ time: new Date('2033-07-15 12:03:05.332'),
};
stathatService.stat(stat, function (e) {
@@ -141,13 +141,13 @@ describe('Stathat Service Unit Test', function () {
const stat = {
namespace: 'testValueWithTime',
values: {
- value: 3
+ value: 3,
},
tags: {
first: 'foo',
- second: 'bar'
+ second: 'bar',
},
- time: new Date('2033-07-15 12:03:05.332')
+ time: new Date('2033-07-15 12:03:05.332'),
};
stathatService.stat(stat, function (e) {
@@ -175,7 +175,7 @@ describe('Stathat Service Unit Test', function () {
should(argmGroups[1]).containEql([
defaultName, // the default metric name
defaultName + '.first.foo', // the name with 1st tag
- defaultName + '.second.bar' // the name with 2nd tag
+ defaultName + '.second.bar', // the name with 2nd tag
][n]);
// 3rd argument is a stat value
@@ -197,12 +197,12 @@ describe('Stathat Service Unit Test', function () {
namespace: 'testCountWithTime',
counts: {
count: 2,
- events: 5
+ events: 5,
},
values: {
value: 3,
- other: 7
- }
+ other: 7,
+ },
};
stathatService.stat(stat, function (e) {
diff --git a/modules/stats/tests/server/services/stats.server.service.tests.js b/modules/stats/tests/server/services/stats.server.service.tests.js
index 5175050f8f..7ae4788da0 100644
--- a/modules/stats/tests/server/services/stats.server.service.tests.js
+++ b/modules/stats/tests/server/services/stats.server.service.tests.js
@@ -69,7 +69,7 @@ describe('General Stats API Service Unit Tests', function () {
counts: { duplicate: 1 },
values: { duplicate: 'value' },
meta: { duplicate: 'meta' },
- tags: { duplicate: 'tag' }
+ tags: { duplicate: 'tag' },
};
statsService.stat(statWithDuplicates, function (e) {
@@ -89,17 +89,17 @@ describe('General Stats API Service Unit Tests', function () {
const validData = {
namespace: 'test',
counts: {
- testCount: 1
+ testCount: 1,
},
values: {
- testValue: 3.5
+ testValue: 3.5,
},
meta: {
- testMeta: 13
+ testMeta: 13,
},
tags: {
- testTag: 'testing'
- }
+ testTag: 'testing',
+ },
};
it('should reach influxService.stat with correct data', function (done) {
diff --git a/modules/stats/tests/server/stats-api-integration.server.tests.js b/modules/stats/tests/server/stats-api-integration.server.tests.js
index 2d37e87d25..eca2dcf66a 100644
--- a/modules/stats/tests/server/stats-api-integration.server.tests.js
+++ b/modules/stats/tests/server/stats-api-integration.server.tests.js
@@ -26,7 +26,7 @@ describe('Stat API integration tests', function () {
influx.InfluxDB.prototype.writeMeasurement.returns(
new Promise(function (resolve) {
process.nextTick(resolve());
- })
+ }),
);
// provide config options for influxdb
@@ -34,7 +34,7 @@ describe('Stat API integration tests', function () {
host: 'localhost',
port: 8086,
protocol: 'http',
- database: 'trustroots-test'
+ database: 'trustroots-test',
});
// stub the stathat endpoints
@@ -72,12 +72,12 @@ describe('Stat API integration tests', function () {
namespace: 'test',
counts: {
count1: 1,
- count2: 2
+ count2: 2,
},
values: {
value1: 3,
- value2: 4
- }
+ value2: 4,
+ },
};
// call the stat api with the testing data
@@ -143,13 +143,13 @@ describe('Stat API integration tests', function () {
namespace: 'test',
counts: {
count1: 1,
- count2: 2
+ count2: 2,
},
values: {
value1: 3,
- value2: 4
+ value2: 4,
},
- time: new Date('2012-12-21 13:41:01.134')
+ time: new Date('2012-12-21 13:41:01.134'),
};
// call the stat api with the testing data
@@ -222,15 +222,15 @@ describe('Stat API integration tests', function () {
const data = {
namespace: 'test',
counts: {
- count: 1
+ count: 1,
},
values: {
- value: 2
+ value: 2,
},
tags: {
tag1: 'string1',
- tag2: 'string2'
- }
+ tag2: 'string2',
+ },
};
// call the stat api with the testing data
@@ -287,7 +287,7 @@ describe('Stat API integration tests', function () {
// the expected names
'test.count',
'test.count.tag1.string1',
- 'test.count.tag2.string2'
+ 'test.count.tag2.string2',
], function (value) {
// the 2nd arguments of the countsCalledWith
should(countGroupArgs[1]).containEql(value);
@@ -303,7 +303,7 @@ describe('Stat API integration tests', function () {
// the expected names
'test.value',
'test.value.tag1.string1',
- 'test.value.tag2.string2'
+ 'test.value.tag2.string2',
], function (value) {
// the 2nd arguments of the countsCalledWith
should(valueGroupArgs[1]).containEql(value);
@@ -325,15 +325,15 @@ describe('Stat API integration tests', function () {
const data = {
namespace: 'test',
counts: {
- count: 1
+ count: 1,
},
values: {
- value: 2
+ value: 2,
},
meta: {
meta1: 'meta string',
- meta2: 3
- }
+ meta2: 3,
+ },
};
// call the stat api with the testing data
@@ -564,11 +564,11 @@ describe('Stat API integration tests', function () {
const invalidData = {
namespace: 'test',
counts: {
- sameName: 3
+ sameName: 3,
},
values: {
- sameName: 2
- }
+ sameName: 2,
+ },
};
// call the stat api with the testing data
@@ -592,8 +592,8 @@ describe('Stat API integration tests', function () {
namespace: 'test',
counts: {},
meta: {
- meta1: 1
- }
+ meta1: 1,
+ },
};
// call the stat api with the testing data
@@ -616,8 +616,8 @@ describe('Stat API integration tests', function () {
const invalidData = {
namespace: 'test',
counts: {
- stringCount: 'string'
- }
+ stringCount: 'string',
+ },
};
// call the stat api with the testing data
@@ -640,9 +640,9 @@ describe('Stat API integration tests', function () {
const data = {
namespace: 'invalidTime',
values: {
- v1: 5
+ v1: 5,
},
- time: 123456
+ time: 123456,
};
// call the stat api with the testing data
statsService.stat(data, function (e) {
@@ -680,8 +680,8 @@ describe('Stat API integration tests', function () {
statsService.stat({
namespace: 'test',
counts: {
- c: 1
- }
+ c: 1,
+ },
}, function (e) {
if (e) return done(e);
try {
@@ -712,8 +712,8 @@ describe('Stat API integration tests', function () {
statsService.stat({
namespace: 'test',
counts: {
- c: 1
- }
+ c: 1,
+ },
}, function (e) {
if (e) return done(e);
try {
diff --git a/modules/support/client/components/ReportMemberLink.component.js b/modules/support/client/components/ReportMemberLink.component.js
index 52d8eab64a..1a18df04e8 100644
--- a/modules/support/client/components/ReportMemberLink.component.js
+++ b/modules/support/client/components/ReportMemberLink.component.js
@@ -21,5 +21,5 @@ export default function ReportMemberLink({ username }) {
}
ReportMemberLink.propTypes = {
- username: PropTypes.string.isRequired
+ username: PropTypes.string.isRequired,
};
diff --git a/modules/support/client/config/support.client.routes.js b/modules/support/client/config/support.client.routes.js
index 7586db44b1..697dff9c98 100644
--- a/modules/support/client/config/support.client.routes.js
+++ b/modules/support/client/config/support.client.routes.js
@@ -14,8 +14,8 @@
controller: 'SupportController',
controllerAs: 'support',
data: {
- pageTitle: 'Support'
- }
+ pageTitle: 'Support',
+ },
}).
// Deprecated (02-2016):
state('contact', {
@@ -25,8 +25,8 @@
controller: 'SupportController',
controllerAs: 'support',
data: {
- pageTitle: 'Contact us'
- }
+ pageTitle: 'Contact us',
+ },
});
}
}());
diff --git a/modules/support/client/controllers/support.client.controller.js b/modules/support/client/controllers/support.client.controller.js
index a91348a5e6..b3a8c981fe 100644
--- a/modules/support/client/controllers/support.client.controller.js
+++ b/modules/support/client/controllers/support.client.controller.js
@@ -16,7 +16,7 @@
vm.request = {
username: '',
email: '',
- message: ''
+ message: '',
};
activate();
diff --git a/modules/support/server/controllers/support.server.controller.js b/modules/support/server/controllers/support.server.controller.js
index c77a67415a..3d032b5c07 100644
--- a/modules/support/server/controllers/support.server.controller.js
+++ b/modules/support/server/controllers/support.server.controller.js
@@ -29,14 +29,14 @@ exports.supportRequest = function (req, res) {
authenticated: (req.user) ? 'yes' : 'no',
profilePublic: (req.user && req.user.public) ? 'yes' : 'no',
signupDate: (req.user) ? req.user.created.toString() : '-',
- reportMember: (req.body.reportMember) ? textService.plainText(req.body.reportMember) : false
+ reportMember: (req.body.reportMember) ? textService.plainText(req.body.reportMember) : false,
/* eslint-enable key-spacing */
};
const replyTo = {
// Trust registered user's email, otherwise validate it
// Default to TO-support email
- address: (req.user || validator.isEmail(supportRequestData.email)) ? supportRequestData.email : config.supportEmail
+ address: (req.user || validator.isEmail(supportRequestData.email)) ? supportRequestData.email : config.supportEmail,
};
// Add name to sender if we have it
@@ -49,7 +49,7 @@ exports.supportRequest = function (req, res) {
userAgent: supportRequestData.userAgent,
username: supportRequestData.username,
email: supportRequestData.email,
- message: supportRequestData.message
+ message: supportRequestData.message,
};
if (req.user) {
storedSupportRequestData.user = req.user._id;
@@ -64,7 +64,7 @@ exports.supportRequest = function (req, res) {
supportRequest.save(function (dbErr) {
if (dbErr) {
log('error', 'Failed storing support request to the DB. #39ghsa', {
- error: dbErr
+ error: dbErr,
});
}
@@ -72,27 +72,27 @@ exports.supportRequest = function (req, res) {
emailService.sendSupportRequest(replyTo, supportRequestData, function (emailServiceErr) {
if (emailServiceErr) {
log('error', 'Failed sending support request via email. #49ghsd', {
- error: emailServiceErr
+ error: emailServiceErr,
});
return res.status(400).send({
- message: 'Failure while sending your support request. Please try again.'
+ message: 'Failure while sending your support request. Please try again.',
});
}
res.json({
- message: 'Support request sent.'
+ message: 'Support request sent.',
});
const statsObject = {
namespace: 'supportRequest',
counts: {
- count: 1
+ count: 1,
},
tags: {
authenticated: supportRequestData.authenticated,
- type: supportRequestData.reportMember ? 'reportMember' : 'normal'
- }
+ type: supportRequestData.reportMember ? 'reportMember' : 'normal',
+ },
};
statService.stat(statsObject, function () {
diff --git a/modules/support/server/models/support.server.model.js b/modules/support/server/models/support.server.model.js
index 3ca97e8f1c..693230488f 100644
--- a/modules/support/server/models/support.server.model.js
+++ b/modules/support/server/models/support.server.model.js
@@ -12,30 +12,30 @@ const Schema = mongoose.Schema;
const SupportRequestSchema = new Schema({
user: {
type: Schema.ObjectId,
- ref: 'User'
+ ref: 'User',
},
sent: {
type: Date,
- default: Date.now
+ default: Date.now,
},
email: {
type: String,
trim: true,
- lowercase: true
+ lowercase: true,
},
username: {
- type: String
+ type: String,
},
message: {
type: String,
- required: true
+ required: true,
},
userAgent: {
- type: String
+ type: String,
},
reportMember: {
- type: String
- }
+ type: String,
+ },
});
mongoose.model('SupportRequest', SupportRequestSchema);
diff --git a/modules/support/tests/server/model.server.model.tests.js b/modules/support/tests/server/model.server.model.tests.js
index 013bcd74ec..4938cb8e5d 100644
--- a/modules/support/tests/server/model.server.model.tests.js
+++ b/modules/support/tests/server/model.server.model.tests.js
@@ -27,7 +27,7 @@ describe('Support request Model Unit Tests:', function () {
email: 'test@test.com',
username: 'joedoe',
password: 'password123',
- provider: 'local'
+ provider: 'local',
});
_support = {
@@ -35,7 +35,7 @@ describe('Support request Model Unit Tests:', function () {
username: 'joedoe',
message: 'Testing.',
userAgent: 'Mozilla/5.0 (X11; Linux x86_64; rv:10.0) Gecko/20100101 Firefox/10.0',
- reportMember: 'baduser'
+ reportMember: 'baduser',
};
support = new SupportRequest(_support);
@@ -84,7 +84,7 @@ describe('Support request Model Unit Tests:', function () {
it('should be able to save without problems without any other fields than message', function (done) {
const supportOnlyMessage = new SupportRequest({
- message: _support.message
+ message: _support.message,
});
supportOnlyMessage.save(function (err, supportRes) {
diff --git a/modules/support/tests/server/support.server.routes.tests.js b/modules/support/tests/server/support.server.routes.tests.js
index c53f80b962..95584631be 100644
--- a/modules/support/tests/server/support.server.routes.tests.js
+++ b/modules/support/tests/server/support.server.routes.tests.js
@@ -31,7 +31,7 @@ describe('Support CRUD tests', function () {
// Create user credentials
credentials = {
username: 'loremipsum',
- password: 'Password123!'
+ password: 'Password123!',
};
// Create a new user
@@ -43,14 +43,14 @@ describe('Support CRUD tests', function () {
username: credentials.username,
password: credentials.password,
provider: 'local',
- public: true
+ public: true,
});
// Create new support message
supportMessage = {
username: user.username,
email: user.email,
- message: 'Trustroots rocks!'
+ message: 'Trustroots rocks!',
};
// Save user to the test db
@@ -78,7 +78,7 @@ describe('Support CRUD tests', function () {
.send({
username: '',
email: '',
- message: 'Trustroots is cool!'
+ message: 'Trustroots is cool!',
})
.expect(200)
.end(function (supportSaveErr, supportSaveRes) {
diff --git a/modules/tribes/client/config/tribes.client.config.js b/modules/tribes/client/config/tribes.client.config.js
index 99356f8879..c7f77b3876 100644
--- a/modules/tribes/client/config/tribes.client.config.js
+++ b/modules/tribes/client/config/tribes.client.config.js
@@ -10,7 +10,7 @@
state('tribes', {
url: '/tribes',
abstract: true,
- template: ''
+ template: '',
}).
state('tribes.list', {
url: '',
@@ -22,11 +22,11 @@
TribesService: 'TribesService',
tribes: function (TribesService) {
return TribesService.query();
- }
+ },
},
data: {
- pageTitle: 'Tribes'
- }
+ pageTitle: 'Tribes',
+ },
}).
state('tribes.tribe', {
url: '/:tribe',
@@ -39,13 +39,13 @@
TribeService: 'TribeService',
tribe: function (TribeService, $stateParams) {
return TribeService.get({
- tribeSlug: $stateParams.tribe
+ tribeSlug: $stateParams.tribe,
});
- }
+ },
},
data: {
- pageTitle: 'Tribe'
- }
+ pageTitle: 'Tribe',
+ },
});
}
diff --git a/modules/tribes/client/directives/tr-tribe-badge.client.directive.js b/modules/tribes/client/directives/tr-tribe-badge.client.directive.js
index 07b14c0e9f..f62958e040 100644
--- a/modules/tribes/client/directives/tr-tribe-badge.client.directive.js
+++ b/modules/tribes/client/directives/tr-tribe-badge.client.directive.js
@@ -13,10 +13,10 @@
restrict: 'AE',
replace: true,
scope: {
- tribe: '=trTribeBadge'
+ tribe: '=trTribeBadge',
},
controller: trTribeBadgeController,
- controllerAs: 'tribeBadge'
+ controllerAs: 'tribeBadge',
};
/* @ngInject */
diff --git a/modules/tribes/client/directives/tr-tribe-join-button.client.directive.js b/modules/tribes/client/directives/tr-tribe-join-button.client.directive.js
index 11acbf42a9..74bff6c54b 100644
--- a/modules/tribes/client/directives/tr-tribe-join-button.client.directive.js
+++ b/modules/tribes/client/directives/tr-tribe-join-button.client.directive.js
@@ -16,11 +16,11 @@
tribe: '=',
joinLabel: '=',
joinedLabel: '=',
- icon: '='
+ icon: '=',
},
templateUrl: '/modules/tribes/views/directives/tr-tribe-join-button.client.view.html',
controller: trTribeJoinButtonDirectiveController,
- controllerAs: 'tribeJoinButton'
+ controllerAs: 'tribeJoinButton',
};
/* @ngInject */
@@ -34,7 +34,7 @@
Authentication,
TribeService,
UserMembershipsService,
- messageCenterService
+ messageCenterService,
) {
const vm = this;
@@ -96,7 +96,7 @@
$analytics.eventTrack('join-tribe', {
category: 'tribes.membership',
label: 'Join tribe',
- value: $scope.tribe.slug
+ value: $scope.tribe.slug,
});
})
.catch(function () {
@@ -117,7 +117,7 @@
$analytics.eventTrack('leave-tribe', {
category: 'tribes.membership',
label: 'Leave tribe',
- value: $scope.tribe.slug
+ value: $scope.tribe.slug,
});
})
.catch(function (err) {
@@ -125,7 +125,7 @@
$analytics.eventTrack('leave-tribe-cancelled', {
category: 'tribes.membership',
label: 'Leaving tribe cancelled',
- value: $scope.tribe.slug
+ value: $scope.tribe.slug,
});
return;
}
@@ -144,7 +144,7 @@
function join() {
return $q(function (resolve, reject) {
UserMembershipsService.post({
- tribeId: $scope.tribe._id
+ tribeId: $scope.tribe._id,
},
function (data) {
if (data.tribe && data.user) {
@@ -170,11 +170,11 @@
title: 'Leave this Tribe?',
text: 'Do you want to leave "' + $scope.tribe.label + '"?',
ok: 'Leave Tribe',
- cancel: 'Cancel'
+ cancel: 'Cancel',
})
.then(function () {
UserMembershipsService.delete({
- tribeId: $scope.tribe._id
+ tribeId: $scope.tribe._id,
},
function (data) {
if (data.tribe && data.user) {
diff --git a/modules/tribes/client/directives/tr-tribe-styles.client.directive.js b/modules/tribes/client/directives/tr-tribe-styles.client.directive.js
index c5a27cd120..2c13d37794 100644
--- a/modules/tribes/client/directives/tr-tribe-styles.client.directive.js
+++ b/modules/tribes/client/directives/tr-tribe-styles.client.directive.js
@@ -41,7 +41,7 @@
'progressive/' + progressive,
'scale_crop/' + dimensions + '/center',
'quality/' + quality,
- 'format/jpeg'
+ 'format/jpeg',
];
style += 'background-image: url(https://ucarecdn.com/' + tribe.image_UUID + '/-/' + img_params.join('/-/') + '/);';
@@ -56,7 +56,7 @@
}
}
- }
+ },
};
}
}());
diff --git a/modules/tribes/client/directives/tr-tribes-in-common.client.directive.js b/modules/tribes/client/directives/tr-tribes-in-common.client.directive.js
index 216cde0ba5..93dd024558 100644
--- a/modules/tribes/client/directives/tr-tribes-in-common.client.directive.js
+++ b/modules/tribes/client/directives/tr-tribes-in-common.client.directive.js
@@ -13,10 +13,10 @@
restrict: 'A',
replace: true,
scope: {
- trTribesInCommon: '='
+ trTribesInCommon: '=',
},
controller: trTribesInCommonController,
- controllerAs: 'tribesInCommon'
+ controllerAs: 'tribesInCommon',
};
/* @ngInject */
diff --git a/modules/tribes/client/services/tribe.client.service.js b/modules/tribes/client/services/tribe.client.service.js
index 26114184da..6010773dfa 100644
--- a/modules/tribes/client/services/tribe.client.service.js
+++ b/modules/tribes/client/services/tribe.client.service.js
@@ -8,11 +8,11 @@
// `$resource` to communicate with tribes REST API
const Tribe = $resource('/api/tribes/:tribeSlug', {
- tribeSlug: '@slug'
+ tribeSlug: '@slug',
}, {
get: {
- method: 'GET'
- }
+ method: 'GET',
+ },
});
let cachedTribe;
@@ -20,7 +20,7 @@
const service = {
fillCache: fillCache,
clearCache: clearCache,
- get: get
+ get: get,
};
return service;
@@ -63,7 +63,7 @@
} else {
// Not found from cache, return $resource
Tribe.get({
- tribeSlug: options.tribeSlug
+ tribeSlug: options.tribeSlug,
}).$promise
.then(function (tribe) {
resolve(tribe);
diff --git a/modules/tribes/client/services/tribes.client.service.js b/modules/tribes/client/services/tribes.client.service.js
index 14aa743c48..aeed83506e 100644
--- a/modules/tribes/client/services/tribes.client.service.js
+++ b/modules/tribes/client/services/tribes.client.service.js
@@ -6,12 +6,12 @@
/* @ngInject */
function TribesService($resource) {
return $resource('/api/tribes', {
- limit: 50
+ limit: 50,
}, {
'query': {
method: 'GET',
- isArray: true
- }
+ isArray: true,
+ },
});
}
}());
diff --git a/modules/tribes/server/controllers/tribes.server.controller.js b/modules/tribes/server/controllers/tribes.server.controller.js
index 9356ef79f5..34a899859b 100644
--- a/modules/tribes/server/controllers/tribes.server.controller.js
+++ b/modules/tribes/server/controllers/tribes.server.controller.js
@@ -18,7 +18,7 @@ exports.tribeFields = [
'attribution',
'attribution_url',
'description',
- 'created'
+ 'created',
].join(' ');
/**
@@ -39,20 +39,20 @@ exports.listTribes = function (req, res) {
Tribe.paginate(
{
- public: true
+ public: true,
},
{
page: parseInt(req.query.page, 10) || 1, // Note: `parseInt('0')` will return `NaN`, `page` will be set to `1` in such case.
limit: parseInt(req.query.limit, 10) || 0, // `0` for infinite
sort: {
- count: 'desc'
+ count: 'desc',
},
- select: exports.tribeFields
+ select: exports.tribeFields,
},
function (err, data) {
if (err) {
return res.status(400).send({
- message: errorService.getErrorMessage(err)
+ message: errorService.getErrorMessage(err),
});
} else {
// Pass pagination data to construct link header
@@ -60,7 +60,7 @@ exports.listTribes = function (req, res) {
res.json(data.docs);
}
- }
+ },
);
};
@@ -78,14 +78,14 @@ exports.tribeBySlug = function (req, res, next, slug) {
Tribe.findOne(
{
public: true,
- slug: slug
+ slug: slug,
},
- exports.tribeFields
+ exports.tribeFields,
)
.exec(function (err, tribe) {
if (err) {
return res.status(400).send({
- message: errorService.getErrorMessage(err)
+ message: errorService.getErrorMessage(err),
});
} else {
req.tribe = tribe;
@@ -108,8 +108,8 @@ exports.updateCount = function (id, difference, returnUpdated, callback) {
{ $inc: { count: parseInt(difference) } },
{
safe: false, // @link http://stackoverflow.com/a/4975054/1984644
- new: Boolean(returnUpdated) // get the updated document in return?
+ new: Boolean(returnUpdated), // get the updated document in return?
},
- callback
+ callback,
);
};
diff --git a/modules/tribes/server/models/tribe.server.model.js b/modules/tribes/server/models/tribe.server.model.js
index a58a4e7219..4de4a6858a 100644
--- a/modules/tribes/server/models/tribe.server.model.js
+++ b/modules/tribes/server/models/tribe.server.model.js
@@ -20,7 +20,7 @@ const Schema = mongoose.Schema;
function randomHex() {
return randomColor({
luminosity: 'dark',
- format: 'hex'
+ format: 'hex',
}).substr(1);
}
@@ -51,7 +51,7 @@ const validateURL = function (url) {
require_valid_protocol: true,
allow_underscores: false,
allow_trailing_dot: false,
- allow_protocol_relative_urls: false
+ allow_protocol_relative_urls: false,
});
};
@@ -76,64 +76,64 @@ const TribeSchema = new Schema({
trim: true,
required: true,
unique: 'Tribe exists already.',
- validate: [validateLabel, 'Please fill a valid name.']
+ validate: [validateLabel, 'Please fill a valid name.'],
},
labelHistory: {
- type: [String]
+ type: [String],
},
slugHistory: {
- type: [String]
+ type: [String],
},
synonyms: {
- type: [String]
+ type: [String],
},
color: {
type: String,
minlength: 6,
maxlength: 6,
required: true,
- default: randomHex
+ default: randomHex,
},
count: {
type: Number,
integer: true,
min: 0,
default: 0,
- required: true
+ required: true,
},
created: {
type: Date,
default: Date.now,
- required: true
+ required: true,
},
modified: {
type: Date,
- default: Date.now
+ default: Date.now,
},
public: {
type: Boolean,
default: true,
- required: true
+ required: true,
},
image_UUID: {
type: String,
- validate: [validateUUID, 'Please use valid UUID.']
+ validate: [validateUUID, 'Please use valid UUID.'],
},
attribution: {
type: String,
minlength: 3,
- maxlength: 255
+ maxlength: 255,
},
attribution_url: {
type: String,
minlength: 12,
trim: true,
- validate: [validateURL, 'Please fill a valid URL.']
+ validate: [validateURL, 'Please fill a valid URL.'],
},
description: {
type: String,
- trim: true
- }
+ trim: true,
+ },
});
/**
@@ -172,9 +172,9 @@ TribeSchema.plugin(urlslugs('label', {
return speakingurl(string, {
separator: '-', // char that replaces the whitespaces
maintainCase: false, // maintain case (true, convert all chars to lower case (false)
- truncate: 255 // trim to max length ({number}), don't truncate (0)
+ truncate: 255, // trim to max length ({number}), don't truncate (0)
});
- }
+ },
}));
/**
diff --git a/modules/tribes/server/policies/tribes.server.policy.js b/modules/tribes/server/policies/tribes.server.policy.js
index 151190c848..c59c06f3fd 100644
--- a/modules/tribes/server/policies/tribes.server.policy.js
+++ b/modules/tribes/server/policies/tribes.server.policy.js
@@ -16,29 +16,29 @@ exports.invokeRolesPolicies = function () {
roles: ['admin'],
allows: [{
resources: '/api/tribes',
- permissions: ['get']
+ permissions: ['get'],
}, {
resources: '/api/tribes/:tribe',
- permissions: ['get']
- }]
+ permissions: ['get'],
+ }],
}, {
roles: ['user'],
allows: [{
resources: '/api/tribes',
- permissions: ['get']
+ permissions: ['get'],
}, {
resources: '/api/tribes/:tribe',
- permissions: ['get']
- }]
+ permissions: ['get'],
+ }],
}, {
roles: ['guest'],
allows: [{
resources: '/api/tribes',
- permissions: ['get']
+ permissions: ['get'],
}, {
resources: '/api/tribes/:tribe',
- permissions: ['get']
- }]
+ permissions: ['get'],
+ }],
}]);
};
@@ -55,7 +55,7 @@ exports.isAllowed = function (req, res, next) {
if (err) {
// An authorization error occurred.
return res.status(500).send({
- message: 'Unexpected authorization error'
+ message: 'Unexpected authorization error',
});
} else {
if (isAllowed) {
@@ -63,7 +63,7 @@ exports.isAllowed = function (req, res, next) {
return next();
} else {
return res.status(403).json({
- message: errorService.getErrorMessageByKey('forbidden')
+ message: errorService.getErrorMessageByKey('forbidden'),
});
}
}
diff --git a/modules/tribes/tests/server/tribes.server.model.tests.js b/modules/tribes/tests/server/tribes.server.model.tests.js
index d6c4f2adc8..bb4d62e10d 100644
--- a/modules/tribes/tests/server/tribes.server.model.tests.js
+++ b/modules/tribes/tests/server/tribes.server.model.tests.js
@@ -22,13 +22,13 @@ describe('Tribe Model Unit Tests:', function () {
before(function () {
tribe1 = new Tribe({
- 'label': 'Tribe label'
+ 'label': 'Tribe label',
});
tribe2 = new Tribe({
- 'label': 'Tribe label'
+ 'label': 'Tribe label',
});
tribe3 = new Tribe({
- 'label': 'Different tribe label'
+ 'label': 'Different tribe label',
});
});
diff --git a/modules/tribes/tests/server/tribes.server.routes.test.js b/modules/tribes/tests/server/tribes.server.routes.test.js
index 63ad47b9c0..d230cde799 100644
--- a/modules/tribes/tests/server/tribes.server.routes.test.js
+++ b/modules/tribes/tests/server/tribes.server.routes.test.js
@@ -36,7 +36,7 @@ describe('Tribe CRUD tests', function () {
// Create user credentials
credentials = {
username: 'tr_username',
- password: 'M3@n.jsI$Aw3$0m3'
+ password: 'M3@n.jsI$Aw3$0m3',
};
// Create a new user
@@ -48,7 +48,7 @@ describe('Tribe CRUD tests', function () {
username: credentials.username,
password: credentials.password,
provider: 'local',
- public: true
+ public: true,
};
// Create a new tribe
@@ -58,14 +58,14 @@ describe('Tribe CRUD tests', function () {
attribution_url: 'http://www.trustroots.org/team',
image_UUID: '3c8bb9f1-e313-4baa-bf4c-1d8994fd6c6c',
tribe: true,
- description: 'Lorem ipsum.'
+ description: 'Lorem ipsum.',
};
// Create a new non-public tribe
_tribeNonPublic = {
label: 'Non-public Tribe',
tribe: true,
- public: false
+ public: false,
};
user = new User(_user);
diff --git a/modules/users/client/components/AboutMe.component.js b/modules/users/client/components/AboutMe.component.js
index 3c9105b5bd..c6a179ea6e 100644
--- a/modules/users/client/components/AboutMe.component.js
+++ b/modules/users/client/components/AboutMe.component.js
@@ -10,12 +10,12 @@ export class AboutMe extends Component {
this.changeProfileDescriptionToggle = this.changeProfileDescriptionToggle.bind(this);
this.state = {
- profileDescriptionToggle: false
+ profileDescriptionToggle: false,
};
}
changeProfileDescriptionToggle(){
this.setState((prevState) => ({
- profileDescriptionToggle: !prevState.profileDescriptionToggle
+ profileDescriptionToggle: !prevState.profileDescriptionToggle,
}));
}
@@ -65,7 +65,7 @@ AboutMe.propTypes = {
profile: PropTypes.object,
isSelf: PropTypes.bool,
appSettings: PropTypes.object,
- t: PropTypes.func
+ t: PropTypes.func,
};
export default withTranslation(['user-profile'])(AboutMe);
diff --git a/modules/users/client/components/Avatar.component.js b/modules/users/client/components/Avatar.component.js
index 7a2f6c8eb2..db0a8b8955 100644
--- a/modules/users/client/components/Avatar.component.js
+++ b/modules/users/client/components/Avatar.component.js
@@ -46,7 +46,7 @@ Avatar.propTypes = {
size: PropTypes.number,
source: PropTypes.string,
link: PropTypes.bool,
- onClick: PropTypes.func
+ onClick: PropTypes.func,
};
export default withTranslation('user')(Avatar);
diff --git a/modules/users/client/components/AvatarNameMobile.component.js b/modules/users/client/components/AvatarNameMobile.component.js
index 0a11661191..f5d4a81367 100644
--- a/modules/users/client/components/AvatarNameMobile.component.js
+++ b/modules/users/client/components/AvatarNameMobile.component.js
@@ -47,5 +47,5 @@ export default function AvatarNameMobile({ profile }) {
}
AvatarNameMobile.propTypes = {
- profile: PropTypes.object.isRequired
+ profile: PropTypes.object.isRequired,
};
diff --git a/modules/users/client/components/BottomNavigationSmall.component.js b/modules/users/client/components/BottomNavigationSmall.component.js
index 8119b055d1..83241cfa46 100644
--- a/modules/users/client/components/BottomNavigationSmall.component.js
+++ b/modules/users/client/components/BottomNavigationSmall.component.js
@@ -18,18 +18,18 @@ export default function BottomNavigationSmall({ username, isSelf, contactCount }
{
key: 'overview',
label: t('Overview'),
- link: `/profile/${username}/overview`
+ link: `/profile/${username}/overview`,
},
{
key: 'about',
label: t('About'),
- link: `/profile/${username}`
+ link: `/profile/${username}`,
},
{
key: 'accommodation',
label: t('Hosting'),
- link: `/profile/${username}/accommodation`
- }
+ link: `/profile/${username}/accommodation`,
+ },
];
// contacts tab is shown only sometimes
@@ -38,7 +38,7 @@ export default function BottomNavigationSmall({ username, isSelf, contactCount }
key: 'contacts',
label: t('Contacts'),
link: `/profile/${username}/contacts`,
- count: contactCount
+ count: contactCount,
});
}
@@ -67,5 +67,5 @@ export default function BottomNavigationSmall({ username, isSelf, contactCount }
BottomNavigationSmall.propTypes = {
isSelf: PropTypes.bool.isRequired,
contactCount: PropTypes.number.isRequired,
- username: PropTypes.string.isRequired
+ username: PropTypes.string.isRequired,
};
diff --git a/modules/users/client/components/InterfaceLanguagePanel.component.js b/modules/users/client/components/InterfaceLanguagePanel.component.js
index b58b53e239..581c368605 100644
--- a/modules/users/client/components/InterfaceLanguagePanel.component.js
+++ b/modules/users/client/components/InterfaceLanguagePanel.component.js
@@ -42,7 +42,7 @@ export function InterfaceLanguagePanel({ t }) {
}
InterfaceLanguagePanel.propTypes = {
- t: PropTypes.func.isRequired
+ t: PropTypes.func.isRequired,
};
export default withTranslation('user')(InterfaceLanguagePanel);
diff --git a/modules/users/client/components/ProfileOverview.component.js b/modules/users/client/components/ProfileOverview.component.js
index 31eb8a7fd7..da882c68b1 100644
--- a/modules/users/client/components/ProfileOverview.component.js
+++ b/modules/users/client/components/ProfileOverview.component.js
@@ -56,5 +56,5 @@ export default function ProfileOverview({ profile }) {
}
ProfileOverview.propTypes = {
- profile: PropTypes.object.isRequired
+ profile: PropTypes.object.isRequired,
};
diff --git a/modules/users/client/components/ProfileViewBasics.js b/modules/users/client/components/ProfileViewBasics.js
index 6ce9330e66..3932044426 100644
--- a/modules/users/client/components/ProfileViewBasics.js
+++ b/modules/users/client/components/ProfileViewBasics.js
@@ -119,7 +119,7 @@ export function ProfileViewBasics({ t, profile }) {
{languagesList.map(
- code => - {getLanguage(code) || code}
+ code => - {getLanguage(code) || code}
,
)}
@@ -147,7 +147,7 @@ export function ProfileViewBasics({ t, profile }) {
href={socialAccountLink(network, profile.additionalProvidersData[network])}>{network}
);
- }
+ },
)}
{/* BeWelcome */}
{profile.extSitesBW &&
@@ -217,7 +217,7 @@ export function ProfileViewBasics({ t, profile }) {
ProfileViewBasics.propTypes = {
profile: PropTypes.object,
- t: PropTypes.func
+ t: PropTypes.func,
};
export default withTranslation(['user-profile', 'languages'])(ProfileViewBasics);
diff --git a/modules/users/client/config/users.client.config.js b/modules/users/client/config/users.client.config.js
index 18346ba7df..d6d886d194 100644
--- a/modules/users/client/config/users.client.config.js
+++ b/modules/users/client/config/users.client.config.js
@@ -27,9 +27,9 @@
}
}
return $q.reject(rejection);
- }
+ },
};
- }
+ },
]);
}
}());
diff --git a/modules/users/client/config/users.client.routes.js b/modules/users/client/config/users.client.routes.js
index 3021f60ae9..cd25b482ad 100644
--- a/modules/users/client/config/users.client.routes.js
+++ b/modules/users/client/config/users.client.routes.js
@@ -18,8 +18,8 @@
controllerAs: 'invite',
requiresAuth: false,
data: {
- pageTitle: 'Signup'
- }
+ pageTitle: 'Signup',
+ },
}).
// Users state routing
state('welcome', {
@@ -28,8 +28,8 @@
requiresAuth: true,
footerHidden: true,
data: {
- pageTitle: 'Welcome'
- }
+ pageTitle: 'Welcome',
+ },
}).
state('profile-edit', {
@@ -37,7 +37,7 @@
templateUrl: '/modules/users/views/profile/profile-edit.client.view.html',
abstract: true,
controller: 'ProfileEditController',
- controllerAs: 'profileEdit'
+ controllerAs: 'profileEdit',
}).
state('profile-edit.about', {
url: '',
@@ -46,8 +46,8 @@
controllerAs: 'profileEditAbout',
requiresAuth: true,
data: {
- pageTitle: 'Edit profile'
- }
+ pageTitle: 'Edit profile',
+ },
}).
state('profile-edit.locations', {
url: '/locations',
@@ -60,11 +60,11 @@
SettingsService: 'SettingsService',
appSettings: function (SettingsService) {
return SettingsService.get();
- }
+ },
},
data: {
- pageTitle: 'Edit your locations'
- }
+ pageTitle: 'Edit your locations',
+ },
}).
state('profile-edit.photo', {
url: '/photo',
@@ -77,11 +77,11 @@
SettingsService: 'SettingsService',
appSettings: function (SettingsService) {
return SettingsService.get();
- }
+ },
},
data: {
- pageTitle: 'Edit profile photo'
- }
+ pageTitle: 'Edit profile photo',
+ },
}).
state('profile-edit.networks', {
url: '/networks',
@@ -90,8 +90,8 @@
controllerAs: 'profileEditNetworks',
requiresAuth: true,
data: {
- pageTitle: 'Edit Profile networks'
- }
+ pageTitle: 'Edit Profile networks',
+ },
}).
state('profile-edit.account', {
url: '/account',
@@ -100,8 +100,8 @@
controllerAs: 'profileEditAccount',
requiresAuth: true,
data: {
- pageTitle: 'Account'
- }
+ pageTitle: 'Account',
+ },
}).
state('profile', {
@@ -124,7 +124,7 @@
profile: function (UserProfilesService, $stateParams, $q) {
return UserProfilesService.get({
- username: $stateParams.username
+ username: $stateParams.username,
}).$promise
.catch(function (e) {
@@ -171,15 +171,15 @@
// Load contact
return ContactsListService.query({
- listUserId: profile._id
+ listUserId: profile._id,
});
});
- }
+ },
},
data: {
- pageTitle: 'Profile'
- }
+ pageTitle: 'Profile',
+ },
}).
state('profile.about', {
url: '',
@@ -187,8 +187,8 @@
requiresAuth: true,
noScrollingTop: true,
data: {
- pageTitle: 'Profile'
- }
+ pageTitle: 'Profile',
+ },
}).
state('profile.accommodation', {
url: '/accommodation',
@@ -196,8 +196,8 @@
requiresAuth: true,
noScrollingTop: true,
data: {
- pageTitle: 'Profile accommodation'
- }
+ pageTitle: 'Profile accommodation',
+ },
}).
state('profile.meet', {
url: '/meet',
@@ -205,8 +205,8 @@
requiresAuth: true,
noScrollingTop: true,
data: {
- pageTitle: 'Profile meet'
- }
+ pageTitle: 'Profile meet',
+ },
}).
state('profile.overview', {
url: '/overview',
@@ -214,8 +214,8 @@
requiresAuth: true,
noScrollingTop: true,
data: {
- pageTitle: 'Profile overview'
- }
+ pageTitle: 'Profile overview',
+ },
}).
state('profile.contacts', {
url: '/contacts',
@@ -223,8 +223,8 @@
requiresAuth: true,
noScrollingTop: true,
data: {
- pageTitle: 'Profile contacts'
- }
+ pageTitle: 'Profile contacts',
+ },
}).
state('profile.tribes', {
url: '/tribes',
@@ -232,8 +232,8 @@
requiresAuth: true,
noScrollingTop: true,
data: {
- pageTitle: 'Profile tribes'
- }
+ pageTitle: 'Profile tribes',
+ },
}).
// When attempting to look at profile as non-authenticated user
@@ -241,8 +241,8 @@
url: '/profile-signup',
templateUrl: '/modules/users/views/profile/profile-signup.client.view.html',
data: {
- pageTitle: 'Trustroots profile'
- }
+ pageTitle: 'Trustroots profile',
+ },
}).
// Auth routes
@@ -264,11 +264,11 @@
appSettings: function (SettingsService) {
return SettingsService.get();
- }
+ },
},
data: {
- pageTitle: 'Sign up'
- }
+ pageTitle: 'Sign up',
+ },
}).
state('signin', {
url: '/signin?continue',
@@ -283,11 +283,11 @@
appSettings: function (SettingsService) {
return SettingsService.get();
- }
+ },
},
data: {
- pageTitle: 'Sign in'
- }
+ pageTitle: 'Sign in',
+ },
}).
state('confirm-email', {
url: '/confirm-email/:token?signup',
@@ -296,16 +296,16 @@
controller: 'ConfirmEmailController',
controllerAs: 'confirmEmail',
data: {
- pageTitle: 'Confirm email'
- }
+ pageTitle: 'Confirm email',
+ },
}).
state('confirm-email-invalid', {
url: '/confirm-email-invalid',
templateUrl: '/modules/users/views/authentication/confirm-email-invalid.client.view.html',
requiresAuth: false,
data: {
- pageTitle: 'Confirm email invalid'
- }
+ pageTitle: 'Confirm email invalid',
+ },
}).
// Password reset
@@ -316,24 +316,24 @@
controllerAs: 'forgotPassword',
footerHidden: true,
data: {
- pageTitle: 'Reset password'
- }
+ pageTitle: 'Reset password',
+ },
}).
state('reset-invalid', {
url: '/password/reset/invalid',
templateUrl: '/modules/users/views/password/reset-password-invalid.client.view.html',
footerHidden: true,
data: {
- pageTitle: 'Reset password'
- }
+ pageTitle: 'Reset password',
+ },
}).
state('reset-success', {
url: '/password/reset/success',
templateUrl: '/modules/users/views/password/reset-password-success.client.view.html',
footerHidden: true,
data: {
- pageTitle: 'Reset password'
- }
+ pageTitle: 'Reset password',
+ },
}).
state('reset', {
url: '/password/reset/:token',
@@ -342,8 +342,8 @@
controller: 'ResetPasswordController',
controllerAs: 'resetPassword',
data: {
- pageTitle: 'Reset password'
- }
+ pageTitle: 'Reset password',
+ },
}).
// Profile removal
@@ -356,8 +356,8 @@
controller: 'RemoveProfileController',
controllerAs: 'removeProfile',
data: {
- pageTitle: 'Remove profile'
- }
+ pageTitle: 'Remove profile',
+ },
});
if (AppConfig.appEnv !== 'production') {
@@ -369,8 +369,8 @@
noScrollingTop: true,
abstract: true,
data: {
- pageTitle: 'Profile references'
- }
+ pageTitle: 'Profile references',
+ },
}).
state('profile.references.list', {
url: '',
@@ -378,8 +378,8 @@
requiresAuth: true,
noScrollingTop: true,
data: {
- pageTitle: 'Profile references'
- }
+ pageTitle: 'Profile references',
+ },
}).
state('profile.references.new', {
url: '/new',
@@ -387,8 +387,8 @@
requiresAuth: true,
noScrollingTop: true,
data: {
- pageTitle: 'Leave a reference'
- }
+ pageTitle: 'Leave a reference',
+ },
});
}
}
diff --git a/modules/users/client/controllers/authentication.client.controller.js b/modules/users/client/controllers/authentication.client.controller.js
index 5e742b2827..e9da86a00d 100644
--- a/modules/users/client/controllers/authentication.client.controller.js
+++ b/modules/users/client/controllers/authentication.client.controller.js
@@ -41,7 +41,7 @@
$analytics.eventTrack('login.success', {
category: 'authentication',
- label: 'Login success'
+ label: 'Login success',
});
// Initialize FB SDK
@@ -74,9 +74,9 @@
messageCenterService.add('danger', error.data.message || 'Something went wrong.');
$analytics.eventTrack('login.failed', {
category: 'authentication',
- label: 'Login failed'
+ label: 'Login failed',
});
- }
+ },
);
}
diff --git a/modules/users/client/controllers/avatar-editor.client.controller.js b/modules/users/client/controllers/avatar-editor.client.controller.js
index 6d8e2984f4..2b3fb8473b 100644
--- a/modules/users/client/controllers/avatar-editor.client.controller.js
+++ b/modules/users/client/controllers/avatar-editor.client.controller.js
@@ -39,11 +39,11 @@
url: '/api/users-avatar',
method: 'POST',
headers: {
- 'Content-Type': (fileAvatar.type !== '' ? fileAvatar.type : 'application/octet-stream')
+ 'Content-Type': (fileAvatar.type !== '' ? fileAvatar.type : 'application/octet-stream'),
},
data: {
- avatar: fileAvatar
- }
+ avatar: fileAvatar,
+ },
}).success(function () {
vm.avatarUploading = false;
$uibModalInstance.close(vm.user);
diff --git a/modules/users/client/controllers/confirm-email.client.controller.js b/modules/users/client/controllers/confirm-email.client.controller.js
index 1f00315cb7..d1c070548b 100644
--- a/modules/users/client/controllers/confirm-email.client.controller.js
+++ b/modules/users/client/controllers/confirm-email.client.controller.js
@@ -55,7 +55,7 @@
},
function () { // On error function
vm.error = true;
- }
+ },
);
}
diff --git a/modules/users/client/controllers/password-forgot.client.controller.js b/modules/users/client/controllers/password-forgot.client.controller.js
index b4da858b65..0afac2080b 100644
--- a/modules/users/client/controllers/password-forgot.client.controller.js
+++ b/modules/users/client/controllers/password-forgot.client.controller.js
@@ -15,7 +15,7 @@
vm.isLoading = false;
vm.credentials = {
// Prefill input from URL if available
- username: $stateParams.userhandle ? $stateParams.userhandle : ''
+ username: $stateParams.userhandle ? $stateParams.userhandle : '',
};
vm.askForPasswordReset = askForPasswordReset;
@@ -35,7 +35,7 @@
// Show user error message
vm.isLoading = false;
vm.error = response.data.message;
- }
+ },
);
}
}
diff --git a/modules/users/client/controllers/password-reset.client.controller.js b/modules/users/client/controllers/password-reset.client.controller.js
index 2b00c8a49d..eb6f6bb869 100644
--- a/modules/users/client/controllers/password-reset.client.controller.js
+++ b/modules/users/client/controllers/password-reset.client.controller.js
@@ -38,7 +38,7 @@
function (response) { // On error function
vm.error = response.data.message;
vm.isLoading = false;
- }
+ },
);
}
}
diff --git a/modules/users/client/controllers/profile-edit-account.client.controller.js b/modules/users/client/controllers/profile-edit-account.client.controller.js
index 6b91202af2..f2f41bb5ef 100644
--- a/modules/users/client/controllers/profile-edit-account.client.controller.js
+++ b/modules/users/client/controllers/profile-edit-account.client.controller.js
@@ -184,7 +184,7 @@
$http.post('/api/users/password', {
currentPassword: vm.currentPassword,
newPassword: vm.newPassword,
- verifyPassword: vm.verifyPassword
+ verifyPassword: vm.verifyPassword,
})
.then(
function (response) { // On success function
@@ -199,7 +199,7 @@
function (response) { // On error function
vm.changeUserPasswordLoading = false;
messageCenterService.add('danger', ((response.data.message && response.data.message !== '') ? response.data.message : 'Password not changed due error, try again.'), { timeout: 10000 });
- }
+ },
);
}
@@ -220,7 +220,7 @@
messageCenterService.add(
'danger',
response.message || 'Something went wrong while initializing profile removal, try again.',
- { timeout: 10000 }
+ { timeout: 10000 },
);
});
}
diff --git a/modules/users/client/controllers/profile-edit-networks.client.controller.js b/modules/users/client/controllers/profile-edit-networks.client.controller.js
index 303d2f982e..1beee5fc06 100644
--- a/modules/users/client/controllers/profile-edit-networks.client.controller.js
+++ b/modules/users/client/controllers/profile-edit-networks.client.controller.js
@@ -57,7 +57,7 @@
},
function (response) { // On error function
messageCenterService.add('danger', response.data.message || 'Something went wrong. Try again or contact us to disconnect your profile.', { timeout: 10000 });
- }
+ },
);
}
diff --git a/modules/users/client/controllers/profile-edit-photo.client.controller.js b/modules/users/client/controllers/profile-edit-photo.client.controller.js
index 908ced54c2..a6f0e03279 100644
--- a/modules/users/client/controllers/profile-edit-photo.client.controller.js
+++ b/modules/users/client/controllers/profile-edit-photo.client.controller.js
@@ -59,11 +59,11 @@
url: '/api/users-avatar',
method: 'POST',
headers: {
- 'Content-Type': (fileAvatar.type !== '' ? fileAvatar.type : 'application/octet-stream')
+ 'Content-Type': (fileAvatar.type !== '' ? fileAvatar.type : 'application/octet-stream'),
},
data: {
- avatar: fileAvatar
- }
+ avatar: fileAvatar,
+ },
}).success(function () {
vm.avatarUploading = false;
updateUserProfile();
diff --git a/modules/users/client/controllers/profile-edit.client.controller.js b/modules/users/client/controllers/profile-edit.client.controller.js
index dc49774a76..516eda46b6 100644
--- a/modules/users/client/controllers/profile-edit.client.controller.js
+++ b/modules/users/client/controllers/profile-edit.client.controller.js
@@ -30,7 +30,7 @@
title: 'Are you sure?',
text: 'Your changes would be lost. Return and press "Save" to keep the changes, or press "Continue" to discard them.',
ok: 'Continue',
- cancel: 'Cancel'
+ cancel: 'Cancel',
})
// If user pressed "continue", create another state go
.then(function () {
diff --git a/modules/users/client/controllers/remove.client.controller.js b/modules/users/client/controllers/remove.client.controller.js
index 4e1c66dc89..89e30f4774 100644
--- a/modules/users/client/controllers/remove.client.controller.js
+++ b/modules/users/client/controllers/remove.client.controller.js
@@ -42,7 +42,7 @@
messageCenterService.add(
'danger',
response.message || 'Something went wrong while initializing profile removal, try again.',
- { timeout: 10000 }
+ { timeout: 10000 },
);
});
}
diff --git a/modules/users/client/controllers/signup.client.controller.js b/modules/users/client/controllers/signup.client.controller.js
index 938fef72ac..ae605852b7 100644
--- a/modules/users/client/controllers/signup.client.controller.js
+++ b/modules/users/client/controllers/signup.client.controller.js
@@ -102,7 +102,7 @@
if ($stateParams.tribe) {
// Fetch information about referred tribe
TribeService.get({
- tribeSlug: $stateParams.tribe
+ tribeSlug: $stateParams.tribe,
})
.then(function (tribe) {
@@ -128,7 +128,7 @@
*/
function getSuggestedTribes(withoutTribeId) {
TribesService.query({
- limit: 20
+ limit: 20,
},
function (tribes) {
const suggestedTribes = [];
@@ -163,7 +163,7 @@
// If there is referred tribe, add user to that next up
if (vm.tribe && vm.tribe._id) {
UserMembershipsService.post({
- tribeId: vm.tribe._id
+ tribeId: vm.tribe._id,
},
function (data) {
updateUser(data.user || newUser.data);
@@ -181,7 +181,7 @@
vm.isLoading = false;
const errorMessage = error.data && error.data.message ? error.data.message : 'Something went wrong while signing you up. Try again!';
messageCenterService.add('danger', errorMessage);
- }
+ },
);
}
@@ -196,7 +196,7 @@
if (vm.invitationCode) {
// Validate code
InvitationService.post({
- invitecode: vm.invitationCode
+ invitecode: vm.invitationCode,
}).$promise.then(function (data) {
// UI
@@ -210,12 +210,12 @@
if (data.valid) {
$analytics.eventTrack('invitationCode.valid', {
category: 'invitation',
- label: 'Valid invitation code entered'
+ label: 'Valid invitation code entered',
});
} else {
$analytics.eventTrack('invitationCode.invalid', {
category: 'invitation',
- label: 'Invalid invitation code entered'
+ label: 'Invalid invitation code entered',
});
}
}, function () {
@@ -228,7 +228,7 @@
messageCenterService.add('danger', 'Something went wrong, try again.');
$analytics.eventTrack('invitationCode.failed', {
category: 'invitation',
- label: 'Failed to validate invitation code'
+ label: 'Failed to validate invitation code',
});
});
} else {
@@ -264,7 +264,7 @@
locker.put(mwrLockerKey, $stateParams.mwr);
$analytics.eventTrack('waitinglist.enabled', {
category: 'waitinglist',
- label: 'Waiting list invitation code enabled'
+ label: 'Waiting list invitation code enabled',
});
// If previously stored `mwr` is available in locker...
} else if (locker.get(mwrLockerKey)) {
@@ -276,7 +276,7 @@
vm.waitinglistInvitation = true;
$analytics.eventTrack('waitinglist.re-enabled', {
category: 'waitinglist',
- label: 'Waiting list invitation code re-enabled'
+ label: 'Waiting list invitation code re-enabled',
});
}
}
@@ -303,7 +303,7 @@
// `true`: show list of waiting up users
// `false`: show number of waiting users
- require_leaderboard: false
+ require_leaderboard: false,
};
// Initialize Maitre app by appending script to the page
@@ -317,7 +317,7 @@
// Send event to analytics
$analytics.eventTrack('waitinglist.failed', {
category: 'waitinglist',
- label: 'Waiting list script failed to load.'
+ label: 'Waiting list script failed to load.',
});
});
@@ -344,13 +344,13 @@
// Open modal
$uibModal.open({
- templateUrl: '/modules/users/views/authentication/rules-modal.client.view.html'
+ templateUrl: '/modules/users/views/authentication/rules-modal.client.view.html',
});
// Record event to analytics
$analytics.eventTrack('signup.rules.open', {
category: 'signup',
- label: 'Open rules from signup form'
+ label: 'Open rules from signup form',
});
}
diff --git a/modules/users/client/directives/tr-avatar.client.directive.js b/modules/users/client/directives/tr-avatar.client.directive.js
index 49e442afec..65ff818f88 100644
--- a/modules/users/client/directives/tr-avatar.client.directive.js
+++ b/modules/users/client/directives/tr-avatar.client.directive.js
@@ -51,7 +51,7 @@
'',
restrict: 'A',
scope: {
- user: '=user'
+ user: '=user',
},
controller: ['$scope', function ($scope) {
@@ -133,8 +133,8 @@
// By default show the link
scope.link = attr.link !== 'false';
- }
+ },
};
- }
+ },
]);
}());
diff --git a/modules/users/client/directives/tr-confirm-password.client.directive.js b/modules/users/client/directives/tr-confirm-password.client.directive.js
index b59e28175d..90599d3ed2 100644
--- a/modules/users/client/directives/tr-confirm-password.client.directive.js
+++ b/modules/users/client/directives/tr-confirm-password.client.directive.js
@@ -19,7 +19,7 @@
restrict: 'A',
require: 'ngModel',
scope: {
- comparisonValue: '=trConfirmPassword'
+ comparisonValue: '=trConfirmPassword',
},
link: function (scope, element, attributes, ngModel) {
@@ -30,7 +30,7 @@
scope.$watch('comparisonValue', function () {
ngModel.$validate();
});
- }
+ },
};
}
}());
diff --git a/modules/users/client/directives/tr-memberships-list.client.directive.js b/modules/users/client/directives/tr-memberships-list.client.directive.js
index 9336ad65b8..f11b732937 100644
--- a/modules/users/client/directives/tr-memberships-list.client.directive.js
+++ b/modules/users/client/directives/tr-memberships-list.client.directive.js
@@ -14,9 +14,9 @@
replace: true,
scope: {
memberships: '=trMembershipsList',
- isOwnProfile: '='
+ isOwnProfile: '=',
},
- controller: trMembershipsListController
+ controller: trMembershipsListController,
};
}
diff --git a/modules/users/client/directives/tr-monkeybox.client.directive.js b/modules/users/client/directives/tr-monkeybox.client.directive.js
index 5c8c50eec6..540f0f5d51 100644
--- a/modules/users/client/directives/tr-monkeybox.client.directive.js
+++ b/modules/users/client/directives/tr-monkeybox.client.directive.js
@@ -13,13 +13,13 @@
restrict: 'A',
replace: true,
scope: {
- profile: '='
+ profile: '=',
},
controller: ['$scope', 'Languages', function ($scope, Languages) {
$scope.languageNames = Languages.get('object');
- }]
+ }],
};
}
}());
diff --git a/modules/users/client/directives/tr-validate-username.client.directive.js b/modules/users/client/directives/tr-validate-username.client.directive.js
index ed29966e81..b0ace4aa3a 100644
--- a/modules/users/client/directives/tr-validate-username.client.directive.js
+++ b/modules/users/client/directives/tr-validate-username.client.directive.js
@@ -64,7 +64,7 @@
});
};
- }
+ },
};
}
}());
diff --git a/modules/users/client/services/authentication.client.service.js b/modules/users/client/services/authentication.client.service.js
index 834eb67300..3ee706a029 100644
--- a/modules/users/client/services/authentication.client.service.js
+++ b/modules/users/client/services/authentication.client.service.js
@@ -7,7 +7,7 @@
/* @ngInject */
function Authentication($window) {
const auth = {
- user: $window.user || null
+ user: $window.user || null,
};
return auth;
}
diff --git a/modules/users/client/services/invitation.client.service.js b/modules/users/client/services/invitation.client.service.js
index dbdaf3bcf0..45d193208e 100644
--- a/modules/users/client/services/invitation.client.service.js
+++ b/modules/users/client/services/invitation.client.service.js
@@ -6,14 +6,14 @@
/* @ngInject */
function InvitationService($resource) {
return $resource('/api/users/invitecode/:invitecode', {
- invitecode: '@invitecode'
+ invitecode: '@invitecode',
}, {
get: {
- method: 'GET'
+ method: 'GET',
},
post: {
- method: 'POST'
- }
+ method: 'POST',
+ },
});
}
}());
diff --git a/modules/users/client/services/signup-validation.client.service.js b/modules/users/client/services/signup-validation.client.service.js
index b027040d43..ad814f32c9 100644
--- a/modules/users/client/services/signup-validation.client.service.js
+++ b/modules/users/client/services/signup-validation.client.service.js
@@ -8,8 +8,8 @@
function SignupValidationFactory($resource) {
return $resource('/api/auth/signup/validate', {}, {
post: {
- method: 'POST'
- }
+ method: 'POST',
+ },
});
}
}());
diff --git a/modules/users/client/services/users-memberships.client.service.js b/modules/users/client/services/users-memberships.client.service.js
index 05b794dde8..350b2e19d4 100644
--- a/modules/users/client/services/users-memberships.client.service.js
+++ b/modules/users/client/services/users-memberships.client.service.js
@@ -6,17 +6,17 @@
/* @ngInject */
function UserMembershipsService($resource) {
return $resource('/api/users/memberships/:tribeId?', {
- tribeId: '@tribeId'
+ tribeId: '@tribeId',
}, {
post: {
- method: 'POST'
+ method: 'POST',
},
delete: {
- method: 'DELETE'
+ method: 'DELETE',
},
get: {
- method: 'GET'
- }
+ method: 'GET',
+ },
});
}
}());
diff --git a/modules/users/client/services/users-mini.client.service.js b/modules/users/client/services/users-mini.client.service.js
index e5d8d2bda3..c641fbd106 100644
--- a/modules/users/client/services/users-mini.client.service.js
+++ b/modules/users/client/services/users-mini.client.service.js
@@ -7,11 +7,11 @@
/* @ngInject */
function UsersMiniFactory($resource) {
return $resource('/api/users/mini/:userId', {
- userId: '@id'
+ userId: '@id',
}, {
get: {
- method: 'GET'
- }
+ method: 'GET',
+ },
});
}
}());
diff --git a/modules/users/client/services/users-profile.client.service.js b/modules/users/client/services/users-profile.client.service.js
index 19355f295d..42860f6fbb 100644
--- a/modules/users/client/services/users-profile.client.service.js
+++ b/modules/users/client/services/users-profile.client.service.js
@@ -6,11 +6,11 @@
/* @ngInject */
function UserProfilesService($resource) {
return $resource('/api/users/:username', {
- username: '@username'
+ username: '@username',
}, {
get: {
- method: 'GET'
- }
+ method: 'GET',
+ },
});
}
}());
diff --git a/modules/users/client/services/users.client.service.js b/modules/users/client/services/users.client.service.js
index d650188b64..629403a332 100644
--- a/modules/users/client/services/users.client.service.js
+++ b/modules/users/client/services/users.client.service.js
@@ -8,28 +8,28 @@
function UsersFactory($resource) {
const Users = $resource('/api/users', {}, {
update: {
- method: 'PUT'
+ method: 'PUT',
},
get: {
- method: 'GET'
+ method: 'GET',
},
delete: {
- method: 'DELETE'
+ method: 'DELETE',
},
deleteConfirm: {
method: 'DELETE',
- url: '/api/users/remove/:token'
- }
+ url: '/api/users/remove/:token',
+ },
});
angular.extend(Users, {
deleteWithToken: function (token) {
return this.deleteConfirm({
- 'token': token // api expects token as a parameter (i.e. /:token)
+ 'token': token, // api expects token as a parameter (i.e. /:token)
}, {
- 'token': token
+ 'token': token,
}).$promise;
- }
+ },
});
return Users;
diff --git a/modules/users/server/config/strategies/facebook.js b/modules/users/server/config/strategies/facebook.js
index 6b4ba051fb..e8629ff5b6 100644
--- a/modules/users/server/config/strategies/facebook.js
+++ b/modules/users/server/config/strategies/facebook.js
@@ -19,7 +19,7 @@ module.exports = function (config) {
log('error', 'Cannot configure Facebook strategy due missing configuration #38h1jv', {
clientIDExists: Boolean(clientID),
clientSecretExists: Boolean(clientSecret),
- callbackURLExists: Boolean(callbackURL)
+ callbackURLExists: Boolean(callbackURL),
});
return;
}
@@ -40,7 +40,7 @@ module.exports = function (config) {
'last_name',
'gender',
'link',
- 'picture'
+ 'picture',
],
// Note FB API version
// v2.10 is available until November 7, 2019
@@ -49,7 +49,7 @@ module.exports = function (config) {
// @link https://developers.facebook.com/docs/apps/changelog
profileURL: 'https://graph.facebook.com/v2.10/me',
passReqToCallback: true,
- enableProof: false
+ enableProof: false,
},
function (req, accessToken, refreshToken, profile, done) {
// Set the provider data and include tokens
@@ -65,7 +65,7 @@ module.exports = function (config) {
email: _.get(profile, 'email', undefined),
provider: 'facebook',
providerIdentifierField: 'id',
- providerData: providerData
+ providerData: providerData,
};
// Save the user OAuth profile
diff --git a/modules/users/server/config/strategies/github.js b/modules/users/server/config/strategies/github.js
index ec7d9a82cf..1af47d6732 100644
--- a/modules/users/server/config/strategies/github.js
+++ b/modules/users/server/config/strategies/github.js
@@ -23,7 +23,7 @@ module.exports = function (config) {
clientID: clientID,
clientSecret: clientSecret,
callbackURL: callbackURL,
- passReqToCallback: true
+ passReqToCallback: true,
},
function (req, accessToken, refreshToken, profile, done) {
// Set the provider data and include tokens
@@ -38,7 +38,7 @@ module.exports = function (config) {
username: profile.username || undefined,
provider: 'github',
providerIdentifierField: 'id',
- providerData: providerData
+ providerData: providerData,
};
// Save the user OAuth profile
diff --git a/modules/users/server/config/strategies/local.js b/modules/users/server/config/strategies/local.js
index 24ae08220e..06fcb708fb 100644
--- a/modules/users/server/config/strategies/local.js
+++ b/modules/users/server/config/strategies/local.js
@@ -9,21 +9,21 @@ module.exports = function () {
// Use local strategy
passport.use(new LocalStrategy({
usernameField: 'username',
- passwordField: 'password'
+ passwordField: 'password',
},
function (username, password, done) {
User.findOne({
$or: [
{ username: username.toLowerCase() },
- { email: username.toLowerCase() }
- ]
+ { email: username.toLowerCase() },
+ ],
}, function (err, user) {
if (err) {
return done(err);
}
if (!user || !user.authenticate(password)) {
return done(null, false, {
- message: 'Unknown user or invalid password'
+ message: 'Unknown user or invalid password',
});
}
diff --git a/modules/users/server/config/strategies/twitter.js b/modules/users/server/config/strategies/twitter.js
index 4bc212ce7b..fe89ffc7c9 100644
--- a/modules/users/server/config/strategies/twitter.js
+++ b/modules/users/server/config/strategies/twitter.js
@@ -23,7 +23,7 @@ module.exports = function (config) {
consumerKey: clientID,
consumerSecret: clientSecret,
callbackURL: callbackURL,
- passReqToCallback: true
+ passReqToCallback: true,
},
function (req, token, tokenSecret, profile, done) {
// Set the provider data and include tokens
@@ -37,7 +37,7 @@ module.exports = function (config) {
username: _.get(profile, 'username', undefined),
provider: 'twitter',
providerIdentifierField: 'id_str',
- providerData: providerData
+ providerData: providerData,
};
// Save the user OAuth profile
diff --git a/modules/users/server/config/users.config.server.js b/modules/users/server/config/users.config.server.js
index 2490fde525..ca371b00ab 100644
--- a/modules/users/server/config/users.config.server.js
+++ b/modules/users/server/config/users.config.server.js
@@ -16,7 +16,7 @@ module.exports = function (app) {
// Deserialize sessions
passport.deserializeUser(function (id, done) {
User.findOne({
- _id: id
+ _id: id,
}, '-salt -password', function (err, user) {
done(err, user);
});
diff --git a/modules/users/server/controllers/users.authentication.server.controller.js b/modules/users/server/controllers/users.authentication.server.controller.js
index 6be90aee87..b79ae00455 100644
--- a/modules/users/server/controllers/users.authentication.server.controller.js
+++ b/modules/users/server/controllers/users.authentication.server.controller.js
@@ -96,16 +96,16 @@ exports.signup = function (req, res) {
done(err, user);
});
- }
+ },
], function (err, user) {
const statsObject = {
namespace: 'signup',
counts: {
- count: 1
+ count: 1,
},
- tags: {}
+ tags: {},
};
// Signup process failed
@@ -113,7 +113,7 @@ exports.signup = function (req, res) {
// Log the failure to signup
log('error', 'User signup failed. #fywghg', {
- error: err
+ error: err,
});
// Send signup failure to stats servers
@@ -121,7 +121,7 @@ exports.signup = function (req, res) {
statService.stat(statsObject, function () {
// Send error to the API
res.status(400).send({
- message: errorService.getErrorMessage(err)
+ message: errorService.getErrorMessage(err),
});
});
@@ -173,7 +173,7 @@ exports.signupValidation = function (req, res) {
// Check username availability against database
function (done) {
User.findOne({
- username: username
+ username: username,
}, function (err, user) {
if (user) {
return done(new Error('Username is not available.'), 'username-not-available');
@@ -181,16 +181,16 @@ exports.signupValidation = function (req, res) {
done();
});
- }
+ },
], function (err, errorCode) {
const statsObject = {
namespace: 'signup-validation',
counts: {
- count: 1
+ count: 1,
},
- tags: {}
+ tags: {},
};
// Signup validation failed
@@ -205,7 +205,7 @@ exports.signupValidation = function (req, res) {
res.status(200).send({
valid: false,
error: errorCode || 'other',
- message: err.message || errorService.getErrorMessage(err)
+ message: err.message || errorService.getErrorMessage(err),
});
});
@@ -218,7 +218,7 @@ exports.signupValidation = function (req, res) {
statsObject.tags.status = 'success';
statService.stat(statsObject, function () {
res.status(200).send({
- valid: true
+ valid: true,
});
});
@@ -233,9 +233,9 @@ exports.signin = function (req, res, next) {
const statsObject = {
namespace: 'signin',
counts: {
- count: 1
+ count: 1,
},
- tags: {}
+ tags: {},
};
passport.authenticate('local', function (err, user, info) {
@@ -244,7 +244,7 @@ exports.signin = function (req, res, next) {
// Log the failure to signin
log('error', 'User signin failed. #3tfgbg-1', {
reason: 'Wrong credentials',
- error: err || null
+ error: err || null,
});
// Send signin failure to stats servers
@@ -262,7 +262,7 @@ exports.signin = function (req, res, next) {
if (_.isArray(user.roles) && user.roles.indexOf('suspended') > -1) {
// Log the failure to signin
log('error', 'User signin failed. #3tfgbg-2', {
- reason: 'Suspended user'
+ reason: 'Suspended user',
});
// Send signin failure to stats servers
@@ -271,7 +271,7 @@ exports.signin = function (req, res, next) {
// Send error to the API
res.status(403).send({
- message: errorService.getErrorMessageByKey('suspended')
+ message: errorService.getErrorMessageByKey('suspended'),
});
});
@@ -283,7 +283,7 @@ exports.signin = function (req, res, next) {
// Log the failure to signin
log('error', 'User signin failed. #3tfgbg-3', {
reason: 'Login error',
- error: err
+ error: err,
});
// Send signin failure to stats servers
@@ -331,14 +331,14 @@ exports.oauthCallback = function (strategy) {
if (err) {
log('error', 'oAuth callback error #h3hg82', {
strategy: strategy,
- err: err
+ err: err,
});
return res.redirect(defaultRedirectUrl);
}
if (!user) {
log('error', 'oAuth callback requires authenticated user #g82bff', {
- strategy: strategy
+ strategy: strategy,
});
return res.redirect('/signin');
}
@@ -346,7 +346,7 @@ exports.oauthCallback = function (strategy) {
req.login(user, function (err) {
if (err) {
log('error', 'oAuth callback failed to login user #h2bgff', {
- strategy: strategy
+ strategy: strategy,
});
return res.redirect('/signin');
}
@@ -397,14 +397,14 @@ exports.removeOAuthProvider = function (req, res) {
// Return error if no user
if (!req.user) {
return res.status(403).send({
- message: errorService.getErrorMessageByKey('forbidden')
+ message: errorService.getErrorMessageByKey('forbidden'),
});
}
// Return error if no provider or wrong provider
if (!req.params.provider || !_.includes(['github', 'facebook', 'twitter'], req.params.provider)) {
return res.status(400).send({
- message: 'No provider defined.'
+ message: 'No provider defined.',
});
}
@@ -423,7 +423,7 @@ exports.removeOAuthProvider = function (req, res) {
user.save(function (err) {
if (err) {
return res.status(400).send({
- message: errorService.getErrorMessage(err)
+ message: errorService.getErrorMessage(err),
});
} else {
req.login(user, function (err) {
@@ -449,14 +449,14 @@ exports.updateFacebookOAuthToken = function (req, res) {
// Return error if no accessToken or userID
if (!req.body.accessToken || !req.body.userID) {
return res.status(400).send({
- message: 'Missing `accessToken` or `userID`.'
+ message: 'Missing `accessToken` or `userID`.',
});
}
// No authenticated user
if (!req.user) {
return res.status(403).send({
- message: errorService.getErrorMessageByKey('forbidden')
+ message: errorService.getErrorMessageByKey('forbidden'),
});
}
@@ -468,10 +468,10 @@ exports.updateFacebookOAuthToken = function (req, res) {
if (!_.has(userObject, 'additionalProvidersData.facebook')) {
log('error', 'Currently authenticated user is not connected to Facebook #k2lJRK', {
userId: userObject._id.toString(),
- requestedFbUserId: req.body.userID
+ requestedFbUserId: req.body.userID,
});
return res.status(403).send({
- message: errorService.getErrorMessageByKey('forbidden')
+ message: errorService.getErrorMessageByKey('forbidden'),
});
}
@@ -479,10 +479,10 @@ exports.updateFacebookOAuthToken = function (req, res) {
if (userObject.additionalProvidersData.facebook.id !== req.body.userID) {
log('error', 'Facebook user ids not matching when updating the token #jFiHjf', {
userId: userObject._id.toString(),
- requestedFbUserId: req.body.userID
+ requestedFbUserId: req.body.userID,
});
return res.status(403).send({
- message: errorService.getErrorMessageByKey('forbidden')
+ message: errorService.getErrorMessageByKey('forbidden'),
});
}
@@ -515,18 +515,18 @@ exports.updateFacebookOAuthToken = function (req, res) {
// Save modified user
user.save(done);
- }
+ },
], function (err) {
if (err) {
return res.status(400).send({
- message: errorService.getErrorMessage(err)
+ message: errorService.getErrorMessage(err),
});
}
// All done & good
return res.json({
- message: 'Token updated.'
+ message: 'Token updated.',
});
});
@@ -565,11 +565,11 @@ exports.extendFBAccessToken = function (shortAccessToken, callback) {
facebook.extendAccessToken({
'access_token': shortAccessToken,
'client_id': fbClientID,
- 'client_secret': fbClientSecret
+ 'client_secret': fbClientSecret,
}, function (err, accessTokenResponse) {
if (err) {
log('error', 'Failed to extend Facebook access token. #JG3jk3', {
- error: err
+ error: err,
});
return callback(err);
}
@@ -580,14 +580,14 @@ exports.extendFBAccessToken = function (shortAccessToken, callback) {
// Response from FB doesn't include access token
if (!accessToken) {
log('error', 'Missing extended Facebook access token from response. #jlkFLl', {
- response: accessTokenResponse
+ response: accessTokenResponse,
});
return callback(new Error(errorService.getErrorMessageByKey('default')), {});
}
// Callback's response object
const response = {
- token: accessToken
+ token: accessToken,
};
// Response from FB contains `expires_in` in seconds
@@ -606,7 +606,7 @@ exports.extendFBAccessToken = function (shortAccessToken, callback) {
exports.validateEmailToken = function (req, res) {
User.findOne({
- emailToken: req.params.token
+ emailToken: req.params.token,
}, function (err, user) {
if (!user) {
return res.redirect('/confirm-email-invalid');
@@ -625,7 +625,7 @@ exports.confirmEmail = function (req, res) {
// Check if user exists with this token
User.findOne({
- emailToken: req.params.token
+ emailToken: req.params.token,
}, function (err, user) {
if (!err && user) {
@@ -639,7 +639,7 @@ exports.confirmEmail = function (req, res) {
} else {
return res.status(400).send({
- message: 'Email confirm token is invalid or has expired.'
+ message: 'Email confirm token is invalid or has expired.',
});
}
});
@@ -661,7 +661,7 @@ exports.confirmEmail = function (req, res) {
// That's fine: we'll just start sending 'finish signup' notifications from scratch
// to the new email. That old email before the change might've been wrong anyway...
publicReminderCount: 1,
- publicReminderSent: 1
+ publicReminderSent: 1,
},
$set: {
public: true,
@@ -670,12 +670,12 @@ exports.confirmEmail = function (req, res) {
// Replace old email with new one
email: user.emailTemporary,
// @todo: this should be done at user.server.model.js
- emailHash: crypto.createHash('md5').update(user.emailTemporary.trim().toLowerCase()).digest('hex')
- }
+ emailHash: crypto.createHash('md5').update(user.emailTemporary.trim().toLowerCase()).digest('hex'),
+ },
},
{
// Return the document after updates if `new = true`
- new: true
+ new: true,
},
function (err, modifiedUser) {
done(err, result, modifiedUser);
@@ -695,11 +695,11 @@ exports.confirmEmail = function (req, res) {
result.user = userProfile.sanitizeProfile(user);
return res.json(result);
- }
+ },
], function (err) {
if (err) {
return res.status(400).send({
- message: errorService.getErrorMessage(err)
+ message: errorService.getErrorMessage(err),
});
}
});
@@ -712,7 +712,7 @@ exports.resendConfirmation = function (req, res) {
if (!req.user) {
return res.status(403).send({
- message: errorService.getErrorMessageByKey('forbidden')
+ message: errorService.getErrorMessageByKey('forbidden'),
});
}
@@ -724,7 +724,7 @@ exports.resendConfirmation = function (req, res) {
*/
if (!req.user.emailTemporary) {
return res.status(400).send({
- message: 'Already confirmed.'
+ message: 'Already confirmed.',
});
}
@@ -768,12 +768,12 @@ exports.resendConfirmation = function (req, res) {
// Return confirmation
function () {
return res.json({ message: 'Sent confirmation email.' });
- }
+ },
], function (err) {
if (err) {
return res.status(400).send({
- message: errorService.getErrorMessage(err)
+ message: errorService.getErrorMessage(err),
});
}
});
diff --git a/modules/users/server/controllers/users.password.server.controller.js b/modules/users/server/controllers/users.password.server.controller.js
index e43488aa9a..2df4f29e80 100644
--- a/modules/users/server/controllers/users.password.server.controller.js
+++ b/modules/users/server/controllers/users.password.server.controller.js
@@ -33,7 +33,7 @@ exports.forgot = function (req, res, next) {
// Missing username, return error
if (!req.body.username) {
return res.status(400).send({
- message: 'Please, we really need your username or email first...'
+ message: 'Please, we really need your username or email first...',
});
}
@@ -42,8 +42,8 @@ exports.forgot = function (req, res, next) {
User.findOne({
$or: [
{ username: userHandle },
- { email: userHandle }
- ]
+ { email: userHandle },
+ ],
}, '-salt -password', function (err, user) {
if (!user) {
@@ -51,15 +51,15 @@ exports.forgot = function (req, res, next) {
return statService.stat({
namespace: 'passwordReset',
counts: {
- count: 1
+ count: 1,
},
tags: {
- status: 'failed:noUser'
- }
+ status: 'failed:noUser',
+ },
}, function () {
// Return failure
res.status(404).send({
- message: 'We could not find an account with that username or email. Make sure you have it spelled correctly.'
+ message: 'We could not find an account with that username or email. Make sure you have it spelled correctly.',
});
});
@@ -82,7 +82,7 @@ exports.forgot = function (req, res, next) {
// Stop on errors
if (err) {
return res.status(400).send({
- message: 'Failure while sending recovery email to you. Please try again later.'
+ message: 'Failure while sending recovery email to you. Please try again later.',
});
}
@@ -90,20 +90,20 @@ exports.forgot = function (req, res, next) {
return statService.stat({
namespace: 'passwordReset',
counts: {
- count: 1
+ count: 1,
},
tags: {
- status: 'emailSent'
- }
+ status: 'emailSent',
+ },
}, function () {
// Return success
res.send({
- message: 'We sent you an email with further instructions.'
+ message: 'We sent you an email with further instructions.',
});
});
});
- }
+ },
], function (err) {
if (err) {
@@ -119,8 +119,8 @@ exports.validateResetToken = function (req, res) {
User.findOne({
resetPasswordToken: req.params.token,
resetPasswordExpires: {
- $gt: Date.now()
- }
+ $gt: Date.now(),
+ },
}, function (err, user) {
if (!user) {
return res.redirect('/password/reset/invalid');
@@ -133,7 +133,7 @@ exports.validateResetToken = function (req, res) {
passwordResetUrl = analyticsHandler.appendUTMParams(passwordResetUrl, {
source: req.query.utm_source,
medium: req.query.utm_medium,
- campaign: req.query.utm_campaign
+ campaign: req.query.utm_campaign,
});
}
@@ -154,21 +154,21 @@ exports.reset = function (req, res) {
User.findOne({
resetPasswordToken: req.params.token,
resetPasswordExpires: {
- $gt: Date.now()
- }
+ $gt: Date.now(),
+ },
}, function (err, user) {
// Can't find user (=invalid or expired token) or other error
if (err || !user) {
return res.status(400).send({
- message: 'Password reset token is invalid or has expired.'
+ message: 'Password reset token is invalid or has expired.',
});
}
// Passwords don't match
if (passwordDetails.newPassword !== passwordDetails.verifyPassword) {
return res.status(400).send({
- message: 'Passwords do not match.'
+ message: 'Passwords do not match.',
});
}
@@ -185,7 +185,7 @@ exports.reset = function (req, res) {
// Error saving user
if (err) {
return res.status(400).send({
- message: 'Password reset failed.'
+ message: 'Password reset failed.',
});
}
@@ -202,7 +202,7 @@ exports.reset = function (req, res) {
if (err) {
// Log the failure
log('error', 'Authenticating user after password reset failed #910jj3', {
- error: err
+ error: err,
});
// Stop here
@@ -218,14 +218,14 @@ exports.reset = function (req, res) {
function (user, done) {
emailService.sendResetPasswordConfirm({
displayName: user.displayName,
- email: user.email
+ email: user.email,
}, function (err) {
// Just log errors, but don't mind about them
// as this is not critical step
if (err) {
// Log the failure to send the email
log('error', 'Sending notification about password reset failed #30lfbv', {
- error: err
+ error: err,
});
}
@@ -236,12 +236,12 @@ exports.reset = function (req, res) {
// Return authenticated user
function (user) {
return res.json(profileHandler.sanitizeProfile(user, user));
- }
+ },
], function (err) {
if (err) {
return res.status(400).send({
- message: 'Password reset failed.'
+ message: 'Password reset failed.',
});
}
});
@@ -260,7 +260,7 @@ exports.changePassword = function (req, res) {
// Return error if no user
if (!req.user) {
return res.status(403).send({
- message: errorService.getErrorMessageByKey('forbidden')
+ message: errorService.getErrorMessageByKey('forbidden'),
});
}
@@ -322,15 +322,15 @@ exports.changePassword = function (req, res) {
if (err) return done(err);
return res.send({
user: user,
- message: 'Password changed successfully!'
+ message: 'Password changed successfully!',
});
});
- }
+ },
], function (err) {
if (err) {
res.status(err.status || 400).send({
- message: err.message || errorService.getErrorMessageByKey('default')
+ message: err.message || errorService.getErrorMessageByKey('default'),
});
}
});
diff --git a/modules/users/server/controllers/users.profile.server.controller.js b/modules/users/server/controllers/users.profile.server.controller.js
index 03af9cd5a2..bda29541af 100644
--- a/modules/users/server/controllers/users.profile.server.controller.js
+++ b/modules/users/server/controllers/users.profile.server.controller.js
@@ -63,7 +63,7 @@ exports.userProfileFields = [
'emailHash', // MD5 hashed email to use with Gravatars
'additionalProvidersData.facebook.id', // For FB avatars and profile links
'additionalProvidersData.twitter.screen_name', // For Twitter profile links
- 'additionalProvidersData.github.login' // For GitHub profile links
+ 'additionalProvidersData.github.login', // For GitHub profile links
].join(' ');
// Restricted set of profile fields when only really "miniprofile" is needed
@@ -75,7 +75,7 @@ exports.userMiniProfileFields = [
'avatarSource',
'avatarUploaded',
'emailHash',
- 'additionalProvidersData.facebook.id' // For FB avatars
+ 'additionalProvidersData.facebook.id', // For FB avatars
].join(' ');
// Mini + a few fields we'll need at listings
@@ -88,7 +88,7 @@ exports.userSearchProfileFields = exports.userMiniProfileFields + ' gender locat
exports.avatarUploadField = function (req, res, next) {
if (!req.user) {
return res.status(403).send({
- message: errorService.getErrorMessageByKey('forbidden')
+ message: errorService.getErrorMessageByKey('forbidden'),
});
}
@@ -96,7 +96,7 @@ exports.avatarUploadField = function (req, res, next) {
'image/gif',
'image/jpeg',
'image/jpg',
- 'image/png'
+ 'image/png',
];
fileUpload.uploadFile(validImageMimeTypes, 'avatar', req, res, next);
@@ -171,7 +171,7 @@ exports.avatarUpload = function (req, res) {
}
// @link http://www.restpatterns.org/HTTP_Status_Codes/422_-_Unprocessable_Entity
return res.status(422).send({
- message: 'Failed to process image, please try again.'
+ message: 'Failed to process image, please try again.',
});
});
} else {
@@ -196,18 +196,18 @@ exports.avatarUpload = function (req, res) {
fs.unlink(req.file.path, function (err) {
done(err);
});
- }
+ },
// Catch errors
], function (err) {
if (err) {
return res.status(400).send({
- message: errorService.getErrorMessage(err) || 'Failed to process image, please try again.'
+ message: errorService.getErrorMessage(err) || 'Failed to process image, please try again.',
});
} else {
// All Done!
return res.send({
- message: 'Avatar image uploaded.'
+ message: 'Avatar image uploaded.',
});
}
});
@@ -220,7 +220,7 @@ exports.update = function (req, res) {
if (!req.user) {
return res.status(403).send({
- message: errorService.getErrorMessageByKey('forbidden')
+ message: errorService.getErrorMessageByKey('forbidden'),
});
}
@@ -229,7 +229,7 @@ exports.update = function (req, res) {
const localeCodes = locales.map(function (locale) { return locale.code; });
if (req.body.locale && (typeof req.body.locale !== 'string' || !localeCodes.includes(req.body.locale))) {
return res.status(400).send({
- message: errorService.getErrorMessageByKey('bad-request')
+ message: errorService.getErrorMessageByKey('bad-request'),
});
}
@@ -245,8 +245,8 @@ exports.update = function (req, res) {
User.findOne({
$or: [
{ emailTemporary: req.body.email.toLowerCase() },
- { email: req.body.email.toLowerCase() }
- ]
+ { email: req.body.email.toLowerCase() },
+ ],
}, 'emailTemporary email', function (err, emailUser) {
// Not available
if (emailUser) {
@@ -257,7 +257,7 @@ exports.update = function (req, res) {
} else {
// Otherwise it was someone else's email. Block the way.
return res.status(403).send({
- message: 'This email is already in use. Please use another one.'
+ message: 'This email is already in use. Please use another one.',
});
}
} else {
@@ -288,7 +288,7 @@ exports.update = function (req, res) {
// They are not allowed to do so
if (!isUsernameUpdateAllowed(req.user)) {
return res.status(403).send({
- message: 'You cannot change your username at this time.'
+ message: 'You cannot change your username at this time.',
});
}
@@ -374,12 +374,12 @@ exports.update = function (req, res) {
function (user) {
user = exports.sanitizeProfile(user, req.user);
return res.json(user);
- }
+ },
], function (err) {
if (err) {
return res.status(400).send({
- message: errorService.getErrorMessage(err)
+ message: errorService.getErrorMessage(err),
});
}
});
@@ -392,7 +392,7 @@ exports.update = function (req, res) {
exports.initializeRemoveProfile = function (req, res) {
if (!req.user) {
return res.status(403).send({
- message: errorService.getErrorMessageByKey('forbidden')
+ message: errorService.getErrorMessageByKey('forbidden'),
});
}
@@ -417,12 +417,12 @@ exports.initializeRemoveProfile = function (req, res) {
{
$set: {
removeProfileToken: token,
- removeProfileExpires: tokenExpires
- }
+ removeProfileExpires: tokenExpires,
+ },
},
{
// Return updated user document
- new: true
+ new: true,
},
function (err, user) {
done(err, user);
@@ -436,7 +436,7 @@ exports.initializeRemoveProfile = function (req, res) {
// Stop on errors
if (err) {
return res.status(400).send({
- message: 'Failure while sending confirmation email to you. Please try again later.'
+ message: 'Failure while sending confirmation email to you. Please try again later.',
});
}
@@ -444,25 +444,25 @@ exports.initializeRemoveProfile = function (req, res) {
return statService.stat({
namespace: 'profileRemoval',
counts: {
- count: 1
+ count: 1,
},
tags: {
- status: 'emailSent'
- }
+ status: 'emailSent',
+ },
}, function () {
// Return success
res.send({
- message: 'We sent you an email with further instructions.'
+ message: 'We sent you an email with further instructions.',
});
});
});
- }
+ },
], function (err) {
if (err) {
return res.status(400).send({
- message: 'Removing your profile failed.'
+ message: 'Removing your profile failed.',
});
}
});
@@ -475,7 +475,7 @@ exports.initializeRemoveProfile = function (req, res) {
exports.removeProfile = function (req, res) {
if (!req.user) {
return res.status(403).send({
- message: errorService.getErrorMessageByKey('forbidden')
+ message: errorService.getErrorMessageByKey('forbidden'),
});
}
@@ -487,8 +487,8 @@ exports.removeProfile = function (req, res) {
_id: req.user._id,
removeProfileToken: req.params.token,
removeProfileExpires: {
- $gt: Date.now()
- }
+ $gt: Date.now(),
+ },
}, function (err, user) {
// Can't find user (=invalid or expired token) or other error
@@ -498,15 +498,15 @@ exports.removeProfile = function (req, res) {
return statService.stat({
namespace: 'profileRemoval',
counts: {
- count: 1
+ count: 1,
},
tags: {
- status: 'failed'
- }
+ status: 'failed',
+ },
}, function () {
// Return failure
return res.status(400).send({
- message: 'Profile remove token is invalid or has expired.'
+ message: 'Profile remove token is invalid or has expired.',
});
});
}
@@ -518,7 +518,7 @@ exports.removeProfile = function (req, res) {
// Remove profile
function (user, done) {
User.findOneAndRemove({
- _id: user._id
+ _id: user._id,
}, function (err) {
done(err, user);
});
@@ -529,7 +529,7 @@ exports.removeProfile = function (req, res) {
offerHandler.removeAllByUserId(user._id, function (err) {
if (err) {
log('error', 'Error when removing all offers by user ID. #rj393', {
- error: err
+ error: err,
});
}
done(null, user);
@@ -541,7 +541,7 @@ exports.removeProfile = function (req, res) {
contactHandler.removeAllByUserId(user._id, function (err) {
if (err) {
log('error', 'Error when removing all contacts by user ID. #j93hdd', {
- error: err
+ error: err,
});
}
done(null, user);
@@ -578,13 +578,13 @@ exports.removeProfile = function (req, res) {
function (user, done) {
emailService.sendRemoveProfileConfirmed({
displayName: user.displayName,
- email: user.email
+ email: user.email,
}, function (err) {
// Just log errors but don't mind about them as this is not critical step
if (err) {
// Log the failure to send the email
log('error', 'Sending confirmation email about successfull profile removal failed #289hhs', {
- error: err
+ error: err,
});
}
@@ -599,18 +599,18 @@ exports.removeProfile = function (req, res) {
return statService.stat({
namespace: 'profileRemoval',
counts: {
- count: 1
+ count: 1,
},
tags: {
- status: 'removed'
- }
+ status: 'removed',
+ },
}, function () {
// Return success
return res.json({
- message: 'Your profile has been removed.'
+ message: 'Your profile has been removed.',
});
});
- }
+ },
], function (err) {
if (err) {
@@ -618,15 +618,15 @@ exports.removeProfile = function (req, res) {
return statService.stat({
namespace: 'profileRemoval',
counts: {
- count: 1
+ count: 1,
},
tags: {
- status: 'failed'
- }
+ status: 'failed',
+ },
}, function () {
// Return failure
return res.status(400).send({
- message: 'Removing your profile failed.'
+ message: 'Removing your profile failed.',
});
});
}
@@ -679,7 +679,7 @@ exports.userMiniByID = function (req, res, next, userId) {
// Not a valid ObjectId
if (!mongoose.Types.ObjectId.isValid(userId)) {
return res.status(400).send({
- message: errorService.getErrorMessageByKey('invalid-id')
+ message: errorService.getErrorMessageByKey('invalid-id'),
});
}
@@ -693,7 +693,7 @@ exports.userMiniByID = function (req, res, next, userId) {
// No such user
if (!profile || !profile.public) {
return res.status(404).send({
- message: errorService.getErrorMessageByKey('not-found')
+ message: errorService.getErrorMessageByKey('not-found'),
});
}
@@ -711,14 +711,14 @@ exports.userByUsername = function (req, res, next, username) {
// Require user
if (!req.user) {
return res.status(403).send({
- message: errorService.getErrorMessageByKey('forbidden')
+ message: errorService.getErrorMessageByKey('forbidden'),
});
}
// Proper 'username' value required
if (typeof username !== 'string' || username.trim() === '' || username.length < 3) {
return res.status(400).send({
- message: 'Valid username required.'
+ message: 'Valid username required.',
});
}
@@ -728,13 +728,13 @@ exports.userByUsername = function (req, res, next, username) {
function (done) {
User
.findOne({
- username: username.toLowerCase()
+ username: username.toLowerCase(),
},
exports.userProfileFields + ' public')
.populate({
path: 'member.tribe',
select: tribesHandler.tribeFields,
- model: 'Tribe'
+ model: 'Tribe',
// Not possible at the moment due bug in Mongoose
// http://mongoosejs.com/docs/faq.html#populate_sort_order
// https://github.com/Automattic/mongoose/issues/2202
@@ -747,7 +747,7 @@ exports.userByUsername = function (req, res, next, username) {
} else if (!profile) {
// No such user
return res.status(404).send({
- message: errorService.getErrorMessageByKey('not-found')
+ message: errorService.getErrorMessageByKey('not-found'),
});
} else if (req.user && req.user._id.equals(profile._id)) {
// User's own profile, okay to send with public value in it
@@ -755,7 +755,7 @@ exports.userByUsername = function (req, res, next, username) {
} else if (req.user && (!req.user._id.equals(profile._id) && !profile.public)) {
// Not own profile and not public
return res.status(404).send({
- message: errorService.getErrorMessageByKey('not-found')
+ message: errorService.getErrorMessageByKey('not-found'),
});
} else {
// Transform profile into object so that we can add new fields to it
@@ -792,7 +792,7 @@ exports.userByUsername = function (req, res, next, username) {
// Next Route
function () {
next();
- }
+ },
], function (err) {
if (err) return next(err);
@@ -897,7 +897,7 @@ exports.sanitizeProfile = function (profile, authenticatedUser) {
exports.joinTribe = function (req, res) {
if (!req.user) {
return res.status(403).send({
- message: errorService.getErrorMessageByKey('forbidden')
+ message: errorService.getErrorMessageByKey('forbidden'),
});
}
@@ -906,7 +906,7 @@ exports.joinTribe = function (req, res) {
// Not a valid ObjectId
if (!tribeId || !mongoose.Types.ObjectId.isValid(tribeId)) {
return res.status(400).send({
- message: errorService.getErrorMessageByKey('invalid-id')
+ message: errorService.getErrorMessageByKey('invalid-id'),
});
}
@@ -917,7 +917,7 @@ exports.joinTribe = function (req, res) {
// Return if user is already a member
if (isUserMemberOfTribe(req.user, tribeId)) {
return res.status(409).send({
- message: 'You are already a member of this tribe.'
+ message: 'You are already a member of this tribe.',
});
}
@@ -934,12 +934,12 @@ exports.joinTribe = function (req, res) {
// Tribe by id `req.body.id` didn't exist
if (!tribe || !tribe._id) {
return res.status(400).send({
- message: errorService.getErrorMessageByKey('bad-request')
+ message: errorService.getErrorMessageByKey('bad-request'),
});
}
done(err, tribe);
- }
+ },
);
},
@@ -951,14 +951,14 @@ exports.joinTribe = function (req, res) {
$push: {
member: {
tribe: tribe._id,
- since: Date.now()
- }
- }
+ since: Date.now(),
+ },
+ },
},
{
safe: true, // @link http://stackoverflow.com/a/4975054/1984644
- new: true // get the updated document in return
- }
+ new: true, // get the updated document in return
+ },
).exec(function (err, user) {
done(err, tribe, user);
});
@@ -976,33 +976,33 @@ exports.joinTribe = function (req, res) {
statService.stat({
namespace: 'tagAction',
counts: {
- count: 1
+ count: 1,
},
tags: {
- type: 'tribe'
+ type: 'tribe',
},
meta: {
- slug: tribe.slug
- }
+ slug: tribe.slug,
+ },
}, function () {
// Send response to API
res.send({
message: 'Joined tribe.',
tribe: pickedTribe,
- user: user
+ user: user,
});
done();
});
- }
+ },
// Catch errors
], function (err) {
if (err) {
return res.status(400).send({
- message: 'Failed to join tribe.'
+ message: 'Failed to join tribe.',
});
}
});
@@ -1014,7 +1014,7 @@ exports.joinTribe = function (req, res) {
exports.leaveTribe = function (req, res) {
if (!req.user) {
return res.status(403).send({
- message: errorService.getErrorMessageByKey('forbidden')
+ message: errorService.getErrorMessageByKey('forbidden'),
});
}
@@ -1023,7 +1023,7 @@ exports.leaveTribe = function (req, res) {
// Not a valid ObjectId
if (!tribeId || !mongoose.Types.ObjectId.isValid(tribeId)) {
return res.status(400).send({
- message: errorService.getErrorMessageByKey('invalid-id')
+ message: errorService.getErrorMessageByKey('invalid-id'),
});
}
@@ -1034,7 +1034,7 @@ exports.leaveTribe = function (req, res) {
// Return if isn't a member anymore
if (!isUserMemberOfTribe(req.user, tribeId)) {
return res.status(409).send({
- message: 'You are not a member of this tribe.'
+ message: 'You are not a member of this tribe.',
});
}
@@ -1051,12 +1051,12 @@ exports.leaveTribe = function (req, res) {
// Tribe by id `req.body.id` didn't exist
if (!tribe || !tribe._id) {
return res.status(400).send({
- message: errorService.getErrorMessageByKey('bad-request')
+ message: errorService.getErrorMessageByKey('bad-request'),
});
}
done(err, tribe);
- }
+ },
);
},
@@ -1067,14 +1067,14 @@ exports.leaveTribe = function (req, res) {
{
$pull: {
member: {
- tribe: tribeId
- }
- }
+ tribe: tribeId,
+ },
+ },
},
{
safe: true, // @link http://stackoverflow.com/a/4975054/1984644
- new: true // get the updated document in return
- }
+ new: true, // get the updated document in return
+ },
).exec(function (err, user) {
done(err, tribe, user);
});
@@ -1092,33 +1092,33 @@ exports.leaveTribe = function (req, res) {
statService.stat({
namespace: 'tagAction',
counts: {
- count: -1
+ count: -1,
},
tags: {
- type: 'tribe'
+ type: 'tribe',
},
meta: {
- slug: tribe.slug
- }
+ slug: tribe.slug,
+ },
}, function () {
// Send response to API
res.send({
message: 'Left tribe.',
tribe: pickedTribe,
- user: user
+ user: user,
});
done();
});
- }
+ },
// Catch errors
], function (err) {
if (err) {
return res.status(400).send({
- message: 'Failed to leave tribe.'
+ message: 'Failed to leave tribe.',
});
}
});
@@ -1131,7 +1131,7 @@ exports.getUserMemberships = function (req, res) {
if (!req.user) {
return res.status(403).send({
- message: errorService.getErrorMessageByKey('forbidden')
+ message: errorService.getErrorMessageByKey('forbidden'),
});
}
@@ -1140,7 +1140,7 @@ exports.getUserMemberships = function (req, res) {
.populate({
path: 'member.tribe',
select: tribesHandler.tribeFields,
- model: 'Tribe'
+ model: 'Tribe',
// Not possible at the moment due bug in Mongoose
// http://mongoosejs.com/docs/faq.html#populate_sort_order
// https://github.com/Automattic/mongoose/issues/2202
@@ -1151,7 +1151,7 @@ exports.getUserMemberships = function (req, res) {
// Something went wrong
if (err) {
return res.status(400).send({
- message: 'Failed to get list of tribes.'
+ message: 'Failed to get list of tribes.',
});
}
@@ -1166,7 +1166,7 @@ exports.removePushRegistration = function (req, res) {
if (!req.user) {
return res.status(403).send({
- message: errorService.getErrorMessageByKey('forbidden')
+ message: errorService.getErrorMessageByKey('forbidden'),
});
}
@@ -1176,24 +1176,24 @@ exports.removePushRegistration = function (req, res) {
const query = {
$pull: {
pushRegistration: {
- token: token
- }
- }
+ token: token,
+ },
+ },
};
User.findByIdAndUpdate(user._id, query, {
safe: true, // @link http://stackoverflow.com/a/4975054/1984644
- new: true // get the updated document in return
+ new: true, // get the updated document in return
})
.exec(function (err, user) {
if (err) {
return res.status(400).send({
- message: errorService.getErrorMessage(err) || 'Failed to remove registration, please try again.'
+ message: errorService.getErrorMessage(err) || 'Failed to remove registration, please try again.',
});
} else {
return res.send({
message: 'Removed registration.',
- user: exports.sanitizeProfile(user, user)
+ user: exports.sanitizeProfile(user, user),
});
}
});
@@ -1208,7 +1208,7 @@ exports.addPushRegistration = function (req, res) {
if (!req.user) {
return res.status(403).send({
- message: errorService.getErrorMessageByKey('forbidden')
+ message: errorService.getErrorMessageByKey('forbidden'),
});
}
@@ -1220,7 +1220,7 @@ exports.addPushRegistration = function (req, res) {
if (!token) {
return res.status(400).send({
- message: 'Token is invalid or missing.'
+ message: 'Token is invalid or missing.',
});
}
@@ -1230,7 +1230,7 @@ exports.addPushRegistration = function (req, res) {
if (!platform || validPlatforms.indexOf(platform) === -1) {
return res.status(400).send({
- message: 'Platform is invalid or missing.'
+ message: 'Platform is invalid or missing.',
});
}
@@ -1242,9 +1242,9 @@ exports.addPushRegistration = function (req, res) {
User.findByIdAndUpdate(user._id, {
$pull: {
pushRegistration: {
- token: token
- }
- }
+ token: token,
+ },
+ },
}).exec(function (err) {
done(err);
});
@@ -1257,7 +1257,7 @@ exports.addPushRegistration = function (req, res) {
const registration = {
platform: platform,
token: token,
- created: Date.now()
+ created: Date.now(),
};
if (deviceId) {
@@ -1266,10 +1266,10 @@ exports.addPushRegistration = function (req, res) {
User.findByIdAndUpdate(user._id, {
$push: {
- pushRegistration: registration
- }
+ pushRegistration: registration,
+ },
}, {
- new: true
+ new: true,
}).exec(function (err, updatedUser) {
if (err) {
return done(err);
@@ -1291,28 +1291,28 @@ exports.addPushRegistration = function (req, res) {
if (err) {
// don't stop on error, but log it
log('error', 'Error when sending push notification about added device. #9hsdff', {
- error: err
+ error: err,
});
}
done();
});
- }
+ },
], function (err) {
if (err) {
return res.status(400).send({
- message: errorService.getErrorMessage(err) || 'Failed, please try again.'
+ message: errorService.getErrorMessage(err) || 'Failed, please try again.',
});
} else {
User.findById(user._id).exec(function (err, user) {
if (err) {
return res.status(400).send({
- message: errorService.getErrorMessage(err) || 'Failed to fetch user, please try again.'
+ message: errorService.getErrorMessage(err) || 'Failed to fetch user, please try again.',
});
}
return res.send({
message: 'Saved registration.',
- user: exports.sanitizeProfile(user, user)
+ user: exports.sanitizeProfile(user, user),
});
});
}
@@ -1334,12 +1334,12 @@ exports.getInviteCode = function (req, res) {
if (!req.user) {
return res.status(403).send({
- message: errorService.getErrorMessageByKey('forbidden')
+ message: errorService.getErrorMessageByKey('forbidden'),
});
}
return res.send({
- code: inviteCodeService.getCode()
+ code: inviteCodeService.getCode(),
});
};
@@ -1360,13 +1360,13 @@ exports.validateInviteCode = function (req, res) {
const stats = {
namespace: 'inviteCodeValidation',
counts: {
- count: 1
+ count: 1,
},
tags: {
valid: inviteCodeValid ? 'yes' : 'no',
- isPredefined: isPredefined ? 'yes' : 'no'
+ isPredefined: isPredefined ? 'yes' : 'no',
},
- meta: { }
+ meta: { },
};
// Store predefined codes to stats
@@ -1378,7 +1378,7 @@ exports.validateInviteCode = function (req, res) {
statService.stat(stats, function () {
// Send validation out to API
return res.send({
- valid: inviteCodeValid
+ valid: inviteCodeValid,
});
});
};
@@ -1418,7 +1418,7 @@ exports.search = function (req, res, next) {
const errorMessage = errorService.getErrorMessageByKey('bad-request');
return res.status(400).send({
message: errorMessage,
- detail: 'Query string should be at least 3 characters long.'
+ detail: 'Query string should be at least 3 characters long.',
});
}
@@ -1428,9 +1428,9 @@ exports.search = function (req, res, next) {
{ public: true }, // only public users
{
$text: {
- $search: req.query.search
- }
- }
+ $search: req.query.search,
+ },
+ },
] }, { score: { $meta: 'textScore' } })
// select only the right profile properties
.select(exports.userSearchProfileFields)
diff --git a/modules/users/server/controllers/users.suspended.server.controller.js b/modules/users/server/controllers/users.suspended.server.controller.js
index 896085b5f3..cca21c0310 100644
--- a/modules/users/server/controllers/users.suspended.server.controller.js
+++ b/modules/users/server/controllers/users.suspended.server.controller.js
@@ -29,15 +29,15 @@ exports.invalidateSuspendedSessions = function (req, res, next) {
// For HTML calls send "suspended" html view
'text/html': function () {
res.render('suspended.server.view.html', {
- message: suspendedMessage
+ message: suspendedMessage,
});
},
// For API calls send "suspended" json message
'application/json': function () {
res.json({
- message: suspendedMessage
+ message: suspendedMessage,
});
- }
+ },
});
});
diff --git a/modules/users/server/jobs/user-finish-signup.server.job.js b/modules/users/server/jobs/user-finish-signup.server.job.js
index e7fc64db90..177c56edad 100644
--- a/modules/users/server/jobs/user-finish-signup.server.job.js
+++ b/modules/users/server/jobs/user-finish-signup.server.job.js
@@ -38,28 +38,28 @@ module.exports = function (job, agendaDone) {
.find({
public: false,
created: {
- $lt: createdTimeAgo
+ $lt: createdTimeAgo,
},
// Exlude users with `suspended` role
roles: {
$elemMatch: {
- $ne: 'suspended'
- }
- }
+ $ne: 'suspended',
+ },
+ },
})
.and([
{
$or: [
{ publicReminderCount: { $lt: config.limits.maxSignupReminders || 3 } },
- { publicReminderCount: { $exists: false } }
- ]
+ { publicReminderCount: { $exists: false } },
+ ],
},
{
$or: [
{ publicReminderSent: { $lt: remindedTimeAgo } },
- { publicReminderSent: { $exists: false } }
- ]
- }
+ { publicReminderSent: { $exists: false } },
+ ],
+ },
])
.limit(config.limits.maxProcessSignupReminders || 50)
.exec(function (err, users) {
@@ -86,17 +86,17 @@ module.exports = function (job, agendaDone) {
user._id,
{
$set: {
- publicReminderSent: new Date()
+ publicReminderSent: new Date(),
},
// If the field does not exist, $inc creates the field
// and sets the field to the specified value.
$inc: {
- publicReminderCount: 1
- }
+ publicReminderCount: 1,
+ },
},
function (err) {
callback(err);
- }
+ },
);
}
});
@@ -104,7 +104,7 @@ module.exports = function (job, agendaDone) {
done(err);
});
- }
+ },
], function (err) {
if (err) {
@@ -112,7 +112,7 @@ module.exports = function (job, agendaDone) {
// Agenda stores Mongo `ObjectId` so turning that into a string here
log('error', 'Failure in finish signup reminder background job.', {
error: err,
- jobId: _.get(job, 'attrs._id').toString()
+ jobId: _.get(job, 'attrs._id').toString(),
});
}
return agendaDone(err);
diff --git a/modules/users/server/jobs/user-welcome-sequence-first.server.job.js b/modules/users/server/jobs/user-welcome-sequence-first.server.job.js
index 548113934e..d25abce289 100644
--- a/modules/users/server/jobs/user-welcome-sequence-first.server.job.js
+++ b/modules/users/server/jobs/user-welcome-sequence-first.server.job.js
@@ -45,9 +45,9 @@ module.exports = function (job, agendaDone) {
// Exlude users with `suspended` role
roles: {
$elemMatch: {
- $ne: 'suspended'
- }
- }
+ $ne: 'suspended',
+ },
+ },
})
// Limit stops any crazy amounts of emails being processed at once
// the rest would be processed in next round.
@@ -77,30 +77,30 @@ module.exports = function (job, agendaDone) {
user._id,
{
$set: {
- welcomeSequenceSent: new Date()
+ welcomeSequenceSent: new Date(),
},
// If the field does not exist, $inc creates the field
// and sets the field to the specified value.
$inc: {
- welcomeSequenceStep: 1
- }
+ welcomeSequenceStep: 1,
+ },
},
function (err) {
callback(err);
- }
+ },
);
});
}, function (err) {
done(err);
});
- }
+ },
], function (err) {
if (err) {
log('error', 'Failure in first welcome sequence background job.', {
error: err,
- jobId: _.get(job, 'attrs._id').toString()
+ jobId: _.get(job, 'attrs._id').toString(),
});
}
return agendaDone(err);
diff --git a/modules/users/server/jobs/user-welcome-sequence-second.server.job.js b/modules/users/server/jobs/user-welcome-sequence-second.server.job.js
index 58ee492753..3c8d163c4d 100644
--- a/modules/users/server/jobs/user-welcome-sequence-second.server.job.js
+++ b/modules/users/server/jobs/user-welcome-sequence-second.server.job.js
@@ -45,9 +45,9 @@ module.exports = function (job, agendaDone) {
// Exlude users with `suspended` role
roles: {
$elemMatch: {
- $ne: 'suspended'
- }
- }
+ $ne: 'suspended',
+ },
+ },
})
// Limit stops any crazy amounts of emails being processed at once
// the rest would be processed in next round.
@@ -76,17 +76,17 @@ module.exports = function (job, agendaDone) {
user._id,
{
$set: {
- welcomeSequenceSent: new Date()
+ welcomeSequenceSent: new Date(),
},
// If the field does not exist, $inc creates the field
// and sets the field to the specified value.
$inc: {
- welcomeSequenceStep: 1
- }
+ welcomeSequenceStep: 1,
+ },
},
function (err) {
callback(err);
- }
+ },
);
}
});
@@ -94,13 +94,13 @@ module.exports = function (job, agendaDone) {
done(err);
});
- }
+ },
], function (err) {
if (err) {
log('error', 'Failure in second welcome sequence background job.', {
error: err,
- jobId: _.get(job, 'attrs._id').toString()
+ jobId: _.get(job, 'attrs._id').toString(),
});
}
return agendaDone(err);
diff --git a/modules/users/server/jobs/user-welcome-sequence-third.server.job.js b/modules/users/server/jobs/user-welcome-sequence-third.server.job.js
index 6cae4d1abf..bb84589b22 100644
--- a/modules/users/server/jobs/user-welcome-sequence-third.server.job.js
+++ b/modules/users/server/jobs/user-welcome-sequence-third.server.job.js
@@ -45,9 +45,9 @@ module.exports = function (job, agendaDone) {
// Exlude users with `suspended` role
roles: {
$elemMatch: {
- $ne: 'suspended'
- }
- }
+ $ne: 'suspended',
+ },
+ },
})
// Limit stops any crazy amounts of emails being processed at once
// the rest would be processed in next round.
@@ -76,17 +76,17 @@ module.exports = function (job, agendaDone) {
user._id,
{
$set: {
- welcomeSequenceSent: new Date()
+ welcomeSequenceSent: new Date(),
},
// If the field does not exist, $inc creates the field
// and sets the field to the specified value.
$inc: {
- welcomeSequenceStep: 1
- }
+ welcomeSequenceStep: 1,
+ },
},
function (err) {
callback(err);
- }
+ },
);
}
});
@@ -94,13 +94,13 @@ module.exports = function (job, agendaDone) {
done(err);
});
- }
+ },
], function (err) {
if (err) {
log('error', 'Failure in third welcome sequence background job.', {
error: err,
- jobId: _.get(job, 'attrs._id').toString()
+ jobId: _.get(job, 'attrs._id').toString(),
});
}
return agendaDone(err);
diff --git a/modules/users/server/models/user.server.model.js b/modules/users/server/models/user.server.model.js
index 321f756b4d..eeaa218fd7 100755
--- a/modules/users/server/models/user.server.model.js
+++ b/modules/users/server/models/user.server.model.js
@@ -61,13 +61,13 @@ const UserMemberSchema = new Schema({
tribe: {
type: Schema.Types.ObjectId,
ref: 'Tribe',
- required: true
+ required: true,
},
since: {
type: Date,
default: Date.now,
- required: true
- }
+ required: true,
+ },
}, { _id: false });
/**
@@ -78,21 +78,21 @@ const UserPushRegistrationSchema = new Schema({
type: String,
// android, ios, web → Firebase; expo → Exponent
enum: ['android', 'ios', 'web', 'expo'],
- required: true
+ required: true,
},
token: {
type: String,
- required: true
+ required: true,
},
created: {
type: Date,
default: Date.now,
- required: true
+ required: true,
},
deviceId: {
type: String,
- trim: true
- }
+ trim: true,
+ },
}, { _id: false });
/**
@@ -103,17 +103,17 @@ const UserSchema = new Schema({
type: String,
required: true,
validate: [validateLocalStrategyProperty, 'Please fill in your first name'],
- set: setPlainTextField
+ set: setPlainTextField,
},
lastName: {
type: String,
required: true,
validate: [validateLocalStrategyProperty, 'Please fill in your last name'],
- set: setPlainTextField
+ set: setPlainTextField,
},
/* This is generated in Schema pre-save hook below */
displayName: {
- type: String
+ type: String,
},
email: {
type: String,
@@ -121,7 +121,7 @@ const UserSchema = new Schema({
unique: 'Email exists already.',
lowercase: true,
required: true,
- validate: [validateLocalStrategyEmail, 'Please fill a valid email address']
+ validate: [validateLocalStrategyEmail, 'Please fill a valid email address'],
},
/* New email is stored here until it is confirmed */
emailTemporary: {
@@ -129,40 +129,40 @@ const UserSchema = new Schema({
trim: true,
lowercase: true,
default: '',
- match: [/.+@.+\..+/, 'Please enter a valid email address']
+ match: [/.+@.+\..+/, 'Please enter a valid email address'],
},
tagline: {
type: String,
default: '',
- set: setPlainTextField
+ set: setPlainTextField,
},
description: {
type: String,
default: '',
- set: textService.html
+ set: textService.html,
},
birthdate: {
- type: Date
+ type: Date,
},
gender: {
type: String,
enum: ['', 'female', 'male', 'non-binary', 'other'],
- default: ''
+ default: '',
},
languages: {
type: [{
type: String,
- enum: _.keys(languages)
+ enum: _.keys(languages),
}],
- default: []
+ default: [],
},
locationLiving: {
type: String,
- set: setPlainTextField
+ set: setPlainTextField,
},
locationFrom: {
type: String,
- set: setPlainTextField
+ set: setPlainTextField,
},
// Lowercase enforced username
username: {
@@ -171,46 +171,46 @@ const UserSchema = new Schema({
required: true,
validate: [validateUsername, 'Please fill in valid username: 3+ characters long, non banned word, characters "_-.", no consecutive dots, does not begin or end with dots, letters a-z and numbers 0-9.'],
lowercase: true, // Stops users creating case sensitive duplicate usernames with "username" and "USERname", via @link https://github.com/meanjs/mean/issues/147
- trim: true
+ trim: true,
},
usernameUpdated: {
- type: Date
+ type: Date,
},
// Bewelcome.org username
extSitesBW: {
type: String,
trim: true,
- set: setPlainTextField
+ set: setPlainTextField,
},
// Couchsurfing.com username
extSitesCS: {
type: String,
trim: true,
- set: setPlainTextField
+ set: setPlainTextField,
},
// Warmshowers.org username
extSitesWS: {
type: String,
trim: true,
- set: setPlainTextField
+ set: setPlainTextField,
},
password: {
type: String,
default: '',
- validate: [validatePassword, 'Password should be more than ' + passwordMinLength + ' characters long.']
+ validate: [validatePassword, 'Password should be more than ' + passwordMinLength + ' characters long.'],
},
emailHash: {
- type: String
+ type: String,
},
salt: {
- type: String
+ type: String,
},
/* All this provider stuff relates to oauth logins, will always be local for
Trustroots, comes from boilerplate. Will be removed one day. */
provider: {
type: String,
required: true,
- default: 'local'
+ default: 'local',
},
/* Facebook, Twitter etc data is stored here. */
providerData: {},
@@ -218,96 +218,96 @@ const UserSchema = new Schema({
roles: {
type: [{
type: String,
- enum: ['user', 'admin', 'suspended']
+ enum: ['user', 'admin', 'suspended'],
}],
- default: ['user']
+ default: ['user'],
},
/* The last time the user was logged in; collected from July 2017 onwards */
seen: {
- type: Date
+ type: Date,
},
updated: {
- type: Date
+ type: Date,
},
created: {
type: Date,
- default: Date.now
+ default: Date.now,
},
avatarSource: {
type: String,
enum: ['none', 'gravatar', 'facebook', 'local'],
- default: 'gravatar'
+ default: 'gravatar',
},
avatarUploaded: {
type: Boolean,
- default: false
+ default: false,
},
newsletter: {
type: Boolean,
- default: false
+ default: false,
},
/* Preferred interface language (client, emails, ...) */
locale: {
type: String,
- default: ''
+ default: '',
},
passwordUpdated: {
- type: Date
+ type: Date,
},
/* For email confirmations */
emailToken: {
- type: String
+ type: String,
},
/* New users are public=false until they validate their email. If public=false,
users can't email other users, can't be seen by other users. They are
effectively black holed... */
public: {
type: Boolean,
- default: false
+ default: false,
},
/* Count and latest date of emails sent to remind about un-finished signup
Will be removed once user sets `public:true` */
publicReminderCount: {
- type: Number
+ type: Number,
},
publicReminderSent: {
- type: Date
+ type: Date,
},
welcomeSequenceSent: {
- type: Date
+ type: Date,
},
// Count on which welcome sequence step (onboarding emails) user is at
welcomeSequenceStep: {
type: Number,
- default: 0
+ default: 0,
},
/* For reset password */
resetPasswordToken: {
- type: String
+ type: String,
},
resetPasswordExpires: {
- type: Date
+ type: Date,
},
/* For removing the profile */
removeProfileToken: {
- type: String
+ type: String,
},
removeProfileExpires: {
- type: Date
+ type: Date,
},
/* Tribes user is member of */
member: {
- type: [UserMemberSchema]
+ type: [UserMemberSchema],
},
pushRegistration: {
type: [UserPushRegistrationSchema],
- default: []
+ default: [],
},
acquisitionStory: {
type: String,
default: '',
- set: setPlainTextFieldAndLimit(500)
- }
+ set: setPlainTextFieldAndLimit(500),
+ },
});
/**
diff --git a/modules/users/server/policies/users.server.policy.js b/modules/users/server/policies/users.server.policy.js
index d49b88968e..53245388ee 100644
--- a/modules/users/server/policies/users.server.policy.js
+++ b/modules/users/server/policies/users.server.policy.js
@@ -16,95 +16,95 @@ exports.invokeRolesPolicies = function () {
roles: ['admin'],
allows: [{
resources: '/api/users',
- permissions: []
+ permissions: [],
}, {
resources: '/api/users/:username',
- permissions: []
+ permissions: [],
}, {
resources: '/api/users/avatar',
- permissions: []
+ permissions: [],
}, {
resources: '/api/users/mini/:userId',
- permissions: []
+ permissions: [],
}, {
resources: '/api/users/password',
- permissions: []
+ permissions: [],
}, {
resources: '/api/auth/accounts',
- permissions: []
+ permissions: [],
}, {
resources: '/api/users/memberships',
- permissions: []
+ permissions: [],
}, {
resources: '/api/users/memberships/:tribeId',
- permissions: []
- }]
+ permissions: [],
+ }],
}, {
roles: ['user'],
allows: [{
resources: '/api/users',
- permissions: ['get', 'put', 'delete']
+ permissions: ['get', 'put', 'delete'],
}, {
resources: '/api/users/remove/:token',
- permissions: ['delete']
+ permissions: ['delete'],
}, {
resources: '/api/users/:username',
- permissions: ['get']
+ permissions: ['get'],
}, {
resources: '/api/users-avatar',
- permissions: ['post']
+ permissions: ['post'],
}, {
resources: '/api/users/mini/:userId',
- permissions: ['get']
+ permissions: ['get'],
}, {
resources: '/api/users/password',
- permissions: ['post']
+ permissions: ['post'],
}, {
resources: '/api/auth/accounts',
- permissions: ['get', 'post', 'delete']
+ permissions: ['get', 'post', 'delete'],
}, {
resources: '/api/auth/twitter',
- permissions: ['get']
+ permissions: ['get'],
}, {
resources: '/api/auth/twitter/callback',
- permissions: ['get']
+ permissions: ['get'],
}, {
resources: '/api/auth/facebook',
- permissions: ['get', 'put']
+ permissions: ['get', 'put'],
}, {
resources: '/api/auth/facebook/callback',
- permissions: ['get']
+ permissions: ['get'],
}, {
resources: '/api/auth/github',
- permissions: ['get']
+ permissions: ['get'],
}, {
resources: '/api/auth/github/callback',
- permissions: ['get']
+ permissions: ['get'],
}, {
resources: '/api/users/memberships',
- permissions: ['get']
+ permissions: ['get'],
}, {
resources: '/api/users/memberships/:tribeId',
- permissions: ['post', 'delete']
+ permissions: ['post', 'delete'],
}, {
resources: '/api/users/push/registrations',
- permissions: ['post']
+ permissions: ['post'],
}, {
resources: '/api/users/push/registrations/:token',
- permissions: ['delete']
+ permissions: ['delete'],
}, {
resources: '/api/users/invitecode',
- permissions: ['get']
+ permissions: ['get'],
}, {
resources: '/api/users/invitecode/:invitecode',
- permissions: ['post']
- }]
+ permissions: ['post'],
+ }],
}, {
roles: ['guest'],
allows: [{
resources: '/api/users/invitecode/:invitecode',
- permissions: ['post']
- }]
+ permissions: ['post'],
+ }],
}]);
};
@@ -116,14 +116,14 @@ exports.isAllowed = function (req, res, next) {
// Non-public profiles are invisible
if (req.profile && !req.profile.public && req.user && !req.profile._id.equals(req.user._id)) {
return res.status(404).json({
- message: errorService.getErrorMessageByKey('not-found')
+ message: errorService.getErrorMessageByKey('not-found'),
});
}
// No profile browsing for non-public users
if (req.profile && req.user && !req.user.public && !req.profile._id.equals(req.user._id)) {
return res.status(403).json({
- message: errorService.getErrorMessageByKey('forbidden')
+ message: errorService.getErrorMessageByKey('forbidden'),
});
}
@@ -133,7 +133,7 @@ exports.isAllowed = function (req, res, next) {
if (err) {
// An authorization error occurred
return res.status(500).json({
- message: 'Unexpected authorization error'
+ message: 'Unexpected authorization error',
});
} else {
if (isAllowed) {
@@ -141,7 +141,7 @@ exports.isAllowed = function (req, res, next) {
return next();
} else {
return res.status(403).json({
- message: errorService.getErrorMessageByKey('forbidden')
+ message: errorService.getErrorMessageByKey('forbidden'),
});
}
}
diff --git a/modules/users/server/routes/auth.server.routes.js b/modules/users/server/routes/auth.server.routes.js
index 75d27ae44f..df1cb3e923 100644
--- a/modules/users/server/routes/auth.server.routes.js
+++ b/modules/users/server/routes/auth.server.routes.js
@@ -38,8 +38,8 @@ module.exports = function (app) {
.get(passport.authenticate('facebook', {
scope: [
'public_profile',
- 'email'
- ]
+ 'email',
+ ],
}))
.put(userAuthentication.updateFacebookOAuthToken);
app.route('/api/auth/facebook/callback').all(usersPolicy.isAllowed)
@@ -55,8 +55,8 @@ module.exports = function (app) {
app.route('/api/auth/github').all(usersPolicy.isAllowed)
.get(passport.authenticate('github', {
scope: [
- 'user:email'
- ]
+ 'user:email',
+ ],
}));
app.route('/api/auth/github/callback').all(usersPolicy.isAllowed)
.get(userAuthentication.oauthCallback('github'));
diff --git a/modules/users/tests/client/authentication.client.controller.tests.js b/modules/users/tests/client/authentication.client.controller.tests.js
index b840439ec2..cf12e6dbd7 100644
--- a/modules/users/tests/client/authentication.client.controller.tests.js
+++ b/modules/users/tests/client/authentication.client.controller.tests.js
@@ -13,11 +13,11 @@
return {
compare: function (actual, expected) {
return {
- pass: angular.equals(actual, expected)
+ pass: angular.equals(actual, expected),
};
- }
+ },
};
- }
+ },
});
});
@@ -28,7 +28,7 @@
let $scope;
const appSettings = {
- flashTimeout: 0
+ flashTimeout: 0,
};
// The injector ignores leading and trailing underscores here (i.e. _$httpBackend_).
@@ -46,7 +46,7 @@
// Initialize the Authentication controller
AuthenticationController = $controller('AuthenticationController', {
$scope: $scope,
- appSettings: appSettings
+ appSettings: appSettings,
});
$scope.vm = AuthenticationController;
@@ -73,7 +73,7 @@
// Test expected POST request
$httpBackend.expectPOST('/api/auth/signin').respond(400, {
- 'message': 'Missing credentials'
+ 'message': 'Missing credentials',
});
$httpBackend.when('GET', '/modules/pages/views/home.client.view.html').respond(200, '');
$httpBackend.when('GET', '/modules/search/views/search.client.view.html').respond(200, '');
@@ -98,12 +98,12 @@
// Mock logged in user
_Authentication_.user = {
username: 'test',
- roles: ['user']
+ roles: ['user'],
};
AuthenticationController = $controller('AuthenticationController', {
$scope: $scope,
- appSettings: appSettings
+ appSettings: appSettings,
});
}));
diff --git a/modules/users/tests/client/password-forgot.client.controller.tests.js b/modules/users/tests/client/password-forgot.client.controller.tests.js
index 7dbe076e67..4b2aa217be 100644
--- a/modules/users/tests/client/password-forgot.client.controller.tests.js
+++ b/modules/users/tests/client/password-forgot.client.controller.tests.js
@@ -19,11 +19,11 @@
return {
compare: function (actual, expected) {
return {
- pass: angular.equals(actual, expected)
+ pass: angular.equals(actual, expected),
};
- }
+ },
};
- }
+ },
});
});
@@ -45,7 +45,7 @@
// Initialize the Authentication controller
$controller('ForgotPasswordController as vm', {
- $scope: $scope
+ $scope: $scope,
});
}));
@@ -56,7 +56,7 @@
describe('askForPasswordReset', function () {
const credentials = {
username: 'test',
- password: 'test'
+ password: 'test',
};
beforeEach(function () {
// Test expected GET request
@@ -82,7 +82,7 @@
// Test expected GET request
$httpBackend.when('GET', '/modules/users/views/password/reset-password-success.client.view.html').respond(200, '');
$httpBackend.when('POST', '/api/auth/forgot', credentials).respond(400, {
- 'message': errorMessage
+ 'message': errorMessage,
});
Authentication.user = null;
@@ -106,7 +106,7 @@
// Test expected requests
$httpBackend.when('GET', '/modules/users/views/password/reset-password-success.client.view.html').respond(200, '');
$httpBackend.when('POST', '/api/auth/forgot', credentials).respond({
- 'message': successMessage
+ 'message': successMessage,
});
Authentication.user = null;
diff --git a/modules/users/tests/client/password-reset.client.controller.tests.js b/modules/users/tests/client/password-reset.client.controller.tests.js
index 5c01720bd7..419fe89ac5 100644
--- a/modules/users/tests/client/password-reset.client.controller.tests.js
+++ b/modules/users/tests/client/password-reset.client.controller.tests.js
@@ -20,11 +20,11 @@
return {
compare: function (actual, expected) {
return {
- pass: angular.equals(actual, expected)
+ pass: angular.equals(actual, expected),
};
- }
+ },
};
- }
+ },
});
});
@@ -49,7 +49,7 @@
// Initialize the Authentication controller
$controller('ResetPasswordController as vm', {
- $scope: $scope
+ $scope: $scope,
});
}));
@@ -60,7 +60,7 @@
describe('resetUserPassword', function () {
const token = 'testToken';
const passwordDetails = {
- password: 'test'
+ password: 'test',
};
beforeEach(function () {
@@ -81,7 +81,7 @@
it('POST error should set $scope.vm.error to response message', function () {
const errorMessage = 'Passwords do not match';
$httpBackend.when('POST', '/api/auth/reset/' + token, passwordDetails).respond(400, {
- 'message': errorMessage
+ 'message': errorMessage,
});
$scope.vm.resetUserPassword();
@@ -92,7 +92,7 @@
describe('POST success', function () {
const user = {
- username: 'test'
+ username: 'test',
};
beforeEach(function () {
diff --git a/modules/users/tests/client/profile-edit-account.client.controller.tests.js b/modules/users/tests/client/profile-edit-account.client.controller.tests.js
index 223b3a9374..00295ebef1 100644
--- a/modules/users/tests/client/profile-edit-account.client.controller.tests.js
+++ b/modules/users/tests/client/profile-edit-account.client.controller.tests.js
@@ -9,7 +9,7 @@
const user = {
_id: 'user',
displayName: 'User',
- emailTemporary: 'foo@foo.com'
+ emailTemporary: 'foo@foo.com',
};
// Load the main application module
@@ -18,7 +18,7 @@
beforeEach(inject(function (
_$httpBackend_,
_Authentication_,
- _messageCenterService_
+ _messageCenterService_,
) {
$httpBackend = _$httpBackend_;
Authentication = _Authentication_;
@@ -40,7 +40,7 @@
ProfileEditAccountController = $controller('ProfileEditAccountController', {
messageCenterService: messageCenterService,
$scope: $rootScope.$new(),
- push: {} // this ends up trying to load firebaseMessaging service otherwise
+ push: {}, // this ends up trying to load firebaseMessaging service otherwise
});
done();
});
@@ -53,14 +53,14 @@
const expectedPutData = {
_id: 'user',
displayName: 'User',
- emailTemporary: 'new@email.com'
+ emailTemporary: 'new@email.com',
};
$httpBackend.expect('PUT', '/api/users', expectedPutData).respond(200);
ProfileEditAccountController.updateUserEmail();
$httpBackend.flush();
expect(messageCenterService.add).toHaveBeenCalledWith(
'success',
- 'Check your email for further instructions.'
+ 'Check your email for further instructions.',
);
});
@@ -90,7 +90,7 @@
$httpBackend.flush();
expect(messageCenterService.add).toHaveBeenCalledWith(
'success',
- 'Confirmation email resent.'
+ 'Confirmation email resent.',
);
});
@@ -100,19 +100,19 @@
$httpBackend.flush();
expect(messageCenterService.add).toHaveBeenCalledWith(
'danger',
- 'Error: Something went wrong.'
+ 'Error: Something went wrong.',
);
});
it('can show an custom error message during failure', function () {
$httpBackend.expect('POST', '/api/auth/resend-confirmation').respond(400, {
- message: 'my custom error'
+ message: 'my custom error',
});
ProfileEditAccountController.resendUserEmailConfirm();
$httpBackend.flush();
expect(messageCenterService.add).toHaveBeenCalledWith(
'danger',
- 'Error: my custom error'
+ 'Error: my custom error',
);
});
diff --git a/modules/users/tests/server/jobs/user-finish-signup.server.job.tests.js b/modules/users/tests/server/jobs/user-finish-signup.server.job.tests.js
index bc9f5f2894..8c86b49848 100644
--- a/modules/users/tests/server/jobs/user-finish-signup.server.job.tests.js
+++ b/modules/users/tests/server/jobs/user-finish-signup.server.job.tests.js
@@ -42,7 +42,7 @@ describe('Job: user finish signup', function () {
username: 'user_unconfirmed',
password: 'M3@n.jsI$Aw3$0m3',
provider: 'local',
- created: moment().subtract(moment.duration({ 'hours': 4 }))
+ created: moment().subtract(moment.duration({ 'hours': 4 })),
};
unConfirmedUser = new User(_unConfirmedUser);
@@ -63,7 +63,7 @@ describe('Job: user finish signup', function () {
username: 'user_confirmed',
password: 'M3@n.jsI$Aw3$0m4',
provider: 'local',
- created: moment().subtract(moment.duration({ 'hours': 4 }))
+ created: moment().subtract(moment.duration({ 'hours': 4 })),
};
confirmedUser = new User(_confirmedUser);
@@ -257,7 +257,7 @@ describe('Job: user finish signup', function () {
username: 'l' + i + _unConfirmedUser.username,
emailToken: 'l' + i + _unConfirmedUser.emailToken,
emailTemporary: 'l' + i + _unConfirmedUser.emailTemporary,
- email: 'l' + i + _unConfirmedUser.email
+ email: 'l' + i + _unConfirmedUser.email,
};
const _unConfirmedUserLooped = _.merge(_.clone(_unConfirmedUser), loopVars);
_users.push(_unConfirmedUserLooped);
diff --git a/modules/users/tests/server/jobs/user-welcome-sequence-first.server.job.tests.js b/modules/users/tests/server/jobs/user-welcome-sequence-first.server.job.tests.js
index 3ec1a4dbd3..95b275aacc 100644
--- a/modules/users/tests/server/jobs/user-welcome-sequence-first.server.job.tests.js
+++ b/modules/users/tests/server/jobs/user-welcome-sequence-first.server.job.tests.js
@@ -58,7 +58,7 @@ describe('Job: welcome sequence, first email', function () {
password: 'M3@n.jsI$Aw3$0m3',
provider: 'local',
welcomeSequenceStep: 0,
- created: moment().subtract(moment.duration({ 'minutes': 3 }))
+ created: moment().subtract(moment.duration({ 'minutes': 3 })),
};
unConfirmedUser = new User(_unConfirmedUser);
@@ -81,7 +81,7 @@ describe('Job: welcome sequence, first email', function () {
provider: 'local',
welcomeSequenceStep: 0,
welcomeSequenceSent: timePast,
- created: timePast
+ created: timePast,
};
confirmedUser = new User(_confirmedUser);
diff --git a/modules/users/tests/server/jobs/user-welcome-sequence-second.server.job.tests.js b/modules/users/tests/server/jobs/user-welcome-sequence-second.server.job.tests.js
index 2216402968..23864aa764 100644
--- a/modules/users/tests/server/jobs/user-welcome-sequence-second.server.job.tests.js
+++ b/modules/users/tests/server/jobs/user-welcome-sequence-second.server.job.tests.js
@@ -60,7 +60,7 @@ describe('Job: welcome sequence, second email', function () {
password: 'M3@n.jsI$Aw3$0m3',
provider: 'local',
welcomeSequenceStep: 0,
- created: moment().subtract(moment.duration({ 'minutes': 3 }))
+ created: moment().subtract(moment.duration({ 'minutes': 3 })),
};
unConfirmedUser = new User(_unConfirmedUser);
@@ -83,7 +83,7 @@ describe('Job: welcome sequence, second email', function () {
provider: 'local',
welcomeSequenceStep: 1,
welcomeSequenceSent: timePast,
- created: timePast
+ created: timePast,
};
confirmedUser = new User(_confirmedUser);
diff --git a/modules/users/tests/server/jobs/user-welcome-sequence-third.server.job.tests.js b/modules/users/tests/server/jobs/user-welcome-sequence-third.server.job.tests.js
index 8d6721b9e3..9b9fbf0280 100644
--- a/modules/users/tests/server/jobs/user-welcome-sequence-third.server.job.tests.js
+++ b/modules/users/tests/server/jobs/user-welcome-sequence-third.server.job.tests.js
@@ -60,7 +60,7 @@ describe('Job: welcome sequence, third email', function () {
password: 'M3@n.jsI$Aw3$0m3',
provider: 'local',
welcomeSequenceStep: 0,
- created: moment().subtract(moment.duration({ 'minutes': 3 }))
+ created: moment().subtract(moment.duration({ 'minutes': 3 })),
};
unConfirmedUser = new User(_unConfirmedUser);
@@ -83,7 +83,7 @@ describe('Job: welcome sequence, third email', function () {
provider: 'local',
welcomeSequenceStep: 2,
welcomeSequenceSent: timePast,
- created: timePast
+ created: timePast,
};
confirmedUser = new User(_confirmedUser);
diff --git a/modules/users/tests/server/search-users.server.routes.tests.js b/modules/users/tests/server/search-users.server.routes.tests.js
index 4c80c2cb58..e4254db30f 100644
--- a/modules/users/tests/server/search-users.server.routes.tests.js
+++ b/modules/users/tests/server/search-users.server.routes.tests.js
@@ -60,7 +60,7 @@ describe('Search users: GET /users?search=string', function () {
public: _.has(user, 'public') ? user.public : true,
gender: 'non-binary',
locationFrom: 'Wonderland',
- locationLiving: 'La Islantilla'
+ locationLiving: 'La Islantilla',
});
@@ -117,7 +117,7 @@ describe('Search users: GET /users?search=string', function () {
{ username: 'asdf' },
{ username: 'asdfg' },
{ username: 'asdia' },
- { username: 'hasdfg' }
+ { username: 'hasdfg' },
], cb);
},
@@ -136,7 +136,7 @@ describe('Search users: GET /users?search=string', function () {
should(foundUsers).length(1);
cb();
- }
+ },
], done);
});
@@ -151,7 +151,7 @@ describe('Search users: GET /users?search=string', function () {
{ firstName: 'qwery' },
{ firstName: 'qwer' },
{ firstName: 'qwe' },
- { firstName: 'sqwero' }
+ { firstName: 'sqwero' },
], cb);
},
@@ -170,7 +170,7 @@ describe('Search users: GET /users?search=string', function () {
should(foundUsers).length(2);
cb();
- }
+ },
], done);
});
@@ -188,7 +188,7 @@ describe('Search users: GET /users?search=string', function () {
{ lastName: 'zxcvba' },
{ lastName: 'zxcvz' },
{ lastName: 'asdia' },
- { lastName: 'hasdfg' }
+ { lastName: 'hasdfg' },
], cb);
},
@@ -207,7 +207,7 @@ describe('Search users: GET /users?search=string', function () {
should(foundUsers).length(2);
cb();
- }
+ },
], done);
});
@@ -223,7 +223,7 @@ describe('Search users: GET /users?search=string', function () {
{ firstName: 'jaCob', lastName: 'alid' },
{ firstName: 'jacob', lastName: 'aliE' },
{ firstName: 'jacob', lastName: 'alIA' },
- { firstName: 'jaco', lastName: 'alg' }
+ { firstName: 'jaco', lastName: 'alg' },
], cb);
},
@@ -242,7 +242,7 @@ describe('Search users: GET /users?search=string', function () {
should(foundUsers).length(6);
cb();
- }
+ },
], done);
});
@@ -256,7 +256,7 @@ describe('Search users: GET /users?search=string', function () {
{ username: 'zxcvba' },
{ firstName: 'xcvz' },
{ lastName: 'asdia' },
- { username: 'hasdfg' }
+ { username: 'hasdfg' },
], cb);
},
@@ -275,7 +275,7 @@ describe('Search users: GET /users?search=string', function () {
should(foundUsers).length(0);
cb();
- }
+ },
], done);
});
@@ -285,7 +285,7 @@ describe('Search users: GET /users?search=string', function () {
// create some users
function (cb) {
createUsers([
- { username: 'aaa' }
+ { username: 'aaa' },
], cb);
},
@@ -313,7 +313,7 @@ describe('Search users: GET /users?search=string', function () {
should(unexpectedFields).eql(['score']);
cb();
- }
+ },
], done);
});
@@ -331,7 +331,7 @@ describe('Search users: GET /users?search=string', function () {
{ firstName: 'aaaaaa' },
{ lastName: 'aaaaaa' },
{ firstName: 'aaaaaa' },
- { lastName: 'aaaaaa' }
+ { lastName: 'aaaaaa' },
];
beforeEach(function (done) {
@@ -346,7 +346,7 @@ describe('Search users: GET /users?search=string', function () {
{ params: '&page=2', expected: testUsers.length - limit },
{ params: '&limit=11', expected: 11 },
{ params: '&page=1&limit=11', expected: 11 },
- { params: '&page=2&limit=11', expected: testUsers.length - 11 }
+ { params: '&page=2&limit=11', expected: testUsers.length - 11 },
];
pageTests.forEach(function (test) {
@@ -367,7 +367,7 @@ describe('Search users: GET /users?search=string', function () {
function (foundUsers, cb) {
should(foundUsers).length(test.expected);
cb();
- }
+ },
], done);
});
});
@@ -382,7 +382,7 @@ describe('Search users: GET /users?search=string', function () {
{ username: 'abcdef' },
{ firstName: 'abCdef' },
{ lastName: 'ABCdEF' },
- { username: 'aabc' }
+ { username: 'aabc' },
], cb);
},
@@ -401,7 +401,7 @@ describe('Search users: GET /users?search=string', function () {
should(foundUsers).length(3);
cb();
- }
+ },
], done);
});
@@ -415,7 +415,7 @@ describe('Search users: GET /users?search=string', function () {
{ firstName: 'aAabCd', public: false },
{ lastName: 'aaABCc', public: false },
{ lastName: 'aaABCc', public: true }, // this one is not matched
- { firstName: 'aabCDef', lastName: 'aAbcdef', public: true }
+ { firstName: 'aabCDef', lastName: 'aAbcdef', public: true },
], cb);
},
@@ -434,7 +434,7 @@ describe('Search users: GET /users?search=string', function () {
should(foundUsers).length(2);
cb();
- }
+ },
], done);
});
});
diff --git a/modules/users/tests/server/user-invite.server.routes.tests.js b/modules/users/tests/server/user-invite.server.routes.tests.js
index a855dec0cc..94b92cf4e1 100644
--- a/modules/users/tests/server/user-invite.server.routes.tests.js
+++ b/modules/users/tests/server/user-invite.server.routes.tests.js
@@ -34,7 +34,7 @@ describe('User invites CRUD tests', function () {
// Create user credentials
credentials = {
username: 'TR_username',
- password: 'TR-I$Aw3$0m4'
+ password: 'TR-I$Aw3$0m4',
};
// Create a new user
@@ -46,7 +46,7 @@ describe('User invites CRUD tests', function () {
username: credentials.username.toLowerCase(),
password: credentials.password,
provider: 'local',
- public: true
+ public: true,
};
user = new User(_user);
diff --git a/modules/users/tests/server/user-lastseen.server.tests.js b/modules/users/tests/server/user-lastseen.server.tests.js
index 8bbf9948fe..4a7568a371 100644
--- a/modules/users/tests/server/user-lastseen.server.tests.js
+++ b/modules/users/tests/server/user-lastseen.server.tests.js
@@ -46,7 +46,7 @@ describe('User last seen CRUD tests', function () {
email: 'confirmed-test@test.com',
username: 'usertest',
password: 'aPassWoRd_*....',
- provider: 'local'
+ provider: 'local',
};
confirmedUser = new User(_confirmedUser);
diff --git a/modules/users/tests/server/user-password.server.routes.tests.js b/modules/users/tests/server/user-password.server.routes.tests.js
index 11e8376796..b99472d324 100644
--- a/modules/users/tests/server/user-password.server.routes.tests.js
+++ b/modules/users/tests/server/user-password.server.routes.tests.js
@@ -33,7 +33,7 @@ describe('User password CRUD tests', function () {
// Create user credentials
credentials = {
username: 'TR_username',
- password: 'TR-I$Aw3$0m4'
+ password: 'TR-I$Aw3$0m4',
};
// Create a new user
@@ -46,7 +46,7 @@ describe('User password CRUD tests', function () {
emailToken: 'initial email token',
username: credentials.username.toLowerCase(),
password: credentials.password,
- provider: 'local'
+ provider: 'local',
};
user = new User(_user);
@@ -62,7 +62,7 @@ describe('User password CRUD tests', function () {
should.not.exist(err);
agent.post('/api/auth/forgot')
.send({
- username: 'some_username_that_doesnt_exist'
+ username: 'some_username_that_doesnt_exist',
})
.expect(404)
.end(function (err, res) {
@@ -86,7 +86,7 @@ describe('User password CRUD tests', function () {
should.not.exist(err);
agent.post('/api/auth/forgot')
.send({
- username: ''
+ username: '',
})
.expect(400)
.end(function (err, res) {
@@ -108,7 +108,7 @@ describe('User password CRUD tests', function () {
should.not.exist(err);
agent.post('/api/auth/forgot')
.send({
- username: user.username
+ username: user.username,
})
.expect(200)
.end(function (err, res) {
@@ -135,7 +135,7 @@ describe('User password CRUD tests', function () {
should.not.exist(err);
agent.post('/api/auth/forgot')
.send({
- username: user.username.toUpperCase()
+ username: user.username.toUpperCase(),
})
.expect(200)
.end(function (err, res) {
@@ -162,7 +162,7 @@ describe('User password CRUD tests', function () {
should.not.exist(err);
agent.post('/api/auth/forgot')
.send({
- username: user.email
+ username: user.email,
})
.expect(200)
.end(function (err, res) {
@@ -189,7 +189,7 @@ describe('User password CRUD tests', function () {
should.not.exist(err);
agent.post('/api/auth/forgot')
.send({
- username: user.email.toUpperCase()
+ username: user.email.toUpperCase(),
})
.expect(200)
.end(function (err, res) {
@@ -216,7 +216,7 @@ describe('User password CRUD tests', function () {
should.not.exist(err);
agent.post('/api/auth/forgot')
.send({
- username: user.username
+ username: user.username,
})
.expect(200)
.end(function (err) {
@@ -251,7 +251,7 @@ describe('User password CRUD tests', function () {
should.not.exist(err);
agent.post('/api/auth/forgot')
.send({
- username: user.username
+ username: user.username,
})
.expect(200)
.end(function (err) {
@@ -292,7 +292,7 @@ describe('User password CRUD tests', function () {
.send({
newPassword: '1234567890Aa$',
verifyPassword: '1234567890Aa$',
- currentPassword: credentials.password
+ currentPassword: credentials.password,
})
.expect(200)
.end(function (err, res) {
@@ -321,7 +321,7 @@ describe('User password CRUD tests', function () {
.send({
newPassword: '1234567890Aa$',
verifyPassword: '1234567890-ABC-123-Aa$',
- currentPassword: credentials.password
+ currentPassword: credentials.password,
})
.expect(400)
.end(function (err, res) {
@@ -350,7 +350,7 @@ describe('User password CRUD tests', function () {
.send({
newPassword: '1234567890Aa$',
verifyPassword: '1234567890Aa$',
- currentPassword: 'some_wrong_passwordAa$'
+ currentPassword: 'some_wrong_passwordAa$',
})
.expect(400)
.end(function (err, res) {
@@ -379,7 +379,7 @@ describe('User password CRUD tests', function () {
.send({
newPassword: '',
verifyPassword: '',
- currentPassword: credentials.password
+ currentPassword: credentials.password,
})
.expect(400)
.end(function (err, res) {
@@ -400,7 +400,7 @@ describe('User password CRUD tests', function () {
.send({
newPassword: '1234567890Aa$',
verifyPassword: '1234567890Aa$',
- currentPassword: credentials.password
+ currentPassword: credentials.password,
})
.expect(403)
.end(function (err, res) {
diff --git a/modules/users/tests/server/user-profile.server.routes.tests.js b/modules/users/tests/server/user-profile.server.routes.tests.js
index ab582a7a41..48aa6dc8d9 100644
--- a/modules/users/tests/server/user-profile.server.routes.tests.js
+++ b/modules/users/tests/server/user-profile.server.routes.tests.js
@@ -37,7 +37,7 @@ describe('User profile CRUD tests', function () {
// Create user credentials
credentials = {
username: 'TR_username',
- password: 'TR-I$Aw3$0m3'
+ password: 'TR-I$Aw3$0m3',
};
// Create a new user
@@ -49,7 +49,7 @@ describe('User profile CRUD tests', function () {
email: 'test@example.org',
username: credentials.username.toLowerCase(),
password: credentials.password,
- provider: 'local'
+ provider: 'local',
};
user = new User(_user);
@@ -63,7 +63,7 @@ describe('User profile CRUD tests', function () {
unConfirmedCredentials = {
username: 'TR_username_unconfirmed',
- password: 'TR-I$Aw3$0m4'
+ password: 'TR-I$Aw3$0m4',
};
_unConfirmedUser = {
@@ -75,7 +75,7 @@ describe('User profile CRUD tests', function () {
emailToken: 'initial email token',
username: unConfirmedCredentials.username.toLowerCase(),
password: unConfirmedCredentials.password,
- provider: 'local'
+ provider: 'local',
};
unConfirmedUser = new User(_unConfirmedUser);
@@ -166,7 +166,7 @@ describe('User profile CRUD tests', function () {
const userUpdate = {
firstName: 'user_update_first',
- lastName: 'user_update_last'
+ lastName: 'user_update_last',
};
agent.put('/api/users')
@@ -209,7 +209,7 @@ describe('User profile CRUD tests', function () {
const userUpdate = {
firstName: 'user_update_first',
lastName: 'user_update_last',
- roles: ['user', 'admin']
+ roles: ['user', 'admin'],
};
agent.put('/api/users')
@@ -244,7 +244,7 @@ describe('User profile CRUD tests', function () {
const credentials2 = {
username: 'username2',
- password: 'TR-I$Aw3$0m4'
+ password: 'TR-I$Aw3$0m4',
};
_user2.username = credentials2.username;
@@ -267,7 +267,7 @@ describe('User profile CRUD tests', function () {
const userUpdate = {
firstName: 'user_update_first',
lastName: 'user_update_last',
- email: user.email
+ email: user.email,
};
agent.put('/api/users')
@@ -296,7 +296,7 @@ describe('User profile CRUD tests', function () {
const userUpdate = {
firstName: 'user_update_first',
- lastName: 'user_update_last'
+ lastName: 'user_update_last',
};
agent.put('/api/users')
@@ -737,7 +737,7 @@ describe('User profile CRUD tests', function () {
}
agent.put('/api/users')
.send({
- usernameUpdateAllowed: true
+ usernameUpdateAllowed: true,
})
.expect(200)
.end(function (err, res) {
@@ -768,7 +768,7 @@ describe('User profile CRUD tests', function () {
}
agent.put('/api/users')
.send({
- usernameUpdated: moment().subtract(3, 'months').toDate()
+ usernameUpdated: moment().subtract(3, 'months').toDate(),
})
.expect(200)
.end(function (err) {
diff --git a/modules/users/tests/server/user-removal.server.routes.tests.js b/modules/users/tests/server/user-removal.server.routes.tests.js
index 83db8281d8..d2cb3f1a8f 100644
--- a/modules/users/tests/server/user-removal.server.routes.tests.js
+++ b/modules/users/tests/server/user-removal.server.routes.tests.js
@@ -56,7 +56,7 @@ describe('User removal CRUD tests', function () {
// Create user credentials for user A
credentialsA = {
username: 'user_a',
- password: 'M3@n.jsI$Aw3$0m3'
+ password: 'M3@n.jsI$Aw3$0m3',
};
// Create a new user A
@@ -68,7 +68,7 @@ describe('User removal CRUD tests', function () {
email: 'user_a@example.com',
username: credentialsA.username.toLowerCase(),
password: credentialsA.password,
- provider: 'local'
+ provider: 'local',
};
userA = new User(_userA);
@@ -83,7 +83,7 @@ describe('User removal CRUD tests', function () {
// Create user credentials for user B
credentialsB = {
username: 'user_b',
- password: 'M3@n.jsI$Aw3$0m3'
+ password: 'M3@n.jsI$Aw3$0m3',
};
// Create a new user B
@@ -95,7 +95,7 @@ describe('User removal CRUD tests', function () {
email: 'user_b@example.com',
username: credentialsB.username.toLowerCase(),
password: credentialsB.password,
- provider: 'local'
+ provider: 'local',
};
userB = new User(_userB);
@@ -554,7 +554,7 @@ describe('User removal CRUD tests', function () {
sendDeleteRequest,
// Avatar should not exist anymore
- checkAvatarExistence.bind(null, false)
+ checkAvatarExistence.bind(null, false),
], done);
});
@@ -567,14 +567,14 @@ describe('User removal CRUD tests', function () {
content: 'Message content',
userFrom: userA._id,
userTo: userB._id,
- read: false
+ read: false,
});
const messageBA = new Message({
content: 'Message content',
userFrom: userB._id,
userTo: userA._id,
- read: false
+ read: false,
});
async.each([messageAB, messageBA], function (msg, callback) {
@@ -606,7 +606,7 @@ describe('User removal CRUD tests', function () {
cb(e);
}
});
- }
+ },
], done);
});
@@ -625,7 +625,7 @@ describe('User removal CRUD tests', function () {
attribution_url: 'http://www.trustroots.org/team',
image_UUID: '3c8bb9f1-e313-4baa-bf4c-1d8994fd6c6c',
description: 'Lorem ipsum.',
- count: 5
+ count: 5,
});
tribeB = new Tribe({
@@ -634,7 +634,7 @@ describe('User removal CRUD tests', function () {
attribution_url: 'http://www.trustroots.org/team2',
image_UUID: '3c8bb9f1-e313-4baa-bf4c-1d8994fd6c6d',
description: 'Lorem ipsum.',
- count: 5
+ count: 5,
});
async.each([tribeA, tribeB], function (tribe, callback) {
@@ -688,7 +688,7 @@ describe('User removal CRUD tests', function () {
cb(e);
}
});
- }
+ },
], done);
});
@@ -700,7 +700,7 @@ describe('User removal CRUD tests', function () {
function (cb) {
const offer = new Offer({
user: userA._id,
- location: [0, 0]
+ location: [0, 0],
});
offer.save(function (err) { cb(err); });
@@ -730,7 +730,7 @@ describe('User removal CRUD tests', function () {
cb(e);
}
});
- }
+ },
], done);
});
@@ -749,7 +749,7 @@ describe('User removal CRUD tests', function () {
email: 'user_c@example.com',
username: 'userc',
password: '**********asdfasdf',
- provider: 'local'
+ provider: 'local',
});
userC.save(function (err) { cb(err); });
@@ -760,19 +760,19 @@ describe('User removal CRUD tests', function () {
const contactAB = new Contact({
userFrom: userA._id,
userTo: userB._id,
- confirmed: true
+ confirmed: true,
});
const contactBC = new Contact({
userFrom: userB._id,
userTo: userC._id,
- confirmed: true
+ confirmed: true,
});
const contactCA = new Contact({
userFrom: userC._id,
userTo: userA._id,
- confirmed: false
+ confirmed: false,
});
async.each([contactAB, contactBC, contactCA], function (contact, callback) {
@@ -811,7 +811,7 @@ describe('User removal CRUD tests', function () {
} catch (e) {
cb(e);
}
- }
+ },
], done);
});
diff --git a/modules/users/tests/server/user-signup-validate.server.routes.tests.js b/modules/users/tests/server/user-signup-validate.server.routes.tests.js
index 2d48fabbc3..4f5149fbf3 100644
--- a/modules/users/tests/server/user-signup-validate.server.routes.tests.js
+++ b/modules/users/tests/server/user-signup-validate.server.routes.tests.js
@@ -69,7 +69,7 @@ describe('User signup validation CRUD tests', function () {
{},
'username-missing',
'Please provide required `username` field.',
- done
+ done,
);
});
@@ -84,14 +84,14 @@ describe('User signup validation CRUD tests', function () {
emailToken: 'initial email token',
username: 'taken_username',
password: 'TR-I$Aw3$0m4',
- provider: 'local'
+ provider: 'local',
});
user.save(function () {
validationFailure(
{ username: 'taken_username' },
'username-not-available',
'Username is not available.',
- done
+ done,
);
});
});
@@ -101,7 +101,7 @@ describe('User signup validation CRUD tests', function () {
{ username: config.illegalStrings[Math.floor(Math.random() * config.illegalStrings.length)] },
'username-not-available-reserved',
'Username is not available.',
- done
+ done,
);
});
@@ -113,7 +113,7 @@ describe('User signup validation CRUD tests', function () {
{ username: '.login' },
'username-invalid',
invalidMessage,
- done
+ done,
);
});
@@ -122,7 +122,7 @@ describe('User signup validation CRUD tests', function () {
{ username: 'login.' },
'username-invalid',
invalidMessage,
- done
+ done,
);
});
@@ -131,7 +131,7 @@ describe('User signup validation CRUD tests', function () {
{ username: 'log..in' },
'username-invalid',
invalidMessage,
- done
+ done,
);
});
@@ -140,7 +140,7 @@ describe('User signup validation CRUD tests', function () {
{ username: 'lo' },
'username-invalid',
invalidMessage,
- done
+ done,
);
});
@@ -149,7 +149,7 @@ describe('User signup validation CRUD tests', function () {
{ username: '-_-' },
'username-invalid',
invalidMessage,
- done
+ done,
);
});
@@ -158,7 +158,7 @@ describe('User signup validation CRUD tests', function () {
{ username: 'l'.repeat(35) },
'username-invalid',
invalidMessage,
- done
+ done,
);
});
@@ -169,7 +169,7 @@ describe('User signup validation CRUD tests', function () {
it('should validate username with dot in the middle', function (done) {
validationSuccess(
{ username: 'log.in' },
- done
+ done,
);
});
diff --git a/modules/users/tests/server/user-signup.server.routes.tests.js b/modules/users/tests/server/user-signup.server.routes.tests.js
index c31a20ad78..6b8ff7ef4b 100644
--- a/modules/users/tests/server/user-signup.server.routes.tests.js
+++ b/modules/users/tests/server/user-signup.server.routes.tests.js
@@ -39,7 +39,7 @@ describe('User signup and authentication CRUD tests', function () {
// Create user credentials
confirmedCredentials = {
username: 'TR_username',
- password: 'TR-I$Aw3$0m4'
+ password: 'TR-I$Aw3$0m4',
};
// Create a new user
@@ -52,7 +52,7 @@ describe('User signup and authentication CRUD tests', function () {
emailToken: 'initial email token',
username: confirmedCredentials.username.toLowerCase(),
password: confirmedCredentials.password,
- provider: 'local'
+ provider: 'local',
};
confirmedUser = new User(_confirmedUser);
@@ -66,7 +66,7 @@ describe('User signup and authentication CRUD tests', function () {
unConfirmedCredentials = {
username: 'TR_username_unconfirmed',
- password: 'TR-I$Aw3$0m4'
+ password: 'TR-I$Aw3$0m4',
};
_unConfirmedUser = {
@@ -79,7 +79,7 @@ describe('User signup and authentication CRUD tests', function () {
username: unConfirmedCredentials.username.toLowerCase(),
password: unConfirmedCredentials.password,
provider: 'local',
- acquisitionStory: 'A fish told me...'
+ acquisitionStory: 'A fish told me...',
};
unConfirmedUser = new User(_unConfirmedUser);
@@ -291,7 +291,7 @@ describe('User signup and authentication CRUD tests', function () {
agent.post('/api/auth/signin')
.send({
username: 'test@example.org',
- password: confirmedCredentials.password
+ password: confirmedCredentials.password,
})
.expect(200)
.end(function (signinErr) {
diff --git a/modules/users/tests/server/user-tribe.server.routes.tests.js b/modules/users/tests/server/user-tribe.server.routes.tests.js
index bdbdba68ea..ac210a949c 100644
--- a/modules/users/tests/server/user-tribe.server.routes.tests.js
+++ b/modules/users/tests/server/user-tribe.server.routes.tests.js
@@ -32,7 +32,7 @@ describe('User tribe memberships CRUD tests', function () {
// Create user credentials
credentials = {
username: 'TR_username',
- password: 'TR-I$Aw3$0m4'
+ password: 'TR-I$Aw3$0m4',
};
// Create a new user
@@ -45,7 +45,7 @@ describe('User tribe memberships CRUD tests', function () {
emailToken: 'initial email token',
username: credentials.username.toLowerCase(),
password: credentials.password,
- provider: 'local'
+ provider: 'local',
};
user = new User(_user);
@@ -66,7 +66,7 @@ describe('User tribe memberships CRUD tests', function () {
// Create test tribe
const tribe = new Tribe({
- label: 'Awesome Tribe'
+ label: 'Awesome Tribe',
});
// Add tribe to test DB
@@ -117,7 +117,7 @@ describe('User tribe memberships CRUD tests', function () {
// Create test tribe
const tribe = new Tribe({
- label: 'Hitchhikers'
+ label: 'Hitchhikers',
});
// Add tribe to test DB
@@ -180,7 +180,7 @@ describe('User tribe memberships CRUD tests', function () {
// Create test tribe
const tribe = new Tribe({
- label: 'Russian literature students'
+ label: 'Russian literature students',
});
// Add tribe to test DB
@@ -238,7 +238,7 @@ describe('User tribe memberships CRUD tests', function () {
// Create test tribe
const tribe = new Tribe({
- label: 'Japanese linguistics'
+ label: 'Japanese linguistics',
});
// Add tribe to test DB
diff --git a/modules/users/tests/server/user.server.model.tests.js b/modules/users/tests/server/user.server.model.tests.js
index 65fa057b12..5e88a7fd14 100644
--- a/modules/users/tests/server/user.server.model.tests.js
+++ b/modules/users/tests/server/user.server.model.tests.js
@@ -27,7 +27,7 @@ describe('User Model Unit Tests:', function () {
email: 'test@test.com',
username: 'username123',
password: 'password123',
- provider: 'local'
+ provider: 'local',
});
user2 = new User({
firstName: 'Full',
@@ -36,7 +36,7 @@ describe('User Model Unit Tests:', function () {
email: 'test@test.com',
username: 'username123',
password: 'password123',
- provider: 'local'
+ provider: 'local',
});
user3 = {
firstName: 'Different',
@@ -45,7 +45,7 @@ describe('User Model Unit Tests:', function () {
email: 'test3@test.com',
username: 'different_username',
password: 'different_password',
- provider: 'local'
+ provider: 'local',
};
});
diff --git a/testutils/server/data.server.testutil.js b/testutils/server/data.server.testutil.js
index 03e0661e8e..06580cae08 100644
--- a/testutils/server/data.server.testutil.js
+++ b/testutils/server/data.server.testutil.js
@@ -40,7 +40,7 @@ function generateUsers(count, { username='username', firstName='GivenName', last
username: username + i,
locale,
roles,
- password: password || crypto.randomBytes(24).toString('base64')
+ password: password || crypto.randomBytes(24).toString('base64'),
}));
}
@@ -61,9 +61,9 @@ function generateReferences(users, referenceData) {
interactions: {
met: !getRandInt(2),
hostedMe: !getRandInt(2),
- hostedThem: !getRandInt(2)
+ hostedThem: !getRandInt(2),
},
- recommend: ['yes', 'no', 'unknown'][getRandInt(3)]
+ recommend: ['yes', 'no', 'unknown'][getRandInt(3)],
};
return _.defaultsDeep({}, data[2], defaultReference);
@@ -145,7 +145,7 @@ async function clearDatabaseCollections(collections) {
*/
const collections = [
'User',
- 'Reference'
+ 'Reference',
];
/**
@@ -190,5 +190,5 @@ module.exports = {
saveReferences,
clearDatabase,
signIn,
- signOut
+ signOut,
};
diff --git a/testutils/server/server.testutil.js b/testutils/server/server.testutil.js
index b7c2a4b937..1304e2cc46 100644
--- a/testutils/server/server.testutil.js
+++ b/testutils/server/server.testutil.js
@@ -65,7 +65,7 @@ exports.catchEmails = function () {
sentEmails.push(data);
callback();
},
- logger: false
+ logger: false,
};
});
diff --git a/worker.js b/worker.js
index 9dcebdeac7..0c6cc01c2d 100644
--- a/worker.js
+++ b/worker.js
@@ -34,9 +34,9 @@ async.waterfall([
// Start the worker
worker.start({
maxAttempts: 10,
- retryDelaySeconds: 10
+ retryDelaySeconds: 10,
});
- }
+ },
], function (err) {
if (err) {