diff --git a/package-lock.json b/package-lock.json
index 5cf2d56b68..71b54c232c 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -4476,9 +4476,9 @@
}
},
"eslint-config-habitrpg": {
- "version": "6.0.7",
- "resolved": "https://registry.npmjs.org/eslint-config-habitrpg/-/eslint-config-habitrpg-6.0.7.tgz",
- "integrity": "sha512-hda2IKsfwE/94CjLtPI3Cgsq0capQCFKCiqPPNM7foeO/E6cZpXCSvMHdGt5TXy66DQxF5h+kz4xcheHdcaRcA==",
+ "version": "6.0.8",
+ "resolved": "https://registry.npmjs.org/eslint-config-habitrpg/-/eslint-config-habitrpg-6.0.8.tgz",
+ "integrity": "sha512-jQ62H3+Gkie4CK8uFfV37SX+yNs6yu+SHP27hIYIlnZ21HCaQnabEQfhrYzbpQUn9fNd2y1gUNqGOIG8ph84vg==",
"dev": true,
"requires": {
"eslint": "^6.5.1",
diff --git a/package.json b/package.json
index e2993caf3e..b0b3ec4e46 100644
--- a/package.json
+++ b/package.json
@@ -72,7 +72,7 @@
"npm": "^6"
},
"scripts": {
- "lint": "eslint --ext .js --fix ./website/server",
+ "lint": "eslint --ext .js --fix ./website/common",
"test": "npm run lint && gulp test && gulp apidoc",
"test:build": "gulp test:prepare:build",
"test:api-v3": "gulp test:api-v3",
@@ -103,7 +103,7 @@
"chai-as-promised": "^7.1.1",
"chalk": "^2.4.1",
"eslint": "^6.5.1",
- "eslint-config-habitrpg": "^6.0.7",
+ "eslint-config-habitrpg": "^6.0.8",
"eslint-plugin-mocha": "^5.0.0",
"expect.js": "^0.3.1",
"istanbul": "^1.1.0-alpha.1",
diff --git a/webpack/build.js b/webpack/build.js
deleted file mode 100644
index 793784e55b..0000000000
--- a/webpack/build.js
+++ /dev/null
@@ -1,47 +0,0 @@
-/* global env:true, rm:true, mkdir:true, cp:true */
-
-// https://github.com/shelljs/shelljs
-require('shelljs/global');
-
-const path = require('path');
-const config = require('./config');
-const ora = require('ora');
-const webpack = require('webpack');
-const webpackConfig = require('./webpack.prod.conf');
-
-module.exports = function webpackProductionBuild (callback) {
- env.NODE_ENV = 'production';
-
- console.log( // eslint-disable-line no-console
- ' Tip:\n' +
- ' Built files are meant to be served over an HTTP server.\n' +
- ' Opening index.html over file:// won\'t work.\n'
- );
-
- const spinner = ora('building for production...');
- spinner.start();
-
- const assetsPath = path.join(config.build.assetsRoot, config.build.assetsSubDirectory);
- rm('-rf', assetsPath);
- mkdir('-p', assetsPath);
- cp('-R', config.build.staticAssetsDirectory, assetsPath);
-
- webpack(webpackConfig, (err, stats) => {
- spinner.stop();
-
- const output = `${stats.toString({
- colors: true,
- modules: false,
- children: false,
- chunks: false,
- chunkModules: false,
- })}\n`;
-
- if (callback) {
- return err ? callback(err) : callback(null, output);
- } else {
- if (err) throw err;
- process.stdout.write(output);
- }
- });
-};
diff --git a/webpack/config/dev.env.js b/webpack/config/dev.env.js
deleted file mode 100644
index 6c18ee1767..0000000000
--- a/webpack/config/dev.env.js
+++ /dev/null
@@ -1,6 +0,0 @@
-const merge = require('webpack-merge');
-const prodEnv = require('./prod.env');
-
-module.exports = merge(prodEnv, {
- NODE_ENV: '"development"',
-});
diff --git a/webpack/config/index.js b/webpack/config/index.js
deleted file mode 100644
index ca098d0a95..0000000000
--- a/webpack/config/index.js
+++ /dev/null
@@ -1,81 +0,0 @@
-// see http://vuejs-templates.github.io/webpack for documentation.
-const path = require('path');
-const staticAssetsDirectory = './website/static/.'; // The folder where static files (not processed) live
-const prodEnv = require('./prod.env');
-const devEnv = require('./dev.env');
-const nconf = require('nconf');
-const setupNconf = require('../../website/server/libs/setupNconf');
-
-let configFile = path.join(path.resolve(__dirname, '../../config.json'));
-
-setupNconf(configFile);
-
-const DEV_BASE_URL = nconf.get('BASE_URL');
-
-module.exports = {
- build: {
- env: prodEnv,
- index: path.resolve(__dirname, '../../dist-client/index.html'),
- assetsRoot: path.resolve(__dirname, '../../dist-client'),
- assetsSubDirectory: 'static',
- assetsPublicPath: '/',
- staticAssetsDirectory,
- productionSourceMap: true,
- // Gzip off by default as many popular static hosts such as
- // Surge or Netlify already gzip all static assets for you.
- // Before setting to `true`, make sure to:
- // npm install --save-dev compression-webpack-plugin
- productionGzip: false,
- productionGzipExtensions: ['js', 'css'],
- // Run the build command with an extra argument to
- // View the bundle analyzer report after build finishes:
- // `npm run client:build --report`
- // Set to `true` or `false` to always turn it on or off
- bundleAnalyzerReport: process.env.npm_config_report, // eslint-disable-line no-process-env
- },
- dev: {
- env: devEnv,
- port: 8080,
- autoOpenBrowser: true,
- assetsSubDirectory: 'static',
- assetsPublicPath: '/',
- staticAssetsDirectory,
- proxyTable: {
- // proxy all requests to the server at IP:PORT as specified in the top-level config
- '/api/v3': {
- target: DEV_BASE_URL,
- changeOrigin: true,
- },
- '/api/v4': {
- target: DEV_BASE_URL,
- changeOrigin: true,
- },
- '/stripe': {
- target: DEV_BASE_URL,
- changeOrigin: true,
- },
- '/amazon': {
- target: DEV_BASE_URL,
- changeOrigin: true,
- },
- '/paypal': {
- target: DEV_BASE_URL,
- changeOrigin: true,
- },
- '/logout-server': {
- target: DEV_BASE_URL,
- changeOrigin: true,
- },
- '/export': {
- target: DEV_BASE_URL,
- changeOrigin: true,
- },
- },
- // CSS Sourcemaps off by default because relative paths are "buggy"
- // with this option, according to the CSS-Loader README
- // (https://github.com/webpack/css-loader#sourcemaps)
- // In our experience, they generally work as expected,
- // just be aware of this issue when enabling this option.
- cssSourceMap: false,
- },
-};
diff --git a/webpack/config/prod.env.js b/webpack/config/prod.env.js
deleted file mode 100644
index 7b89084678..0000000000
--- a/webpack/config/prod.env.js
+++ /dev/null
@@ -1,45 +0,0 @@
-const nconf = require('nconf');
-const { join, resolve } = require('path');
-const setupNconf = require('../../website/server/libs/setupNconf');
-
-const PATH_TO_CONFIG = join(resolve(__dirname, '../../config.json'));
-let configFile = PATH_TO_CONFIG;
-
-setupNconf(configFile);
-
-// @TODO: Check if we can import from client. Items like admin emails can be imported
-// and that should be prefered
-
-// To avoid stringifying more data then we need,
-// items from `env` used on the client will have to be specified in this array
-// @TODO: Do we need? const CLIENT_VARS = ['language', 'isStaticPage', 'availableLanguages', 'translations',
-// 'FACEBOOK_KEY', 'GOOGLE_CLIENT_ID', 'NODE_ENV', 'BASE_URL', 'GA_ID',
-// 'AMAZON_PAYMENTS', 'STRIPE_PUB_KEY', 'AMPLITUDE_KEY',
-// 'worldDmg', 'mods', 'IS_MOBILE'];
-
-const AMAZON_SELLER_ID = nconf.get('AMAZON_PAYMENTS_SELLER_ID');
-const AMAZON_CLIENT_ID = nconf.get('AMAZON_PAYMENTS_CLIENT_ID');
-const AMAZON_MODE = nconf.get('AMAZON_PAYMENTS_MODE');
-
-let env = {
- NODE_ENV: '"production"',
- // clientVars: CLIENT_VARS,
- AMAZON_PAYMENTS: {
- SELLER_ID: `"${AMAZON_SELLER_ID}"`,
- CLIENT_ID: `"${AMAZON_CLIENT_ID}"`,
- MODE: `"${AMAZON_MODE}"`,
- },
- EMAILS: {
- COMMUNITY_MANAGER_EMAIL: `"${nconf.get('EMAILS_COMMUNITY_MANAGER_EMAIL')}"`,
- TECH_ASSISTANCE_EMAIL: `"${nconf.get('EMAILS_TECH_ASSISTANCE_EMAIL')}"`,
- PRESS_ENQUIRY_EMAIL: `"${nconf.get('EMAILS_PRESS_ENQUIRY_EMAIL')}"`,
- },
-};
-
-'NODE_ENV BASE_URL GA_ID STRIPE_PUB_KEY FACEBOOK_KEY GOOGLE_CLIENT_ID AMPLITUDE_KEY LOGGLY_CLIENT_TOKEN'
- .split(' ')
- .forEach(key => {
- env[key] = `"${nconf.get(key)}"`;
- });
-
-module.exports = env;
diff --git a/webpack/config/test.env.js b/webpack/config/test.env.js
deleted file mode 100644
index 42e6329b71..0000000000
--- a/webpack/config/test.env.js
+++ /dev/null
@@ -1,6 +0,0 @@
-const merge = require('webpack-merge');
-const devEnv = require('./dev.env');
-
-module.exports = merge(devEnv, {
- NODE_ENV: '"test"',
-});
diff --git a/webpack/dev-client.js b/webpack/dev-client.js
deleted file mode 100644
index e81faee24c..0000000000
--- a/webpack/dev-client.js
+++ /dev/null
@@ -1,10 +0,0 @@
-/* global window:true */
-
-require('eventsource-polyfill');
-const hotClient = require('webpack-hot-middleware/client?noInfo=true&reload=true&overlay=false');
-
-hotClient.subscribe(event => {
- if (event.action === 'reload') {
- window.location.reload();
- }
-});
diff --git a/webpack/dev-server.js b/webpack/dev-server.js
deleted file mode 100644
index aee1529044..0000000000
--- a/webpack/dev-server.js
+++ /dev/null
@@ -1,72 +0,0 @@
-/* eslint-disable no-process-env, no-console */
-
-const path = require('path');
-const express = require('express');
-const webpack = require('webpack');
-const config = require('./config');
-
-if (!process.env.NODE_ENV) {
- process.env.NODE_ENV = JSON.parse(config.dev.env.NODE_ENV);
-}
-
-const proxyMiddleware = require('http-proxy-middleware');
-const webpackConfig = process.env.NODE_ENV === 'test' ?
- require('./webpack.prod.conf') :
- require('./webpack.dev.conf');
-
-// default port where dev server listens for incoming traffic
-const port = process.env.PORT || config.dev.port;
-// Define HTTP proxies to your custom API backend
-// https://github.com/chimurai/http-proxy-middleware
-const proxyTable = config.dev.proxyTable;
-
-const app = express();
-const compiler = webpack(webpackConfig);
-
-const devMiddleware = require('webpack-dev-middleware')(compiler, {
- publicPath: webpackConfig.output.publicPath,
- stats: {
- colors: true,
- chunks: false,
- },
-});
-
-const hotMiddleware = require('webpack-hot-middleware')(compiler);
-// force page reload when html-webpack-plugin template changes
-compiler.plugin('compilation', (compilation) => {
- compilation.plugin('html-webpack-plugin-after-emit', (data, cb) => {
- hotMiddleware.publish({ action: 'reload' });
- cb();
- });
-});
-
-// proxy api requests
-Object.keys(proxyTable).forEach((context) => {
- let options = proxyTable[context];
- if (typeof options === 'string') {
- options = { target: options };
- }
- app.use(proxyMiddleware(options.filter || context, options));
-});
-
-// handle fallback for HTML5 history API
-app.use(require('connect-history-api-fallback')());
-
-// serve webpack bundle output
-app.use(devMiddleware);
-
-// enable hot-reload and state-preserving
-// compilation error display
-app.use(hotMiddleware);
-
-// serve pure static assets
-const staticPath = path.posix.join(config.dev.assetsPublicPath, config.dev.assetsSubDirectory);
-app.use(staticPath, express.static(config.dev.staticAssetsDirectory));
-
-module.exports = app.listen(port, (err) => {
- if (err) {
- console.log(err);
- return;
- }
- console.log(`Listening at http://localhost:${port}\n`);
-});
diff --git a/webpack/utils.js b/webpack/utils.js
deleted file mode 100644
index 5bf7fabe28..0000000000
--- a/webpack/utils.js
+++ /dev/null
@@ -1,66 +0,0 @@
-/* eslint-disable no-process-env, no-console */
-
-const path = require('path');
-const config = require('./config');
-const ExtractTextPlugin = require('extract-text-webpack-plugin');
-
-exports.assetsPath = (_path) => {
- const assetsSubDirectory = process.env.NODE_ENV === 'production' ?
- config.build.assetsSubDirectory :
- config.dev.assetsSubDirectory;
- return path.posix.join(assetsSubDirectory, _path);
-};
-
-exports.cssLoaders = function cssLoaders (options) {
- options = options || {};
- // generate loader string to be used with extract text plugin
- function generateLoaders (loaders) {
- let sourceLoader = loaders.map((loader) => {
- let extraParamChar;
- if (/\?/.test(loader)) {
- loader = loader.replace(/\?/, '-loader?');
- extraParamChar = '&';
- } else {
- loader = `${loader}-loader`;
- extraParamChar = '?';
- }
- return loader + (options.sourceMap ? `${extraParamChar}sourceMap` : '');
- }).join('!');
-
- // Extract CSS when that option is specified
- // (which is the case during production build)
- if (options.extract) {
- return ExtractTextPlugin.extract({
- use: sourceLoader,
- fallback: 'vue-style-loader',
- });
- } else {
- return ['vue-style-loader', sourceLoader].join('!');
- }
- }
-
- // http://vuejs.github.io/vue-loader/en/configurations/extract-css.html
- return {
- css: generateLoaders(['css']),
- postcss: generateLoaders(['css']),
- less: generateLoaders(['css', 'less']),
- sass: generateLoaders(['css', 'sass?indentedSyntax']),
- scss: generateLoaders(['css', 'sass']),
- stylus: generateLoaders(['css', 'stylus']),
- styl: generateLoaders(['css', 'stylus']),
- };
-};
-
-// Generate loaders for standalone style files (outside of .vue)
-exports.styleLoaders = (options) => {
- const output = [];
- const loaders = exports.cssLoaders(options);
- for (let extension in loaders) {
- const loader = loaders[extension];
- output.push({
- test: new RegExp(`\\.${extension}$`),
- loader,
- });
- }
- return output;
-};
diff --git a/webpack/webpack.base.conf.js b/webpack/webpack.base.conf.js
deleted file mode 100644
index fcc86bc21b..0000000000
--- a/webpack/webpack.base.conf.js
+++ /dev/null
@@ -1,154 +0,0 @@
-/* eslint-disable no-process-env, no-console */
-
-const path = require('path');
-const config = require('./config');
-const utils = require('./utils');
-const webpack = require('webpack');
-const projectRoot = path.resolve(__dirname, '../');
-const autoprefixer = require('autoprefixer');
-const postcssEasyImport = require('postcss-easy-import');
-const IS_PROD = process.env.NODE_ENV === 'production';
-
-const baseConfig = {
- entry: {
- app: ['babel-polyfill', './website/client/main.js'],
- },
- output: {
- path: config.build.assetsRoot,
- publicPath: IS_PROD ? config.build.assetsPublicPath : config.dev.assetsPublicPath,
- filename: '[name].js',
- devtoolModuleFilenameTemplate (info) {
- // Fix source maps, code from
- // https://github.com/Darkside73/bbsmile.com.ua/commit/3596d3c42ef91b69d8380359c3e8908edc08acdb
- let filename = info.resourcePath;
- if (info.resource.match(/\.vue$/) && !info.allLoaders.match(/type=script/)) {
- filename = 'generated';
- }
-
- return filename;
- },
- },
- resolve: {
- extensions: ['*', '.js', '.vue', '.json'],
- modules: [
- path.join(projectRoot, 'website'),
- path.join(projectRoot, 'test/client/unit'),
- path.join(projectRoot, 'node_modules'),
- ],
- alias: {
- website: path.resolve(projectRoot, 'website'),
- common: path.resolve(projectRoot, 'website/common'),
- client: path.resolve(projectRoot, 'website/client'),
- assets: path.resolve(projectRoot, 'website/client/assets'),
- components: path.resolve(projectRoot, 'website/client/components'),
- },
- },
- plugins: [
- new webpack.ContextReplacementPlugin(/moment[\\\/]locale$/, /^\.\/(NOT_EXISTING)$/),
- ],
- module: {
- rules: [
- {
- test: /\.vue$/,
- loader: 'vue-loader',
- options: {
- loaders: utils.cssLoaders({
- sourceMap: IS_PROD ?
- config.build.productionSourceMap :
- config.dev.cssSourceMap,
- extract: IS_PROD,
- }),
- postcss: [
- autoprefixer({
- overrideBrowserslist: ['last 2 versions'],
- }),
- postcssEasyImport(),
- ],
- },
- },
- {
- test: /\.js$/,
- loader: 'babel-loader',
- include: [
- path.join(projectRoot, 'test'),
- path.join(projectRoot, 'website'),
- path.join(projectRoot, 'node_modules', 'bootstrap-vue'),
- ],
- options: {
- cacheDirectory: true,
- },
- },
- {
- test: /\.(png|jpe?g|gif)(\?.*)?$/,
- loader: 'url-loader',
- query: {
- limit: 10000,
- name: utils.assetsPath('images/[name].[hash:7].[ext]'),
- },
- },
- {
- test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
- loader: 'url-loader',
- query: {
- limit: 10000,
- name: utils.assetsPath('fonts/[name].[hash:7].[ext]'),
- },
- },
- {
- test: /\.svg$/,
- use: [
- { loader: 'svg-inline-loader' },
- {
- loader: 'svgo-loader',
- options: {
- plugins: [
- {removeViewBox: false},
- {convertPathData: {noSpaceAfterFlags: false}},
- ],
- },
- },
- ],
- exclude: [path.resolve(projectRoot, 'website/client/assets/svg/for-css')],
- },
- {
- test: /\.svg$/,
- use: [
- {
- loader: 'svg-url-loader',
- options: {
- limit: 10000,
- name: utils.assetsPath('svg/[name].[hash:7].[ext]'),
- },
- },
- {
- loader: 'svgo-loader',
- options: {
- plugins: [
- {removeViewBox: false},
- {convertPathData: {noSpaceAfterFlags: false}},
- ],
- },
- },
- ],
- include: [path.resolve(projectRoot, 'website/client/assets/svg/for-css')],
- },
- ],
- },
-};
-
-if (!IS_PROD) {
- const eslintFriendlyFormatter = require('eslint-friendly-formatter'); // eslint-disable-line global-require
-
- baseConfig.module.rules.unshift({
- test: /\.(js|vue)$/,
- loader: 'eslint-loader',
- enforce: 'pre',
- include: projectRoot,
- options: {
- formatter: eslintFriendlyFormatter,
- emitWarning: true,
- },
- exclude: /node_modules/,
- });
-}
-module.exports = baseConfig;
\ No newline at end of file
diff --git a/webpack/webpack.dev.conf.js b/webpack/webpack.dev.conf.js
deleted file mode 100644
index 75d6741d08..0000000000
--- a/webpack/webpack.dev.conf.js
+++ /dev/null
@@ -1,32 +0,0 @@
-const config = require('./config');
-const webpack = require('webpack');
-const merge = require('webpack-merge');
-const utils = require('./utils');
-const baseWebpackConfig = require('./webpack.base.conf');
-const HtmlWebpackPlugin = require('html-webpack-plugin');
-
-// add hot-reload related code to entry chunks
-Object.keys(baseWebpackConfig.entry).forEach((name) => {
- baseWebpackConfig.entry[name] = baseWebpackConfig.entry[name].concat('./webpack/dev-client');
-});
-
-module.exports = merge(baseWebpackConfig, {
- module: {
- rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap }),
- },
- // cheap-module-eval-source-map is faster for development
- devtool: '#cheap-module-eval-source-map',
- plugins: [
- new webpack.DefinePlugin({
- 'process.env': config.dev.env,
- }),
- // https://github.com/glenjamin/webpack-hot-middleware#installation--usage
- new webpack.HotModuleReplacementPlugin(),
- // https://github.com/ampedandwired/html-webpack-plugin
- new HtmlWebpackPlugin({
- filename: 'index.html',
- template: './website/client/index.html',
- inject: true,
- }),
- ],
-});
diff --git a/webpack/webpack.prod.conf.js b/webpack/webpack.prod.conf.js
deleted file mode 100644
index 5ee916508e..0000000000
--- a/webpack/webpack.prod.conf.js
+++ /dev/null
@@ -1,101 +0,0 @@
-/* eslint-disable no-process-env, no-console */
-
-const path = require('path');
-const config = require('./config');
-const utils = require('./utils');
-const webpack = require('webpack');
-const merge = require('webpack-merge');
-const baseWebpackConfig = require('./webpack.base.conf');
-const ExtractTextPlugin = require('extract-text-webpack-plugin');
-const HtmlWebpackPlugin = require('html-webpack-plugin');
-const env = process.env.NODE_ENV === 'test' ?
- require('./config/test.env') :
- config.build.env;
-
-const webpackConfig = merge(baseWebpackConfig, {
- module: {
- rules: utils.styleLoaders({ sourceMap: config.build.productionSourceMap, extract: true }),
- },
- devtool: config.build.productionSourceMap ? '#source-map' : false,
- output: {
- path: config.build.assetsRoot,
- filename: utils.assetsPath('js/[name].[chunkhash].js'),
- chunkFilename: utils.assetsPath('js/[id].[chunkhash].js'),
- },
- plugins: [
- // http://vuejs.github.io/vue-loader/workflow/production.html
- new webpack.DefinePlugin({
- 'process.env': env,
- }),
- new webpack.optimize.UglifyJsPlugin({
- compress: {
- warnings: false,
- },
- sourceMap: true,
- }),
- // extract css into its own file
- new ExtractTextPlugin({
- filename: utils.assetsPath('css/[name].[contenthash].css'),
- }),
- // generate dist index.html with correct asset hash for caching.
- // you can customize output by editing /index.html
- // see https://github.com/ampedandwired/html-webpack-plugin
- new HtmlWebpackPlugin({
- filename: process.env.NODE_ENV === 'test' ?
- 'index.html' :
- config.build.index,
- template: './website/client/index.html',
- inject: true,
- minify: {
- removeComments: true,
- collapseWhitespace: true,
- removeAttributeQuotes: true,
- // more options:
- // https://github.com/kangax/html-minifier#options-quick-reference
- },
- // necessary to consistently work with multiple chunks via CommonsChunkPlugin
- chunksSortMode: 'dependency',
- }),
- // split vendor js into its own file
- new webpack.optimize.CommonsChunkPlugin({
- name: 'vendor',
- minChunks (scriptModule) {
- // any required modules inside node_modules are extracted to vendor
- return (
- scriptModule.resource &&
- /\.js$/.test(scriptModule.resource) &&
- scriptModule.resource.indexOf(
- path.join(__dirname, '../node_modules')
- ) === 0
- );
- },
- }),
- // extract webpack runtime and module manifest to its own file in order to
- // prevent vendor hash from being updated whenever app bundle is updated
- new webpack.optimize.CommonsChunkPlugin({
- name: 'manifest',
- chunks: ['vendor'],
- }),
- ],
-});
-
-if (config.build.productionGzip) {
- const CompressionWebpackPlugin = require('compression-webpack-plugin'); // eslint-disable-line global-require
-
- webpackConfig.plugins.push(
- new CompressionWebpackPlugin({
- asset: '[path].gz[query]',
- algorithm: 'gzip',
- test: new RegExp(`\\.(${config.build.productionGzipExtensions.join('|')})$`),
- threshold: 10240,
- minRatio: 0.8,
- })
- );
-}
-
-if (config.build.bundleAnalyzerReport) {
- const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin; // eslint-disable-line global-require
- webpackConfig.plugins.push(new BundleAnalyzerPlugin());
-}
-
-module.exports = webpackConfig;
diff --git a/webpack/webpack.test.conf.js b/webpack/webpack.test.conf.js
deleted file mode 100644
index 16327ea609..0000000000
--- a/webpack/webpack.test.conf.js
+++ /dev/null
@@ -1,24 +0,0 @@
-// This is the webpack config used for unit tests.
-const merge = require('webpack-merge');
-const baseConfig = require('./webpack.base.conf');
-const utils = require('./utils');
-const webpack = require('webpack');
-const testEnv = require('./config/test.env');
-
-const webpackConfig = merge(baseConfig, {
- // use inline sourcemap for karma-sourcemap-loader
- module: {
- rules: utils.styleLoaders(),
- },
- devtool: '#inline-source-map',
- plugins: [
- new webpack.DefinePlugin({
- 'process.env': testEnv,
- }),
- ],
-});
-
-// no need for app entry during tests
-delete webpackConfig.entry;
-
-module.exports = webpackConfig;
diff --git a/website/client/.eslintrc.js b/website/client/.eslintrc.js
index e37caab6e4..de3a53ac1a 100644
--- a/website/client/.eslintrc.js
+++ b/website/client/.eslintrc.js
@@ -1,27 +1,26 @@
module.exports = {
root: true,
env: {
- node: true
+ node: true,
},
- 'extends': [
- 'plugin:vue/essential',
- 'eslint:recommended'
+ extends: [
+ 'habitrpg/lib/vue',
],
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
- 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
+ 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
},
parserOptions: {
- parser: 'babel-eslint'
+ parser: 'babel-eslint',
},
overrides: [
{
files: [
- '**/__tests__/*.{j,t}s?(x)'
+ '**/__tests__/*.{j,t}s?(x)',
],
env: {
- mocha: true
- }
- }
- ]
-}
+ mocha: true,
+ },
+ },
+ ],
+};
diff --git a/website/client/babel.config.js b/website/client/babel.config.js
index e9558405fd..757ff9b16a 100644
--- a/website/client/babel.config.js
+++ b/website/client/babel.config.js
@@ -1,5 +1,5 @@
module.exports = {
presets: [
- '@vue/cli-plugin-babel/preset'
- ]
-}
+ '@vue/cli-plugin-babel/preset',
+ ],
+};
diff --git a/website/client/postcss.config.js b/website/client/postcss.config.js
index 961986e2b1..a47ef4f952 100644
--- a/website/client/postcss.config.js
+++ b/website/client/postcss.config.js
@@ -1,5 +1,5 @@
module.exports = {
plugins: {
- autoprefixer: {}
- }
-}
+ autoprefixer: {},
+ },
+};
diff --git a/website/client/src/app.vue b/website/client/src/app.vue
index 64d3ec8fd7..4cc73fee6a 100644
--- a/website/client/src/app.vue
+++ b/website/client/src/app.vue
@@ -201,8 +201,7 @@ import bannedAccountModal from '@/components/bannedAccountModal';
const COMMUNITY_MANAGER_EMAIL = process.env.EMAILS_COMMUNITY_MANAGER_EMAIL; // eslint-disable-line
export default {
- mixins: [notifications, spellsMixin],
- name: 'app',
+ name: 'App',
components: {
AppMenu,
AppHeader,
@@ -217,6 +216,7 @@ export default {
subCancelModalConfirm,
subCanceledModal,
},
+ mixins: [notifications, spellsMixin],
data () {
return {
icons: Object.freeze({
@@ -235,9 +235,9 @@ export default {
},
computed: {
...mapState(['isUserLoggedIn', 'browserTimezoneOffset', 'isUserLoaded']),
- ...mapState({user: 'user.data'}),
+ ...mapState({ user: 'user.data' }),
isStaticPage () {
- return this.$route.meta.requiresLogin === false ? true : false;
+ return this.$route.meta.requiresLogin === false;
},
castingSpell () {
return this.$store.state.spellOptions.castingSpell;
@@ -256,14 +256,14 @@ export default {
},
},
created () {
- this.$root.$on('playSound', (sound) => {
- let theme = this.user.preferences.sound;
+ this.$root.$on('playSound', sound => {
+ const theme = this.user.preferences.sound;
if (!theme || theme === 'off') {
return;
}
- let file = `/static/audio/${theme}/${sound}`;
+ const file = `/static/audio/${theme}/${sound}`;
if (this.audioSuffix === null) {
this.audioSource = document.createElement('source');
@@ -284,12 +284,12 @@ export default {
});
// @TODO: I'm not sure these should be at the app level. Can we move these back into shop/inventory or maybe they need a lateral move?
- this.$root.$on('buyModal::showItem', (item) => {
+ this.$root.$on('buyModal::showItem', item => {
this.selectedItemToBuy = item;
this.$root.$emit('bv::show::modal', 'buy-modal');
});
- this.$root.$on('selectMembersModal::showItem', (item) => {
+ this.$root.$on('selectMembersModal::showItem', item => {
this.selectedSpellToBuy = item;
this.$root.$emit('bv::show::modal', 'select-member-modal');
});
@@ -301,18 +301,18 @@ export default {
});
// Set up Error interceptors
- axios.interceptors.response.use((response) => {
+ axios.interceptors.response.use(response => {
if (this.user && response.data && response.data.notifications) {
this.$set(this.user, 'notifications', response.data.notifications);
}
return response;
- }, (error) => {
+ }, error => {
if (error.response.status >= 400) {
this.checkForBannedUser(error);
// Don't show errors from getting user details. These users have delete their account,
// but their chat message still exists.
- let configExists = Boolean(error.response) && Boolean(error.response.config);
+ const configExists = Boolean(error.response) && Boolean(error.response.config);
if (configExists && error.response.config.method === 'get' && error.response.config.url.indexOf('/api/v4/members/') !== -1) {
// @TODO: We resolve the promise because we need our caching to cache this user as tried
// Chat paging should help this, but maybe we can also find another solution..
@@ -333,11 +333,11 @@ export default {
let snackbarTimeout = false;
if (error.response.status === 502) snackbarTimeout = true;
- let errorsToShow = [];
+ const errorsToShow = [];
// show only the first error for each param
- let paramErrorsFound = {};
+ const paramErrorsFound = {};
if (errorData.errors) {
- for (let e of errorData.errors) {
+ for (const e of errorData.errors) {
if (!paramErrorsFound[e.param]) {
errorsToShow.push(e.message);
paramErrorsFound[e.param] = true;
@@ -362,11 +362,11 @@ export default {
return Promise.reject(error);
});
- axios.interceptors.response.use((response) => {
+ axios.interceptors.response.use(response => {
// Verify that the user was not updated from another browser/app/client
// If it was, sync
- const url = response.config.url;
- const method = response.config.method;
+ const { url } = response.config;
+ const { method } = response.config;
const isApiCall = url.indexOf('api/v4') !== -1;
const userV = response.data && response.data.userV;
@@ -380,14 +380,14 @@ export default {
const isUserSync = url.indexOf('/api/v4/user') === 0 && method === 'get';
const isTasksSync = url.indexOf('/api/v4/tasks/user') === 0 && method === 'get';
// exclude chat seen requests because with real time chat they would be too many
- const isChatSeen = url.indexOf('/chat/seen') !== -1 && method === 'post';
+ const isChatSeen = url.indexOf('/chat/seen') !== -1 && method === 'post';
// exclude POST /api/v4/cron because the user is synced automatically after cron runs
// Something has changed on the user object that was not tracked here, sync the user
if (userV - oldUserV > 1 && !isCron && !isChatSeen && !isUserSync && !isTasksSync) {
Promise.all([
- this.$store.dispatch('user:fetch', {forceLoad: true}),
- this.$store.dispatch('tasks:fetchUserTasks', {forceLoad: true}),
+ this.$store.dispatch('user:fetch', { forceLoad: true }),
+ this.$store.dispatch('tasks:fetchUserTasks', { forceLoad: true }),
]);
}
}
@@ -407,7 +407,7 @@ export default {
});
// Setup listener for title
- this.$store.watch(state => state.title, (title) => {
+ this.$store.watch(state => state.title, title => {
document.title = title;
});
this.$nextTick(() => {
@@ -446,7 +446,7 @@ export default {
// Load external scripts after the app has been rendered
setupPayments();
});
- }).catch((err) => {
+ }).catch(err => {
console.error('Impossible to fetch user. Clean up localStorage and refresh.', err); // eslint-disable-line no-console
});
} else {
@@ -491,17 +491,17 @@ export default {
// Manage modals
this.$root.$on('bv::show::modal', (modalId, data = {}) => {
if (data.fromRoot) return;
- const modalStack = this.$store.state.modalStack;
+ const { modalStack } = this.$store.state;
this.trackGemPurchase(modalId, data);
// Add new modal to the stack
const prev = modalStack[modalStack.length - 1];
const prevId = prev ? prev.modalId : undefined;
- modalStack.push({modalId, prev: prevId});
+ modalStack.push({ modalId, prev: prevId });
});
- this.$root.$on('bv::modal::hidden', (bvEvent) => {
+ this.$root.$on('bv::modal::hidden', bvEvent => {
let modalId = bvEvent.target && bvEvent.target.id;
// sometimes the target isn't passed to the hidden event, fallback is the vueTarget
@@ -513,7 +513,7 @@ export default {
return;
}
- const modalStack = this.$store.state.modalStack;
+ const { modalStack } = this.$store.state;
const modalOnTop = modalStack[modalStack.length - 1];
@@ -529,7 +529,7 @@ export default {
// Get previous modal
const modalBefore = modalOnTop ? modalOnTop.prev : undefined;
- if (modalBefore) this.$root.$emit('bv::show::modal', modalBefore, {fromRoot: true});
+ if (modalBefore) this.$root.$emit('bv::show::modal', modalBefore, { fromRoot: true });
});
},
validStack (modalStack) {
@@ -537,7 +537,7 @@ export default {
const modalCount = {};
const prevAndCurrent = 2;
- for (let index in modalStack) {
+ for (const index in modalStack) {
const current = modalStack[index];
if (!modalCount[current.modalId]) modalCount[current.modalId] = 0;
@@ -574,11 +574,9 @@ export default {
this.selectedItemToBuy = item;
},
genericPurchase (item) {
- if (!item)
- return false;
+ if (!item) return false;
- if (['card', 'debuffPotion'].includes(item.purchaseType))
- return false;
+ if (['card', 'debuffPotion'].includes(item.purchaseType)) return false;
return true;
},
@@ -609,7 +607,7 @@ export default {
this.selectedSpellToBuy = null;
if (this.user.party._id) {
- this.$store.dispatch('party:getMembers', {forceLoad: true});
+ this.$store.dispatch('party:getMembers', { forceLoad: true });
}
this.$root.$emit('bv::hide::modal', 'select-member-modal');
diff --git a/website/client/src/components/404.vue b/website/client/src/components/404.vue
index d94b3b3191..983d5c274b 100644
--- a/website/client/src/components/404.vue
+++ b/website/client/src/components/404.vue
@@ -3,8 +3,8 @@
.col-12.text-center
// @TODO i18n. How to setup the strings with the router-link inside?
img.not-found-img(src='~@/assets/images/404.png')
- h1.not-found Sometimes even the bravest adventurer gets lost.
- h2.not-found Looks like this link is broken or the page may have moved, sorry!
+ h1.not-found Sometimes even the bravest adventurer gets lost.
+ h2.not-found Looks like this link is broken or the page may have moved, sorry!
h2.not-found Head back to the Homepage or Contact Us about the issue.
@@ -16,10 +16,9 @@ export default {
...mapState(['isUserLoggedIn']),
contactUsLink () {
if (this.isUserLoggedIn) {
- return {name: 'guild', params: {groupId: 'a29da26b-37de-4a71-b0c6-48e72a900dac'} };
- } else {
- return {name: 'contact'};
+ return { name: 'guild', params: { groupId: 'a29da26b-37de-4a71-b0c6-48e72a900dac' } };
}
+ return { name: 'contact' };
},
},
};
@@ -52,4 +51,4 @@ h2.not-found {
margin-bottom: 0px;
margin-top: 0px;
}
-
\ No newline at end of file
+
diff --git a/website/client/src/components/achievements/achievementFooter.vue b/website/client/src/components/achievements/achievementFooter.vue
index d751f840a8..da75a68147 100644
--- a/website/client/src/components/achievements/achievementFooter.vue
+++ b/website/client/src/components/achievements/achievementFooter.vue
@@ -56,13 +56,14 @@
diff --git a/website/client/src/components/achievements/justAddWater.vue b/website/client/src/components/achievements/justAddWater.vue
index 7f027af528..b881c2e369 100644
--- a/website/client/src/components/achievements/justAddWater.vue
+++ b/website/client/src/components/achievements/justAddWater.vue
@@ -19,28 +19,28 @@
diff --git a/website/client/src/components/achievements/levelUp.vue b/website/client/src/components/achievements/levelUp.vue
index f439939d85..90956723d4 100644
--- a/website/client/src/components/achievements/levelUp.vue
+++ b/website/client/src/components/achievements/levelUp.vue
@@ -116,20 +116,20 @@
diff --git a/website/client/src/components/achievements/lowHealth.vue b/website/client/src/components/achievements/lowHealth.vue
index b42efc7909..76d552ceb2 100644
--- a/website/client/src/components/achievements/lowHealth.vue
+++ b/website/client/src/components/achievements/lowHealth.vue
@@ -59,7 +59,7 @@
import Avatar from '../avatar';
import { mapState } from '@/libs/store';
import percent from '@/../../common/script/libs/percent';
-import {MAX_HEALTH as maxHealth} from '@/../../common/script/constants';
+import { MAX_HEALTH as maxHealth } from '@/../../common/script/constants';
export default {
components: {
@@ -71,7 +71,7 @@ export default {
};
},
computed: {
- ...mapState({user: 'user.data'}),
+ ...mapState({ user: 'user.data' }),
barStyle () {
return {
width: `${percent(this.user.stats.hp, maxHealth)}%`,
diff --git a/website/client/src/components/achievements/mindOverMatter.vue b/website/client/src/components/achievements/mindOverMatter.vue
index 919fbec53c..d25f1129cf 100644
--- a/website/client/src/components/achievements/mindOverMatter.vue
+++ b/website/client/src/components/achievements/mindOverMatter.vue
@@ -19,28 +19,28 @@
diff --git a/website/client/src/components/achievements/newStuff.vue b/website/client/src/components/achievements/newStuff.vue
index 6734457ecf..fa106a234b 100644
--- a/website/client/src/components/achievements/newStuff.vue
+++ b/website/client/src/components/achievements/newStuff.vue
@@ -24,37 +24,37 @@
diff --git a/website/client/src/components/achievements/questCompleted.vue b/website/client/src/components/achievements/questCompleted.vue
index 1d5a40ab5c..6fb7144664 100644
--- a/website/client/src/components/achievements/questCompleted.vue
+++ b/website/client/src/components/achievements/questCompleted.vue
@@ -28,7 +28,7 @@ import questDialogDrops from '@/components/shops/quests/questDialogDrops';
import { mapState } from '@/libs/store';
import percent from '@/../../common/script/libs/percent';
-import {MAX_HEALTH as maxHealth} from '@/../../common/script/constants';
+import { MAX_HEALTH as maxHealth } from '@/../../common/script/constants';
export default {
components: {
@@ -41,7 +41,7 @@ export default {
};
},
computed: {
- ...mapState({user: 'user.data'}),
+ ...mapState({ user: 'user.data' }),
questData () {
return this.quests.quests[this.user.party.quest.completed];
},
@@ -62,7 +62,7 @@ export default {
this.close();
},
hide () {
- this.$store.dispatch('user:set', {'party.quest.completed': ''});
+ this.$store.dispatch('user:set', { 'party.quest.completed': '' });
},
},
};
diff --git a/website/client/src/components/achievements/questInvitation.vue b/website/client/src/components/achievements/questInvitation.vue
index 9c633442d9..e6cfff0daf 100644
--- a/website/client/src/components/achievements/questInvitation.vue
+++ b/website/client/src/components/achievements/questInvitation.vue
@@ -48,7 +48,7 @@
import * as quests from '@/../../common/script/content/quests';
import { mapState } from '@/libs/store';
import percent from '@/../../common/script/libs/percent';
-import {MAX_HEALTH as maxHealth} from '@/../../common/script/constants';
+import { MAX_HEALTH as maxHealth } from '@/../../common/script/constants';
export default {
data () {
@@ -58,7 +58,7 @@ export default {
};
},
computed: {
- ...mapState({user: 'user.data'}),
+ ...mapState({ user: 'user.data' }),
barStyle () {
return {
width: `${percent(this.user.stats.hp, maxHealth)}%`,
diff --git a/website/client/src/components/achievements/rebirth.vue b/website/client/src/components/achievements/rebirth.vue
index edf78448fb..68612857dc 100644
--- a/website/client/src/components/achievements/rebirth.vue
+++ b/website/client/src/components/achievements/rebirth.vue
@@ -24,23 +24,23 @@
diff --git a/website/client/src/components/achievements/rebirthEnabled.vue b/website/client/src/components/achievements/rebirthEnabled.vue
index 6f575a8936..4e69bda00e 100644
--- a/website/client/src/components/achievements/rebirthEnabled.vue
+++ b/website/client/src/components/achievements/rebirthEnabled.vue
@@ -21,7 +21,7 @@ import { mapState } from '@/libs/store';
export default {
computed: {
- ...mapState({user: 'user.data'}),
+ ...mapState({ user: 'user.data' }),
},
methods: {
close () {
diff --git a/website/client/src/components/achievements/streak.vue b/website/client/src/components/achievements/streak.vue
index 95cb2269fa..198cf3ebea 100644
--- a/website/client/src/components/achievements/streak.vue
+++ b/website/client/src/components/achievements/streak.vue
@@ -38,15 +38,15 @@ export default {
achievementAvatar,
},
computed: {
- ...mapState({user: 'user.data'}),
+ ...mapState({ user: 'user.data' }),
},
methods: {
close () {
this.$root.$emit('bv::hide::modal', 'streak');
},
suppressModals () {
- let surpress = this.user.preferences.suppressModals.streak ? true : false;
- this.$store.dispatch('user:set', {'preferences.suppressModals.streak': surpress});
+ const surpress = !!this.user.preferences.suppressModals.streak;
+ this.$store.dispatch('user:set', { 'preferences.suppressModals.streak': surpress });
},
},
};
diff --git a/website/client/src/components/achievements/ultimateGear.vue b/website/client/src/components/achievements/ultimateGear.vue
index fd1c46abb1..1d0e03576e 100644
--- a/website/client/src/components/achievements/ultimateGear.vue
+++ b/website/client/src/components/achievements/ultimateGear.vue
@@ -56,7 +56,7 @@ export default {
achievementAvatar,
},
computed: {
- ...mapState({user: 'user.data'}),
+ ...mapState({ user: 'user.data' }),
},
methods: {
close () {
diff --git a/website/client/src/components/achievements/wonChallenge.vue b/website/client/src/components/achievements/wonChallenge.vue
index af8f7fd877..3390579edf 100644
--- a/website/client/src/components/achievements/wonChallenge.vue
+++ b/website/client/src/components/achievements/wonChallenge.vue
@@ -49,10 +49,10 @@ export default {
markdown: markdownDirective,
},
computed: {
- ...mapState({user: 'user.data'}),
+ ...mapState({ user: 'user.data' }),
},
data () {
- let tweet = this.$t('wonChallengeShare');
+ const tweet = this.$t('wonChallengeShare');
return {
tweet,
};
diff --git a/website/client/src/components/appFooter.vue b/website/client/src/components/appFooter.vue
index 363d9cef69..fe5dbd0209 100644
--- a/website/client/src/components/appFooter.vue
+++ b/website/client/src/components/appFooter.vue
@@ -295,7 +295,7 @@ export default {
};
},
computed: {
- ...mapState({user: 'user.data'}),
+ ...mapState({ user: 'user.data' }),
...mapState(['isUserLoaded']),
getDataDisplayToolUrl () {
const base = 'https://oldgods.net/habitrpg/habitrpg_user_data_display.html';
@@ -318,7 +318,7 @@ export default {
async addMissedDay (numberOfDays) {
if (!confirm(`Are you sure you want to reset the day by ${numberOfDays} day(s)?`)) return;
- let date = moment(this.user.lastCron).subtract(numberOfDays, 'days').toDate();
+ const date = moment(this.user.lastCron).subtract(numberOfDays, 'days').toDate();
await axios.post('/api/v4/debug/set-cron', {
lastCron: date,
@@ -349,18 +349,18 @@ export default {
addLevelsAndGold () {
this.$store.dispatch('user:set', {
'stats.exp': this.user.stats.exp + 10000,
- 'stats.gp': this.user.stats.gp + 10000,
- 'stats.mp': this.user.stats.mp + 10000,
+ 'stats.gp': this.user.stats.gp + 10000,
+ 'stats.mp': this.user.stats.mp + 10000,
});
},
addExp () {
// @TODO: Name these variables better
let exp = 0;
- let five = 10 * this.user.stats.lvl;
- let four = Math.pow(this.user.stats.lvl, 2) * 0.25;
- let three = four + five + 139.75;
- let two = three / 10;
- let one = Math.round(two) * 10;
+ const five = 10 * this.user.stats.lvl;
+ const four = Math.pow(this.user.stats.lvl, 2) * 0.25;
+ const three = four + five + 139.75;
+ const two = three / 10;
+ const one = Math.round(two) * 10;
exp = this.user.stats.exp + one;
this.$store.dispatch('user:set', {
@@ -394,7 +394,7 @@ export default {
eventAction: 'click',
eventLabel: 'Gems > Donate',
});
- this.$root.$emit('bv::show::modal', 'buy-gems', {alreadyTracked: true});
+ this.$root.$emit('bv::show::modal', 'buy-gems', { alreadyTracked: true });
},
},
};
diff --git a/website/client/src/components/auth/authForm.vue b/website/client/src/components/auth/authForm.vue
index 5184753a8f..fd9e9d8871 100644
--- a/website/client/src/components/auth/authForm.vue
+++ b/website/client/src/components/auth/authForm.vue
@@ -80,9 +80,9 @@
diff --git a/website/client/src/components/auth/registerLoginReset.vue b/website/client/src/components/auth/registerLoginReset.vue
index b7bdfbfb80..2c241f157d 100644
--- a/website/client/src/components/auth/registerLoginReset.vue
+++ b/website/client/src/components/auth/registerLoginReset.vue
@@ -304,7 +304,7 @@ import googleIcon from '@/assets/svg/google.svg';
export default {
data () {
- let data = {
+ const data = {
username: '',
email: '',
password: '',
@@ -364,29 +364,22 @@ export default {
return !this.passwordConfirmValid;
},
},
- mounted () {
- hello.init({
- facebook: process.env.FACEBOOK_KEY, // eslint-disable-line
- // windows: WINDOWS_CLIENT_ID,
- google: process.env.GOOGLE_CLIENT_ID, // eslint-disable-line
- });
- },
watch: {
$route: {
handler () {
if (this.resetPasswordSetNewOne) {
- const query = this.$route.query;
- const code = query.code;
- const hasError = query.hasError === 'true' ? true : false;
+ const { query } = this.$route;
+ const { code } = query;
+ const hasError = query.hasError === 'true';
if (hasError) {
alert(query.message);
- this.$router.push({name: 'login'});
+ this.$router.push({ name: 'login' });
return;
}
if (!code) {
alert(this.$t('invalidPasswordResetCode'));
- this.$router.push({name: 'login'});
+ this.$router.push({ name: 'login' });
return;
}
@@ -400,6 +393,13 @@ export default {
this.validateUsername(this.username);
},
},
+ mounted () {
+ hello.init({
+ facebook: process.env.FACEBOOK_KEY, // eslint-disable-line
+ // windows: WINDOWS_CLIENT_ID,
+ google: process.env.GOOGLE_CLIENT_ID, // eslint-disable-line
+ });
+ },
methods: {
// eslint-disable-next-line func-names
validateUsername: debounce(function (username) {
@@ -488,7 +488,7 @@ export default {
} catch (e) {} // eslint-disable-line
const redirectUrl = `${window.location.protocol}//${window.location.host}`;
- let auth = await hello(network).login({
+ const auth = await hello(network).login({
scope: 'email',
// explicitly pass the redirect url or it might redirect to /home
redirect_uri: redirectUrl, // eslint-disable-line camelcase
@@ -568,7 +568,7 @@ export default {
this.passwordConfirm = '';
this.resetPasswordSetNewOneData.code = '';
this.resetPasswordSetNewOneData.hasError = false;
- this.$router.push({name: 'login'});
+ this.$router.push({ name: 'login' });
},
},
};
diff --git a/website/client/src/components/avatar.vue b/website/client/src/components/avatar.vue
index 0699576841..104591935b 100644
--- a/website/client/src/components/avatar.vue
+++ b/website/client/src/components/avatar.vue
@@ -146,9 +146,9 @@ export default {
return val;
},
backgroundClass () {
- let background = this.member.preferences.background;
+ const { background } = this.member.preferences;
- let allowToShowBackground = !this.avatarOnly || this.withBackground;
+ const allowToShowBackground = !this.avatarOnly || this.withBackground;
if (this.overrideAvatarGear && this.overrideAvatarGear.background) {
return `background_${this.overrideAvatarGear.background}`;
@@ -169,7 +169,7 @@ export default {
};
},
skinClass () {
- let baseClass = `skin_${this.member.preferences.skin}`;
+ const baseClass = `skin_${this.member.preferences.skin}`;
return `${baseClass}${this.member.preferences.sleep ? '_sleep' : ''}`;
},
@@ -196,19 +196,19 @@ export default {
},
hideGear (gearType) {
if (gearType === 'weapon') {
- let equippedWeapon = this.member.items.gear[this.costumeClass][gearType];
+ const equippedWeapon = this.member.items.gear[this.costumeClass][gearType];
if (!equippedWeapon) {
return false;
}
- let equippedIsTwoHanded = this.flatGear[equippedWeapon].twoHanded;
- let hasOverrideShield = this.overrideAvatarGear && this.overrideAvatarGear.shield;
+ const equippedIsTwoHanded = this.flatGear[equippedWeapon].twoHanded;
+ const hasOverrideShield = this.overrideAvatarGear && this.overrideAvatarGear.shield;
return equippedIsTwoHanded && hasOverrideShield;
- } else if (gearType === 'shield') {
- let overrideWeapon = this.overrideAvatarGear && this.overrideAvatarGear.weapon;
- let overrideIsTwoHanded = overrideWeapon && this.flatGear[overrideWeapon].twoHanded;
+ } if (gearType === 'shield') {
+ const overrideWeapon = this.overrideAvatarGear && this.overrideAvatarGear.weapon;
+ const overrideIsTwoHanded = overrideWeapon && this.flatGear[overrideWeapon].twoHanded;
return overrideIsTwoHanded;
}
@@ -218,10 +218,9 @@ export default {
this.$root.$emit('castEnd', this.member, 'user', e);
},
showAvatar () {
- if (!this.showVisualBuffs)
- return true;
+ if (!this.showVisualBuffs) return true;
- let buffs = this.member.stats.buffs;
+ const { buffs } = this.member.stats;
return !buffs.snowball && !buffs.spookySparkles && !buffs.shinySeed && !buffs.seafoam;
},
diff --git a/website/client/src/components/avatarModal/body-settings.vue b/website/client/src/components/avatarModal/body-settings.vue
index 8071ddcf32..fcd4a35a2e 100644
--- a/website/client/src/components/avatarModal/body-settings.vue
+++ b/website/client/src/components/avatarModal/body-settings.vue
@@ -21,70 +21,70 @@
diff --git a/website/client/src/components/challenges/challengeMemberProgressModal.vue b/website/client/src/components/challenges/challengeMemberProgressModal.vue
index afc90b4682..7c76144b56 100644
--- a/website/client/src/components/challenges/challengeMemberProgressModal.vue
+++ b/website/client/src/components/challenges/challengeMemberProgressModal.vue
@@ -23,10 +23,10 @@ import axios from 'axios';
import Column from '../tasks/column';
export default {
- props: ['challengeId'],
components: {
TaskColumn: Column,
},
+ props: ['challengeId'],
data () {
return {
columns: ['habit', 'daily', 'todo', 'reward'],
@@ -41,18 +41,6 @@ export default {
isAdmin: false,
};
},
- mounted () {
- this.$root.$on('habitica:challenge:member-progress', (data) => {
- if (!data.progressMemberId) return;
- this.memberId = data.progressMemberId;
- this.isLeader = data.isLeader;
- this.isAdmin = data.isAdmin;
- this.$root.$emit('bv::show::modal', 'challenge-member-modal');
- });
- },
- beforeDestroy () {
- this.$root.$off('habitica:challenge:member-progress');
- },
watch: {
async memberId (id) {
if (!id) return;
@@ -63,13 +51,25 @@ export default {
reward: [],
};
- let response = await axios.get(`/api/v4/challenges/${this.challengeId}/members/${this.memberId}`);
- let tasks = response.data.data.tasks;
- tasks.forEach((task) => {
+ const response = await axios.get(`/api/v4/challenges/${this.challengeId}/members/${this.memberId}`);
+ const { tasks } = response.data.data;
+ tasks.forEach(task => {
this.tasksByType[task.type].push(task);
});
},
},
+ mounted () {
+ this.$root.$on('habitica:challenge:member-progress', data => {
+ if (!data.progressMemberId) return;
+ this.memberId = data.progressMemberId;
+ this.isLeader = data.isLeader;
+ this.isAdmin = data.isAdmin;
+ this.$root.$emit('bv::show::modal', 'challenge-member-modal');
+ });
+ },
+ beforeDestroy () {
+ this.$root.$off('habitica:challenge:member-progress');
+ },
methods: {
async closeChallenge () {
this.challenge = await this.$store.dispatch('challenges:selectChallengeWinner', {
diff --git a/website/client/src/components/challenges/challengeModal.vue b/website/client/src/components/challenges/challengeModal.vue
index 67641106e1..c6f1bcc437 100644
--- a/website/client/src/components/challenges/challengeModal.vue
+++ b/website/client/src/components/challenges/challengeModal.vue
@@ -138,12 +138,12 @@ import { TAVERN_ID, MIN_SHORTNAME_SIZE_FOR_CHALLENGES, MAX_SUMMARY_SIZE_FOR_CHAL
import { mapState } from '@/libs/store';
export default {
- props: ['groupId'],
directives: {
markdown: markdownDirective,
},
+ props: ['groupId'],
data () {
- let categoryOptions = [
+ const categoryOptions = [
{
label: 'habitica_official',
key: 'habitica_official',
@@ -201,11 +201,11 @@ export default {
key: 'time_management',
},
];
- let hashedCategories = {};
- categoryOptions.forEach((category) => {
+ const hashedCategories = {};
+ categoryOptions.forEach(category => {
hashedCategories[category.key] = category.label;
});
- let categoriesHashByKey = hashedCategories;
+ const categoriesHashByKey = hashedCategories;
return {
workingChallenge: {
@@ -233,24 +233,6 @@ export default {
groups: [],
};
},
- mounted () {
- this.$root.$on('habitica:clone-challenge', (data) => {
- if (!data.challenge) return;
- this.cloning = true;
- this.cloningChallengeId = data.challenge._id;
- this.$store.state.challengeOptions.workingChallenge = Object.assign({}, this.$store.state.challengeOptions.workingChallenge, data.challenge);
- this.$root.$emit('bv::show::modal', 'challenge-modal');
- });
- this.$root.$on('habitica:update-challenge', (data) => {
- if (!data.challenge) return;
- this.cloning = false;
- this.$store.state.challengeOptions.workingChallenge = Object.assign({}, this.$store.state.challengeOptions.workingChallenge, data.challenge);
- this.$root.$emit('bv::show::modal', 'challenge-modal');
- });
- },
- beforeDestroy () {
- this.$root.$off('habitica:clone-challenge');
- },
watch: {
user () {
if (!this.challenge) this.workingChallenge.leader = this.user._id;
@@ -262,8 +244,26 @@ export default {
this.setUpWorkingChallenge();
},
},
+ mounted () {
+ this.$root.$on('habitica:clone-challenge', data => {
+ if (!data.challenge) return;
+ this.cloning = true;
+ this.cloningChallengeId = data.challenge._id;
+ this.$store.state.challengeOptions.workingChallenge = { ...this.$store.state.challengeOptions.workingChallenge, ...data.challenge };
+ this.$root.$emit('bv::show::modal', 'challenge-modal');
+ });
+ this.$root.$on('habitica:update-challenge', data => {
+ if (!data.challenge) return;
+ this.cloning = false;
+ this.$store.state.challengeOptions.workingChallenge = { ...this.$store.state.challengeOptions.workingChallenge, ...data.challenge };
+ this.$root.$emit('bv::show::modal', 'challenge-modal');
+ });
+ },
+ beforeDestroy () {
+ this.$root.$off('habitica:clone-challenge');
+ },
computed: {
- ...mapState({user: 'user.data'}),
+ ...mapState({ user: 'user.data' }),
creating () {
return !this.workingChallenge.id;
},
@@ -274,19 +274,18 @@ export default {
return this.$t('editingChallenge');
},
charactersRemaining () {
- let currentLength = this.workingChallenge.summary ? this.workingChallenge.summary.length : 0;
+ const currentLength = this.workingChallenge.summary ? this.workingChallenge.summary.length : 0;
return MAX_SUMMARY_SIZE_FOR_CHALLENGES - currentLength;
},
maxPrize () {
let userBalance = this.user.balance || 0;
- userBalance = userBalance * 4;
+ userBalance *= 4;
let groupBalance = 0;
let group;
this.groups.forEach(item => {
if (item._id === this.workingChallenge.group) {
group = item;
- return;
}
});
@@ -301,14 +300,13 @@ export default {
return 0;
},
insufficientGemsForTavernChallenge () {
- let balance = this.user.balance || 0;
- let isForTavern = this.workingChallenge.group === TAVERN_ID;
+ const balance = this.user.balance || 0;
+ const isForTavern = this.workingChallenge.group === TAVERN_ID;
if (isForTavern) {
return balance <= 0;
- } else {
- return false;
}
+ return false;
},
challenge () {
return this.$store.state.challengeOptions.workingChallenge;
@@ -342,7 +340,7 @@ export default {
if (!this.challenge) return;
- this.workingChallenge = Object.assign({}, this.workingChallenge, this.challenge);
+ this.workingChallenge = { ...this.workingChallenge, ...this.challenge };
// @TODO: Should we use a separate field? I think the API expects `group` but it is confusing
this.workingChallenge.group = this.workingChallenge.group._id;
this.workingChallenge.categories = [];
@@ -381,7 +379,7 @@ export default {
async createChallenge () {
this.loading = true;
// @TODO: improve error handling, add it to updateChallenge, make errors translatable. Suggestion: `<% fieldName %> is required` where possible, where `fieldName` is inserted as the translatable string that's used for the field header.
- let errors = [];
+ const errors = [];
if (!this.workingChallenge.name) errors.push(this.$t('nameRequired'));
if (this.workingChallenge.shortName.length < MIN_SHORTNAME_SIZE_FOR_CHALLENGES) errors.push(this.$t('tagTooShort'));
@@ -398,17 +396,17 @@ export default {
}
this.workingChallenge.timestamp = new Date().getTime();
- let categoryKeys = this.workingChallenge.categories;
- let serverCategories = [];
+ const categoryKeys = this.workingChallenge.categories;
+ const serverCategories = [];
categoryKeys.forEach(key => {
- let catName = this.categoriesHashByKey[key];
+ const catName = this.categoriesHashByKey[key];
serverCategories.push({
slug: key,
name: catName,
});
});
- let challengeDetails = clone(this.workingChallenge);
+ const challengeDetails = clone(this.workingChallenge);
challengeDetails.categories = serverCategories;
let challenge;
@@ -419,13 +417,11 @@ export default {
});
this.cloningChallengeId = '';
} else {
- challenge = await this.$store.dispatch('challenges:createChallenge', {challenge: challengeDetails});
+ challenge = await this.$store.dispatch('challenges:createChallenge', { challenge: challengeDetails });
}
// Update Group Prize
- let challengeGroup = this.groups.find(group => {
- return group._id === this.workingChallenge.group;
- });
+ const challengeGroup = this.groups.find(group => group._id === this.workingChallenge.group);
// @TODO: Share with server
const prizeCost = this.workingChallenge.prize / 4;
@@ -435,7 +431,7 @@ export default {
// Group pays for all of prize
} else if (challengeGroup && userIsLeader && challengeGroup.balance > 0) {
// User pays remainder of prize cost after group
- let remainder = prizeCost - challengeGroup.balance;
+ const remainder = prizeCost - challengeGroup.balance;
this.user.balance -= remainder;
} else {
// User pays for all of prize
@@ -449,24 +445,24 @@ export default {
this.$router.push(`/challenges/${challenge._id}`);
},
updateChallenge () {
- let categoryKeys = this.workingChallenge.categories;
- let serverCategories = [];
+ const categoryKeys = this.workingChallenge.categories;
+ const serverCategories = [];
categoryKeys.forEach(key => {
- let newKey = key.trim();
- let catName = this.categoriesHashByKey[newKey];
+ const newKey = key.trim();
+ const catName = this.categoriesHashByKey[newKey];
serverCategories.push({
slug: newKey,
name: catName,
});
});
- let challengeDetails = clone(this.workingChallenge);
+ const challengeDetails = clone(this.workingChallenge);
challengeDetails.categories = serverCategories;
this.$emit('updatedChallenge', {
challenge: challengeDetails,
});
- this.$store.dispatch('challenges:updateChallenge', {challenge: challengeDetails});
+ this.$store.dispatch('challenges:updateChallenge', { challenge: challengeDetails });
this.resetWorkingChallenge();
this.$root.$emit('bv::hide::modal', 'challenge-modal');
},
diff --git a/website/client/src/components/challenges/closeChallengeModal.vue b/website/client/src/components/challenges/closeChallengeModal.vue
index 248034dce9..76d97a1379 100644
--- a/website/client/src/components/challenges/closeChallengeModal.vue
+++ b/website/client/src/components/challenges/closeChallengeModal.vue
@@ -74,10 +74,10 @@ div
import memberSearchDropdown from '@/components/members/memberSearchDropdown';
export default {
- props: ['challengeId', 'members', 'prize'],
components: {
memberSearchDropdown,
},
+ props: ['challengeId', 'members', 'prize'],
data () {
return {
winner: {},
diff --git a/website/client/src/components/challenges/findChallenges.vue b/website/client/src/components/challenges/findChallenges.vue
index 623c04e786..893dad43c5 100644
--- a/website/client/src/components/challenges/findChallenges.vue
+++ b/website/client/src/components/challenges/findChallenges.vue
@@ -66,6 +66,8 @@
diff --git a/website/client/src/components/challenges/leaveChallengeModal.vue b/website/client/src/components/challenges/leaveChallengeModal.vue
index 805076d5e9..f2309c6984 100644
--- a/website/client/src/components/challenges/leaveChallengeModal.vue
+++ b/website/client/src/components/challenges/leaveChallengeModal.vue
@@ -19,22 +19,20 @@ import { mapState } from '@/libs/store';
import notifications from '@/mixins/notifications';
export default {
- props: ['challengeId'],
mixins: [notifications],
+ props: ['challengeId'],
computed: {
- ...mapState({user: 'user.data'}),
+ ...mapState({ user: 'user.data' }),
},
methods: {
async leaveChallenge (keep) {
- let index = findIndex(this.user.challenges, (id) => {
- return id === this.challengeId;
- });
+ const index = findIndex(this.user.challenges, id => id === this.challengeId);
this.user.challenges.splice(index, 1);
await this.$store.dispatch('challenges:leaveChallenge', {
challengeId: this.challengeId,
keep,
});
- await this.$store.dispatch('tasks:fetchUserTasks', {forceLoad: true});
+ await this.$store.dispatch('tasks:fetchUserTasks', { forceLoad: true });
this.close();
},
close () {
diff --git a/website/client/src/components/challenges/myChallenges.vue b/website/client/src/components/challenges/myChallenges.vue
index fdd5e4b54b..ad974d3e65 100644
--- a/website/client/src/components/challenges/myChallenges.vue
+++ b/website/client/src/components/challenges/myChallenges.vue
@@ -80,6 +80,8 @@
diff --git a/website/client/src/components/chat/chatCard.vue b/website/client/src/components/chat/chatCard.vue
index 7c3f317692..edc52ae889 100644
--- a/website/client/src/components/chat/chatCard.vue
+++ b/website/client/src/components/chat/chatCard.vue
@@ -140,7 +140,16 @@ import { highlightUsers } from '../../libs/highlightUsers';
import { CHAT_FLAG_LIMIT_FOR_HIDING, CHAT_FLAG_FROM_SHADOW_MUTE } from '@/../../common/script/constants';
export default {
- components: {userLink},
+ components: { userLink },
+ filters: {
+ timeAgo (value) {
+ return moment(value).fromNow();
+ },
+ date (value) {
+ // @TODO: Vue doesn't support this so we cant user preference
+ return moment(value).toDate().toString();
+ },
+ },
props: {
msg: {},
inbox: {
@@ -161,20 +170,11 @@ export default {
reported: false,
};
},
- filters: {
- timeAgo (value) {
- return moment(value).fromNow();
- },
- date (value) {
- // @TODO: Vue doesn't support this so we cant user preference
- return moment(value).toDate().toString();
- },
- },
computed: {
- ...mapState({user: 'user.data'}),
+ ...mapState({ user: 'user.data' }),
isUserMentioned () {
const message = this.msg;
- const user = this.user;
+ const { user } = this;
if (message.hasOwnProperty('highlight')) return message.highlight;
@@ -190,7 +190,7 @@ export default {
const pattern = `@(${escapedUsername}|${escapedDisplayName})(\\b)`;
const precedingChar = messageText.substring(mentioned - 1, mentioned);
if (mentioned === 0 || precedingChar.trim() === '' || precedingChar === '@') {
- let regex = new RegExp(pattern, 'i');
+ const regex = new RegExp(pattern, 'i');
message.highlight = regex.test(messageText);
}
@@ -201,8 +201,8 @@ export default {
if (!message.likes) return 0;
let likeCount = 0;
- for (let key in message.likes) {
- let like = message.likes[key];
+ for (const key in message.likes) {
+ const like = message.likes[key];
if (like) likeCount += 1;
}
return likeCount;
@@ -217,9 +217,14 @@ export default {
return 'Message hidden (shadow-muted)';
},
},
+ mounted () {
+ this.CHAT_FLAG_LIMIT_FOR_HIDING = CHAT_FLAG_LIMIT_FOR_HIDING;
+ this.CHAT_FLAG_FROM_SHADOW_MUTE = CHAT_FLAG_FROM_SHADOW_MUTE;
+ this.$emit('chat-card-mounted', this.msg.id);
+ },
methods: {
async like () {
- let message = cloneDeep(this.msg);
+ const message = cloneDeep(this.msg);
await this.$store.dispatch('chat:like', {
groupId: this.groupId,
@@ -279,10 +284,5 @@ export default {
return habiticaMarkdown.render(String(text));
},
},
- mounted () {
- this.CHAT_FLAG_LIMIT_FOR_HIDING = CHAT_FLAG_LIMIT_FOR_HIDING;
- this.CHAT_FLAG_FROM_SHADOW_MUTE = CHAT_FLAG_FROM_SHADOW_MUTE;
- this.$emit('chat-card-mounted', this.msg.id);
- },
};
diff --git a/website/client/src/components/chat/chatMessages.vue b/website/client/src/components/chat/chatMessages.vue
index 5a9e942224..e15a930949 100644
--- a/website/client/src/components/chat/chatMessages.vue
+++ b/website/client/src/components/chat/chatMessages.vue
@@ -140,15 +140,20 @@
\ No newline at end of file
+ },
+};
+
diff --git a/website/client/src/components/groups/chat.vue b/website/client/src/components/groups/chat.vue
index f2e696a0a3..a515b11abc 100644
--- a/website/client/src/components/groups/chat.vue
+++ b/website/client/src/components/groups/chat.vue
@@ -48,190 +48,190 @@
diff --git a/website/client/src/components/groups/discovery.vue b/website/client/src/components/groups/discovery.vue
index e44bfbb5b6..0d33238b7b 100644
--- a/website/client/src/components/groups/discovery.vue
+++ b/website/client/src/components/groups/discovery.vue
@@ -64,7 +64,7 @@ import groupUtilities from '@/mixins/groupsUtilities';
import positiveIcon from '@/assets/svg/positive.svg';
function _mapCategories (guilds) {
- guilds.forEach((guild) => {
+ guilds.forEach(guild => {
if (!guild.categories) return;
guild.categorySlugs = guild.categories.map(cat => {
if (!cat) return;
@@ -74,8 +74,8 @@ function _mapCategories (guilds) {
}
export default {
- mixins: [groupUtilities],
components: { PublicGuildItem, MugenScroll, Sidebar },
+ mixins: [groupUtilities],
data () {
return {
icons: Object.freeze({
@@ -113,14 +113,12 @@ export default {
},
computed: {
filteredGuilds () {
- let search = this.search;
- let filters = this.filters;
- let user = this.$store.state.user.data;
- let filterGuild = this.filterGuild;
+ const { search } = this;
+ const { filters } = this;
+ const user = this.$store.state.user.data;
+ const { filterGuild } = this;
// @TODO: Move this to the server
- return this.guilds.filter((guild) => {
- return filterGuild(guild, filters, search, user);
- });
+ return this.guilds.filter(guild => filterGuild(guild, filters, search, user));
},
},
methods: {
@@ -133,7 +131,7 @@ export default {
this.queryFilters.search = eventData.searchTerm;
- let guilds = await this.$store.dispatch('guilds:getPublicGuilds', this.queryFilters);
+ const guilds = await this.$store.dispatch('guilds:getPublicGuilds', this.queryFilters);
_mapCategories(guilds);
this.guilds = guilds;
},
@@ -157,7 +155,7 @@ export default {
this.queryFilters.categories = eventData.categories.join(',');
// Role filters
- let filteringRole = eventData.roles && eventData.roles.length > 0;
+ const filteringRole = eventData.roles && eventData.roles.length > 0;
if (filteringRole && eventData.roles.indexOf('member') !== -1) {
this.queryFilters.member = true;
}
@@ -182,7 +180,7 @@ export default {
this.queryFilters.maxMemberCount = 99;
}
- let guilds = await this.$store.dispatch('guilds:getPublicGuilds', this.queryFilters);
+ const guilds = await this.$store.dispatch('guilds:getPublicGuilds', this.queryFilters);
_mapCategories(guilds);
this.guilds = guilds;
},
@@ -194,7 +192,7 @@ export default {
this.loading = true;
this.queryFilters.page = this.lastPageLoaded;
- let guilds = await this.$store.dispatch('guilds:getPublicGuilds', this.queryFilters);
+ const guilds = await this.$store.dispatch('guilds:getPublicGuilds', this.queryFilters);
if (guilds.length === 0) this.hasLoadedAllGuilds = true;
_mapCategories(guilds);
diff --git a/website/client/src/components/groups/group.vue b/website/client/src/components/groups/group.vue
index 332dc532a6..d9db6f8823 100644
--- a/website/client/src/components/groups/group.vue
+++ b/website/client/src/components/groups/group.vue
@@ -289,8 +289,6 @@ import silverGuildBadgeIcon from '@/assets/svg/silver-guild-badge-small.svg';
import bronzeGuildBadgeIcon from '@/assets/svg/bronze-guild-badge-small.svg';
export default {
- mixins: [groupUtilities, styleHelper],
- props: ['groupId'],
components: {
membersModal,
startQuestModal,
@@ -307,6 +305,8 @@ export default {
directives: {
markdown: markdownDirective,
},
+ mixins: [groupUtilities, styleHelper],
+ props: ['groupId'],
data () {
return {
searchId: '',
@@ -333,7 +333,7 @@ export default {
};
},
computed: {
- ...mapState({user: 'user.data'}),
+ ...mapState({ user: 'user.data' }),
partyStore () {
return this.$store.state.party;
},
@@ -353,16 +353,6 @@ export default {
return this.group.memberCount > this.$store.state.constants.LARGE_GROUP_COUNT_MESSAGE_CUTOFF;
},
},
- mounted () {
- if (this.isParty) this.searchId = 'party';
- if (!this.searchId) this.searchId = this.groupId;
- this.load();
- },
- beforeRouteUpdate (to, from, next) {
- this.$set(this, 'searchId', to.params.groupId);
-
- next();
- },
watch: {
// call again the method if the route changes (when this route is already active)
$route: 'fetchGuild',
@@ -375,9 +365,19 @@ export default {
}
},
},
+ mounted () {
+ if (this.isParty) this.searchId = 'party';
+ if (!this.searchId) this.searchId = this.groupId;
+ this.load();
+ },
+ beforeRouteUpdate (to, from, next) {
+ this.$set(this, 'searchId', to.params.groupId);
+
+ next();
+ },
methods: {
acceptCommunityGuidelines () {
- this.$store.dispatch('user:set', {'flags.communityGuidelinesAccepted': true});
+ this.$store.dispatch('user:set', { 'flags.communityGuidelinesAccepted': true });
},
async load () {
if (this.isParty) {
@@ -393,7 +393,7 @@ export default {
includeAllPublicFields: true,
});
this.$root.$on('updatedGroup', group => {
- let updatedGroup = extend(this.group, group);
+ const updatedGroup = extend(this.group, group);
this.$set(this.group, updatedGroup);
});
},
@@ -442,7 +442,7 @@ export default {
this.group = this.$store.state.party.data;
this.checkForAchievements();
} else {
- const group = await this.$store.dispatch('guilds:getGroup', {groupId: this.searchId});
+ const group = await this.$store.dispatch('guilds:getGroup', { groupId: this.searchId });
this.$set(this, 'group', group);
}
@@ -450,7 +450,7 @@ export default {
if (this.hasUnreadMessages(groupId)) {
// Delay by 1sec to make sure it returns after other requests that don't have the notification marked as read
setTimeout(() => {
- this.$store.dispatch('chat:markChatSeen', {groupId});
+ this.$store.dispatch('chat:markChatSeen', { groupId });
this.$delete(this.user.newMessages, groupId);
}, 1000);
}
@@ -458,9 +458,7 @@ export default {
hasUnreadMessages (groupId) {
if (this.user.newMessages[groupId]) return true;
- return this.user.notifications.some(n => {
- return n.type === 'NEW_CHAT_MESSAGE' && n.data.group.id === groupId;
- });
+ return this.user.notifications.some(n => n.type === 'NEW_CHAT_MESSAGE' && n.data.group.id === groupId);
},
checkForAchievements () {
// Checks if user's party has reached 2 players for the first time.
@@ -481,7 +479,7 @@ export default {
if (this.group.cancelledPlan && !confirm(this.$t('aboutToJoinCancelledGroupPlan'))) {
return;
}
- await this.$store.dispatch('guilds:join', {groupId: this.group._id, type: 'guild'});
+ await this.$store.dispatch('guilds:join', { groupId: this.group._id, type: 'guild' });
},
clickLeave () {
Analytics.track({
@@ -493,13 +491,13 @@ export default {
// @TODO: Get challenges and ask to keep or remove
if (!confirm('Are you sure you want to leave?')) return;
- let keep = true;
+ const keep = true;
this.leave(keep);
},
async leave (keepTasks) {
- let keepChallenges = 'remain-in-challenges';
+ const keepChallenges = 'remain-in-challenges';
- let data = {
+ const data = {
groupId: this.group._id,
keep: keepTasks,
keepChallenges,
@@ -507,14 +505,14 @@ export default {
if (this.isParty) {
data.type = 'party';
- Analytics.updateUser({partySize: null, partyID: null});
+ Analytics.updateUser({ partySize: null, partyID: null });
this.$store.state.partyMembers = [];
}
await this.$store.dispatch('guilds:leave', data);
if (this.isParty) {
- this.$router.push({name: 'tasks'});
+ this.$router.push({ name: 'tasks' });
}
},
upgradeGroup () {
diff --git a/website/client/src/components/groups/groupFormModal.vue b/website/client/src/components/groups/groupFormModal.vue
index 0ed797ed66..41db557c8c 100644
--- a/website/client/src/components/groups/groupFormModal.vue
+++ b/website/client/src/components/groups/groupFormModal.vue
@@ -185,7 +185,7 @@ export default {
markdown: markdownDirective,
},
data () {
- let data = {
+ const data = {
workingGroup: {
id: '',
name: '',
@@ -267,8 +267,8 @@ export default {
membersToInvite: [],
};
- let hashedCategories = {};
- data.categoryOptions.forEach((category) => {
+ const hashedCategories = {};
+ data.categoryOptions.forEach(category => {
hashedCategories[category.key] = category.label;
});
data.categoriesHashByKey = hashedCategories;
@@ -281,12 +281,12 @@ export default {
return data;
},
computed: {
- ...mapState({user: 'user.data'}),
+ ...mapState({ user: 'user.data' }),
editingGroup () {
return this.$store.state.editingGroup;
},
charactersRemaining () {
- let currentLength = this.workingGroup.summary ? this.workingGroup.summary.length : 0;
+ const currentLength = this.workingGroup.summary ? this.workingGroup.summary.length : 0;
return MAX_SUMMARY_SIZE_FOR_GUILDS - currentLength;
},
title () {
@@ -304,7 +304,7 @@ export default {
},
watch: {
editingGroup () {
- let editingGroup = this.editingGroup;
+ const { editingGroup } = this;
if (!editingGroup._id) {
this.resetWorkingGroup();
@@ -339,7 +339,7 @@ export default {
methods: {
async getMembers () {
if (!this.workingGroup.id) return;
- let members = await this.$store.dispatch('members:getGroupMembers', {
+ const members = await this.$store.dispatch('members:getGroupMembers', {
groupId: this.workingGroup.id,
includeAllPublicFields: true,
});
@@ -367,7 +367,7 @@ export default {
// @TODO return $rootScope.openModal('buyGems', {track:"Gems > Gems > Create Group"});
}
- let errors = [];
+ const errors = [];
if (!this.workingGroup.name) errors.push(this.$t('nameRequired'));
if (!this.workingGroup.summary) errors.push(this.$t('summaryRequired'));
@@ -391,10 +391,10 @@ export default {
challenges: this.workingGroup.onlyLeaderCreatesChallenges,
};
- let categoryKeys = this.workingGroup.categories;
- let serverCategories = [];
+ const categoryKeys = this.workingGroup.categories;
+ const serverCategories = [];
categoryKeys.forEach(key => {
- let catName = this.categoriesHashByKey[key];
+ const catName = this.categoriesHashByKey[key];
serverCategories.push({
slug: key,
name: catName,
@@ -402,16 +402,16 @@ export default {
});
this.workingGroup.categories = serverCategories;
- let groupData = Object.assign({}, this.workingGroup);
+ const groupData = { ...this.workingGroup };
let newgroup;
if (groupData.id) {
- await this.$store.dispatch('guilds:update', {group: groupData});
+ await this.$store.dispatch('guilds:update', { group: groupData });
this.$root.$emit('updatedGroup', this.workingGroup);
// @TODO: this doesn't work because of the async resource
// if (updatedGroup.type === 'party') this.$store.state.party = {data: updatedGroup};
} else {
- newgroup = await this.$store.dispatch('guilds:create', {group: groupData});
+ newgroup = await this.$store.dispatch('guilds:create', { group: groupData });
this.$store.state.user.data.balance -= 1;
}
diff --git a/website/client/src/components/groups/groupPlan.vue b/website/client/src/components/groups/groupPlan.vue
index c1b0447971..95f5978188 100644
--- a/website/client/src/components/groups/groupPlan.vue
+++ b/website/client/src/components/groups/groupPlan.vue
@@ -49,7 +49,7 @@ div
.box.payment-providers
h3 Choose your payment method
.payments-column
- button.purchase.btn.btn-primary.payment-button.payment-item(@click='pay(PAYMENTS.STRIPE)')
+ button.purchase.btn.btn-primary.payment-button.payment-item(@click='pay(PAYMENTS.STRIPE)')
.svg-icon.credit-card-icon(v-html="icons.creditCardIcon")
| {{ $t('card') }}
amazon-button.payment-item(:amazon-data="pay(PAYMENTS.AMAZON)")
@@ -99,7 +99,7 @@ div
.text-center
h3 Choose your payment method
.payments-column.mx-auto
- button.purchase.btn.btn-primary.payment-button.payment-item(@click='pay(PAYMENTS.STRIPE)')
+ button.purchase.btn.btn-primary.payment-button.payment-item(@click='pay(PAYMENTS.STRIPE)')
.svg-icon.credit-card-icon(v-html="icons.creditCardIcon")
| {{ $t('card') }}
amazon-button.payment-item(:amazon-data="pay(PAYMENTS.AMAZON)")
@@ -297,10 +297,10 @@ import creditCardIcon from '@/assets/svg/credit-card-icon.svg';
import amazonButton from '@/components/payments/amazonButton';
export default {
- mixins: [paymentsMixin],
components: {
amazonButton,
},
+ mixins: [paymentsMixin],
data () {
return {
amazonPayments: {},
@@ -341,7 +341,7 @@ export default {
return this.$store.state.upgradingGroup;
},
// @TODO: can we move this to payment mixin?
- ...mapState({user: 'user.data'}),
+ ...mapState({ user: 'user.data' }),
},
methods: {
launchModal () {
diff --git a/website/client/src/components/groups/inviteModal.vue b/website/client/src/components/groups/inviteModal.vue
index 30e43079ec..ac9926309e 100644
--- a/website/client/src/components/groups/inviteModal.vue
+++ b/website/client/src/components/groups/inviteModal.vue
@@ -90,111 +90,103 @@
diff --git a/website/client/src/components/groups/membersModal.vue b/website/client/src/components/groups/membersModal.vue
index 73e10b0640..377395b0a3 100644
--- a/website/client/src/components/groups/membersModal.vue
+++ b/website/client/src/components/groups/membersModal.vue
@@ -214,11 +214,11 @@ import starIcon from '@/assets/members/star.svg';
import dots from '@/assets/svg/dots.svg';
export default {
- props: ['hideBadge'],
components: {
MemberDetails,
removeMemberModal,
},
+ props: ['hideBadge'],
data () {
return {
sortOption: {},
@@ -278,7 +278,7 @@ export default {
};
},
mounted () {
- this.$root.$on('habitica:show-member-modal', (data) => {
+ this.$root.$on('habitica:show-member-modal', data => {
// @TODO: Remove store
this.$store.state.memberModalOptions.challengeId = data.challengeId;
this.$store.state.memberModalOptions.groupId = data.groupId;
@@ -294,7 +294,7 @@ export default {
this.$root.$off('habitica:show-member-modal');
},
computed: {
- ...mapState({user: 'user.data'}),
+ ...mapState({ user: 'user.data' }),
isLeader () {
if (!this.group || !this.group.leader) return false;
return this.user._id === this.group.leader || this.user._id === this.group.leader._id;
@@ -370,10 +370,10 @@ export default {
});
},
async getMembers () {
- let groupId = this.groupId;
+ const { groupId } = this;
if (groupId && groupId !== 'challenge') {
- let invites = await this.$store.dispatch('members:getGroupInvites', {
+ const invites = await this.$store.dispatch('members:getGroupInvites', {
groupId,
includeAllPublicFields: true,
});
@@ -383,7 +383,7 @@ export default {
this.members = this.$store.state.memberModalOptions.viewingMembers;
},
async clickMember (uid, forceShow) {
- let user = this.$store.state.user.data;
+ const user = this.$store.state.user.data;
if (user._id === uid && !forceShow) {
if (this.$route.name === 'tasks') {
@@ -409,7 +409,7 @@ export default {
memberRemoved () {
this.members.splice(this.memberToRemove.index, 1);
this.group.memberCount -= 1;
- this.memberToRemove = {};
+ this.memberToRemove = {};
},
async quickReply (uid) {
this.memberToReply = uid;
@@ -459,7 +459,7 @@ export default {
const lastMember = this.members[this.members.length - 1];
if (!lastMember) return;
- let newMembers = await this.$store.state.memberModalOptions.fetchMoreMembers({
+ const newMembers = await this.$store.state.memberModalOptions.fetchMoreMembers({
challengeId: this.challengeId,
groupId: this.groupId,
lastMemberId: lastMember._id,
@@ -483,10 +483,10 @@ export default {
this.viewMembers();
},
async promoteToLeader (member) {
- let groupData = Object.assign({}, this.group);
+ const groupData = { ...this.group };
groupData.leader = member._id;
- await this.$store.dispatch('guilds:update', {group: groupData});
+ await this.$store.dispatch('guilds:update', { group: groupData });
alert(this.$t('leaderChanged'));
diff --git a/website/client/src/components/groups/myGuilds.vue b/website/client/src/components/groups/myGuilds.vue
index dbe5eda3c0..83c3d6e983 100644
--- a/website/client/src/components/groups/myGuilds.vue
+++ b/website/client/src/components/groups/myGuilds.vue
@@ -61,10 +61,10 @@
\ No newline at end of file
+
diff --git a/website/client/src/components/groups/publicGuildItem.vue b/website/client/src/components/groups/publicGuildItem.vue
index c732f63ecf..f6f3a2d53d 100644
--- a/website/client/src/components/groups/publicGuildItem.vue
+++ b/website/client/src/components/groups/publicGuildItem.vue
@@ -144,16 +144,16 @@ import bronzeGuildBadgeIcon from '@/assets/svg/bronze-guild-badge-large.svg';
import { MAX_SUMMARY_SIZE_FOR_GUILDS } from '@/../../common/script/constants';
export default {
- mixins: [groupUtilities],
directives: {
markdown,
},
- props: ['guild', 'displayLeave', 'displayGemBank'],
components: {
categoryTags,
},
+ mixins: [groupUtilities],
+ props: ['guild', 'displayLeave', 'displayGemBank'],
computed: {
- ...mapState({user: 'user.data'}),
+ ...mapState({ user: 'user.data' }),
isOwner () {
return this.guild.leader && this.guild.leader === this.user._id;
},
@@ -174,9 +174,9 @@ export default {
},
methods: {
showSuggested (guildId) {
- let habiticaHelpingGuildId = '5481ccf3-5d2d-48a9-a871-70a7380cee5a';
- let sixtyDaysAgoFromNow = moment().subtract(60, 'days');
- let isUserNew = moment(this.user.auth.timestamps.created).isAfter(sixtyDaysAgoFromNow);
+ const habiticaHelpingGuildId = '5481ccf3-5d2d-48a9-a871-70a7380cee5a';
+ const sixtyDaysAgoFromNow = moment().subtract(60, 'days');
+ const isUserNew = moment(this.user.auth.timestamps.created).isAfter(sixtyDaysAgoFromNow);
return guildId === habiticaHelpingGuildId && isUserNew;
},
async join () {
@@ -184,11 +184,11 @@ export default {
if (this.guild.cancelledPlan && !confirm(window.env.t('aboutToJoinCancelledGroupPlan'))) {
return;
}
- await this.$store.dispatch('guilds:join', {groupId: this.guild._id, type: 'guild'});
+ await this.$store.dispatch('guilds:join', { groupId: this.guild._id, type: 'guild' });
},
async leave () {
// @TODO: ask about challenges when we add challenges
- await this.$store.dispatch('guilds:leave', {groupId: this.guild._id, type: 'myGuilds'});
+ await this.$store.dispatch('guilds:leave', { groupId: this.guild._id, type: 'myGuilds' });
},
},
};
diff --git a/website/client/src/components/groups/questDetailsModal.vue b/website/client/src/components/groups/questDetailsModal.vue
index bc85d5a9d5..e442548f1e 100644
--- a/website/client/src/components/groups/questDetailsModal.vue
+++ b/website/client/src/components/groups/questDetailsModal.vue
@@ -149,11 +149,11 @@ import questDialogDrops from '../shops/quests/questDialogDrops';
import questDialogContent from '../shops/quests/questDialogContent';
export default {
- props: ['group'],
components: {
questDialogDrops,
questDialogContent,
},
+ props: ['group'],
data () {
return {
loading: false,
@@ -181,38 +181,36 @@ export default {
return quests.quests[this.group.quest.key];
},
members () {
- let partyMembers = this.partyMembers || [];
- return partyMembers.map(member => {
- return {
- name: member.profile.name,
- accepted: this.group.quest.members[member._id],
- };
- });
+ const partyMembers = this.partyMembers || [];
+ return partyMembers.map(member => ({
+ name: member.profile.name,
+ accepted: this.group.quest.members[member._id],
+ }));
},
canEditQuest () {
if (!this.group.quest) return false;
- let isQuestLeader = this.group.quest.leader === this.user._id;
- let isPartyLeader = this.group.leader._id === this.user._id;
+ const isQuestLeader = this.group.quest.leader === this.user._id;
+ const isPartyLeader = this.group.leader._id === this.user._id;
return isQuestLeader || isPartyLeader;
},
},
methods: {
async questConfirm () {
let count = 0;
- for (let uuid in this.group.quest.members) {
+ for (const uuid in this.group.quest.members) {
if (this.group.quest.members[uuid]) count += 1;
}
- if (!confirm(this.$t('questConfirm', { questmembers: count, totalmembers: this.group.memberCount}))) return;
+ if (!confirm(this.$t('questConfirm', { questmembers: count, totalmembers: this.group.memberCount }))) return;
this.questForceStart();
},
async questForceStart () {
- let quest = await this.$store.dispatch('quests:sendAction', {groupId: this.group._id, action: 'quests/force-start'});
+ const quest = await this.$store.dispatch('quests:sendAction', { groupId: this.group._id, action: 'quests/force-start' });
this.group.quest = quest;
this.close();
},
async questCancel () {
if (!confirm(this.$t('sureCancel'))) return;
- let quest = await this.$store.dispatch('quests:sendAction', {groupId: this.group._id, action: 'quests/cancel'});
+ const quest = await this.$store.dispatch('quests:sendAction', { groupId: this.group._id, action: 'quests/cancel' });
this.group.quest = quest;
this.close();
},
diff --git a/website/client/src/components/groups/questSidebarSection.vue b/website/client/src/components/groups/questSidebarSection.vue
index 11351e2267..fe6868cebf 100644
--- a/website/client/src/components/groups/questSidebarSection.vue
+++ b/website/client/src/components/groups/questSidebarSection.vue
@@ -198,10 +198,10 @@ import sidebarSection from '../sidebarSection';
import questIcon from '@/assets/svg/quest.svg';
export default {
- props: ['group'],
components: {
sidebarSection,
},
+ props: ['group'],
data () {
return {
icons: Object.freeze({
@@ -210,7 +210,7 @@ export default {
};
},
computed: {
- ...mapState({user: 'user.data'}),
+ ...mapState({ user: 'user.data' }),
userIsOnQuest () {
if (!this.group.quest || !this.group.quest.members) return false;
return Boolean(this.group.quest.members[this.user._id]);
@@ -230,20 +230,20 @@ export default {
},
canEditQuest () {
if (!this.group.quest) return false;
- let isQuestLeader = this.group.quest.leader === this.user._id;
- let isPartyLeader = this.group.leader._id === this.user._id;
+ const isQuestLeader = this.group.quest.leader === this.user._id;
+ const isPartyLeader = this.group.leader._id === this.user._id;
return isQuestLeader || isPartyLeader;
},
isMemberOfPendingQuest () {
- let userid = this.user._id;
- let group = this.group;
+ const userid = this.user._id;
+ const { group } = this;
if (!group.quest || !group.quest.members) return false;
if (group.quest.active) return false; // quest is started, not pending
return userid in group.quest.members && group.quest.members[userid] !== false;
},
isMemberOfRunningQuest () {
- let userid = this.user._id;
- let group = this.group;
+ const userid = this.user._id;
+ const { group } = this;
if (!group.quest || !group.quest.members) return false;
if (!group.quest.active) return false; // quest is pending, not started
return group.quest.members[userid];
@@ -253,7 +253,7 @@ export default {
if (!this.group || !this.group.quest) return count;
- for (let uuid in this.group.quest.members) {
+ for (const uuid in this.group.quest.members) {
if (this.group.quest.members[uuid]) count += 1;
}
@@ -273,20 +273,20 @@ export default {
async questAbort () {
if (!confirm(this.$t('sureAbort'))) return;
if (!confirm(this.$t('doubleSureAbort'))) return;
- let quest = await this.$store.dispatch('quests:sendAction', {groupId: this.group._id, action: 'quests/abort'});
+ const quest = await this.$store.dispatch('quests:sendAction', { groupId: this.group._id, action: 'quests/abort' });
this.group.quest = quest;
},
async questLeave () {
if (!confirm(this.$t('sureLeave'))) return;
- let quest = await this.$store.dispatch('quests:sendAction', {groupId: this.group._id, action: 'quests/leave'});
+ const quest = await this.$store.dispatch('quests:sendAction', { groupId: this.group._id, action: 'quests/leave' });
this.group.quest = quest;
},
async questAccept (partyId) {
- let quest = await this.$store.dispatch('quests:sendAction', {groupId: partyId, action: 'quests/accept'});
+ const quest = await this.$store.dispatch('quests:sendAction', { groupId: partyId, action: 'quests/accept' });
this.user.party.quest = quest;
},
async questReject (partyId) {
- let quest = await this.$store.dispatch('quests:sendAction', {groupId: partyId, action: 'quests/reject'});
+ const quest = await this.$store.dispatch('quests:sendAction', { groupId: partyId, action: 'quests/reject' });
this.user.party.quest = quest;
},
},
diff --git a/website/client/src/components/groups/startQuestModal.vue b/website/client/src/components/groups/startQuestModal.vue
index a119708d3a..c310dd4e86 100644
--- a/website/client/src/components/groups/startQuestModal.vue
+++ b/website/client/src/components/groups/startQuestModal.vue
@@ -123,12 +123,12 @@ import questDialogContent from '../shops/quests/questDialogContent';
import QuestInfo from '../shops/quests/questInfo';
export default {
- props: ['group'],
components: {
questDialogDrops,
questDialogContent,
QuestInfo,
},
+ props: ['group'],
data () {
return {
loading: false,
@@ -162,7 +162,7 @@ export default {
this.$root.$off('selectQuest', this.selectQuest);
},
computed: {
- ...mapState({user: 'user.data'}),
+ ...mapState({ user: 'user.data' }),
questData () {
return quests.quests[this.selectedQuest];
},
@@ -179,11 +179,11 @@ export default {
partySize: this.group.memberCount,
});
- let groupId = this.group._id || this.user.party._id;
+ const groupId = this.group._id || this.user.party._id;
const key = this.selectedQuest;
try {
- const response = await this.$store.dispatch('guilds:inviteToQuest', {groupId, key});
+ const response = await this.$store.dispatch('guilds:inviteToQuest', { groupId, key });
const quest = response.data.data;
if (this.$store.state.party.data) this.$store.state.party.data.quest = quest;
diff --git a/website/client/src/components/groups/tavern.vue b/website/client/src/components/groups/tavern.vue
index 107033079e..b2c2aae514 100644
--- a/website/client/src/components/groups/tavern.vue
+++ b/website/client/src/components/groups/tavern.vue
@@ -501,14 +501,14 @@ export default {
};
},
computed: {
- ...mapState({user: 'user.data'}),
+ ...mapState({ user: 'user.data' }),
questData () {
if (!this.group.quest) return {};
return quests.quests[this.group.quest.key];
},
},
async mounted () {
- this.group = await this.$store.dispatch('guilds:getGroup', {groupId: TAVERN_ID});
+ this.group = await this.$store.dispatch('guilds:getGroup', { groupId: TAVERN_ID });
},
methods: {
modForm () {
@@ -543,7 +543,7 @@ export default {
}
},
async fetchRecentMessages () {
- this.group = await this.$store.dispatch('guilds:getGroup', {groupId: TAVERN_ID});
+ this.group = await this.$store.dispatch('guilds:getGroup', { groupId: TAVERN_ID });
},
},
};
diff --git a/website/client/src/components/hall/heroes.vue b/website/client/src/components/hall/heroes.vue
index b6a1d7faef..6b24194483 100644
--- a/website/client/src/components/hall/heroes.vue
+++ b/website/client/src/components/hall/heroes.vue
@@ -119,10 +119,13 @@ import notifications from '@/mixins/notifications';
import userLink from '../userLink';
export default {
- mixins: [notifications, styleHelper],
components: {
userLink,
},
+ directives: {
+ markdown: markdownDirective,
+ },
+ mixins: [notifications, styleHelper],
data () {
return {
heroes: [],
@@ -141,14 +144,11 @@ export default {
expandAuth: false,
};
},
- directives: {
- markdown: markdownDirective,
- },
async mounted () {
this.heroes = await this.$store.dispatch('hall:getHeroes');
},
computed: {
- ...mapState({user: 'user.data'}),
+ ...mapState({ user: 'user.data' }),
},
methods: {
getAllItemPaths () {
@@ -172,7 +172,7 @@ export default {
getFormattedItemReference (pathPrefix, itemKeys, values) {
let finishedString = '\n'.concat('path: ', pathPrefix, ', ', 'value: {', values, '}\n');
- each(itemKeys, (key) => {
+ each(itemKeys, key => {
finishedString = finishedString.concat('\t', pathPrefix, '.', key, '\n');
});
@@ -180,8 +180,8 @@ export default {
},
async loadHero (uuid, heroIndex) {
this.currentHeroIndex = heroIndex;
- let hero = await this.$store.dispatch('hall:getHero', { uuid });
- this.hero = Object.assign({}, hero);
+ const hero = await this.$store.dispatch('hall:getHero', { uuid });
+ this.hero = { ...hero };
if (!this.hero.flags) {
this.hero.flags = {
chatRevoked: false,
@@ -192,8 +192,8 @@ export default {
this.expandAuth = false;
},
async saveHero () {
- this.hero.contributor.admin = this.hero.contributor.level > 7 ? true : false;
- let heroUpdated = await this.$store.dispatch('hall:updateHero', { heroDetails: this.hero });
+ this.hero.contributor.admin = this.hero.contributor.level > 7;
+ const heroUpdated = await this.$store.dispatch('hall:updateHero', { heroDetails: this.hero });
this.text('User updated');
this.hero = {};
this.heroID = -1;
diff --git a/website/client/src/components/hall/patrons.vue b/website/client/src/components/hall/patrons.vue
index 2a6a954802..ec090b9077 100644
--- a/website/client/src/components/hall/patrons.vue
+++ b/website/client/src/components/hall/patrons.vue
@@ -32,7 +32,7 @@ export default {
this.patrons = await this.$store.dispatch('hall:getPatrons', { page: 0 });
},
computed: {
- ...mapState({user: 'user.data'}),
+ ...mapState({ user: 'user.data' }),
},
methods: {
// @TODO: Import member modal - clickMember()
diff --git a/website/client/src/components/header/index.vue b/website/client/src/components/header/index.vue
index 9c709773c4..3104b679ff 100644
--- a/website/client/src/components/header/index.vue
+++ b/website/client/src/components/header/index.vue
@@ -178,7 +178,7 @@ export default {
}
},
mounted () {
- this.$root.$on('inviteModal::inviteToGroup', (group) => {
+ this.$root.$on('inviteModal::inviteToGroup', group => {
this.inviteModalGroup = group;
this.inviteModalGroupType = group.type === 'guild' ? 'Guild' : 'Party';
this.$root.$emit('bv::show::modal', 'invite-modal');
diff --git a/website/client/src/components/header/menu.vue b/website/client/src/components/header/menu.vue
index fc3c18f04a..d8f3064028 100644
--- a/website/client/src/components/header/menu.vue
+++ b/website/client/src/components/header/menu.vue
@@ -488,7 +488,7 @@ export default {
eventLabel: 'Gems > Toolbar',
});
- this.$root.$emit('bv::show::modal', 'buy-gems', {alreadyTracked: true});
+ this.$root.$emit('bv::show::modal', 'buy-gems', { alreadyTracked: true });
},
dropdownDesktop (hover) {
if (this.isDesktop() && hover.target.classList.contains('droppable')) {
@@ -499,7 +499,7 @@ export default {
this.dropdown(click.currentTarget.parentElement);
},
dropdown (element) {
- let droppedElement = document.getElementsByClassName('down')[0];
+ const droppedElement = document.getElementsByClassName('down')[0];
if (droppedElement && droppedElement !== element) {
droppedElement.classList.remove('down');
if (droppedElement.lastChild) {
diff --git a/website/client/src/components/header/messageCount.vue b/website/client/src/components/header/messageCount.vue
index 93c307eecb..b8673b0524 100644
--- a/website/client/src/components/header/messageCount.vue
+++ b/website/client/src/components/header/messageCount.vue
@@ -30,4 +30,4 @@ span.message-count(
.message-count.top-count-gray {
background-color: $gray-200;
}
-
\ No newline at end of file
+
diff --git a/website/client/src/components/header/notifications/base.vue b/website/client/src/components/header/notifications/base.vue
index 30305f0953..7a5bbec0cd 100644
--- a/website/client/src/components/header/notifications/base.vue
+++ b/website/client/src/components/header/notifications/base.vue
@@ -11,7 +11,7 @@
slot(name="content")
.notification-remove(@click.stop="canRemove ? remove() : null",)
.svg-icon(
- v-if="canRemove",
+ v-if="canRemove",
v-html="icons.close",
)
@@ -130,7 +130,7 @@ export default {
};
},
computed: {
- ...mapState({user: 'user.data'}),
+ ...mapState({ user: 'user.data' }),
isNotBailey () {
return this.notification.type !== 'NEW_STUFF';
},
@@ -141,7 +141,7 @@ export default {
}),
clicked () {
if (this.readAfterClick === true) {
- this.readNotification({notificationId: this.notification.id});
+ this.readNotification({ notificationId: this.notification.id });
}
this.$emit('click');
@@ -149,14 +149,14 @@ export default {
remove () {
if (this.notification.type === 'NEW_CHAT_MESSAGE') {
const groupId = this.notification.data.group.id;
- this.$store.dispatch('chat:markChatSeen', {groupId});
+ this.$store.dispatch('chat:markChatSeen', { groupId });
if (this.user.newMessages[groupId]) {
this.$delete(this.user.newMessages, groupId);
}
} else {
- this.readNotification({notificationId: this.notification.id});
+ this.readNotification({ notificationId: this.notification.id });
}
},
},
};
-
\ No newline at end of file
+
diff --git a/website/client/src/components/header/notifications/cardReceived.vue b/website/client/src/components/header/notifications/cardReceived.vue
index 0762f6e09a..f7c2351cdf 100644
--- a/website/client/src/components/header/notifications/cardReceived.vue
+++ b/website/client/src/components/header/notifications/cardReceived.vue
@@ -14,10 +14,10 @@ base-notification(
import BaseNotification from './base';
export default {
- props: ['notification', 'canRemove'],
components: {
BaseNotification,
},
+ props: ['notification', 'canRemove'],
computed: {
cardString () {
return this.$t(`${this.notification.data.card}Card`);
@@ -28,8 +28,8 @@ export default {
},
methods: {
action () {
- this.$router.push({name: 'items'});
+ this.$router.push({ name: 'items' });
},
},
};
-
\ No newline at end of file
+
diff --git a/website/client/src/components/header/notifications/challengeInvitation.vue b/website/client/src/components/header/notifications/challengeInvitation.vue
index 97083da552..852a0425c5 100644
--- a/website/client/src/components/header/notifications/challengeInvitation.vue
+++ b/website/client/src/components/header/notifications/challengeInvitation.vue
@@ -1,3 +1,3 @@
div {{ props.notification }}
-
\ No newline at end of file
+
diff --git a/website/client/src/components/header/notifications/groupTaskApproval.vue b/website/client/src/components/header/notifications/groupTaskApproval.vue
index cbc5295c98..2b378c410b 100644
--- a/website/client/src/components/header/notifications/groupTaskApproval.vue
+++ b/website/client/src/components/header/notifications/groupTaskApproval.vue
@@ -18,13 +18,13 @@ import { mapState } from '@/libs/store';
import sync from '@/mixins/sync';
export default {
- mixins: [sync],
- props: ['notification', 'canRemove'],
components: {
BaseNotification,
},
+ mixins: [sync],
+ props: ['notification', 'canRemove'],
computed: {
- ...mapState({user: 'user.data'}),
+ ...mapState({ user: 'user.data' }),
// Check that the notification has all the necessary data (old ones are missing some fields)
notificationHasData () {
return Boolean(this.notification.data.groupTaskId && this.notification.data.userId);
@@ -33,14 +33,17 @@ export default {
methods: {
action () {
const groupId = this.notification.data.group.id;
- this.$router.push({ name: 'groupPlanDetailTaskInformation', params: { groupId }});
+ this.$router.push({ name: 'groupPlanDetailTaskInformation', params: { groupId } });
},
async approve () {
// Redirect users to the group tasks page if the notification doesn't have data
if (!this.notificationHasData) {
- this.$router.push({ name: 'groupPlanDetailTaskInformation', params: {
- groupId: this.notification.data.groupId,
- }});
+ this.$router.push({
+ name: 'groupPlanDetailTaskInformation',
+ params: {
+ groupId: this.notification.data.groupId,
+ },
+ });
return;
}
@@ -55,9 +58,12 @@ export default {
async needsWork () {
// Redirect users to the group tasks page if the notification doesn't have data
if (!this.notificationHasData) {
- this.$router.push({ name: 'groupPlanDetailTaskInformation', params: {
- groupId: this.notification.data.groupId,
- }});
+ this.$router.push({
+ name: 'groupPlanDetailTaskInformation',
+ params: {
+ groupId: this.notification.data.groupId,
+ },
+ });
return;
}
diff --git a/website/client/src/components/header/notifications/groupTaskApproved.vue b/website/client/src/components/header/notifications/groupTaskApproved.vue
index 35982f3ef9..bbd6000e36 100644
--- a/website/client/src/components/header/notifications/groupTaskApproved.vue
+++ b/website/client/src/components/header/notifications/groupTaskApproved.vue
@@ -13,15 +13,15 @@ base-notification(
import BaseNotification from './base';
export default {
- props: ['notification', 'canRemove'],
components: {
BaseNotification,
},
+ props: ['notification', 'canRemove'],
methods: {
action () {
- const groupId = this.notification.data.groupId;
- this.$router.push({ name: 'groupPlanDetailTaskInformation', params: { groupId }});
+ const { groupId } = this.notification.data;
+ this.$router.push({ name: 'groupPlanDetailTaskInformation', params: { groupId } });
},
},
};
-
\ No newline at end of file
+
diff --git a/website/client/src/components/header/notifications/groupTaskAssigned.vue b/website/client/src/components/header/notifications/groupTaskAssigned.vue
index 5916ba27a6..7d1fc32bad 100644
--- a/website/client/src/components/header/notifications/groupTaskAssigned.vue
+++ b/website/client/src/components/header/notifications/groupTaskAssigned.vue
@@ -10,17 +10,17 @@
diff --git a/website/client/src/components/header/notifications/groupTaskClaimed.vue b/website/client/src/components/header/notifications/groupTaskClaimed.vue
index 508177dbb2..e3768668d6 100644
--- a/website/client/src/components/header/notifications/groupTaskClaimed.vue
+++ b/website/client/src/components/header/notifications/groupTaskClaimed.vue
@@ -13,14 +13,14 @@ base-notification(
import BaseNotification from './base';
export default {
- props: ['notification', 'canRemove'],
components: {
BaseNotification,
},
+ props: ['notification', 'canRemove'],
methods: {
action () {
- const groupId = this.notification.data.groupId;
- this.$router.push({ name: 'groupPlanDetailTaskInformation', params: { groupId }});
+ const { groupId } = this.notification.data;
+ this.$router.push({ name: 'groupPlanDetailTaskInformation', params: { groupId } });
},
},
};
diff --git a/website/client/src/components/header/notifications/groupTaskNeedsWork.vue b/website/client/src/components/header/notifications/groupTaskNeedsWork.vue
index 068e479f72..45175bead8 100644
--- a/website/client/src/components/header/notifications/groupTaskNeedsWork.vue
+++ b/website/client/src/components/header/notifications/groupTaskNeedsWork.vue
@@ -13,15 +13,15 @@ base-notification(
import BaseNotification from './base';
export default {
- props: ['notification', 'canRemove'],
components: {
BaseNotification,
},
+ props: ['notification', 'canRemove'],
methods: {
action () {
const groupId = this.notification.data.group.id;
- this.$router.push({ name: 'groupPlanDetailTaskInformation', params: { groupId }});
+ this.$router.push({ name: 'groupPlanDetailTaskInformation', params: { groupId } });
},
},
};
-
\ No newline at end of file
+
diff --git a/website/client/src/components/header/notifications/guildInvitation.vue b/website/client/src/components/header/notifications/guildInvitation.vue
index c140e7de86..1ac067d926 100644
--- a/website/client/src/components/header/notifications/guildInvitation.vue
+++ b/website/client/src/components/header/notifications/guildInvitation.vue
@@ -17,12 +17,12 @@ import BaseNotification from './base';
import { mapState } from '@/libs/store';
export default {
- props: ['notification', 'canRemove'],
components: {
BaseNotification,
},
+ props: ['notification', 'canRemove'],
computed: {
- ...mapState({user: 'user.data'}),
+ ...mapState({ user: 'user.data' }),
isPublicGuild () {
if (this.notification.data.publicGuild === true) return true;
return false;
@@ -31,10 +31,9 @@ export default {
const guild = this.notification.data.name;
if (this.isPublicGuild) {
- return this.$t('invitedToPublicGuild', {guild});
- } else {
- return this.$t('invitedToPrivateGuild', {guild});
+ return this.$t('invitedToPublicGuild', { guild });
}
+ return this.$t('invitedToPrivateGuild', { guild });
},
},
methods: {
@@ -52,11 +51,11 @@ export default {
return;
}
- await this.$store.dispatch('guilds:join', {groupId: group.id, type: 'guild'});
+ await this.$store.dispatch('guilds:join', { groupId: group.id, type: 'guild' });
this.$router.push({ name: 'guild', params: { groupId: group.id } });
},
reject () {
- this.$store.dispatch('guilds:rejectInvite', {groupId: this.notification.data.id, type: 'guild'});
+ this.$store.dispatch('guilds:rejectInvite', { groupId: this.notification.data.id, type: 'guild' });
},
},
diff --git a/website/client/src/components/header/notifications/justAddWater.vue b/website/client/src/components/header/notifications/justAddWater.vue
index 9889b28cc4..81a2b0e3d5 100644
--- a/website/client/src/components/header/notifications/justAddWater.vue
+++ b/website/client/src/components/header/notifications/justAddWater.vue
@@ -9,22 +9,22 @@
diff --git a/website/client/src/components/header/notifications/lostMasterclasser.vue b/website/client/src/components/header/notifications/lostMasterclasser.vue
index c72aa02d3e..9c76589cfb 100644
--- a/website/client/src/components/header/notifications/lostMasterclasser.vue
+++ b/website/client/src/components/header/notifications/lostMasterclasser.vue
@@ -9,22 +9,22 @@
diff --git a/website/client/src/components/header/notifications/mindOverMatter.vue b/website/client/src/components/header/notifications/mindOverMatter.vue
index 9044a25a91..a294475b36 100644
--- a/website/client/src/components/header/notifications/mindOverMatter.vue
+++ b/website/client/src/components/header/notifications/mindOverMatter.vue
@@ -9,22 +9,22 @@
diff --git a/website/client/src/components/header/notifications/newChatMessage.vue b/website/client/src/components/header/notifications/newChatMessage.vue
index 3d55485d33..558033fa01 100644
--- a/website/client/src/components/header/notifications/newChatMessage.vue
+++ b/website/client/src/components/header/notifications/newChatMessage.vue
@@ -15,12 +15,12 @@ import BaseNotification from './base';
import { mapState } from '@/libs/store';
export default {
- props: ['notification', 'canRemove'],
components: {
BaseNotification,
},
+ props: ['notification', 'canRemove'],
computed: {
- ...mapState({user: 'user.data'}),
+ ...mapState({ user: 'user.data' }),
groupId () {
return this.notification.data.group.id;
},
@@ -29,7 +29,7 @@ export default {
},
string () {
const stringKey = this.isParty ? 'newMsgParty' : 'newMsgGuild';
- return this.$t(stringKey, {name: this.notification.data.group.name});
+ return this.$t(stringKey, { name: this.notification.data.group.name });
},
},
methods: {
@@ -39,8 +39,8 @@ export default {
return;
}
- this.$router.push({ name: 'guild', params: { groupId: this.groupId }});
+ this.$router.push({ name: 'guild', params: { groupId: this.groupId } });
},
},
};
-
\ No newline at end of file
+
diff --git a/website/client/src/components/header/notifications/newInboxMessage.vue b/website/client/src/components/header/notifications/newInboxMessage.vue
index 05f76b2f15..3ee3ec4f3b 100644
--- a/website/client/src/components/header/notifications/newInboxMessage.vue
+++ b/website/client/src/components/header/notifications/newInboxMessage.vue
@@ -15,14 +15,14 @@ base-notification(
import BaseNotification from './base';
export default {
- props: ['notification', 'canRemove'],
components: {
BaseNotification,
},
+ props: ['notification', 'canRemove'],
methods: {
action () {
this.$root.$emit('bv::show::modal', 'inbox-modal');
},
},
};
-
\ No newline at end of file
+
diff --git a/website/client/src/components/header/notifications/newMysteryItems.vue b/website/client/src/components/header/notifications/newMysteryItems.vue
index 763b848b11..1202daaca6 100644
--- a/website/client/src/components/header/notifications/newMysteryItems.vue
+++ b/website/client/src/components/header/notifications/newMysteryItems.vue
@@ -11,14 +11,14 @@ base-notification(
\ No newline at end of file
+
diff --git a/website/client/src/components/header/notifications/newStuff.vue b/website/client/src/components/header/notifications/newStuff.vue
index a479748413..bc919fb5d0 100644
--- a/website/client/src/components/header/notifications/newStuff.vue
+++ b/website/client/src/components/header/notifications/newStuff.vue
@@ -16,14 +16,14 @@ base-notification(
import BaseNotification from './base';
export default {
- props: ['notification', 'canRemove'],
components: {
BaseNotification,
},
+ props: ['notification', 'canRemove'],
methods: {
action () {
this.$root.$emit('bv::show::modal', 'new-stuff');
},
},
};
-
\ No newline at end of file
+
diff --git a/website/client/src/components/header/notifications/partyInvitation.vue b/website/client/src/components/header/notifications/partyInvitation.vue
index 1d3e93490f..8cbaf45e78 100644
--- a/website/client/src/components/header/notifications/partyInvitation.vue
+++ b/website/client/src/components/header/notifications/partyInvitation.vue
@@ -16,12 +16,12 @@ import BaseNotification from './base';
import { mapState } from '@/libs/store';
export default {
- props: ['notification', 'canRemove'],
components: {
BaseNotification,
},
+ props: ['notification', 'canRemove'],
computed: {
- ...mapState({user: 'user.data'}),
+ ...mapState({ user: 'user.data' }),
},
methods: {
async accept () {
@@ -31,12 +31,12 @@ export default {
return;
}
- await this.$store.dispatch('guilds:join', {groupId: group.id, type: 'party'});
+ await this.$store.dispatch('guilds:join', { groupId: group.id, type: 'party' });
this.$router.push('/party');
},
reject () {
- this.$store.dispatch('guilds:rejectInvite', {groupId: this.notification.data.id, type: 'party'});
+ this.$store.dispatch('guilds:rejectInvite', { groupId: this.notification.data.id, type: 'party' });
},
},
};
-
\ No newline at end of file
+
diff --git a/website/client/src/components/header/notifications/questInvitation.vue b/website/client/src/components/header/notifications/questInvitation.vue
index 16f036e591..bc67a538e7 100644
--- a/website/client/src/components/header/notifications/questInvitation.vue
+++ b/website/client/src/components/header/notifications/questInvitation.vue
@@ -26,13 +26,13 @@ import * as quests from '@/../../common/script/content/quests';
import questInfo from '@/components/shops/quests/questInfo';
export default {
- props: ['notification', 'canRemove'],
components: {
BaseNotification,
questInfo,
},
+ props: ['notification', 'canRemove'],
computed: {
- ...mapState({user: 'user.data'}),
+ ...mapState({ user: 'user.data' }),
questData () {
return quests.quests[this.notification.data.quest];
},
diff --git a/website/client/src/components/header/notifications/unallocatedStatsPoints.vue b/website/client/src/components/header/notifications/unallocatedStatsPoints.vue
index 455f1d4e81..203c4727d4 100644
--- a/website/client/src/components/header/notifications/unallocatedStatsPoints.vue
+++ b/website/client/src/components/header/notifications/unallocatedStatsPoints.vue
@@ -22,6 +22,9 @@ import BaseNotification from './base';
import sparklesIcon from '@/assets/svg/sparkles.svg';
export default {
+ components: {
+ BaseNotification,
+ },
props: ['notification', 'canRemove'],
data () {
return {
@@ -30,12 +33,9 @@ export default {
}),
};
},
- components: {
- BaseNotification,
- },
methods: {
action () {
- this.$router.push({name: 'stats'});
+ this.$router.push({ name: 'stats' });
},
},
};
diff --git a/website/client/src/components/header/notifications/verifyUsername.vue b/website/client/src/components/header/notifications/verifyUsername.vue
index e127250ada..aec3a35e80 100644
--- a/website/client/src/components/header/notifications/verifyUsername.vue
+++ b/website/client/src/components/header/notifications/verifyUsername.vue
@@ -46,29 +46,29 @@
diff --git a/website/client/src/components/header/notifications/worldBoss.vue b/website/client/src/components/header/notifications/worldBoss.vue
index eb33bcc0ec..11f96612e4 100644
--- a/website/client/src/components/header/notifications/worldBoss.vue
+++ b/website/client/src/components/header/notifications/worldBoss.vue
@@ -163,7 +163,7 @@ export default {
this.worldBoss = result.worldBoss;
},
computed: {
- ...mapState({user: 'user.data'}),
+ ...mapState({ user: 'user.data' }),
bossHp () {
if (this.worldBoss && this.worldBoss.progress) {
return this.worldBoss.progress.hp;
@@ -173,7 +173,7 @@ export default {
},
methods: {
action () {
- this.$router.push({name: 'tavern'});
+ this.$router.push({ name: 'tavern' });
},
},
};
diff --git a/website/client/src/components/header/notificationsDropdown.vue b/website/client/src/components/header/notificationsDropdown.vue
index bc338aa559..74d410fe78 100644
--- a/website/client/src/components/header/notificationsDropdown.vue
+++ b/website/client/src/components/header/notificationsDropdown.vue
@@ -105,12 +105,24 @@ export default {
MenuDropdown,
MessageCount,
// One component for each type
- NEW_STUFF, GROUP_TASK_NEEDS_WORK,
- GUILD_INVITATION, PARTY_INVITATION, CHALLENGE_INVITATION,
- QUEST_INVITATION, GROUP_TASK_APPROVAL, GROUP_TASK_APPROVED, GROUP_TASK_ASSIGNED, GROUP_TASK_CLAIMED,
- UNALLOCATED_STATS_POINTS, NEW_MYSTERY_ITEMS, CARD_RECEIVED,
- NEW_INBOX_MESSAGE, NEW_CHAT_MESSAGE,
- ACHIEVEMENT_JUST_ADD_WATER, ACHIEVEMENT_LOST_MASTERCLASSER, ACHIEVEMENT_MIND_OVER_MATTER,
+ NEW_STUFF,
+ GROUP_TASK_NEEDS_WORK,
+ GUILD_INVITATION,
+ PARTY_INVITATION,
+ CHALLENGE_INVITATION,
+ QUEST_INVITATION,
+ GROUP_TASK_APPROVAL,
+ GROUP_TASK_APPROVED,
+ GROUP_TASK_ASSIGNED,
+ GROUP_TASK_CLAIMED,
+ UNALLOCATED_STATS_POINTS,
+ NEW_MYSTERY_ITEMS,
+ CARD_RECEIVED,
+ NEW_INBOX_MESSAGE,
+ NEW_CHAT_MESSAGE,
+ ACHIEVEMENT_JUST_ADD_WATER,
+ ACHIEVEMENT_LOST_MASTERCLASSER,
+ ACHIEVEMENT_MIND_OVER_MATTER,
WorldBoss: WORLD_BOSS,
VERIFY_USERNAME,
},
@@ -141,7 +153,7 @@ export default {
};
},
computed: {
- ...mapState({user: 'user.data'}),
+ ...mapState({ user: 'user.data' }),
notificationsOrder () {
// Returns a map of NOTIFICATION_TYPE -> POSITION
const orderMap = {};
@@ -157,24 +169,20 @@ export default {
const notifications = [];
// Parties invitations
- notifications.push(...this.user.invitations.parties.map(partyInvitation => {
- return {
- type: 'PARTY_INVITATION',
- data: partyInvitation,
- // Create a custom id for notifications outside user.notifications (must be unique)
- id: `custom-party-invitation-${partyInvitation.id}`,
- };
- }));
+ notifications.push(...this.user.invitations.parties.map(partyInvitation => ({
+ type: 'PARTY_INVITATION',
+ data: partyInvitation,
+ // Create a custom id for notifications outside user.notifications (must be unique)
+ id: `custom-party-invitation-${partyInvitation.id}`,
+ })));
// Guilds invitations
- notifications.push(...this.user.invitations.guilds.map(guildInvitation => {
- return {
- type: 'GUILD_INVITATION',
- data: guildInvitation,
- // Create a custom id for notifications outside user.notifications (must be unique)
- id: `custom-guild-invitation-${guildInvitation.id}`,
- };
- }));
+ notifications.push(...this.user.invitations.guilds.map(guildInvitation => ({
+ type: 'GUILD_INVITATION',
+ data: guildInvitation,
+ // Create a custom id for notifications outside user.notifications (must be unique)
+ id: `custom-guild-invitation-${guildInvitation.id}`,
+ })));
// Quest invitation
if (this.user.party.quest.RSVPNeeded === true) {
@@ -228,9 +236,7 @@ export default {
return this.notifications.length;
},
hasUnseenNotifications () {
- return this.notifications.some((notification) => {
- return notification.seen === false ? true : false;
- });
+ return this.notifications.some(notification => (notification.seen === false));
},
hasClass () {
return this.$store.getters['members:hasClass'](this.user);
@@ -257,7 +263,7 @@ export default {
}
}).filter(id => Boolean(id));
- if (idsToSee.length > 0) this.seeNotifications({notificationIds: idsToSee});
+ if (idsToSee.length > 0) this.seeNotifications({ notificationIds: idsToSee });
},
dismissAll () {
const idsToRead = this.notifications.map(notification => {
@@ -270,7 +276,7 @@ export default {
}).filter(id => Boolean(id));
this.openStatus = 0;
- if (idsToRead.length > 0) this.readNotifications({notificationIds: idsToRead});
+ if (idsToRead.length > 0) this.readNotifications({ notificationIds: idsToRead });
},
isActionable (notification) {
return this.actionableNotifications.indexOf(notification.type) !== -1;
diff --git a/website/client/src/components/header/userDropdown.vue b/website/client/src/components/header/userDropdown.vue
index 8e453cb8d5..372c3dbcb7 100644
--- a/website/client/src/components/header/userDropdown.vue
+++ b/website/client/src/components/header/userDropdown.vue
@@ -66,11 +66,11 @@ menu-dropdown.item-user(:right="true")
diff --git a/website/client/src/components/inventory/equipment/attributesPopover.vue b/website/client/src/components/inventory/equipment/attributesPopover.vue
index 2466800d42..0cefb75cbb 100644
--- a/website/client/src/components/inventory/equipment/attributesPopover.vue
+++ b/website/client/src/components/inventory/equipment/attributesPopover.vue
@@ -18,39 +18,37 @@ div
diff --git a/website/client/src/components/inventory/equipment/equipGearModal.vue b/website/client/src/components/inventory/equipment/equipGearModal.vue
index 6746cb27b4..d3c679399a 100644
--- a/website/client/src/components/inventory/equipment/equipGearModal.vue
+++ b/website/client/src/components/inventory/equipment/equipGearModal.vue
@@ -117,103 +117,100 @@
diff --git a/website/client/src/components/inventory/equipment/index.vue b/website/client/src/components/inventory/equipment/index.vue
index 27cf0cf25e..8a132d48b0 100644
--- a/website/client/src/components/inventory/equipment/index.vue
+++ b/website/client/src/components/inventory/equipment/index.vue
@@ -139,14 +139,14 @@
\ No newline at end of file
+
diff --git a/website/client/src/components/inventory/items/cards-modal.vue b/website/client/src/components/inventory/items/cards-modal.vue
index 44c2f22431..ec5ad2d32f 100644
--- a/website/client/src/components/inventory/items/cards-modal.vue
+++ b/website/client/src/components/inventory/items/cards-modal.vue
@@ -22,10 +22,10 @@ import { mapState } from '@/libs/store';
import markdown from '@/directives/markdown';
export default {
- props: ['cardOptions'],
directives: {
markdown,
},
+ props: ['cardOptions'],
computed: {
...mapState({
user: 'user.data',
@@ -41,13 +41,13 @@ export default {
return numberOfVariations;
},
cardMessage () {
- let random = Math.random() * this.numberOfVariations;
- let selection = Math.floor(random);
+ const random = Math.random() * this.numberOfVariations;
+ const selection = Math.floor(random);
return this.$t(`${this.cardType}${selection}`);
},
fromName () {
let fromName = '';
- let card = this.user.items.special[`${this.cardType}Received`];
+ const card = this.user.items.special[`${this.cardType}Received`];
if (card && card[0]) fromName = card[0];
return fromName;
},
diff --git a/website/client/src/components/inventory/items/index.vue b/website/client/src/components/inventory/items/index.vue
index 566dd277bf..4a8ef581f8 100644
--- a/website/client/src/components/inventory/items/index.vue
+++ b/website/client/src/components/inventory/items/index.vue
@@ -221,20 +221,17 @@ const groups = [
['food', 'Pet_Food_'],
['special', 'inventory_special_', allowedSpecialItems],
['quests', 'inventory_quest_scroll_'],
-].map(([group, classPrefix, allowedItems]) => {
- return {
- key: group,
- quantity: 0,
- selected: false,
- classPrefix,
- allowedItems,
- };
-});
+].map(([group, classPrefix, allowedItems]) => ({
+ key: group,
+ quantity: 0,
+ selected: false,
+ classPrefix,
+ allowedItems,
+}));
let lastMouseMoveEvent = {};
export default {
- mixins: [notifications],
name: 'Items',
components: {
Item,
@@ -249,6 +246,7 @@ export default {
drag: DragDropDirective,
mousePosition: MouseMoveDirective,
},
+ mixins: [notifications],
data () {
return {
searchText: null,
@@ -283,11 +281,11 @@ export default {
this.groups.forEach(group => {
const groupKey = group.key;
group.quantity = 0; // resetf the count
- let itemsArray = itemsByType[groupKey] = [];
+ const itemsArray = itemsByType[groupKey] = [];
const contentItems = this.content[groupKey];
each(this.user.items[groupKey], (itemQuantity, itemKey) => {
- let isAllowed = !group.allowedItems || group.allowedItems.indexOf(itemKey) !== -1;
+ const isAllowed = !group.allowedItems || group.allowedItems.indexOf(itemKey) !== -1;
if (itemQuantity > 0 && isAllowed) {
const item = contentItems[itemKey];
@@ -310,13 +308,12 @@ export default {
itemsArray.sort((a, b) => {
if (this.sortBy === 'quantity') {
return b.quantity - a.quantity;
- } else { // AZ
- return a.text.localeCompare(b.text);
- }
+ } // AZ
+ return a.text.localeCompare(b.text);
});
});
- let specialArray = itemsByType.special;
+ const specialArray = itemsByType.special;
specialArray.push({
key: 'mysteryItem',
@@ -325,14 +322,14 @@ export default {
quantity: this.user.purchased.plan.mysteryItems.length,
});
- for (let type in this.content.cardTypes) {
- let card = this.user.items.special[`${type}Received`] || [];
+ for (const type in this.content.cardTypes) {
+ const card = this.user.items.special[`${type}Received`] || [];
if (this.user.items.special[type] > 0 || card.length > 0) {
specialArray.push({
type: 'card',
key: type,
class: `inventory_special_${type}`,
- text: this.$t('toAndFromCard', { toName: this.user.profile.name, fromName: card[0]}),
+ text: this.$t('toAndFromCard', { toName: this.user.profile.name, fromName: card[0] }),
quantity: this.user.items.special[type],
});
}
@@ -347,15 +344,15 @@ export default {
},
methods: {
userHasPet (potionKey, eggKey) {
- let animalKey = `${eggKey}-${potionKey}`;
+ const animalKey = `${eggKey}-${potionKey}`;
- let result = this.user.items.pets[animalKey] > 0;
+ const result = this.user.items.pets[animalKey] > 0;
return result;
},
hatchPet (potion, egg) {
- this.$store.dispatch('common:hatch', {egg: egg.key, hatchingPotion: potion.key});
- this.text(this.$t('hatchedPet', {egg: egg.text, potion: potion.text}));
+ this.$store.dispatch('common:hatch', { egg: egg.key, hatchingPotion: potion.key });
+ this.text(this.$t('hatchedPet', { egg: egg.text, potion: potion.text }));
if (this.user.preferences.suppressModals.hatchPet) return;
const newPet = createAnimal(egg, potion, 'pet', this.content, this.user.items);
this.$root.$emit('hatchedPet::open', newPet);
@@ -367,23 +364,21 @@ export default {
// Dragging needs to be added for egg items
this.currentDraggingPotion = potion;
- let itemRef = this.$refs.draggingPotionInfo;
+ const itemRef = this.$refs.draggingPotionInfo;
- let dragEvent = $event.event;
+ const dragEvent = $event.event;
dragEvent.dataTransfer.setDragImage(itemRef, -20, -20);
},
isHatchable (potion, egg) {
- if (potion === null || egg === null)
- return false;
+ if (potion === null || egg === null) return false;
const petKey = `${egg.key}-${potion.key}`;
const petInfo = this.content.petInfo[petKey];
// Check pet exists and is hatchable
- if (!petInfo || !petInfo.potion)
- return false;
+ if (!petInfo || !petInfo.potion) return false;
return !this.userHasPet(potion.key, egg.key);
},
@@ -459,16 +454,15 @@ export default {
if (groupKey === 'special') {
if (item.key === 'timeTravelers') {
- this.$router.push({name: 'time'});
+ this.$router.push({ name: 'time' });
} else if (item.key === 'mysteryItem') {
- if (item.quantity === 0)
- return;
+ if (item.quantity === 0) return;
- let result = await this.$store.dispatch('user:openMysteryItem');
+ const result = await this.$store.dispatch('user:openMysteryItem');
- let openedItem = result.data.data;
- let text = this.content.gear.flat[openedItem.key].text();
- this.drop(this.$t('messageDropMysteryItem', {dropText: text}), openedItem);
+ const openedItem = result.data.data;
+ const text = this.content.gear.flat[openedItem.key].text();
+ this.drop(this.$t('messageDropMysteryItem', { dropText: text }), openedItem);
} else {
this.$root.$emit('selectMembersModal::showItem', item);
}
diff --git a/website/client/src/components/inventory/stable/foodItem.vue b/website/client/src/components/inventory/stable/foodItem.vue
index 6b730fb08b..fc3d80e639 100644
--- a/website/client/src/components/inventory/stable/foodItem.vue
+++ b/website/client/src/components/inventory/stable/foodItem.vue
@@ -22,11 +22,11 @@ div
diff --git a/website/client/src/components/inventory/stable/hatchingModal.vue b/website/client/src/components/inventory/stable/hatchingModal.vue
index 3c98b0061e..213b959136 100644
--- a/website/client/src/components/inventory/stable/hatchingModal.vue
+++ b/website/client/src/components/inventory/stable/hatchingModal.vue
@@ -64,8 +64,8 @@ import svgClose from '@/assets/svg/close.svg';
import petMixin from '@/mixins/petMixin';
export default {
- props: ['hatchablePet'],
mixins: [petMixin],
+ props: ['hatchablePet'],
data () {
return {
icons: Object.freeze({
diff --git a/website/client/src/components/inventory/stable/index.vue b/website/client/src/components/inventory/stable/index.vue
index 2c0e0535fb..1fea83fc89 100644
--- a/website/client/src/components/inventory/stable/index.vue
+++ b/website/client/src/components/inventory/stable/index.vue
@@ -312,500 +312,489 @@
diff --git a/website/client/src/components/inventory/stable/mountItem.vue b/website/client/src/components/inventory/stable/mountItem.vue
index 0c283d0743..a7f7d15dad 100644
--- a/website/client/src/components/inventory/stable/mountItem.vue
+++ b/website/client/src/components/inventory/stable/mountItem.vue
@@ -16,44 +16,44 @@ div
diff --git a/website/client/src/components/inventory/stable/mountRaisedModal.vue b/website/client/src/components/inventory/stable/mountRaisedModal.vue
index 80272c0614..daa873e373 100644
--- a/website/client/src/components/inventory/stable/mountRaisedModal.vue
+++ b/website/client/src/components/inventory/stable/mountRaisedModal.vue
@@ -57,41 +57,41 @@ b-modal#mount-raised-modal(:hide-header="true")
diff --git a/website/client/src/components/inventory/stable/petItem.vue b/website/client/src/components/inventory/stable/petItem.vue
index 72f0b48764..55fabceae5 100644
--- a/website/client/src/components/inventory/stable/petItem.vue
+++ b/website/client/src/components/inventory/stable/petItem.vue
@@ -71,91 +71,93 @@
diff --git a/website/client/src/components/memberDetails.vue b/website/client/src/components/memberDetails.vue
index 860e272f54..44392e2757 100644
--- a/website/client/src/components/memberDetails.vue
+++ b/website/client/src/components/memberDetails.vue
@@ -161,6 +161,14 @@ export default {
ClassBadge,
StatsBar,
},
+ filters: {
+ statFloor (value) {
+ if (value < 1 && value > 0) {
+ return Math.ceil(value * 10) / 10;
+ }
+ return Math.floor(value);
+ },
+ },
props: {
member: {
type: Object,
@@ -193,19 +201,10 @@ export default {
}),
};
},
- filters: {
- statFloor (value) {
- if (value < 1 && value > 0) {
- return Math.ceil(value * 10) / 10;
- } else {
- return Math.floor(value);
- }
- },
- },
methods: {
percent,
showMemberModal (member) {
- this.$router.push({name: 'userProfile', params: {userId: member._id}});
+ this.$router.push({ name: 'userProfile', params: { userId: member._id } });
},
},
computed: {
diff --git a/website/client/src/components/modifyInventory.vue b/website/client/src/components/modifyInventory.vue
index df612de158..866a75cb36 100644
--- a/website/client/src/components/modifyInventory.vue
+++ b/website/client/src/components/modifyInventory.vue
@@ -262,11 +262,11 @@ import Content from '@/../../common/script/content';
export default {
computed: {
- ...mapState({user: 'user.data'}),
+ ...mapState({ user: 'user.data' }),
},
data () {
- let showInv = {};
- let inv = {
+ const showInv = {};
+ const inv = {
gear: {},
special: {},
pets: {},
@@ -285,9 +285,9 @@ export default {
},
methods: {
setAllItems (type, value) {
- let set = this.inv[type];
+ const set = this.inv[type];
- for (let item in set) {
+ for (const item in set) {
if (set.hasOwnProperty(item)) {
set[item] = value;
}
diff --git a/website/client/src/components/notifications.vue b/website/client/src/components/notifications.vue
index 4b6033619e..1f55641fd6 100644
--- a/website/client/src/components/notifications.vue
+++ b/website/client/src/components/notifications.vue
@@ -132,53 +132,52 @@ import verifyUsername from './settings/verifyUsername';
const NOTIFICATIONS = {
CHALLENGE_JOINED_ACHIEVEMENT: {
achievement: true,
- label: ($t) => `${$t('achievement')}: ${$t('joinedChallenge')}`,
+ label: $t => `${$t('achievement')}: ${$t('joinedChallenge')}`,
modalId: 'joined-challenge',
},
ULTIMATE_GEAR_ACHIEVEMENT: {
achievement: true,
- label: ($t) => `${$t('achievement')}: ${$t('gearAchievementNotification')}`,
+ label: $t => `${$t('achievement')}: ${$t('gearAchievementNotification')}`,
modalId: 'ultimate-gear',
},
GUILD_JOINED_ACHIEVEMENT: {
- label: ($t) => `${$t('achievement')}: ${$t('joinedGuild')}`,
+ label: $t => `${$t('achievement')}: ${$t('joinedGuild')}`,
achievement: true,
modalId: 'joined-guild',
},
INVITED_FRIEND_ACHIEVEMENT: {
achievement: true,
- label: ($t) => `${$t('achievement')}: ${$t('invitedFriend')}`,
+ label: $t => `${$t('achievement')}: ${$t('invitedFriend')}`,
modalId: 'invited-friend',
},
NEW_CONTRIBUTOR_LEVEL: {
achievement: true,
- label: ($t) => $t('modalContribAchievement'),
+ label: $t => $t('modalContribAchievement'),
modalId: 'contributor',
},
ACHIEVEMENT_ALL_YOUR_BASE: {
achievement: true,
- label: ($t) => `${$t('achievement')}: ${$t('achievementAllYourBase')}`,
+ label: $t => `${$t('achievement')}: ${$t('achievementAllYourBase')}`,
modalId: 'generic-achievement',
},
ACHIEVEMENT_BACK_TO_BASICS: {
achievement: true,
- label: ($t) => `${$t('achievement')}: ${$t('achievementBackToBasics')}`,
+ label: $t => `${$t('achievement')}: ${$t('achievementBackToBasics')}`,
modalId: 'generic-achievement',
},
ACHIEVEMENT_DUST_DEVIL: {
achievement: true,
- label: ($t) => `${$t('achievement')}: ${$t('achievementDustDevil')}`,
+ label: $t => `${$t('achievement')}: ${$t('achievementDustDevil')}`,
modalId: 'generic-achievement',
},
ACHIEVEMENT_ARID_AUTHORITY: {
achievement: true,
- label: ($t) => `${$t('achievement')}: ${$t('achievementAridAuthority')}`,
+ label: $t => `${$t('achievement')}: ${$t('achievementAridAuthority')}`,
modalId: 'generic-achievement',
},
};
export default {
- mixins: [notifications, guide],
components: {
yesterdailyModal,
wonChallenge,
@@ -209,17 +208,18 @@ export default {
mindOverMatter,
justAddWater,
},
+ mixins: [notifications, guide],
data () {
// Levels that already display modals and should not trigger generic Level Up
- let unlockLevels = {
+ const unlockLevels = {
3: 'drop system',
10: 'class system',
50: 'Orb of Rebirth',
};
// Avoid showing the same notiication more than once
- let lastShownNotifications = [];
- let alreadyReadNotification = [];
+ const lastShownNotifications = [];
+ const alreadyReadNotification = [];
// A list of notifications handled by this component,
// NOTE: Those not listed here won't be handled at all!
@@ -292,7 +292,7 @@ export default {
if (after === before) return;
if (this.user.stats.lvl === 0) return;
- let money = after - before;
+ const money = after - before;
let bonus;
if (this.user._tmp) {
bonus = this.user._tmp.streakBonus || 0;
@@ -427,7 +427,7 @@ export default {
}
// Lvl evaluation
- if (afterLvl !== beforeLvl) {
+ if (afterLvl !== beforeLvl) {
if (afterLvl <= beforeLvl || this.$store.state.isRunningYesterdailies) return;
this.showLevelUpNotifications(afterLvl);
}
@@ -472,8 +472,8 @@ export default {
checkNextCron: throttle(function checkNextCron () {
if (!this.$store.state.isRunningYesterdailies && this.nextCron && Date.now() > this.nextCron) {
Promise.all([
- this.$store.dispatch('user:fetch', {forceLoad: true}),
- this.$store.dispatch('tasks:fetchUserTasks', {forceLoad: true}),
+ this.$store.dispatch('user:fetch', { forceLoad: true }),
+ this.$store.dispatch('tasks:fetchUserTasks', { forceLoad: true }),
]).then(() => this.runYesterDailies());
}
}, 1000),
@@ -482,8 +482,9 @@ export default {
this.yesterDailies = [];
// Open yesterdailies modal the next time cron runs
- const dayStart = this.user.preferences.dayStart;
- let nextCron = moment().hours(dayStart).minutes(0).seconds(0).milliseconds(0);
+ const { dayStart } = this.user.preferences;
+ let nextCron = moment().hours(dayStart).minutes(0).seconds(0)
+ .milliseconds(0);
const currentHour = moment().format('H');
if (currentHour >= dayStart) {
@@ -504,16 +505,16 @@ export default {
return;
}
- let dailys = this.$store.state.tasks.data.dailys;
+ const { dailys } = this.$store.state.tasks.data;
- let yesterDay = moment().subtract('1', 'day').startOf('day').add({
+ const yesterDay = moment().subtract('1', 'day').startOf('day').add({
hours: this.user.preferences.dayStart,
});
- dailys.forEach((task) => {
+ dailys.forEach(task => {
if (task && task.group.approval && task.group.approval.requested) return;
if (task.completed) return;
- let due = shouldDo(yesterDay, task);
+ const due = shouldDo(yesterDay, task);
if (task.yesterDaily && due) this.yesterDailies.push(task);
});
@@ -533,8 +534,8 @@ export default {
// Sync
await Promise.all([
- this.$store.dispatch('user:fetch', {forceLoad: true}),
- this.$store.dispatch('tasks:fetchUserTasks', {forceLoad: true}),
+ this.$store.dispatch('user:fetch', { forceLoad: true }),
+ this.$store.dispatch('tasks:fetchUserTasks', { forceLoad: true }),
]);
this.$store.state.isRunningYesterdailies = false;
@@ -551,10 +552,10 @@ export default {
if (!after || after.length === 0 || !Array.isArray(after)) return;
- let notificationsToRead = [];
- let scoreTaskNotification = [];
+ const notificationsToRead = [];
+ const scoreTaskNotification = [];
- after.forEach((notification) => {
+ after.forEach(notification => {
// This notification type isn't implemented here
if (!this.handledNotifications[notification.type]) return;
@@ -644,7 +645,7 @@ export default {
if (markAsRead) notificationsToRead.push(notification.id);
});
- let userReadNotifsPromise = false;
+ const userReadNotifsPromise = false;
if (notificationsToRead.length > 0) {
await axios.post('/api/v4/notifications/read', {
@@ -657,7 +658,7 @@ export default {
userReadNotifsPromise.then(() => {
// Only run this code for scoring approved tasks
if (scoreTaskNotification.length > 0) {
- let approvedTasks = [];
+ const approvedTasks = [];
for (let i = 0; i < scoreTaskNotification.length; i++) {
// Array with all approved tasks
const scoreData = scoreTaskNotification[i].data;
diff --git a/website/client/src/components/parentPage.vue b/website/client/src/components/parentPage.vue
index 1e0681ba50..a645ba7eb3 100644
--- a/website/client/src/components/parentPage.vue
+++ b/website/client/src/components/parentPage.vue
@@ -2,4 +2,4 @@
.row
.col
router-view
-
\ No newline at end of file
+
diff --git a/website/client/src/components/payments/amazonButton.vue b/website/client/src/components/payments/amazonButton.vue
index 4f1ffbef75..9924df7691 100644
--- a/website/client/src/components/payments/amazonButton.vue
+++ b/website/client/src/components/payments/amazonButton.vue
@@ -4,12 +4,19 @@
diff --git a/website/client/src/components/payments/cancelModalConfirm.vue b/website/client/src/components/payments/cancelModalConfirm.vue
index a2c66f4d05..31a1ca21a1 100644
--- a/website/client/src/components/payments/cancelModalConfirm.vue
+++ b/website/client/src/components/payments/cancelModalConfirm.vue
@@ -50,7 +50,7 @@ export default {
};
},
mounted () {
- this.$root.$on('habitica:cancel-subscription-confirm', (config) => {
+ this.$root.$on('habitica:cancel-subscription-confirm', config => {
this.config = config;
this.$root.$emit('bv::show::modal', 'subscription-cancel-modal');
});
@@ -64,4 +64,4 @@ export default {
},
},
};
-
\ No newline at end of file
+
diff --git a/website/client/src/components/payments/canceledModal.vue b/website/client/src/components/payments/canceledModal.vue
index e058d74165..ce59401ef7 100644
--- a/website/client/src/components/payments/canceledModal.vue
+++ b/website/client/src/components/payments/canceledModal.vue
@@ -4,7 +4,7 @@
:hideFooter="true",
:modalClass="['modal-hidden-footer']"
)
- div(slot="modal-header")
+ div(slot="modal-header")
.svg-icon.close(v-html="icons.close", v-once, @click="close()")
.icon-container.check-container.d-flex.align-items-center.justify-content-center
.svg-icon.check(v-html="icons.check", v-once)
@@ -80,7 +80,7 @@ export default {
};
},
mounted () {
- this.$root.$on('habitica:subscription-canceled', ({dateTerminated, isGroup}) => {
+ this.$root.$on('habitica:subscription-canceled', ({ dateTerminated, isGroup }) => {
this.isGroup = isGroup;
if (isGroup) {
this.groupDateTerminated = dateTerminated;
@@ -97,4 +97,4 @@ export default {
},
},
};
-
\ No newline at end of file
+
diff --git a/website/client/src/components/payments/sendGemsModal.vue b/website/client/src/components/payments/sendGemsModal.vue
index 9ad1f65dbd..0174162ba9 100644
--- a/website/client/src/components/payments/sendGemsModal.vue
+++ b/website/client/src/components/payments/sendGemsModal.vue
@@ -49,7 +49,7 @@ b-modal#send-gems(:title="title", :hide-footer="true", size='md', @hide='onHide(
:disabled="sendingInProgress"
) {{ $t("send") }}
.payments-column.mx-auto(v-else, :class="{'payments-disabled': !gift.subscription.key && gift.gems.amount < 1}")
- button.purchase.btn.btn-primary.payment-button.payment-item(@click='showStripe({gift, uuid: userReceivingGems._id, receiverName})', :disabled="!gift.subscription.key && gift.gems.amount < 1")
+ button.purchase.btn.btn-primary.payment-button.payment-item(@click='showStripe({gift, uuid: userReceivingGems._id, receiverName})', :disabled="!gift.subscription.key && gift.gems.amount < 1")
.svg-icon.credit-card-icon(v-html="icons.creditCardIcon")
| {{ $t('card') }}
button.btn.payment-item.paypal-checkout.payment-button(@click="openPaypalGift({gift: gift, giftedTo: userReceivingGems._id, receiverName})", :disabled="!gift.subscription.key && gift.gems.amount < 1")
@@ -106,10 +106,10 @@ import creditCardIcon from '@/assets/svg/credit-card-icon.svg';
const TECH_ASSISTANCE_EMAIL = 'admin@habitica.com';
export default {
- mixins: [paymentsMixin, notificationsMixin],
components: {
amazonButton,
},
+ mixins: [paymentsMixin, notificationsMixin],
data () {
return {
planGemLimits,
@@ -119,7 +119,7 @@ export default {
amount: 0,
fromBalance: true,
},
- subscription: {key: ''},
+ subscription: { key: '' },
message: '',
},
amazonPayments: {},
@@ -140,9 +140,7 @@ export default {
}),
subscriptionBlocks () {
let subscriptionBlocks = toArray(this.originalSubscriptionBlocks);
- subscriptionBlocks = omitBy(subscriptionBlocks, (block) => {
- return block.discount === true;
- });
+ subscriptionBlocks = omitBy(subscriptionBlocks, block => block.discount === true);
subscriptionBlocks = orderBy(subscriptionBlocks, ['months']);
return subscriptionBlocks;
@@ -152,16 +150,21 @@ export default {
},
title () {
if (!this.userReceivingGems) return '';
- return this.$t('sendGiftHeading', {name: this.userReceivingGems.profile.name});
+ return this.$t('sendGiftHeading', { name: this.userReceivingGems.profile.name });
},
receiverName () {
if (this.userReceivingGems.auth && this.userReceivingGems.auth.local && this.userReceivingGems.auth.local.username) {
return this.userReceivingGems.auth.local.username;
- } else {
- return this.userReceivingGems.profile.name;
}
+ return this.userReceivingGems.profile.name;
},
},
+ mounted () {
+ this.$root.$on('habitica::send-gems', data => {
+ this.userReceivingGems = data;
+ this.$root.$emit('bv::show::modal', 'send-gems');
+ });
+ },
methods: {
// @TODO move to payments mixin or action (problem is that we need notifications)
async sendGift () {
@@ -197,11 +200,5 @@ export default {
this.$root.$emit('bv::hide::modal', 'send-gems');
},
},
- mounted () {
- this.$root.$on('habitica::send-gems', (data) => {
- this.userReceivingGems = data;
- this.$root.$emit('bv::show::modal', 'send-gems');
- });
- },
};
diff --git a/website/client/src/components/payments/successModal.vue b/website/client/src/components/payments/successModal.vue
index 47f3c8fb23..92f3d73b70 100644
--- a/website/client/src/components/payments/successModal.vue
+++ b/website/client/src/components/payments/successModal.vue
@@ -1,11 +1,11 @@
b-modal#payments-success-modal(
- :title="$t('accountSuspendedTitle')",
+ :title="$t('accountSuspendedTitle')",
size='sm',
:hideFooter="isFromBalance",
:modalClass="isFromBalance ? ['modal-hidden-footer'] : []"
)
- div(slot="modal-header")
+ div(slot="modal-header")
.check-container.d-flex.align-items-center.justify-content-center
.svg-icon.check(v-html="icons.check", v-once)
h2 {{ $t(isFromBalance ? 'success' : 'paymentSuccessful') }}
@@ -15,12 +15,12 @@
.col-12.modal-body-col
template(v-if="paymentData.paymentType === 'gems'")
strong(v-once) {{ $t('paymentYouReceived') }}
- .details-block.gems
+ .details-block.gems
.svg-icon(v-html="icons.gem", v-once)
span 20
template(v-if="paymentData.paymentType === 'gift-gems' || paymentData.paymentType === 'gift-gems-balance'")
span(v-html="$t('paymentYouSentGems', {name: paymentData.giftReceiver})")
- .details-block.gems
+ .details-block.gems
.svg-icon(v-html="icons.gem", v-once)
span {{ paymentData.gift.gems.amount }}
template(v-if="paymentData.paymentType === 'gift-subscription'")
@@ -59,8 +59,8 @@
border-top-left-radius: 8px;
border-bottom: none;
- h2 {
- color: white;
+ h2 {
+ color: white;
}
.check-container {
@@ -154,8 +154,18 @@ export default {
paymentData: {},
};
},
+ computed: {
+ groupPlanCost () {
+ const sub = this.paymentData.subscription;
+ const memberCount = this.paymentData.group.memberCount || 1;
+ return sub.price + 3 * (memberCount - 1);
+ },
+ isFromBalance () {
+ return this.paymentData.paymentType === 'gift-gems-balance';
+ },
+ },
mounted () {
- this.$root.$on('habitica:payment-success', (data) => {
+ this.$root.$on('habitica:payment-success', data => {
if (['subscription', 'groupPlan', 'gift-subscription'].indexOf(data.paymentType) !== -1) {
data.subscription = subscriptionBlocks[data.subscriptionKey || data.gift.subscription.key];
}
@@ -167,16 +177,6 @@ export default {
this.paymentData = {};
this.$root.$off('habitica:payments-success');
},
- computed: {
- groupPlanCost () {
- const sub = this.paymentData.subscription;
- const memberCount = this.paymentData.group.memberCount || 1;
- return sub.price + 3 * (memberCount - 1);
- },
- isFromBalance () {
- return this.paymentData.paymentType === 'gift-gems-balance';
- },
- },
methods: {
close () {
this.paymentData = {};
@@ -184,4 +184,4 @@ export default {
},
},
};
-
\ No newline at end of file
+
diff --git a/website/client/src/components/selectMembersModal.vue b/website/client/src/components/selectMembersModal.vue
index 26343a8a12..616db77973 100644
--- a/website/client/src/components/selectMembersModal.vue
+++ b/website/client/src/components/selectMembersModal.vue
@@ -103,10 +103,10 @@ import starIcon from '@/assets/members/star.svg';
import { mapState } from '@/libs/store';
export default {
- props: ['group', 'hideBadge', 'item'],
components: {
MemberDetails,
},
+ props: ['group', 'hideBadge', 'item'],
data () {
return {
sortOption: '',
@@ -139,20 +139,20 @@ export default {
};
},
computed: {
- ...mapState({user: 'user.data'}),
+ ...mapState({ user: 'user.data' }),
sortedMembers () {
- let sortedMembers = this.members;
+ const sortedMembers = this.members;
if (!this.sortOption) return sortedMembers;
- sortBy(this.members, [(member) => {
+ sortBy(this.members, [member => {
if (this.sortOption === 'tier') {
if (!member.contributor) return;
return member.contributor.level;
- } else if (this.sortOption === 'name') {
+ } if (this.sortOption === 'name') {
return member.profile.name;
- } else if (this.sortOption === 'lvl') {
+ } if (this.sortOption === 'lvl') {
return member.stats.lvl;
- } else if (this.sortOption === 'class') {
+ } if (this.sortOption === 'class') {
return member.stats.class;
}
}]);
@@ -172,17 +172,17 @@ export default {
},
methods: {
async getMembers () {
- let groupId = this.groupId;
+ const { groupId } = this;
if (groupId && groupId !== 'challenge') {
- let members = await this.$store.dispatch('members:getGroupMembers', {
+ const members = await this.$store.dispatch('members:getGroupMembers', {
groupId,
includeAllPublicFields: true,
});
this.members = members;
}
- if ((!this.members || this.members.length === 0) &&
- this.$store.state.memberModalOptions.viewingMembers.length > 0
+ if ((!this.members || this.members.length === 0)
+ && this.$store.state.memberModalOptions.viewingMembers.length > 0
) {
this.members = this.$store.state.memberModalOptions.viewingMembers;
}
diff --git a/website/client/src/components/settings/api.vue b/website/client/src/components/settings/api.vue
index 2192c1edca..1ea459e56e 100644
--- a/website/client/src/components/settings/api.vue
+++ b/website/client/src/components/settings/api.vue
@@ -93,7 +93,7 @@ export default {
window.removeEventListener('message', this.receiveMessage);
},
computed: {
- ...mapState({user: 'user.data', credentials: 'credentials'}),
+ ...mapState({ user: 'user.data', credentials: 'credentials' }),
apiToken () {
return this.credentials.API_TOKEN;
},
@@ -109,7 +109,7 @@ export default {
eventFrom.source.postMessage(creds, eventFrom.origin);
},
async addWebhook (url) {
- let webhookInfo = {
+ const webhookInfo = {
id: uuid(),
type: 'taskActivity',
options: {
@@ -122,19 +122,19 @@ export default {
enabled: true,
};
- let webhook = await this.$store.dispatch('user:addWebhook', {webhookInfo});
+ const webhook = await this.$store.dispatch('user:addWebhook', { webhookInfo });
this.user.webhooks.push(webhook);
this.newWebhook.url = '';
},
async saveWebhook (webhook, index) {
delete webhook._editing;
- let updatedWebhook = await this.$store.dispatch('user:updateWebhook', {webhook});
+ const updatedWebhook = await this.$store.dispatch('user:updateWebhook', { webhook });
this.user.webhooks[index] = updatedWebhook;
},
async deleteWebhook (webhook, index) {
delete webhook._editing;
- await this.$store.dispatch('user:deleteWebhook', {webhook});
+ await this.$store.dispatch('user:deleteWebhook', { webhook });
this.user.webhooks.splice(index, 1);
},
},
diff --git a/website/client/src/components/settings/deleteModal.vue b/website/client/src/components/settings/deleteModal.vue
index 2d13b65ca6..975e1f2375 100644
--- a/website/client/src/components/settings/deleteModal.vue
+++ b/website/client/src/components/settings/deleteModal.vue
@@ -28,7 +28,7 @@ export default {
};
},
computed: {
- ...mapState({user: 'user.data'}),
+ ...mapState({ user: 'user.data' }),
},
methods: {
close () {
diff --git a/website/client/src/components/settings/notifications.vue b/website/client/src/components/settings/notifications.vue
index 2c1bcf9945..6824e427d3 100644
--- a/website/client/src/components/settings/notifications.vue
+++ b/website/client/src/components/settings/notifications.vue
@@ -73,7 +73,7 @@ export default {
};
},
computed: {
- ...mapState({user: 'user.data'}),
+ ...mapState({ user: 'user.data' }),
},
async mounted () {
// If ?unsubFrom param is passed with valid email type,
@@ -86,7 +86,7 @@ export default {
importantAnnouncements: 'inactivityEmails',
};
- const unsubFrom = this.$route.query.unsubFrom;
+ const { unsubFrom } = this.$route.query;
if (unsubFrom) {
await this.$store.dispatch('user:set', {
@@ -94,12 +94,12 @@ export default {
});
const emailTypeString = this.$t(MAP_PREF_TO_EMAIL_STRING[unsubFrom] || unsubFrom);
- this.text(this.$t('correctlyUnsubscribedEmailType', {emailType: emailTypeString}));
+ this.text(this.$t('correctlyUnsubscribedEmailType', { emailType: emailTypeString }));
}
},
methods: {
set (preferenceType, notification) {
- let settings = {};
+ const settings = {};
settings[`preferences.${preferenceType}.${notification}`] = this.user.preferences[preferenceType][notification];
this.$store.dispatch('user:set', settings);
},
diff --git a/website/client/src/components/settings/promoCode.vue b/website/client/src/components/settings/promoCode.vue
index f4333adbab..836699ff09 100644
--- a/website/client/src/components/settings/promoCode.vue
+++ b/website/client/src/components/settings/promoCode.vue
@@ -37,7 +37,7 @@ export default {
};
},
computed: {
- ...mapState({user: 'user.data', credentials: 'credentials'}),
+ ...mapState({ user: 'user.data', credentials: 'credentials' }),
getCodesUrl () {
if (!this.user) return '';
return '/api/v4/coupons';
@@ -53,7 +53,7 @@ export default {
// })
},
async enterCoupon () {
- let code = await axios.post(`/api/v4/coupons/enter/${this.couponCode}`);
+ const code = await axios.post(`/api/v4/coupons/enter/${this.couponCode}`);
if (!code) return;
this.$store.state.user.data = code.data.data;
diff --git a/website/client/src/components/settings/resetModal.vue b/website/client/src/components/settings/resetModal.vue
index c9f7c28d56..2dd544dc16 100644
--- a/website/client/src/components/settings/resetModal.vue
+++ b/website/client/src/components/settings/resetModal.vue
@@ -13,14 +13,14 @@ import { mapState } from '@/libs/store';
export default {
computed: {
- ...mapState({user: 'user.data'}),
+ ...mapState({ user: 'user.data' }),
},
methods: {
close () {
this.$root.$emit('bv::hide::modal', 'reset');
},
async reset () {
- let response = await axios.post('/api/v4/user/reset');
+ const response = await axios.post('/api/v4/user/reset');
// @TODO: Not sure if this is correct
this.$store.user = response.data.data.user;
this.$router.push('/');
diff --git a/website/client/src/components/settings/restoreModal.vue b/website/client/src/components/settings/restoreModal.vue
index 845300852b..73f1b84e46 100644
--- a/website/client/src/components/settings/restoreModal.vue
+++ b/website/client/src/components/settings/restoreModal.vue
@@ -72,7 +72,7 @@ export default {
this.restoreValues.achievements.streak = clone(this.user.achievements.streak);
},
computed: {
- ...mapState({user: 'user.data'}),
+ ...mapState({ user: 'user.data' }),
},
methods: {
close () {
@@ -92,7 +92,7 @@ export default {
this.user.stats = clone(this.restoreValues.stats);
this.user.achievements.streak = clone(this.restoreValues.achievements.streak);
- let settings = {
+ const settings = {
'stats.hp': Number(this.restoreValues.stats.hp),
'stats.exp': Number(this.restoreValues.stats.exp),
'stats.gp': Number(this.restoreValues.stats.gp),
diff --git a/website/client/src/components/settings/site.vue b/website/client/src/components/settings/site.vue
index d1fbb99933..88a077076e 100644
--- a/website/client/src/components/settings/site.vue
+++ b/website/client/src/components/settings/site.vue
@@ -209,33 +209,33 @@
import hello from 'hellojs';
import moment from 'moment';
import axios from 'axios';
-import { mapState } from '@/libs/store';
import debounce from 'lodash/debounce';
+import { mapState } from '@/libs/store';
import restoreModal from './restoreModal';
import resetModal from './resetModal';
import deleteModal from './deleteModal';
import { SUPPORTED_SOCIAL_NETWORKS } from '@/../../common/script/constants';
-import changeClass from '@/../../common/script/ops/changeClass';
+import changeClass from '@/../../common/script/ops/changeClass';
import notificationsMixin from '../../mixins/notifications';
import sounds from '../../libs/sounds';
// @TODO: this needs our window.env fix
// import { availableLanguages } from '../../../server/libs/i18n';
export default {
- mixins: [notificationsMixin],
components: {
restoreModal,
resetModal,
deleteModal,
},
+ mixins: [notificationsMixin],
data () {
- let dayStartOptions = [];
+ const dayStartOptions = [];
for (let number = 0; number < 24; number += 1) {
- let meridian = number < 12 ? 'AM' : 'PM';
- let hour = number % 12;
- let option = {
+ const meridian = number < 12 ? 'AM' : 'PM';
+ const hour = number % 12;
+ const option = {
value: number,
- name: `${hour ? hour : 12}:00 ${meridian}`,
+ name: `${hour || 12}:00 ${meridian}`,
};
dayStartOptions.push(option);
}
@@ -248,7 +248,7 @@ export default {
dayStartOptions,
newDayStart: 0,
temporaryDisplayName: '',
- usernameUpdates: {username: ''},
+ usernameUpdates: { username: '' },
emailUpdates: {},
passwordUpdates: {},
localAuth: {
@@ -299,14 +299,14 @@ export default {
},
timezoneOffsetToUtc () {
let offset = this.user.preferences.timezoneOffset;
- let sign = offset > 0 ? '-' : '+';
+ const sign = offset > 0 ? '-' : '+';
offset = Math.abs(offset) / 60;
- let hour = Math.floor(offset);
+ const hour = Math.floor(offset);
- let minutesInt = (offset - hour) * 60;
- let minutes = minutesInt < 10 ? `0${minutesInt}` : minutesInt;
+ const minutesInt = (offset - hour) * 60;
+ const minutes = minutesInt < 10 ? `0${minutesInt}` : minutesInt;
return `UTC${sign}${hour}:${minutes}`;
},
@@ -390,7 +390,7 @@ export default {
});
}, 500),
set (preferenceType, subtype) {
- let settings = {};
+ const settings = {};
if (!subtype) {
settings[`preferences.${preferenceType}`] = this.user.preferences[preferenceType];
} else {
@@ -420,7 +420,7 @@ export default {
return true;
}
- return find(this.SOCIAL_AUTH_NETWORKS, (network) => {
+ return find(this.SOCIAL_AUTH_NETWORKS, network => {
if (network.key !== networkKeyToCheck) {
if (this.user.auth.hasOwnProperty(network.key)) {
return this.user.auth[network.key].id;
@@ -429,9 +429,10 @@ export default {
});
},
calculateNextCron () {
- let nextCron = moment().hours(this.newDayStart).minutes(0).seconds(0).milliseconds(0);
+ let nextCron = moment().hours(this.newDayStart).minutes(0).seconds(0)
+ .milliseconds(0);
- let currentHour = moment().format('H');
+ const currentHour = moment().format('H');
if (currentHour >= this.newDayStart) {
nextCron = nextCron.add(1, 'day');
}
@@ -439,9 +440,9 @@ export default {
return nextCron.format(`${this.user.preferences.dateFormat.toUpperCase()} @ h:mm a`);
},
openDayStartModal () {
- let nextCron = this.calculateNextCron();
+ const nextCron = this.calculateNextCron();
// @TODO: Add generic modal
- if (!confirm(this.$t('sureChangeCustomDayStartTime', {time: nextCron}))) return;
+ if (!confirm(this.$t('sureChangeCustomDayStartTime', { time: nextCron }))) return;
this.saveDayStart();
// $rootScope.openModal('change-day-start', { scope: $scope });
},
@@ -470,7 +471,7 @@ export default {
}
},
async changeDisplayName (newName) {
- await axios.put('/api/v4/user/', {'profile.name': newName});
+ await axios.put('/api/v4/user/', { 'profile.name': newName });
alert(this.$t('displayNameSuccess'));
this.user.profile.name = newName;
this.temporaryDisplayName = newName;
@@ -486,10 +487,10 @@ export default {
},
async deleteSocialAuth (network) {
await axios.delete(`/api/v4/user/auth/social/${network.key}`);
- this.text(this.$t('detachedSocial', {network: network.name}));
+ this.text(this.$t('detachedSocial', { network: network.name }));
},
async socialAuth (network) {
- let auth = await hello(network).login({scope: 'email'});
+ const auth = await hello(network).login({ scope: 'email' });
await this.$store.dispatch('auth:socialAuth', {
auth,
diff --git a/website/client/src/components/settings/subscription.vue b/website/client/src/components/settings/subscription.vue
index f50185e8f6..df7750a4e2 100644
--- a/website/client/src/components/settings/subscription.vue
+++ b/website/client/src/components/settings/subscription.vue
@@ -74,7 +74,7 @@
.subscribe-pay(v-if='!hasSubscription || hasCanceledSubscription')
h3 {{ $t('subscribeUsing') }}
.payments-column
- button.purchase.btn.btn-primary.payment-button.payment-item(@click='showStripe({subscription:subscription.key, coupon:subscription.coupon})', :disabled='!subscription.key')
+ button.purchase.btn.btn-primary.payment-button.payment-item(@click='showStripe({subscription:subscription.key, coupon:subscription.coupon})', :disabled='!subscription.key')
.svg-icon.credit-card-icon(v-html="icons.creditCardIcon")
| {{ $t('card') }}
button.btn.payment-item.paypal-checkout.payment-button(@click="openPaypal(paypalPurchaseLink, 'subscription')", :disabled='!subscription.key')
@@ -118,10 +118,10 @@ import amazonButton from '@/components/payments/amazonButton';
import creditCardIcon from '@/assets/svg/credit-card-icon.svg';
export default {
- mixins: [paymentsMixin, notificationsMixin],
components: {
amazonButton,
},
+ mixins: [paymentsMixin, notificationsMixin],
data () {
return {
loading: false,
@@ -148,15 +148,11 @@ export default {
};
},
computed: {
- ...mapState({user: 'user.data', credentials: 'credentials'}),
+ ...mapState({ user: 'user.data', credentials: 'credentials' }),
subscriptionBlocksOrdered () {
- let subscriptions = filter(subscriptionBlocks, (o) => {
- return o.discount !== true;
- });
+ const subscriptions = filter(subscriptionBlocks, o => o.discount !== true);
- return sortBy(subscriptions, [(o) => {
- return o.months;
- }]);
+ return sortBy(subscriptions, [o => o.months]);
},
purchasedPlanIdInfo () {
if (!this.subscriptionBlocks[this.user.purchased.plan.planId]) {
@@ -180,8 +176,8 @@ export default {
},
canEditCardDetails () {
return Boolean(
- !this.hasCanceledSubscription &&
- this.user.purchased.plan.paymentMethod === this.paymentMethods.STRIPE
+ !this.hasCanceledSubscription
+ && this.user.purchased.plan.paymentMethod === this.paymentMethods.STRIPE,
);
},
hasSubscription () {
@@ -189,8 +185,8 @@ export default {
},
hasCanceledSubscription () {
return (
- this.hasSubscription &&
- Boolean(this.user.purchased.plan.dateTerminated)
+ this.hasSubscription
+ && Boolean(this.user.purchased.plan.dateTerminated)
);
},
hasPlan () {
@@ -213,20 +209,20 @@ export default {
};
},
gemGoldCap () {
- let baseCap = 25;
- let gemCapIncrement = 5;
- let capIncrementThreshold = 3;
- let gemCapExtra = this.user.purchased.plan.consecutive.gemCapExtra;
- let blocks = subscriptionBlocks[this.subscription.key].months / capIncrementThreshold;
- let flooredBlocks = Math.floor(blocks);
+ const baseCap = 25;
+ const gemCapIncrement = 5;
+ const capIncrementThreshold = 3;
+ const { gemCapExtra } = this.user.purchased.plan.consecutive;
+ const blocks = subscriptionBlocks[this.subscription.key].months / capIncrementThreshold;
+ const flooredBlocks = Math.floor(blocks);
- let userTotalDropCap = baseCap + gemCapExtra + flooredBlocks * gemCapIncrement;
- let maxDropCap = 50;
+ const userTotalDropCap = baseCap + gemCapExtra + flooredBlocks * gemCapIncrement;
+ const maxDropCap = 50;
return [userTotalDropCap, maxDropCap];
},
numberOfMysticHourglasses () {
- let numberOfHourglasses = subscriptionBlocks[this.subscription.key].months / 3;
+ const numberOfHourglasses = subscriptionBlocks[this.subscription.key].months / 3;
return Math.floor(numberOfHourglasses);
},
mysticHourglass () {
@@ -236,10 +232,10 @@ export default {
},
canCancelSubscription () {
return (
- this.user.purchased.plan.paymentMethod !== this.paymentMethods.GOOGLE &&
- this.user.purchased.plan.paymentMethod !== this.paymentMethods.APPLE &&
- !this.hasCanceledSubscription &&
- !this.hasGroupPlan
+ this.user.purchased.plan.paymentMethod !== this.paymentMethods.GOOGLE
+ && this.user.purchased.plan.paymentMethod !== this.paymentMethods.APPLE
+ && !this.hasCanceledSubscription
+ && !this.hasGroupPlan
);
},
},
diff --git a/website/client/src/components/settings/usernameForm.vue b/website/client/src/components/settings/usernameForm.vue
index 3f068caa0f..92b84fb05b 100644
--- a/website/client/src/components/settings/usernameForm.vue
+++ b/website/client/src/components/settings/usernameForm.vue
@@ -95,127 +95,127 @@
diff --git a/website/client/src/components/settings/verifyUsername.vue b/website/client/src/components/settings/verifyUsername.vue
index 5f368cbc88..32ee82f15d 100644
--- a/website/client/src/components/settings/verifyUsername.vue
+++ b/website/client/src/components/settings/verifyUsername.vue
@@ -66,19 +66,19 @@
diff --git a/website/client/src/components/shared/inventoryDrawer.vue b/website/client/src/components/shared/inventoryDrawer.vue
index 0faedb65e5..481593f677 100644
--- a/website/client/src/components/shared/inventoryDrawer.vue
+++ b/website/client/src/components/shared/inventoryDrawer.vue
@@ -40,124 +40,118 @@ drawer.inventoryDrawer(
diff --git a/website/client/src/components/shops/buyModal.vue b/website/client/src/components/shops/buyModal.vue
index ae9618caed..3a4756a257 100644
--- a/website/client/src/components/shops/buyModal.vue
+++ b/website/client/src/components/shops/buyModal.vue
@@ -274,250 +274,246 @@
diff --git a/website/client/src/components/shops/featuredItemsHeader.vue b/website/client/src/components/shops/featuredItemsHeader.vue
index 522f3c6e06..6d89de56c2 100644
--- a/website/client/src/components/shops/featuredItemsHeader.vue
+++ b/website/client/src/components/shops/featuredItemsHeader.vue
@@ -34,36 +34,36 @@ div.featuredItems
diff --git a/website/client/src/components/shops/quests/buyQuestModal.vue b/website/client/src/components/shops/quests/buyQuestModal.vue
index 25ea671953..5573d003e3 100644
--- a/website/client/src/components/shops/quests/buyQuestModal.vue
+++ b/website/client/src/components/shops/quests/buyQuestModal.vue
@@ -196,146 +196,144 @@
diff --git a/website/client/src/components/shops/quests/index.vue b/website/client/src/components/shops/quests/index.vue
index 13c88246a4..be963d5a3b 100644
--- a/website/client/src/components/shops/quests/index.vue
+++ b/website/client/src/components/shops/quests/index.vue
@@ -327,167 +327,164 @@
diff --git a/website/client/src/components/shops/quests/questDialogContent.vue b/website/client/src/components/shops/quests/questDialogContent.vue
index 62660178d3..c84ccf45dc 100644
--- a/website/client/src/components/shops/quests/questDialogContent.vue
+++ b/website/client/src/components/shops/quests/questDialogContent.vue
@@ -32,32 +32,30 @@
diff --git a/website/client/src/components/shops/quests/questDialogDrops.vue b/website/client/src/components/shops/quests/questDialogDrops.vue
index d6a4cbfb4b..4db7e3e32e 100644
--- a/website/client/src/components/shops/quests/questDialogDrops.vue
+++ b/website/client/src/components/shops/quests/questDialogDrops.vue
@@ -66,57 +66,56 @@
diff --git a/website/client/src/components/shops/quests/questInfo.vue b/website/client/src/components/shops/quests/questInfo.vue
index b9f7635bbb..0609ae0b36 100644
--- a/website/client/src/components/shops/quests/questInfo.vue
+++ b/website/client/src/components/shops/quests/questInfo.vue
@@ -95,64 +95,63 @@ dt {
diff --git a/website/client/src/components/shops/seasonal/index.vue b/website/client/src/components/shops/seasonal/index.vue
index 827d4a38f1..5dec3bef91 100644
--- a/website/client/src/components/shops/seasonal/index.vue
+++ b/website/client/src/components/shops/seasonal/index.vue
@@ -284,257 +284,243 @@
diff --git a/website/client/src/components/shops/shopItem.vue b/website/client/src/components/shops/shopItem.vue
index 6ccf2bd9d6..381b2cbe3d 100644
--- a/website/client/src/components/shops/shopItem.vue
+++ b/website/client/src/components/shops/shopItem.vue
@@ -150,104 +150,102 @@ div
diff --git a/website/client/src/components/shops/timeTravelers/index.vue b/website/client/src/components/shops/timeTravelers/index.vue
index b423ae0f18..7507ef738d 100644
--- a/website/client/src/components/shops/timeTravelers/index.vue
+++ b/website/client/src/components/shops/timeTravelers/index.vue
@@ -233,191 +233,183 @@
diff --git a/website/client/src/components/sidebarSection.vue b/website/client/src/components/sidebarSection.vue
index 672ac9d430..c7e1033370 100644
--- a/website/client/src/components/sidebarSection.vue
+++ b/website/client/src/components/sidebarSection.vue
@@ -54,38 +54,38 @@
\ No newline at end of file
+ },
+};
+
diff --git a/website/client/src/components/snackbars/notification.vue b/website/client/src/components/snackbars/notification.vue
index afa265a809..24be51a77c 100644
--- a/website/client/src/components/snackbars/notification.vue
+++ b/website/client/src/components/snackbars/notification.vue
@@ -132,32 +132,6 @@ export default {
show: true,
};
},
- created () {
- let timeout = this.notification.hasOwnProperty('timeout') ? this.notification.timeout : true;
- if (timeout) {
- let delay = this.notification.delay || 1500;
- delay += this.$store.state.notificationStore.length * 1000;
- this.timer = setTimeout(() => {
- this.show = false;
- }, delay);
- }
- },
- beforeDestroy () {
- clearTimeout(this.timer);
- },
- watch: {
- show () {
- this.$store.dispatch('snackbars:remove', this.notification);
- },
- },
- methods: {
- handleOnClick () {
- if (typeof this.notification.onClick === 'function') {
- this.notification.onClick();
- }
- this.show = false;
- },
- },
computed: {
message () {
if (this.notification.flavorMessage) {
@@ -179,5 +153,31 @@ export default {
return `${this.notification.type} ${this.negative}`;
},
},
+ watch: {
+ show () {
+ this.$store.dispatch('snackbars:remove', this.notification);
+ },
+ },
+ created () {
+ const timeout = this.notification.hasOwnProperty('timeout') ? this.notification.timeout : true;
+ if (timeout) {
+ let delay = this.notification.delay || 1500;
+ delay += this.$store.state.notificationStore.length * 1000;
+ this.timer = setTimeout(() => {
+ this.show = false;
+ }, delay);
+ }
+ },
+ beforeDestroy () {
+ clearTimeout(this.timer);
+ },
+ methods: {
+ handleOnClick () {
+ if (typeof this.notification.onClick === 'function') {
+ this.notification.onClick();
+ }
+ this.show = false;
+ },
+ },
};
diff --git a/website/client/src/components/static/clearBrowserData.vue b/website/client/src/components/static/clearBrowserData.vue
index 39c97cda76..ef5de361cf 100644
--- a/website/client/src/components/static/clearBrowserData.vue
+++ b/website/client/src/components/static/clearBrowserData.vue
@@ -15,23 +15,23 @@
diff --git a/website/client/src/components/static/faq.vue b/website/client/src/components/static/faq.vue
index bc74032d83..251cb5d284 100644
--- a/website/client/src/components/static/faq.vue
+++ b/website/client/src/components/static/faq.vue
@@ -41,57 +41,57 @@
diff --git a/website/client/src/components/static/features.vue b/website/client/src/components/static/features.vue
index a578cffb17..efd1d1cd5d 100644
--- a/website/client/src/components/static/features.vue
+++ b/website/client/src/components/static/features.vue
@@ -90,16 +90,16 @@
diff --git a/website/client/src/components/static/groupPlans.vue b/website/client/src/components/static/groupPlans.vue
index 3a34cd987a..f39b5e0ebd 100644
--- a/website/client/src/components/static/groupPlans.vue
+++ b/website/client/src/components/static/groupPlans.vue
@@ -195,58 +195,58 @@
diff --git a/website/client/src/components/static/home.vue b/website/client/src/components/static/home.vue
index 5d3af7b932..4f0b96d4c6 100644
--- a/website/client/src/components/static/home.vue
+++ b/website/client/src/components/static/home.vue
@@ -558,176 +558,176 @@
diff --git a/website/client/src/components/static/merch.vue b/website/client/src/components/static/merch.vue
index d4f3f440b9..d3faae8858 100644
--- a/website/client/src/components/static/merch.vue
+++ b/website/client/src/components/static/merch.vue
@@ -13,21 +13,31 @@
img.img-rendering-auto(:src="`/static/merch/${merchant.key}.png`")
p {{ $t('merch-' + merchant.key + '-summary') }}
a.btn.btn-primary(:href="merchant.link" target='_blank') {{$t('merch-' + merchant.key + '-goto')}}
-
+
diff --git a/website/client/src/components/static/newStuff.vue b/website/client/src/components/static/newStuff.vue
index bffec9d38e..9fc059a7dc 100644
--- a/website/client/src/components/static/newStuff.vue
+++ b/website/client/src/components/static/newStuff.vue
@@ -16,7 +16,7 @@ export default {
};
},
async mounted () {
- let response = await axios.get('/api/v4/news');
+ const response = await axios.get('/api/v4/news');
this.html = response.data.html;
},
};
diff --git a/website/client/src/components/static/pressKit.vue b/website/client/src/components/static/pressKit.vue
index 150606dce0..85f25f75a1 100644
--- a/website/client/src/components/static/pressKit.vue
+++ b/website/client/src/components/static/pressKit.vue
@@ -32,99 +32,99 @@
diff --git a/website/client/src/components/tasks/approvalFooter.vue b/website/client/src/components/tasks/approvalFooter.vue
index 09e270e80f..9c4809fb84 100644
--- a/website/client/src/components/tasks/approvalFooter.vue
+++ b/website/client/src/components/tasks/approvalFooter.vue
@@ -45,43 +45,40 @@ import approvalModal from './approvalModal';
import sync from '@/mixins/sync';
export default {
- mixins: [sync],
- props: ['task', 'group'],
components: {
approvalModal,
},
+ mixins: [sync],
+ props: ['task', 'group'],
computed: {
- ...mapState({user: 'user.data'}),
+ ...mapState({ user: 'user.data' }),
userIsAssigned () {
return this.task.group.assignedUsers && this.task.group.assignedUsers.indexOf(this.user._id) !== -1;
},
message () {
- let assignedUsers = this.task.group.assignedUsers;
- let assignedUsersNames = [];
- let assignedUsersLength = assignedUsers.length;
+ const { assignedUsers } = this.task.group;
+ const assignedUsersNames = [];
+ const assignedUsersLength = assignedUsers.length;
// @TODO: Eh, I think we only ever display one user name
if (this.group && this.group.members) {
assignedUsers.forEach(userId => {
- let index = findIndex(this.group.members, (member) => {
- return member._id === userId;
- });
- let assignedMember = this.group.members[index];
+ const index = findIndex(this.group.members, member => member._id === userId);
+ const assignedMember = this.group.members[index];
assignedUsersNames.push(assignedMember.profile.name);
});
}
if (assignedUsersLength === 1 && !this.userIsAssigned) {
- return this.$t('assignedToUser', {userName: assignedUsersNames[0]});
- } else if (assignedUsersLength > 1 && !this.userIsAssigned) {
- return this.$t('assignedToMembers', {userCount: assignedUsersLength});
- } else if (assignedUsersLength > 1 && this.userIsAssigned) {
- return this.$t('assignedToYouAndMembers', {userCount: assignedUsersLength - 1});
- } else if (this.userIsAssigned) {
+ return this.$t('assignedToUser', { userName: assignedUsersNames[0] });
+ } if (assignedUsersLength > 1 && !this.userIsAssigned) {
+ return this.$t('assignedToMembers', { userCount: assignedUsersLength });
+ } if (assignedUsersLength > 1 && this.userIsAssigned) {
+ return this.$t('assignedToYouAndMembers', { userCount: assignedUsersLength - 1 });
+ } if (this.userIsAssigned) {
return this.$t('youAreAssigned');
- } else { // if (assignedUsersLength === 0) {
- return this.$t('taskIsUnassigned');
- }
+ } // if (assignedUsersLength === 0) {
+ return this.$t('taskIsUnassigned');
},
userIsManager () {
if (this.group && (this.group.leader.id === this.user._id || this.group.managers[this.user._id])) return true;
@@ -124,13 +121,13 @@ export default {
taskId,
userId: this.user._id,
});
- let index = this.task.group.assignedUsers.indexOf(this.user._id);
+ const index = this.task.group.assignedUsers.indexOf(this.user._id);
this.task.group.assignedUsers.splice(index, 1);
this.sync();
},
approve () {
- let userIdToApprove = this.task.group.assignedUsers[0];
+ const userIdToApprove = this.task.group.assignedUsers[0];
this.$store.dispatch('tasks:approve', {
taskId: this.task._id,
userId: userIdToApprove,
@@ -140,7 +137,7 @@ export default {
},
needsWork () {
if (!confirm(this.$t('confirmNeedsWork'))) return;
- let userIdNeedsMoreWork = this.task.group.assignedUsers[0];
+ const userIdNeedsMoreWork = this.task.group.assignedUsers[0];
this.$store.dispatch('tasks:needsWork', {
taskId: this.task._id,
userId: userIdNeedsMoreWork,
diff --git a/website/client/src/components/tasks/approvalHeader.vue b/website/client/src/components/tasks/approvalHeader.vue
index 577aea9f83..fa65fbb956 100644
--- a/website/client/src/components/tasks/approvalHeader.vue
+++ b/website/client/src/components/tasks/approvalHeader.vue
@@ -26,26 +26,24 @@
diff --git a/website/client/src/components/ui/countBadge.vue b/website/client/src/components/ui/countBadge.vue
index ecbee290c9..7f4b828357 100644
--- a/website/client/src/components/ui/countBadge.vue
+++ b/website/client/src/components/ui/countBadge.vue
@@ -21,14 +21,14 @@ span.badge.badge-pill.badge-item.badge-count(
diff --git a/website/client/src/components/ui/customMenuDropdown.vue b/website/client/src/components/ui/customMenuDropdown.vue
index 3485080478..def253602a 100644
--- a/website/client/src/components/ui/customMenuDropdown.vue
+++ b/website/client/src/components/ui/customMenuDropdown.vue
@@ -69,7 +69,7 @@ export default {
computed: {
isOpen () {
// Open status is a number so we can tell if the value was passed
- if (this.openStatus !== undefined) return this.openStatus === 1 ? true : false;
+ if (this.openStatus !== undefined) return this.openStatus === 1;
return this.isDropdownOpen;
},
isPressed () {
diff --git a/website/client/src/components/ui/drawer.vue b/website/client/src/components/ui/drawer.vue
index 7fbdd5428d..db8aaa56ff 100644
--- a/website/client/src/components/ui/drawer.vue
+++ b/website/client/src/components/ui/drawer.vue
@@ -165,15 +165,19 @@ export default {
computed: {
isOpen () {
// Open status is a number so we can tell if the value was passed
- if (this.openStatus !== undefined) return this.openStatus === 1 ? true : false;
+ if (this.openStatus !== undefined) return this.openStatus === 1;
return this.open;
},
},
+ mounted () {
+ // Make sure the page has enough space so the drawer does not overlap content
+ this.adjustPagePadding();
+ },
methods: {
adjustPagePadding () {
- let minPaddingBottom = 20;
- let drawerHeight = this.$el.offsetHeight;
- let standardPage = document.getElementsByClassName('standard-page')[0];
+ const minPaddingBottom = 20;
+ const drawerHeight = this.$el.offsetHeight;
+ const standardPage = document.getElementsByClassName('standard-page')[0];
if (standardPage) {
standardPage.style.paddingBottom = `${drawerHeight + minPaddingBottom}px`;
}
@@ -183,9 +187,5 @@ export default {
this.$emit('toggled', this.open);
},
},
- mounted () {
- // Make sure the page has enough space so the drawer does not overlap content
- this.adjustPagePadding();
- },
};
diff --git a/website/client/src/components/ui/drawerHeaderTabs.vue b/website/client/src/components/ui/drawerHeaderTabs.vue
index ec0738bf97..47cd79eaf3 100644
--- a/website/client/src/components/ui/drawerHeaderTabs.vue
+++ b/website/client/src/components/ui/drawerHeaderTabs.vue
@@ -56,23 +56,23 @@
diff --git a/website/client/src/components/ui/drawerSlider.vue b/website/client/src/components/ui/drawerSlider.vue
index 85511cff96..1aaddab27d 100644
--- a/website/client/src/components/ui/drawerSlider.vue
+++ b/website/client/src/components/ui/drawerSlider.vue
@@ -100,90 +100,89 @@
diff --git a/website/client/src/components/ui/filterDropdown.vue b/website/client/src/components/ui/filterDropdown.vue
index d1ebd52b3b..e712152e8f 100644
--- a/website/client/src/components/ui/filterDropdown.vue
+++ b/website/client/src/components/ui/filterDropdown.vue
@@ -16,28 +16,28 @@ span
diff --git a/website/client/src/components/ui/layoutSection.vue b/website/client/src/components/ui/layoutSection.vue
index 11c527c492..ec5e72383f 100644
--- a/website/client/src/components/ui/layoutSection.vue
+++ b/website/client/src/components/ui/layoutSection.vue
@@ -13,11 +13,11 @@ div
diff --git a/website/client/src/components/ui/statsbar.vue b/website/client/src/components/ui/statsbar.vue
index 84a44bd53a..e3f31ccbaf 100644
--- a/website/client/src/components/ui/statsbar.vue
+++ b/website/client/src/components/ui/statsbar.vue
@@ -75,52 +75,51 @@
diff --git a/website/client/src/components/ui/toggleSwitch.vue b/website/client/src/components/ui/toggleSwitch.vue
index 13101b4590..a2e025779b 100644
--- a/website/client/src/components/ui/toggleSwitch.vue
+++ b/website/client/src/components/ui/toggleSwitch.vue
@@ -108,14 +108,6 @@
-
diff --git a/website/client/src/components/userLink.vue b/website/client/src/components/userLink.vue
index 06415d6f7b..1d4433c262 100644
--- a/website/client/src/components/userLink.vue
+++ b/website/client/src/components/userLink.vue
@@ -33,83 +33,82 @@
diff --git a/website/client/src/components/userMenu/achievements.vue b/website/client/src/components/userMenu/achievements.vue
index 9f8bdf50fa..0424b94e5b 100644
--- a/website/client/src/components/userMenu/achievements.vue
+++ b/website/client/src/components/userMenu/achievements.vue
@@ -66,7 +66,7 @@ export default {
this.achievements = achievementsLib.getAchievementsForProfile(this.user);
},
computed: {
- ...mapState({user: 'user.data'}),
+ ...mapState({ user: 'user.data' }),
},
};
diff --git a/website/client/src/components/userMenu/inbox.vue b/website/client/src/components/userMenu/inbox.vue
index 4afb7d9be9..d0727ddb51 100644
--- a/website/client/src/components/userMenu/inbox.vue
+++ b/website/client/src/components/userMenu/inbox.vue
@@ -238,11 +238,11 @@ import moment from 'moment';
import filter from 'lodash/filter';
import groupBy from 'lodash/groupBy';
import orderBy from 'lodash/orderBy';
-import { mapState } from '@/libs/store';
import habiticaMarkdown from 'habitica-markdown';
+import axios from 'axios';
+import { mapState } from '@/libs/store';
import styleHelper from '@/mixins/styleHelper';
import toggleSwitch from '@/components/ui/toggleSwitch';
-import axios from 'axios';
import chatMessages from '../chat/chatMessages';
import messageIcon from '@/assets/svg/message.svg';
@@ -259,44 +259,16 @@ import tier9 from '@/assets/svg/tier-staff.svg';
import tierNPC from '@/assets/svg/tier-npc.svg';
export default {
- mixins: [styleHelper],
components: {
chatMessages,
toggleSwitch,
},
- mounted () {
- this.$root.$on('habitica::new-inbox-message', (data) => {
- this.$root.$emit('bv::show::modal', 'inbox-modal');
-
- // Wait for messages to be loaded
- const unwatchLoaded = this.$watch('loaded', (loaded) => {
- if (!loaded) return;
-
- const conversation = this.conversations.find(convo => {
- return convo.key === data.userIdToMessage;
- });
- if (loaded) setImmediate(() => unwatchLoaded());
-
- if (conversation) {
- this.selectConversation(data.userIdToMessage);
- return;
- }
-
- this.initiatedConversation = {
- uuid: data.userIdToMessage,
- user: data.displayName,
- username: data.username,
- backer: data.backer,
- contributor: data.contributor,
- };
-
- this.selectConversation(data.userIdToMessage);
- }, {immediate: true});
- });
- },
- destroyed () {
- this.$root.$off('habitica::new-inbox-message');
+ filters: {
+ timeAgo (value) {
+ return moment(new Date(value)).fromNow();
+ },
},
+ mixins: [styleHelper],
data () {
return {
icons: Object.freeze({
@@ -327,13 +299,39 @@ export default {
updateConversionsCounter: 0,
};
},
- filters: {
- timeAgo (value) {
- return moment(new Date(value)).fromNow();
- },
+ mounted () {
+ this.$root.$on('habitica::new-inbox-message', data => {
+ this.$root.$emit('bv::show::modal', 'inbox-modal');
+
+ // Wait for messages to be loaded
+ const unwatchLoaded = this.$watch('loaded', loaded => {
+ if (!loaded) return;
+
+ const conversation = this.conversations.find(convo => convo.key === data.userIdToMessage);
+ if (loaded) setImmediate(() => unwatchLoaded());
+
+ if (conversation) {
+ this.selectConversation(data.userIdToMessage);
+ return;
+ }
+
+ this.initiatedConversation = {
+ uuid: data.userIdToMessage,
+ user: data.displayName,
+ username: data.username,
+ backer: data.backer,
+ contributor: data.contributor,
+ };
+
+ this.selectConversation(data.userIdToMessage);
+ }, { immediate: true });
+ });
+ },
+ destroyed () {
+ this.$root.$off('habitica::new-inbox-message');
},
computed: {
- ...mapState({user: 'user.data'}),
+ ...mapState({ user: 'user.data' }),
canLoadMore () {
return this.selectedConversation && this.selectedConversation.canLoadMore;
},
@@ -354,7 +352,7 @@ export default {
}
// Create conversation objects
const convos = [];
- for (let key in inboxGroup) {
+ for (const key in inboxGroup) {
const recentMessage = inboxGroup[key][0];
const convoModel = {
@@ -381,9 +379,7 @@ export default {
const selectedConversation = this.messagesByConversation[selectedConversationKey];
this.messages = selectedConversation || []; // eslint-disable-line vue/no-side-effects-in-computed-properties
- const ordered = orderBy(this.messages, [(m) => {
- return m.timestamp;
- }], ['asc']);
+ const ordered = orderBy(this.messages, [m => m.timestamp], ['asc']);
if (subScribeToUpdate) {
return ordered;
@@ -395,15 +391,11 @@ export default {
// Vue-subscribe to changes
const subScribeToUpdate = this.updateConversionsCounter > -1;
- const filtered = subScribeToUpdate && !this.search ?
- this.conversations :
- filter(this.conversations, (conversation) => {
- return conversation.name.toLowerCase().indexOf(this.search.toLowerCase()) !== -1;
- });
+ const filtered = subScribeToUpdate && !this.search
+ ? this.conversations
+ : filter(this.conversations, conversation => conversation.name.toLowerCase().indexOf(this.search.toLowerCase()) !== -1);
- const ordered = orderBy(filtered, [(o) => {
- return moment(o.date).toDate();
- }], ['desc']);
+ const ordered = orderBy(filtered, [o => moment(o.date).toDate()], ['desc']);
return ordered;
},
@@ -474,9 +466,7 @@ export default {
this.$store.dispatch('user:togglePrivateMessagesOpt');
},
async selectConversation (key) {
- let convoFound = this.conversations.find((conversation) => {
- return conversation.key === key;
- });
+ const convoFound = this.conversations.find(conversation => conversation.key === key);
this.selectedConversation = convoFound || {};
@@ -486,7 +476,7 @@ export default {
Vue.nextTick(() => {
if (!this.$refs.chatscroll) return;
- let chatscroll = this.$refs.chatscroll.$el;
+ const chatscroll = this.$refs.chatscroll.$el;
chatscroll.scrollTop = chatscroll.scrollHeight;
});
},
@@ -527,7 +517,7 @@ export default {
Vue.nextTick(() => {
if (!this.$refs.chatscroll) return;
- let chatscroll = this.$refs.chatscroll.$el;
+ const chatscroll = this.$refs.chatscroll.$el;
chatscroll.scrollTop = chatscroll.scrollHeight;
});
@@ -556,7 +546,7 @@ export default {
return this.icons[`tier${message.contributor.level}`];
},
removeTags (html) {
- let tmp = document.createElement('DIV');
+ const tmp = document.createElement('DIV');
tmp.innerHTML = html;
return tmp.textContent || tmp.innerText || '';
},
@@ -586,8 +576,7 @@ export default {
this.messagesByConversation[this.selectedConversation.key] = this.messagesByConversation[this.selectedConversation.key] || [];
const loadedMessagesToAdd = loadedMessages
- .filter(m => this.messagesByConversation[this.selectedConversation.key].findIndex(mI => mI.id === m.id) === -1)
- ;
+ .filter(m => this.messagesByConversation[this.selectedConversation.key].findIndex(mI => mI.id === m.id) === -1);
this.messagesByConversation[this.selectedConversation.key].push(...loadedMessagesToAdd);
// only show the load more Button if the max count was returned
diff --git a/website/client/src/components/userMenu/profile.vue b/website/client/src/components/userMenu/profile.vue
index 0a32de8fe0..e97e872791 100644
--- a/website/client/src/components/userMenu/profile.vue
+++ b/website/client/src/components/userMenu/profile.vue
@@ -393,14 +393,12 @@
import moment from 'moment';
import axios from 'axios';
import each from 'lodash/each';
-import { mapState } from '@/libs/store';
import cloneDeep from 'lodash/cloneDeep';
+import { mapState } from '@/libs/store';
import MemberDetails from '../memberDetails';
import markdown from '@/directives/markdown';
import achievementsLib from '@/../../common/script/libs/achievements';
-// @TODO: EMAILS.COMMUNITY_MANAGER_EMAIL
-const COMMUNITY_MANAGER_EMAIL = 'admin@habitica.com';
import Content from '@/../../common/script/content';
import profileStats from './profileStats';
@@ -415,9 +413,10 @@ import lock from '@/assets/svg/lock.svg';
import challenge from '@/assets/svg/challenge.svg';
import member from '@/assets/svg/member-icon.svg';
import staff from '@/assets/svg/tier-staff.svg';
+// @TODO: EMAILS.COMMUNITY_MANAGER_EMAIL
+const COMMUNITY_MANAGER_EMAIL = 'admin@habitica.com';
export default {
- props: ['userId', 'startingPage'],
directives: {
markdown,
},
@@ -425,6 +424,7 @@ export default {
MemberDetails,
profileStats,
},
+ props: ['userId', 'startingPage'],
data () {
return {
icons: Object.freeze({
@@ -479,7 +479,7 @@ export default {
},
classText () {
- let classTexts = {
+ const classTexts = {
warrior: this.$t('warrior'),
wizard: this.$t('mage'),
rogue: this.$t('rogue'),
@@ -495,9 +495,6 @@ export default {
return this.$store.getters['members:hasClass'](this.userLoggedIn);
},
},
- mounted () {
- this.loadUser();
- },
watch: {
startingPage () {
this.selectedPage = this.startingPage;
@@ -509,6 +506,9 @@ export default {
this.loadUser();
},
},
+ mounted () {
+ this.loadUser();
+ },
methods: {
async loadUser () {
let user = this.userLoggedIn;
@@ -518,10 +518,10 @@ export default {
this.hero = {};
this.adminToolsLoaded = false;
- let profileUserId = this.userId;
+ const profileUserId = this.userId;
if (profileUserId && profileUserId !== this.userLoggedIn._id) {
- let response = await this.$store.dispatch('members:fetchMember', { memberId: profileUserId });
+ const response = await this.$store.dispatch('members:fetchMember', { memberId: profileUserId });
user = response.data.data;
}
@@ -566,20 +566,20 @@ export default {
// return `${this.$t('checkinProgressTitle')} ${start}/${end}`;
},
getIncentivesProgress () {
- let currentLoginDay = Content.loginIncentives[this.user.loginIncentives];
+ const currentLoginDay = Content.loginIncentives[this.user.loginIncentives];
if (!currentLoginDay) return 0;
- let previousRewardDay = currentLoginDay.prevRewardKey;
- let nextRewardAt = currentLoginDay.nextRewardAt;
+ const previousRewardDay = currentLoginDay.prevRewardKey;
+ const { nextRewardAt } = currentLoginDay;
return (this.user.loginIncentives - previousRewardDay) / (nextRewardAt - previousRewardDay) * 100;
},
save () {
- let values = {};
+ const values = {};
- let edits = cloneDeep(this.editingProfile);
+ const edits = cloneDeep(this.editingProfile);
each(edits, (value, key) => {
// Using toString because we need to compare two arrays (websites)
- let curVal = this.user.profile[key];
+ const curVal = this.user.profile[key];
if (!curVal || value.toString() !== curVal.toString()) {
values[`profile.${key}`] = value;
@@ -596,7 +596,7 @@ export default {
axios.post(`/api/v4/user/block/${this.user._id}`);
},
unblockUser () {
- let index = this.userLoggedIn.inbox.blocks.indexOf(this.user._id);
+ const index = this.userLoggedIn.inbox.blocks.indexOf(this.user._id);
this.userLoggedIn.inbox.blocks.splice(index, 1);
axios.post(`/api/v4/user/block/${this.user._id}`);
},
diff --git a/website/client/src/components/userMenu/profileModal.vue b/website/client/src/components/userMenu/profileModal.vue
index 2379c7ec64..4c04e95408 100644
--- a/website/client/src/components/userMenu/profileModal.vue
+++ b/website/client/src/components/userMenu/profileModal.vue
@@ -12,39 +12,39 @@
diff --git a/website/client/src/components/userMenu/profilePage.vue b/website/client/src/components/userMenu/profilePage.vue
index e1ec222301..cfb7a0f50b 100644
--- a/website/client/src/components/userMenu/profilePage.vue
+++ b/website/client/src/components/userMenu/profilePage.vue
@@ -13,12 +13,12 @@
diff --git a/website/client/src/components/userMenu/profileStats.vue b/website/client/src/components/userMenu/profileStats.vue
index a7f8cc0239..8c55dd7ad5 100644
--- a/website/client/src/components/userMenu/profileStats.vue
+++ b/website/client/src/components/userMenu/profileStats.vue
@@ -150,205 +150,202 @@
diff --git a/website/client/src/components/yesterdailyModal.vue b/website/client/src/components/yesterdailyModal.vue
index 4d6a5ad6d4..62b0e7c900 100644
--- a/website/client/src/components/yesterdailyModal.vue
+++ b/website/client/src/components/yesterdailyModal.vue
@@ -69,17 +69,17 @@ import { mapState } from '@/libs/store';
import Task from './tasks/task';
export default {
- props: ['yesterDailies'],
components: {
Task,
},
+ props: ['yesterDailies'],
data () {
return {
dueDate: moment().subtract(1, 'days'),
};
},
computed: {
- ...mapState({user: 'user.data'}),
+ ...mapState({ user: 'user.data' }),
tasksByType () {
this.dueDate = moment().subtract(1, 'days'); // eslint-disable-line vue/no-side-effects-in-computed-properties
diff --git a/website/client/src/directives/directive.common.js b/website/client/src/directives/directive.common.js
index 151bc76870..a7321b864b 100644
--- a/website/client/src/directives/directive.common.js
+++ b/website/client/src/directives/directive.common.js
@@ -1,6 +1,6 @@
// https://stackoverflow.com/a/40720172/1298154
export const emit = (vnode, emitName, data) => {
- let handlers = vnode.data && vnode.data.on || vnode.componentOptions && vnode.componentOptions.listeners;
+ const handlers = vnode.data && vnode.data.on || vnode.componentOptions && vnode.componentOptions.listeners;
if (handlers && handlers[emitName]) {
handlers[emitName].fns(data);
diff --git a/website/client/src/directives/markdown.js b/website/client/src/directives/markdown.js
index bc2cd0a458..99237ee1c8 100644
--- a/website/client/src/directives/markdown.js
+++ b/website/client/src/directives/markdown.js
@@ -1,6 +1,6 @@
import habiticaMarkdown from 'habitica-markdown';
-export default function markdown (el, {value, oldValue}) {
+export default function markdown (el, { value, oldValue }) {
if (value === oldValue) return;
if (value) {
@@ -10,4 +10,4 @@ export default function markdown (el, {value, oldValue}) {
}
el.classList.add('markdown');
-}
\ No newline at end of file
+}
diff --git a/website/client/src/directives/mouseposition.directive.js b/website/client/src/directives/mouseposition.directive.js
index 7206ef3102..b923408896 100644
--- a/website/client/src/directives/mouseposition.directive.js
+++ b/website/client/src/directives/mouseposition.directive.js
@@ -12,7 +12,7 @@ const EVENT_NAME = 'mouseMoved';
export default {
bind (el, binding, vnode) {
- el.handleMouseMove = _throttle((ev) => {
+ el.handleMouseMove = _throttle(ev => {
emit(vnode, EVENT_NAME, {
x: ev.clientX,
y: ev.clientY,
diff --git a/website/client/src/filters/floorWholeNumber.js b/website/client/src/filters/floorWholeNumber.js
index 02e04b9ec6..3e30e2e5c3 100644
--- a/website/client/src/filters/floorWholeNumber.js
+++ b/website/client/src/filters/floorWholeNumber.js
@@ -1,3 +1,3 @@
export default function floorWholeNumber (val) {
return Math.floor(val);
-}
\ No newline at end of file
+}
diff --git a/website/client/src/filters/registerGlobals.js b/website/client/src/filters/registerGlobals.js
index d111cfd6dd..a6ae6e2d4e 100644
--- a/website/client/src/filters/registerGlobals.js
+++ b/website/client/src/filters/registerGlobals.js
@@ -7,4 +7,4 @@ import floorWholeNumber from './floorWholeNumber';
Vue.filter('round', round);
Vue.filter('floor', floor);
Vue.filter('roundBigNumber', roundBigNumber);
-Vue.filter('floorWholeNumber', floorWholeNumber);
\ No newline at end of file
+Vue.filter('floorWholeNumber', floorWholeNumber);
diff --git a/website/client/src/filters/round.js b/website/client/src/filters/round.js
index 2fa5858670..5fdd3c10d9 100644
--- a/website/client/src/filters/round.js
+++ b/website/client/src/filters/round.js
@@ -1,3 +1,3 @@
export default function round (val) {
return Math.round(val * 100) / 100;
-}
\ No newline at end of file
+}
diff --git a/website/client/src/filters/roundBigNumber.js b/website/client/src/filters/roundBigNumber.js
index 4f7e94961d..92c48032bc 100644
--- a/website/client/src/filters/roundBigNumber.js
+++ b/website/client/src/filters/roundBigNumber.js
@@ -15,11 +15,10 @@ function _convertToBillion (num) {
export default function roundBigNumber (num) {
if (num > 999999999) {
return _convertToBillion(num);
- } else if (num > 999999) {
+ } if (num > 999999) {
return _convertToMillion(num);
- } else if (num > 999) {
+ } if (num > 999) {
return _convertToThousand(num);
- } else {
- return round(num);
}
-}
\ No newline at end of file
+ return round(num);
+}
diff --git a/website/client/src/libs/analytics.js b/website/client/src/libs/analytics.js
index 0a202fed6f..1e687f635b 100644
--- a/website/client/src/libs/analytics.js
+++ b/website/client/src/libs/analytics.js
@@ -3,16 +3,16 @@ import isEqual from 'lodash/isEqual';
import keys from 'lodash/keys';
import pick from 'lodash/pick';
import includes from 'lodash/includes';
-import getStore from '@/store';
import amplitude from 'amplitude-js';
import Vue from 'vue';
+import getStore from '@/store';
const IS_PRODUCTION = process.env.NODE_ENV === 'production'; // eslint-disable-line no-process-env
-const AMPLITUDE_KEY = process.env.AMPLITUDE_KEY; // eslint-disable-line no-process-env
-const GA_ID = process.env.GA_ID; // eslint-disable-line no-process-env
+const { AMPLITUDE_KEY } = process.env; // eslint-disable-line no-process-env
+const { GA_ID } = process.env; // eslint-disable-line no-process-env
-let REQUIRED_FIELDS = ['hitType', 'eventCategory', 'eventAction'];
-let ALLOWED_HIT_TYPES = [
+const REQUIRED_FIELDS = ['hitType', 'eventCategory', 'eventAction'];
+const ALLOWED_HIT_TYPES = [
'pageview',
'screenview',
'event',
@@ -73,7 +73,7 @@ export function setUser () {
const store = getStore();
const user = store.state.user.data;
amplitude.getInstance().setUserId(user._id);
- window.ga('set', {userId: user._id});
+ window.ga('set', { userId: user._id });
}
export function track (properties) {
diff --git a/website/client/src/libs/asyncResource.js b/website/client/src/libs/asyncResource.js
index c620295865..5d74d99f32 100644
--- a/website/client/src/libs/asyncResource.js
+++ b/website/client/src/libs/asyncResource.js
@@ -10,7 +10,9 @@ export function asyncResourceFactory () {
};
}
-export function loadAsyncResource ({store, path, url, deserialize, forceLoad = false}) {
+export function loadAsyncResource ({
+ store, path, url, deserialize, forceLoad = false,
+}) {
if (!store) throw new Error('"store" is required and must be the application store.');
if (!path) throw new Error('The path to the resource in the application state is required.');
if (!url) throw new Error('The resource\'s url on the server is required.');
@@ -18,22 +20,21 @@ export function loadAsyncResource ({store, path, url, deserialize, forceLoad = f
const resource = get(store.state, path);
if (!resource) throw new Error(`No resouce found at path "${path}".`);
- const loadingStatus = resource.loadingStatus;
+ const { loadingStatus } = resource;
if (loadingStatus === 'LOADED' && !forceLoad) {
return Promise.resolve(resource);
- } else if (loadingStatus === 'LOADING') {
+ } if (loadingStatus === 'LOADING') {
return new Promise((resolve, reject) => {
- const resourceWatcher = store.watch(state => get(state, `${path}.loadingStatus`), (newLoadingStatus) => {
+ const resourceWatcher = store.watch(state => get(state, `${path}.loadingStatus`), newLoadingStatus => {
resourceWatcher(); // remove the watcher
if (newLoadingStatus === 'LOADED') {
return resolve(resource);
- } else {
- return reject(); // TODO add reason?
}
+ return reject(); // TODO add reason?
});
});
- } else if (loadingStatus === 'NOT_LOADED' || forceLoad) {
+ } if (loadingStatus === 'NOT_LOADED' || forceLoad) {
return axios.get(url).then(response => { // TODO support more params
resource.loadingStatus = 'LOADED';
// deserialize can be a promise
@@ -42,7 +43,6 @@ export function loadAsyncResource ({store, path, url, deserialize, forceLoad = f
return resource;
});
});
- } else {
- return Promise.reject(new Error(`Invalid loading status "${loadingStatus} for resource at "${path}".`));
}
+ return Promise.reject(new Error(`Invalid loading status "${loadingStatus} for resource at "${path}".`));
}
diff --git a/website/client/src/libs/auth.js b/website/client/src/libs/auth.js
index 8c31ba0179..432222436c 100644
--- a/website/client/src/libs/auth.js
+++ b/website/client/src/libs/auth.js
@@ -8,7 +8,7 @@ export function setUpAxios (AUTH_SETTINGS) {
AUTH_SETTINGS = JSON.parse(AUTH_SETTINGS);
}
- let browserTimezoneOffset = moment().zone();
+ const browserTimezoneOffset = moment().zone();
if (AUTH_SETTINGS.auth && AUTH_SETTINGS.auth.apiId && AUTH_SETTINGS.auth.apiToken) {
axios.defaults.headers.common['x-api-user'] = AUTH_SETTINGS.auth.apiId;
diff --git a/website/client/src/libs/createAnimal.js b/website/client/src/libs/createAnimal.js
index 87df5b46b4..01c10ed13c 100644
--- a/website/client/src/libs/createAnimal.js
+++ b/website/client/src/libs/createAnimal.js
@@ -7,9 +7,8 @@ const wackyPets = Object.keys(content.wackyPets);
function getText (textOrFunction) {
if (textOrFunction instanceof Function) {
return textOrFunction();
- } else {
- return textOrFunction;
}
+ return textOrFunction;
}
export function isOwned (type, animal, userItems) {
@@ -17,16 +16,16 @@ export function isOwned (type, animal, userItems) {
}
export function isHatchable (animal, userItems) {
- return !isOwned('pet', animal, userItems) &&
- userItems.eggs[animal.eggKey] &&
- userItems.hatchingPotions[animal.potionKey];
+ return !isOwned('pet', animal, userItems)
+ && userItems.eggs[animal.eggKey]
+ && userItems.hatchingPotions[animal.potionKey];
}
export function isAllowedToFeed (animal, userItems) {
- return !specialPets.includes(animal.key) &&
- !wackyPets.includes(animal.key) &&
- isOwned('pet', animal, userItems) &&
- !isOwned('mount', animal, userItems);
+ return !specialPets.includes(animal.key)
+ && !wackyPets.includes(animal.key)
+ && isOwned('pet', animal, userItems)
+ && !isOwned('mount', animal, userItems);
}
export function isSpecial (animal) {
@@ -34,7 +33,7 @@ export function isSpecial (animal) {
}
export function createAnimal (egg, potion, type, _content, userItems) {
- let animalKey = `${egg.key}-${potion.key}`;
+ const animalKey = `${egg.key}-${potion.key}`;
return {
key: animalKey,
diff --git a/website/client/src/libs/encodeParams.js b/website/client/src/libs/encodeParams.js
index 1666e92fa5..f208a89405 100644
--- a/website/client/src/libs/encodeParams.js
+++ b/website/client/src/libs/encodeParams.js
@@ -1,7 +1,5 @@
// Equivalent of jQuery's param
export default function (params) {
- return Object.keys(params).map((k) => {
- return `${encodeURIComponent(k)}=${encodeURIComponent(params[k])}`;
- }).join('&');
+ return Object.keys(params).map(k => `${encodeURIComponent(k)}=${encodeURIComponent(params[k])}`).join('&');
}
diff --git a/website/client/src/libs/i18n.js b/website/client/src/libs/i18n.js
index c3f8df67f5..bdf4888f57 100644
--- a/website/client/src/libs/i18n.js
+++ b/website/client/src/libs/i18n.js
@@ -1,17 +1,17 @@
// Vue plugin to globally expose a '$t' method that calls common/i18n.t.
// Can be anywhere inside vue as 'this.$t' or '$t' in templates.
-import i18n from '@/../../common/script/i18n';
import moment from 'moment';
+import i18n from '@/../../common/script/i18n';
export default {
- install (Vue, {i18nData}) {
+ install (Vue, { i18nData }) {
if (i18nData) {
// Load i18n strings
i18n.strings = i18nData.strings;
// Load Moment.js locale
- const language = i18nData.language;
+ const { language } = i18nData;
if (language && i18nData.momentLang && language.momentLangCode) {
// Make moment available under `window` so that the locale can be set
@@ -31,4 +31,4 @@ export default {
return i18n.t.apply(null, arguments);
};
},
-};
\ No newline at end of file
+};
diff --git a/website/client/src/libs/notifications.js b/website/client/src/libs/notifications.js
index 0c1c696560..7ab27a27a2 100644
--- a/website/client/src/libs/notifications.js
+++ b/website/client/src/libs/notifications.js
@@ -1,4 +1,4 @@
-export function getDropClass ({type, key}) {
+export function getDropClass ({ type, key }) {
let dropClass = '';
if (type) {
@@ -48,4 +48,4 @@ export function round (number, nDigits) {
export function getXPMessage (val) {
return `${getSign(val)} ${round(val)}`;
-}
\ No newline at end of file
+}
diff --git a/website/client/src/libs/store/helpers/filterTasks.js b/website/client/src/libs/store/helpers/filterTasks.js
index 6d88e9563d..2068bfadb5 100644
--- a/website/client/src/libs/store/helpers/filterTasks.js
+++ b/website/client/src/libs/store/helpers/filterTasks.js
@@ -38,15 +38,15 @@ const taskFilters = {
};
function typeLabel (filterList) {
- return (type) => filterList[type].label;
+ return type => filterList[type].label;
}
export const getTypeLabel = typeLabel(taskFilters);
function filterLabel (filterList) {
- return (type) => {
- let filterListByType = filterList[type].filters;
- let filterListOfLabels = new Array(filterListByType.length);
+ return type => {
+ const filterListByType = filterList[type].filters;
+ const filterListOfLabels = new Array(filterListByType.length);
filterListByType.forEach(({ label }, i) => filterListOfLabels[i] = label);
return filterListOfLabels;
@@ -57,7 +57,7 @@ export const getFilterLabels = filterLabel(taskFilters);
function activeFilter (filterList) {
return (type, filterType = '') => {
- let filterListByType = filterList[type].filters;
+ const filterListByType = filterList[type].filters;
if (filterType) {
return filterListByType.find(f => f.label === filterType);
}
diff --git a/website/client/src/libs/store/helpers/internals.js b/website/client/src/libs/store/helpers/internals.js
index e6999e932e..c3083d0670 100644
--- a/website/client/src/libs/store/helpers/internals.js
+++ b/website/client/src/libs/store/helpers/internals.js
@@ -20,7 +20,7 @@ Example:
tasks:dailys
*/
export function flattenAndNamespace (namespaces) {
- let result = {};
+ const result = {};
Object.keys(namespaces).forEach(namespace => {
Object.keys(namespaces[namespace]).forEach(itemName => {
@@ -29,4 +29,4 @@ export function flattenAndNamespace (namespaces) {
});
return result;
-}
\ No newline at end of file
+}
diff --git a/website/client/src/libs/store/helpers/orderTasks.js b/website/client/src/libs/store/helpers/orderTasks.js
index 1f4957e2bd..400cd9770f 100644
--- a/website/client/src/libs/store/helpers/orderTasks.js
+++ b/website/client/src/libs/store/helpers/orderTasks.js
@@ -28,4 +28,4 @@ export function orderMultipleTypeTasks (rawTasks, tasksOrder) {
todos: orderSingleTypeTasks(rawTasks.todos, tasksOrder.todos),
rewards: orderSingleTypeTasks(rawTasks.rewards, tasksOrder.rewards),
};
-}
\ No newline at end of file
+}
diff --git a/website/client/src/libs/store/helpers/public.js b/website/client/src/libs/store/helpers/public.js
index 7b46aff7a7..d6ae5ea759 100644
--- a/website/client/src/libs/store/helpers/public.js
+++ b/website/client/src/libs/store/helpers/public.js
@@ -25,9 +25,9 @@ The code has been slightly changed to match our code style and to support nested
import get from 'lodash/get';
function normalizeMap (map) {
- return Array.isArray(map) ?
- map.map(key => ({ key, val: key })) :
- Object.keys(map).map(key => ({ key, val: map[key] }));
+ return Array.isArray(map)
+ ? map.map(key => ({ key, val: key }))
+ : Object.keys(map).map(key => ({ key, val: map[key] }));
}
export function mapState (states) {
@@ -35,9 +35,9 @@ export function mapState (states) {
normalizeMap(states).forEach(({ key, val }) => {
res[key] = function mappedState () {
- return typeof val === 'function' ?
- val.call(this, this.$store.state, this.$store.getters) :
- get(this.$store.state, val);
+ return typeof val === 'function'
+ ? val.call(this, this.$store.state, this.$store.getters)
+ : get(this.$store.state, val);
};
});
@@ -66,4 +66,4 @@ export function mapActions (actions) {
});
return res;
-}
\ No newline at end of file
+}
diff --git a/website/client/src/libs/store/index.js b/website/client/src/libs/store/index.js
index 502c28828c..e288479108 100644
--- a/website/client/src/libs/store/index.js
+++ b/website/client/src/libs/store/index.js
@@ -5,7 +5,7 @@ import Vue from 'vue';
// similar internal implementation (thanks!), main difference is the absence of mutations.
export default class Store {
- constructor ({state, getters, actions}) {
+ constructor ({ state, getters, actions }) {
// Store actions
this._actions = actions;
@@ -16,7 +16,7 @@ export default class Store {
const _computed = {};
Object.keys(getters).forEach(key => {
- let getter = getters[key];
+ const getter = getters[key];
// Each getter is compiled to a computed property on the internal VM
_computed[key] = () => getter(this);
@@ -41,7 +41,7 @@ export default class Store {
// Actions should be called using store.dispatch(ACTION_NAME, ...ARGS)
// They get passed the store instance and any additional argument passed to dispatch()
dispatch (type, ...args) {
- let action = this._actions[type];
+ const action = this._actions[type];
if (!action) throw new Error(`Action "${type}" not found.`);
return action(this, ...args);
diff --git a/website/client/src/main.js b/website/client/src/main.js
index 9bd0a92b12..b0836c73cc 100644
--- a/website/client/src/main.js
+++ b/website/client/src/main.js
@@ -26,7 +26,7 @@ Vue.config.performance = !IS_PRODUCTION;
Vue.config.productionTip = IS_PRODUCTION;
// window['habitica-i18n] is injected by the server
-Vue.use(i18n, {i18nData: window && window['habitica-i18n']});
+Vue.use(i18n, { i18nData: window && window['habitica-i18n'] });
Vue.use(StoreModule);
Vue.use(BootstrapVue);
diff --git a/website/client/src/mixins/avatarEditUtilities.js b/website/client/src/mixins/avatarEditUtilities.js
index 622c2193c8..69d53aedeb 100644
--- a/website/client/src/mixins/avatarEditUtilities.js
+++ b/website/client/src/mixins/avatarEditUtilities.js
@@ -1,15 +1,15 @@
import moment from 'moment';
import axios from 'axios';
+import get from 'lodash/get';
import unlock from '@/../../common/script/ops/unlock';
import buy from '@/../../common/script/ops/buy/buy';
-import get from 'lodash/get';
import appearanceSets from '@/../../common/script/content/appearance/sets';
-import {userStateMixin} from './userState';
+import { userStateMixin } from './userState';
export const avatarEditorUtilies = {
mixins: [userStateMixin],
@@ -31,16 +31,14 @@ export const avatarEditorUtilies = {
option.pathKey = pathKey;
option.active = userPreference === key;
option.class = this.createClass(type, subType, key);
- option.click = (optionParam) => {
- return option.gemLocked ? this.unlock(`${optionParam.pathKey}.${key}`) : this.set({[`preferences.${optionParam.pathKey}`]: optionParam.key});
- };
+ option.click = optionParam => (option.gemLocked ? this.unlock(`${optionParam.pathKey}.${key}`) : this.set({ [`preferences.${optionParam.pathKey}`]: optionParam.key }));
return option;
},
mapKeysToOption (key, type, subType, set) {
const option = this.mapKeysToFreeOption(key, type, subType);
- let userPurchased = subType ? this.user.purchased[type][subType] : this.user.purchased[type];
- let locked = !userPurchased || !userPurchased[key];
+ const userPurchased = subType ? this.user.purchased[type][subType] : this.user.purchased[type];
+ const locked = !userPurchased || !userPurchased[key];
let hide = false;
if (set && appearanceSets[set]) {
@@ -104,7 +102,7 @@ export const avatarEditorUtilies = {
this.$store.dispatch('user:set', settings);
},
equip (key, type) {
- this.$store.dispatch('common:equip', {key, type});
+ this.$store.dispatch('common:equip', { key, type });
},
/**
* For gem-unlockable preferences, (a) if owned, select preference (b) else, purchase
@@ -112,8 +110,8 @@ export const avatarEditorUtilies = {
* Pass in this paramater as "skin.abc". Alternatively, pass as an array ["skin.abc", "skin.xyz"] to unlock sets
*/
async unlock (path) {
- let fullSet = path.indexOf(',') !== -1;
- let isBackground = path.indexOf('background.') !== -1;
+ const fullSet = path.indexOf(',') !== -1;
+ const isBackground = path.indexOf('background.') !== -1;
let cost;
@@ -123,7 +121,7 @@ export const avatarEditorUtilies = {
cost = fullSet ? 1.25 : 0.5; // (Hair, skin, etc) 5G per set, 2G per individual
}
- let loginIncentives = [
+ const loginIncentives = [
'background.blue',
'background.green',
'background.red',
@@ -134,11 +132,11 @@ export const avatarEditorUtilies = {
if (loginIncentives.indexOf(path) === -1) {
if (fullSet) {
- if (confirm(this.$t('purchaseFor', {cost: cost * 4})) !== true) return;
+ if (confirm(this.$t('purchaseFor', { cost: cost * 4 })) !== true) return;
// @TODO: implement gem modal
// if (this.user.balance < cost) return $rootScope.openModal('buyGems');
} else if (!get(this.user, `purchased.${path}`)) {
- if (confirm(this.$t('purchaseFor', {cost: cost * 4})) !== true) return;
+ if (confirm(this.$t('purchaseFor', { cost: cost * 4 })) !== true) return;
// @TODO: implement gem modal
// if (this.user.balance < cost) return $rootScope.openModal('buyGems');
}
diff --git a/website/client/src/mixins/buy.js b/website/client/src/mixins/buy.js
index 7b709861e4..dd537e8db4 100644
--- a/website/client/src/mixins/buy.js
+++ b/website/client/src/mixins/buy.js
@@ -18,9 +18,8 @@ export default {
type: 'error',
});
return;
- } else {
- throw e;
}
+ throw e;
}
this.$root.$emit('playSound', 'Reward');
diff --git a/website/client/src/mixins/groupsUtilities.js b/website/client/src/mixins/groupsUtilities.js
index ce6f22b938..1bab4ce001 100644
--- a/website/client/src/mixins/groupsUtilities.js
+++ b/website/client/src/mixins/groupsUtilities.js
@@ -3,13 +3,13 @@ import intersection from 'lodash/intersection';
export default {
filters: {
// https://stackoverflow.com/questions/2685911/is-there-a-way-to-round-numbers-into-a-reader-friendly-format-e-g-1-1k
- abbrNum: (number) => {
+ abbrNum: number => {
let decPlaces = 1;
decPlaces = Math.pow(10, decPlaces);
- let abbrev = ['k', 'm', 'b', 't'];
+ const abbrev = ['k', 'm', 'b', 't'];
for (let i = abbrev.length - 1; i >= 0; i--) {
- let size = Math.pow(10, (i + 1) * 3);
+ const size = Math.pow(10, (i + 1) * 3);
if (size <= number) {
number = Math.floor(number * decPlaces / size) / decPlaces;
@@ -61,11 +61,11 @@ export default {
}
if (filters.categories && filters.categories.length > 0) {
- let intersectingCats = intersection(filters.categories, group.categorySlugs);
+ const intersectingCats = intersection(filters.categories, group.categorySlugs);
hasCategories = intersectingCats.length > 0;
}
- let filteringRole = filters.roles && filters.roles.length > 0;
+ const filteringRole = filters.roles && filters.roles.length > 0;
if (filteringRole && filters.roles.indexOf('member') !== -1) {
isMember = this.isMemberOfGroup(user, group);
}
diff --git a/website/client/src/mixins/guide.js b/website/client/src/mixins/guide.js
index 10a82b1201..c82e525e27 100644
--- a/website/client/src/mixins/guide.js
+++ b/website/client/src/mixins/guide.js
@@ -109,8 +109,8 @@ export default {
]],
};
- for (let key in this.chapters) {
- let chapter = this.chapters[key][0][0];
+ for (const key in this.chapters) {
+ const chapter = this.chapters[key][0][0];
chapter.intro = `
@@ -128,38 +128,38 @@ export default {
this.initTour();
switch (this.$route.name) {
// case 'options.profile.avatar': return goto('intro', 5);
- case 'stats': return this.goto('stats', 0);
- case 'tavern': return this.goto('tavern', 0);
- case 'party': return this.goto('party', 0);
+ case 'stats': return this.goto('stats', 0);
+ case 'tavern': return this.goto('tavern', 0);
+ case 'party': return this.goto('party', 0);
case 'guildsDiscovery': return this.goto('guilds', 0);
- case 'challenges': return this.goto('challenges', 0);
- case 'patrons': return this.goto('hall', 0);
- case 'items': return this.goto('market', 0);
- case 'stable': return this.goto('pets', 0);
+ case 'challenges': return this.goto('challenges', 0);
+ case 'patrons': return this.goto('hall', 0);
+ case 'items': return this.goto('market', 0);
+ case 'stable': return this.goto('pets', 0);
// @TODO: same page now case 'stable': return this.goto('mounts', 0);
- case 'equipment': return this.goto('equipment', 0);
+ case 'equipment': return this.goto('equipment', 0);
}
},
hoyo (user) {
// @TODO: What is was the timeout for?
// @TODO move to analytics
window.amplitude.setUserId(user._id);
- window.ga('set', {userId: user._id});
+ window.ga('set', { userId: user._id });
},
goto (chapter, page, force) {
- if (chapter === 'intro' && this.user.flags.welcomed !== true) {
+ if (chapter === 'intro' && this.user.flags.welcomed !== true) {
// @TODO: Add dispatch User.set({'flags.welcomed': true});
}
if (chapter === 'classes' && this.user.flags.tour.classes === -2) return;
if (page === -1) page = 0;
- let curr = this.user.flags.tour[chapter];
+ const curr = this.user.flags.tour[chapter];
if (page !== curr + 1 && !force) return;
- let opts = {}; // @TODO: chap._options;
+ const opts = {}; // @TODO: chap._options;
opts.steps = [];
page += 1;
- times(page, (p) => {
- opts.steps = opts.steps.concat(this.chapters[chapter][p]);
+ times(page, p => {
+ opts.steps = opts.steps.concat(this.chapters[chapter][p]);
});
Analytics.track({
@@ -185,8 +185,8 @@ export default {
});
},
markTourComplete (chapter) {
- let ups = {};
- let lastKnownStep = this.user.flags.tour[chapter];
+ const ups = {};
+ const lastKnownStep = this.user.flags.tour[chapter];
// Return early if user has already completed this tutorial
if (lastKnownStep === -2) {
diff --git a/website/client/src/mixins/inventoryUtils.js b/website/client/src/mixins/inventoryUtils.js
index 87385a0aa4..2f3ebc4400 100644
--- a/website/client/src/mixins/inventoryUtils.js
+++ b/website/client/src/mixins/inventoryUtils.js
@@ -16,9 +16,9 @@ export default {
getItemName (type, item) {
switch (type) {
case 'eggs':
- return this.$t('egg', {eggType: item.text()});
+ return this.$t('egg', { eggType: item.text() });
case 'hatchingPotions':
- return this.$t('potion', {potionType: item.text()});
+ return this.$t('potion', { potionType: item.text() });
default:
return item.text();
}
diff --git a/website/client/src/mixins/notifications.js b/website/client/src/mixins/notifications.js
index 76c619ab8a..cfc45b0f80 100644
--- a/website/client/src/mixins/notifications.js
+++ b/website/client/src/mixins/notifications.js
@@ -1,6 +1,8 @@
import habiticaMarkdown from 'habitica-markdown';
import { mapState } from '@/libs/store';
-import { getDropClass, getXPMessage, getSign, round } from '@/libs/notifications';
+import {
+ getDropClass, getXPMessage, getSign, round,
+} from '@/libs/notifications';
// See https://stackoverflow.com/questions/4187146/truncate-number-to-two-decimal-places-without-rounding
function toFixedWithoutRounding (num, fixed) {
@@ -10,18 +12,18 @@ function toFixedWithoutRounding (num, fixed) {
export default {
computed: {
- ...mapState({notifications: 'notificationStore'}),
+ ...mapState({ notifications: 'notificationStore' }),
},
methods: {
coins (money) {
return this.round(money, 2);
},
crit (val) {
- let message = `${this.$t('critBonus')} ${Math.round(val)} %`;
+ const message = `${this.$t('critBonus')} ${Math.round(val)} %`;
this.notify(message, 'crit', 'glyphicon glyphicon-certificate');
},
drop (val, item) {
- let dropClass = getDropClass({key: item.key, type: item.type});
+ const dropClass = getDropClass({ key: item.key, type: item.type });
this.notify(val, 'drop', dropClass);
},
quest (type, val) {
@@ -46,7 +48,7 @@ export default {
},
markdown (val) {
if (!val) return;
- let parsedMarkdown = habiticaMarkdown.render(String(val));
+ const parsedMarkdown = habiticaMarkdown.render(String(val));
this.notify(parsedMarkdown, 'info');
},
mp (val) {
diff --git a/website/client/src/mixins/openedItemRows.js b/website/client/src/mixins/openedItemRows.js
index 5283ad00a7..17d0b1624f 100644
--- a/website/client/src/mixins/openedItemRows.js
+++ b/website/client/src/mixins/openedItemRows.js
@@ -10,12 +10,12 @@ export default {
},
methods: {
$_openedItemRows_toggleByType (typeId, add) {
- let array = this.$store.state.openedItemRows;
+ const array = this.$store.state.openedItemRows;
if (add) {
array.push(typeId);
} else {
- let index = array.indexOf(typeId);
+ const index = array.indexOf(typeId);
if (index > -1) {
array.splice(index, 1);
diff --git a/website/client/src/mixins/payments.js b/website/client/src/mixins/payments.js
index 0392b7dbd9..79c440fcda 100644
--- a/website/client/src/mixins/payments.js
+++ b/website/client/src/mixins/payments.js
@@ -1,21 +1,21 @@
-import axios from 'axios';
-
-const STRIPE_PUB_KEY = process.env.STRIPE_PUB_KEY; // eslint-disable-line no-process-env
+import axios from 'axios'; // eslint-disable-line no-process-env
+import pick from 'lodash/pick';
+import moment from 'moment';
import subscriptionBlocks from '@/../../common/script/content/subscriptionBlocks';
import { mapState } from '@/libs/store';
import encodeParams from '@/libs/encodeParams';
import notificationsMixin from '@/mixins/notifications';
import * as Analytics from '@/libs/analytics';
import { CONSTANTS, setLocalSetting } from '@/libs/userlocalManager';
-import pick from 'lodash/pick';
-import moment from 'moment';
+
+const { STRIPE_PUB_KEY } = process.env;
const habiticaUrl = `${location.protocol}//${location.host}`;
export default {
mixins: [notificationsMixin],
computed: {
- ...mapState({user: 'user.data', credentials: 'credentials'}),
+ ...mapState({ user: 'user.data', credentials: 'credentials' }),
paypalCheckoutLink () {
return '/paypal/checkout';
},
@@ -40,13 +40,13 @@ export default {
methods: {
encodeGift (uuid, gift) {
gift.uuid = uuid;
- let encodedString = JSON.stringify(gift);
+ const encodedString = JSON.stringify(gift);
return encodeURIComponent(encodedString);
},
openPaypalGift (data) {
if (!this.checkGemAmount(data)) return;
- let gift = this.encodeGift(data.giftedTo, data.gift);
+ const gift = this.encodeGift(data.giftedTo, data.gift);
const url = `/paypal/checkout?gift=${gift}`;
this.openPaypal(url, `gift-${data.gift.type === 'gems' ? 'gems' : 'subscription'}`, data);
@@ -114,7 +114,7 @@ export default {
description: sub ? this.$t('subscribe') : this.$t('checkout'),
// image: '/apple-touch-icon-144-precomposed.png',
panelLabel: sub ? this.$t('subscribe') : this.$t('checkout'),
- token: async (res) => {
+ token: async res => {
let url = '/stripe/checkout?a=a'; // just so I can concat &x=x below
if (data.groupToCreate) {
@@ -128,10 +128,10 @@ export default {
if (data.coupon) url += `&coupon=${data.coupon}`;
if (data.groupId) url += `&groupId=${data.groupId}`;
- let response = await axios.post(url, res);
+ const response = await axios.post(url, res);
// @TODO handle with normal notifications?
- let responseStatus = response.status;
+ const responseStatus = response.status;
if (responseStatus >= 400) {
alert(`Error: ${response.message}`);
return;
@@ -162,7 +162,7 @@ export default {
setLocalSetting(CONSTANTS.savedAppStateValues.SAVED_APP_STATE, JSON.stringify(appState));
- let newGroup = response.data.data;
+ const newGroup = response.data.data;
if (newGroup && newGroup._id) {
// @TODO this does not do anything as we reload just below
// @TODO: Just append? or $emit?
@@ -206,10 +206,10 @@ export default {
name: this.$t('subUpdateTitle'),
description: this.$t('subUpdateDescription'),
panelLabel: this.$t('subUpdateCard'),
- token: async (data) => {
+ token: async data => {
data.groupId = groupId;
- let url = '/stripe/subscribe/edit';
- let response = await axios.post(url, data);
+ const url = '/stripe/subscribe/edit';
+ const response = await axios.post(url, data);
// Success
window.location.reload(true);
@@ -219,8 +219,8 @@ export default {
});
},
checkGemAmount (data) {
- let isGem = data && data.gift && data.gift.type === 'gems';
- let notEnoughGem = isGem && (!data.gift.gems.amount || data.gift.gems.amount === 0);
+ const isGem = data && data.gift && data.gift.type === 'gems';
+ const notEnoughGem = isGem && (!data.gift.gems.amount || data.gift.gems.amount === 0);
if (notEnoughGem) {
this.error(this.$t('badAmountOfGemsToPurchase'), true);
return false;
@@ -307,7 +307,7 @@ export default {
await axios.get(cancelUrl);
if (!config || !config.group) {
- await this.$store.dispatch('user:fetch', {forceLoad: true});
+ await this.$store.dispatch('user:fetch', { forceLoad: true });
this.$root.$emit('habitica:subscription-canceled', {
dateTerminated: this.dateTerminated,
isGroup: false,
diff --git a/website/client/src/mixins/petMixin.js b/website/client/src/mixins/petMixin.js
index 5d12d42270..cd442f9572 100644
--- a/website/client/src/mixins/petMixin.js
+++ b/website/client/src/mixins/petMixin.js
@@ -9,8 +9,8 @@ export default {
hatchPet (pet) {
this.closeHatchPetDialog();
- this.$store.dispatch('common:hatch', {egg: pet.eggKey, hatchingPotion: pet.potionKey});
- this.text(this.$t('hatchedPet', {egg: pet.eggName, potion: pet.potionName}));
+ this.$store.dispatch('common:hatch', { egg: pet.eggKey, hatchingPotion: pet.potionKey });
+ this.text(this.$t('hatchedPet', { egg: pet.eggName, potion: pet.potionName }));
},
},
};
diff --git a/website/client/src/mixins/pinUtils.js b/website/client/src/mixins/pinUtils.js
index 1abf5d6c0e..b094e31d13 100644
--- a/website/client/src/mixins/pinUtils.js
+++ b/website/client/src/mixins/pinUtils.js
@@ -8,12 +8,12 @@ export default {
return isPinned(this.user, item);
},
togglePinned (item) {
- if (!this.$store.dispatch('user:togglePinnedItem', {type: item.pinType, path: item.path})) {
+ if (!this.$store.dispatch('user:togglePinnedItem', { type: item.pinType, path: item.path })) {
this.showUnpinNotification(item);
}
},
showUnpinNotification (item) {
- this.text(this.$t('unpinnedItem', {item: item.text}));
+ this.text(this.$t('unpinnedItem', { item: item.text }));
},
},
};
diff --git a/website/client/src/mixins/spells.js b/website/client/src/mixins/spells.js
index 405ef1a11d..2150260f46 100644
--- a/website/client/src/mixins/spells.js
+++ b/website/client/src/mixins/spells.js
@@ -26,9 +26,9 @@ export default {
if (spell.target === 'self') {
return this.castEnd(null, spell.target);
- } else if (spell.target === 'party') {
+ } if (spell.target === 'party') {
if (!this.user.party._id) {
- let party = [this.user];
+ const party = [this.user];
return this.castEnd(party, spell.target);
}
@@ -38,20 +38,20 @@ export default {
}
this.castEnd(partyMembers, spell.target);
} else if (spell.target === 'tasks') {
- let userTasks = this.$store.state.tasks.data;
+ const userTasks = this.$store.state.tasks.data;
// exclude rewards
let tasks = userTasks.habits
.concat(userTasks.dailys)
.concat(userTasks.todos);
// exclude challenge and group plan tasks
- tasks = tasks.filter((task) => {
+ tasks = tasks.filter(task => {
if (task.challenge && task.challenge.id && !task.challenge.broken) return false;
if (task.group && task.group.id && !task.group.broken) return false;
return true;
});
return this.castEnd(tasks, spell.target);
} else if (spell.target === 'user') {
- let result = await this.castEnd(member, spell.target);
+ const result = await this.castEnd(member, spell.target);
if (member.id === this.user.id) {
this.$set(this.$store.state.user.data, 'stats', member.stats);
@@ -79,7 +79,7 @@ export default {
if (target && target.challenge && target.challenge.id) return this.text(this.$t('invalidTarget'));
if (target && target.group && target.group.id) return this.text(this.$t('invalidTarget'));
- let spell = this.spell;
+ const { spell } = this;
this.castCancel();
@@ -95,17 +95,16 @@ export default {
type: 'error',
});
return;
- } else {
- throw e;
}
+ throw e;
}
}
- let targetId = target ? target._id : null;
+ const targetId = target ? target._id : null;
- let spellText = typeof spell.text === 'function' ? spell.text() : spell.text;
+ const spellText = typeof spell.text === 'function' ? spell.text() : spell.text;
- let apiResult = await this.$store.dispatch('user:castSpell', {
+ const apiResult = await this.$store.dispatch('user:castSpell', {
key: spell.key,
targetId,
pinType: spell.pinType,
@@ -120,9 +119,9 @@ export default {
});
break;
case 'user':
- msg = spell.pinType === 'card' ?
- this.$t('sentCardToUser', { profileName: target.profile.name }) :
- this.$t('youCastTarget', {
+ msg = spell.pinType === 'card'
+ ? this.$t('sentCardToUser', { profileName: target.profile.name })
+ : this.$t('youCastTarget', {
spell: spellText,
target: target.profile.name,
});
@@ -147,9 +146,9 @@ export default {
this.markdown(msg); // @TODO: mardown directive?
if (!beforeQuestProgress) return;
- let questProgress = this.questProgress() - beforeQuestProgress;
+ const questProgress = this.questProgress() - beforeQuestProgress;
if (questProgress > 0) {
- let userQuest = this.quests[this.user.party.quest.key];
+ const userQuest = this.quests[this.user.party.quest.key];
if (userQuest.boss) {
this.quest('questDamage', questProgress.toFixed(1));
} else if (userQuest.collection && userQuest.collect) {
@@ -157,7 +156,7 @@ export default {
}
}
- return;
+
// @TOOD: User.sync();
},
castCancel () {
diff --git a/website/client/src/mixins/stats.js b/website/client/src/mixins/stats.js
index 89131e712a..0d534c2a21 100644
--- a/website/client/src/mixins/stats.js
+++ b/website/client/src/mixins/stats.js
@@ -1,21 +1,17 @@
-let emptyStats = () => {
- return {
- str: 0,
- int: 0,
- per: 0,
- con: 0,
- };
-};
+const emptyStats = () => ({
+ str: 0,
+ int: 0,
+ per: 0,
+ con: 0,
+});
export default {
computed: {
stats () {
- let gearStats = this.getItemStats(this.item);
- let classBonus = this.getClassBonus(this.item);
+ const gearStats = this.getItemStats(this.item);
+ const classBonus = this.getClassBonus(this.item);
- let sumNewGearStats = this.calculateStats(gearStats, classBonus, (a1, a2) => {
- return a1 + a2;
- });
+ const sumNewGearStats = this.calculateStats(gearStats, classBonus, (a1, a2) => a1 + a2);
return {
gear: gearStats,
@@ -26,30 +22,30 @@ export default {
},
methods: {
getItemStats (item) {
- let result = emptyStats();
+ const result = emptyStats();
if (!item) {
return result;
}
- for (let attr of this.ATTRIBUTES) {
+ for (const attr of this.ATTRIBUTES) {
result[attr] = Number(item[attr]);
}
return result;
},
getClassBonus (item) {
- let result = emptyStats();
+ const result = emptyStats();
if (!item) {
return result;
}
- let itemStats = this.getItemStats(item);
+ const itemStats = this.getItemStats(item);
- let userClass = this.user.stats.class;
+ const userClass = this.user.stats.class;
if (userClass === item.klass || userClass === item.specialClass) {
- for (let attr of this.ATTRIBUTES) {
+ for (const attr of this.ATTRIBUTES) {
result[attr] = itemStats[attr] * 0.5;
}
}
@@ -57,9 +53,9 @@ export default {
return result;
},
calculateStats (srcStats, otherStats, func) {
- let result = emptyStats();
+ const result = emptyStats();
- for (let attr of this.ATTRIBUTES) {
+ for (const attr of this.ATTRIBUTES) {
result[attr] = func(srcStats[attr], otherStats[attr]);
}
diff --git a/website/client/src/mixins/styleHelper.js b/website/client/src/mixins/styleHelper.js
index 3821f46b8d..d61ed68513 100644
--- a/website/client/src/mixins/styleHelper.js
+++ b/website/client/src/mixins/styleHelper.js
@@ -2,8 +2,8 @@ export default {
methods: {
userLevelStyle (user, style) {
style = style || '';
- let npc = user && user.backer && user.backer.npc ? user.backer.npc : '';
- let level = user && user.contributor && user.contributor.level ? user.contributor.level : '';
+ const npc = user && user.backer && user.backer.npc ? user.backer.npc : '';
+ const level = user && user.contributor && user.contributor.level ? user.contributor.level : '';
style += this.userLevelStyleFromLevel(level, npc, style);
return style;
},
diff --git a/website/client/src/mixins/sync.js b/website/client/src/mixins/sync.js
index bb10dd2ad0..40b5a051ce 100644
--- a/website/client/src/mixins/sync.js
+++ b/website/client/src/mixins/sync.js
@@ -3,8 +3,8 @@ export default {
async sync () {
this.$root.$emit('habitica::resync-requested');
await Promise.all([
- this.$store.dispatch('user:fetch', {forceLoad: true}),
- this.$store.dispatch('tasks:fetchUserTasks', {forceLoad: true}),
+ this.$store.dispatch('user:fetch', { forceLoad: true }),
+ this.$store.dispatch('tasks:fetchUserTasks', { forceLoad: true }),
]);
this.$root.$emit('habitica::resync-completed');
},
diff --git a/website/client/src/mixins/userState.js b/website/client/src/mixins/userState.js
index ee156c6b40..70aed0103f 100644
--- a/website/client/src/mixins/userState.js
+++ b/website/client/src/mixins/userState.js
@@ -2,6 +2,6 @@ import { mapState } from '@/libs/store';
export const userStateMixin = {
computed: {
- ...mapState({user: 'user.data'}),
+ ...mapState({ user: 'user.data' }),
},
};
diff --git a/website/client/src/router/handleRedirect.js b/website/client/src/router/handleRedirect.js
index b4adceb449..0f978d4a7c 100644
--- a/website/client/src/router/handleRedirect.js
+++ b/website/client/src/router/handleRedirect.js
@@ -1,7 +1,7 @@
import { CONSTANTS, getLocalSetting, setLocalSetting } from '@/libs/userlocalManager';
export default function (to, from, next) {
- const redirect = to.params.redirect;
+ const { redirect } = to.params;
switch (redirect) {
case 'paypal-success-checkout':
@@ -16,6 +16,6 @@ export default function (to, from, next) {
break;
}
default:
- next({name: 'notFound'});
+ next({ name: 'notFound' });
}
-}
\ No newline at end of file
+}
diff --git a/website/client/src/router/index.js b/website/client/src/router/index.js
index 11d017ea43..86bb56a370 100644
--- a/website/client/src/router/index.js
+++ b/website/client/src/router/index.js
@@ -102,10 +102,16 @@ const router = new VueRouter({
},
// requiresLogin is true by default, isStatic false
routes: [
- { name: 'register', path: '/register', component: RegisterLoginReset, meta: {requiresLogin: false} },
- { name: 'login', path: '/login', component: RegisterLoginReset, meta: {requiresLogin: false} },
+ {
+ name: 'register', path: '/register', component: RegisterLoginReset, meta: { requiresLogin: false },
+ },
+ {
+ name: 'login', path: '/login', component: RegisterLoginReset, meta: { requiresLogin: false },
+ },
{ name: 'logout', path: '/logout', component: Logout },
- { name: 'resetPassword', path: '/reset-password', component: RegisterLoginReset, meta: {requiresLogin: false} },
+ {
+ name: 'resetPassword', path: '/reset-password', component: RegisterLoginReset, meta: { requiresLogin: false },
+ },
{ name: 'tasks', path: '/', component: UserTasks },
{
name: 'userProfile',
@@ -259,23 +265,57 @@ const router = new VueRouter({
path: '/static',
component: StaticWrapper,
children: [
- { name: 'app', path: 'app', component: AppPage, meta: {requiresLogin: false}},
- { name: 'clearBrowserData', path: 'clear-browser-data', component: ClearBrowserDataPage, meta: {requiresLogin: false}},
- { name: 'communityGuidelines', path: 'community-guidelines', component: CommunityGuidelinesPage, meta: {requiresLogin: false}},
- { name: 'contact', path: 'contact', component: ContactPage, meta: {requiresLogin: false}},
- { name: 'faq', path: 'faq', component: FAQPage, meta: {requiresLogin: false}},
- { name: 'features', path: 'features', component: FeaturesPage, meta: {requiresLogin: false}},
- { name: 'groupPlans', path: 'group-plans', component: GroupPlansPage, meta: {requiresLogin: false}},
- { name: 'home', path: 'home', component: HomePage, meta: {requiresLogin: false} },
- { name: 'front', path: 'front', component: HomePage, meta: {requiresLogin: false} },
- { name: 'merch', path: 'merch', component: MerchPage, meta: {requiresLogin: false}},
- { name: 'news', path: 'new-stuff', component: NewsPage, meta: {requiresLogin: false}},
- { name: 'overview', path: 'overview', component: OverviewPage, meta: {requiresLogin: false}},
- { name: 'plans', path: 'plans', component: GroupPlansPage, meta: {requiresLogin: false}},
- { name: 'pressKit', path: 'press-kit', component: PressKitPage, meta: {requiresLogin: false}},
- { name: 'privacy', path: 'privacy', component: PrivacyPage, meta: {requiresLogin: false}},
- { name: 'terms', path: 'terms', component: TermsPage, meta: {requiresLogin: false}},
- { name: 'notFound', path: 'not-found', component: NotFoundPage, meta: {requiresLogin: false} },
+ {
+ name: 'app', path: 'app', component: AppPage, meta: { requiresLogin: false },
+ },
+ {
+ name: 'clearBrowserData', path: 'clear-browser-data', component: ClearBrowserDataPage, meta: { requiresLogin: false },
+ },
+ {
+ name: 'communityGuidelines', path: 'community-guidelines', component: CommunityGuidelinesPage, meta: { requiresLogin: false },
+ },
+ {
+ name: 'contact', path: 'contact', component: ContactPage, meta: { requiresLogin: false },
+ },
+ {
+ name: 'faq', path: 'faq', component: FAQPage, meta: { requiresLogin: false },
+ },
+ {
+ name: 'features', path: 'features', component: FeaturesPage, meta: { requiresLogin: false },
+ },
+ {
+ name: 'groupPlans', path: 'group-plans', component: GroupPlansPage, meta: { requiresLogin: false },
+ },
+ {
+ name: 'home', path: 'home', component: HomePage, meta: { requiresLogin: false },
+ },
+ {
+ name: 'front', path: 'front', component: HomePage, meta: { requiresLogin: false },
+ },
+ {
+ name: 'merch', path: 'merch', component: MerchPage, meta: { requiresLogin: false },
+ },
+ {
+ name: 'news', path: 'new-stuff', component: NewsPage, meta: { requiresLogin: false },
+ },
+ {
+ name: 'overview', path: 'overview', component: OverviewPage, meta: { requiresLogin: false },
+ },
+ {
+ name: 'plans', path: 'plans', component: GroupPlansPage, meta: { requiresLogin: false },
+ },
+ {
+ name: 'pressKit', path: 'press-kit', component: PressKitPage, meta: { requiresLogin: false },
+ },
+ {
+ name: 'privacy', path: 'privacy', component: PrivacyPage, meta: { requiresLogin: false },
+ },
+ {
+ name: 'terms', path: 'terms', component: TermsPage, meta: { requiresLogin: false },
+ },
+ {
+ name: 'notFound', path: 'not-found', component: NotFoundPage, meta: { requiresLogin: false },
+ },
],
},
{
@@ -295,8 +335,8 @@ const router = new VueRouter({
const store = getStore();
-router.beforeEach(function routerGuard (to, from, next) {
- const isUserLoggedIn = store.state.isUserLoggedIn;
+router.beforeEach((to, from, next) => {
+ const { isUserLoggedIn } = store.state;
const routeRequiresLogin = to.meta.requiresLogin !== false;
if (to.name === 'redirect') return handleRedirect(to, from, next);
@@ -327,7 +367,7 @@ router.beforeEach(function routerGuard (to, from, next) {
}
if (isUserLoggedIn && (to.name === 'login' || to.name === 'register')) {
- return next({name: 'tasks'});
+ return next({ name: 'tasks' });
}
// Redirect old guild urls
diff --git a/website/client/src/store/actions/auth.js b/website/client/src/store/actions/auth.js
index 58af5e3be9..af909201b8 100644
--- a/website/client/src/store/actions/auth.js
+++ b/website/client/src/store/actions/auth.js
@@ -7,16 +7,16 @@ export async function register (store, params) {
if (params.groupInvite) url += `?groupInvite=${params.groupInvite}`;
- let result = await axios.post(url, {
+ const result = await axios.post(url, {
username: params.username,
email: params.email,
password: params.password,
confirmPassword: params.passwordConfirm,
});
- let user = result.data.data;
+ const user = result.data.data;
- let userLocalData = JSON.stringify({
+ const userLocalData = JSON.stringify({
auth: {
apiId: user._id,
apiToken: user.apiToken,
@@ -26,16 +26,16 @@ export async function register (store, params) {
}
export async function login (store, params) {
- let url = '/api/v4/user/auth/local/login';
- let result = await axios.post(url, {
+ const url = '/api/v4/user/auth/local/login';
+ const result = await axios.post(url, {
username: params.username,
// email: params.email,
password: params.password,
});
- let user = result.data.data;
+ const user = result.data.data;
- let userLocalData = JSON.stringify({
+ const userLocalData = JSON.stringify({
auth: {
apiId: user.id,
apiToken: user.apiToken,
@@ -46,8 +46,8 @@ export async function login (store, params) {
}
export async function verifyUsername (store, params) {
- let url = '/api/v4/user/auth/verify-username';
- let result = await axios.post(url, {
+ const url = '/api/v4/user/auth/verify-username';
+ const result = await axios.post(url, {
username: params.username,
});
@@ -55,8 +55,8 @@ export async function verifyUsername (store, params) {
}
export async function verifyDisplayName (store, params) {
- let url = '/api/v4/user/auth/verify-display-name';
- let result = await axios.post(url, {
+ const url = '/api/v4/user/auth/verify-display-name';
+ const result = await axios.post(url, {
displayName: params.displayName,
});
@@ -64,15 +64,15 @@ export async function verifyDisplayName (store, params) {
}
export async function socialAuth (store, params) {
- let url = '/api/v4/user/auth/social';
- let result = await axios.post(url, {
+ const url = '/api/v4/user/auth/social';
+ const result = await axios.post(url, {
network: params.auth.network,
authResponse: params.auth.authResponse,
});
- let user = result.data.data;
+ const user = result.data.data;
- let userLocalData = JSON.stringify({
+ const userLocalData = JSON.stringify({
auth: {
apiId: user.id,
apiToken: user.apiToken,
diff --git a/website/client/src/store/actions/challenges.js b/website/client/src/store/actions/challenges.js
index 07b96b5828..c23dc7844e 100644
--- a/website/client/src/store/actions/challenges.js
+++ b/website/client/src/store/actions/challenges.js
@@ -3,8 +3,8 @@ import omit from 'lodash/omit';
import encodeParams from '@/libs/encodeParams';
export async function createChallenge (store, payload) {
- let response = await axios.post('/api/v4/challenges', payload.challenge);
- let newChallenge = response.data.data;
+ const response = await axios.post('/api/v4/challenges', payload.challenge);
+ const newChallenge = response.data.data;
return newChallenge;
}
@@ -17,14 +17,14 @@ export async function cloneChallenge (store, payload) {
}
export async function joinChallenge (store, payload) {
- let response = await axios.post(`/api/v4/challenges/${payload.challengeId}/join`);
+ const response = await axios.post(`/api/v4/challenges/${payload.challengeId}/join`);
return response.data.data;
}
export async function leaveChallenge (store, payload) {
- let url = `/api/v4/challenges/${payload.challengeId}/leave`;
- let response = await axios.post(url, {
+ const url = `/api/v4/challenges/${payload.challengeId}/leave`;
+ const response = await axios.post(url, {
keep: payload.keep,
});
@@ -32,8 +32,8 @@ export async function leaveChallenge (store, payload) {
}
export async function getUserChallenges (store, payload) {
- let url = '/api/v4/challenges/user';
- let {
+ const url = '/api/v4/challenges/user';
+ const {
member,
page,
search,
@@ -41,7 +41,7 @@ export async function getUserChallenges (store, payload) {
owned,
} = payload;
- let query = {};
+ const query = {};
if (member) query.member = member;
if (page >= 0) query.page = page;
if (search) query.search = search;
@@ -55,30 +55,30 @@ export async function getUserChallenges (store, payload) {
}
export async function getGroupChallenges (store, payload) {
- let response = await axios.get(`/api/v4/challenges/groups/${payload.groupId}`);
+ const response = await axios.get(`/api/v4/challenges/groups/${payload.groupId}`);
return response.data.data;
}
export async function getChallenge (store, payload) {
- let response = await axios.get(`/api/v4/challenges/${payload.challengeId}`);
+ const response = await axios.get(`/api/v4/challenges/${payload.challengeId}`);
return response.data.data;
}
export async function exportChallengeCsv (store, payload) {
- let response = await axios.get(`/api/v4/challenges/${payload.challengeId}/export/csv`);
+ const response = await axios.get(`/api/v4/challenges/${payload.challengeId}/export/csv`);
return response.data.data;
}
export async function updateChallenge (store, payload) {
- let challengeDataToSend = omit(payload.challenge, ['tasks', 'habits', 'todos', 'rewards', 'group']);
+ const challengeDataToSend = omit(payload.challenge, ['tasks', 'habits', 'todos', 'rewards', 'group']);
if (challengeDataToSend.leader && challengeDataToSend.leader._id) challengeDataToSend.leader = challengeDataToSend.leader._id;
- let response = await axios.put(`/api/v4/challenges/${payload.challenge._id}`, challengeDataToSend);
+ const response = await axios.put(`/api/v4/challenges/${payload.challenge._id}`, challengeDataToSend);
return response.data.data;
}
@@ -92,7 +92,7 @@ export async function deleteChallenge (store, payload) {
}
export async function selectChallengeWinner (store, payload) {
- let response = await axios.post(`/api/v4/challenges/${payload.challengeId}/selectWinner/${payload.winnerId}`);
+ const response = await axios.post(`/api/v4/challenges/${payload.challengeId}/selectWinner/${payload.winnerId}`);
return response.data.data;
}
diff --git a/website/client/src/store/actions/chat.js b/website/client/src/store/actions/chat.js
index c3390b40df..75ef624306 100644
--- a/website/client/src/store/actions/chat.js
+++ b/website/client/src/store/actions/chat.js
@@ -2,13 +2,13 @@ import axios from 'axios';
import * as Analytics from '@/libs/analytics';
export async function getChat (store, payload) {
- let response = await axios.get(`/api/v4/groups/${payload.groupId}/chat`);
+ const response = await axios.get(`/api/v4/groups/${payload.groupId}/chat`);
return response.data.data;
}
export async function postChat (store, payload) {
- const group = payload.group;
+ const { group } = payload;
let url = `/api/v4/groups/${group._id}/chat`;
@@ -23,7 +23,7 @@ export async function postChat (store, payload) {
});
}
- let response = await axios.post(url, {
+ const response = await axios.post(url, {
message: payload.message,
});
@@ -37,13 +37,13 @@ export async function deleteChat (store, payload) {
url += `?previousMsg=${payload.previousMsg}`;
}
- let response = await axios.delete(url);
+ const response = await axios.delete(url);
return response.data.data;
}
export async function like (store, payload) {
- let url = `/api/v4/groups/${payload.groupId}/chat/${payload.chatId}/like`;
- let response = await axios.post(url);
+ const url = `/api/v4/groups/${payload.groupId}/chat/${payload.chatId}/like`;
+ const response = await axios.post(url);
return response.data.data;
}
@@ -64,14 +64,14 @@ export async function flag (store, payload) {
}
export async function clearFlagCount (store, payload) {
- let url = `/api/v4/groups/${payload.groupId}/chat/${payload.chatId}/clearflags`;
- let response = await axios.post(url);
+ const url = `/api/v4/groups/${payload.groupId}/chat/${payload.chatId}/clearflags`;
+ const response = await axios.post(url);
return response.data.data;
}
export async function markChatSeen (store, payload) {
if (store.state.user.newMessages) delete store.state.user.newMessages[payload.groupId];
- let url = `/api/v4/groups/${payload.groupId}/chat/seen`;
- let response = await axios.post(url);
+ const url = `/api/v4/groups/${payload.groupId}/chat/seen`;
+ const response = await axios.post(url);
return response.data.data;
}
diff --git a/website/client/src/store/actions/common.js b/website/client/src/store/actions/common.js
index df4eff4bdf..394f48c51b 100644
--- a/website/client/src/store/actions/common.js
+++ b/website/client/src/store/actions/common.js
@@ -5,7 +5,7 @@ import feedOp from '@/../../common/script/ops/feed';
export function equip (store, params) {
const user = store.state.user.data;
- equipOp(user, {params});
+ equipOp(user, { params });
axios
.post(`/api/v4/user/equip/${params.type}/${params.key}`);
// TODO
@@ -15,7 +15,7 @@ export function equip (store, params) {
export function hatch (store, params) {
const user = store.state.user.data;
- hatchOp(user, {params});
+ hatchOp(user, { params });
axios
.post(`/api/v4/user/hatch/${params.egg}/${params.hatchingPotion}`);
// TODO
@@ -25,7 +25,7 @@ export function hatch (store, params) {
export async function feed (store, params) {
const user = store.state.user.data;
- feedOp(user, {params});
+ feedOp(user, { params });
const response = await axios
.post(`/api/v4/user/feed/${params.pet}/${params.food}`);
return response.data;
diff --git a/website/client/src/store/actions/guilds.js b/website/client/src/store/actions/guilds.js
index 488c61aa3a..84bcb60a96 100644
--- a/website/client/src/store/actions/guilds.js
+++ b/website/client/src/store/actions/guilds.js
@@ -4,7 +4,7 @@ import findIndex from 'lodash/findIndex';
import * as Analytics from '@/libs/analytics';
export async function getPublicGuilds (store, payload) {
- let params = {
+ const params = {
type: 'publicGuilds',
paginate: true,
page: payload.page,
@@ -17,7 +17,7 @@ export async function getPublicGuilds (store, payload) {
if (payload.member) params.member = payload.member;
if (payload.search) params.search = payload.search;
- let response = await axios.get('/api/v4/groups', {
+ const response = await axios.get('/api/v4/groups', {
params,
});
@@ -25,20 +25,20 @@ export async function getPublicGuilds (store, payload) {
}
export async function getMyGuilds (store) {
- let params = {
+ const params = {
type: 'guilds',
};
- let response = await axios.get('/api/v4/groups', { params });
+ const response = await axios.get('/api/v4/groups', { params });
- let guilds = response.data.data;
+ const guilds = response.data.data;
store.state.myGuilds = guilds;
return response.data.data;
}
export async function getGroup (store, payload) {
- let response = await axios.get(`/api/v4/groups/${payload.groupId}`);
+ const response = await axios.get(`/api/v4/groups/${payload.groupId}`);
// @TODO: should we store the active group for modifying?
// let guilds = response.data.data;
// store.state.myGuilds = guilds;
@@ -50,10 +50,10 @@ export async function getGroup (store, payload) {
export async function join (store, payload) {
- const groupId = payload.groupId;
- const type = payload.type;
+ const { groupId } = payload;
+ const { type } = payload;
const user = store.state.user.data;
- const invitations = user.invitations;
+ const { invitations } = user;
let response;
try {
@@ -75,7 +75,7 @@ export async function join (store, payload) {
user.party._id = groupId;
- Analytics.updateUser({partyID: groupId});
+ Analytics.updateUser({ partyID: groupId });
}
return response.data.data;
@@ -83,19 +83,17 @@ export async function join (store, payload) {
export async function leave (store, payload) {
// @TODO: is the dafault for keepChallenges 'remain-in-challenges'
- let data = {
+ const data = {
keep: payload.keep,
keepChallenges: payload.keepChallenges,
};
- let response = await axios.post(`/api/v4/groups/${payload.groupId}/leave`, data);
+ const response = await axios.post(`/api/v4/groups/${payload.groupId}/leave`, data);
// @TODO: update for party
- let index = store.state.user.data.guilds.indexOf(payload.groupId);
+ const index = store.state.user.data.guilds.indexOf(payload.groupId);
store.state.user.data.guilds.splice(index, 1);
if (payload.type === 'myGuilds') {
- let guildIndex = findIndex(store.state.myGuilds, (guild) => {
- return guild._id === payload.groupId;
- });
+ const guildIndex = findIndex(store.state.myGuilds, guild => guild._id === payload.groupId);
store.state.myGuilds.splice(guildIndex, 1);
} else if (payload.type === 'party') {
store.state.user.data.party._id = null;
@@ -107,8 +105,8 @@ export async function leave (store, payload) {
}
export async function create (store, payload) {
- let response = await axios.post('/api/v4/groups/', payload.group);
- let newGroup = response.data.data;
+ const response = await axios.post('/api/v4/groups/', payload.group);
+ const newGroup = response.data.data;
if (newGroup.leader._id === store.state.user.data._id || newGroup.privacy === 'private') {
store.state.myGuilds.push(newGroup);
@@ -121,23 +119,23 @@ export async function create (store, payload) {
export async function update (store, payload) {
// Remove populated fields
- let groupDetailsToSend = omit(payload.group, ['chat', 'challenges', 'members', 'invites']);
+ const groupDetailsToSend = omit(payload.group, ['chat', 'challenges', 'members', 'invites']);
if (groupDetailsToSend.leader && groupDetailsToSend.leader._id) groupDetailsToSend.leader = groupDetailsToSend.leader._id;
- let response = await axios.put(`/api/v4/groups/${payload.group.id}`, groupDetailsToSend);
+ const response = await axios.put(`/api/v4/groups/${payload.group.id}`, groupDetailsToSend);
- let updatedGroup = response.data.data;
+ const updatedGroup = response.data.data;
return updatedGroup;
}
export async function rejectInvite (store, payload) {
- const groupId = payload.groupId;
- const type = payload.type;
+ const { groupId } = payload;
+ const { type } = payload;
const user = store.state.user.data;
- const invitations = user.invitations;
+ const { invitations } = user;
- let response = await axios.post(`/api/v4/groups/${groupId}/reject-invite`);
+ const response = await axios.post(`/api/v4/groups/${groupId}/reject-invite`);
if (type === 'guild') {
const invitationI = invitations.guilds.findIndex(i => i.id === groupId);
@@ -151,7 +149,7 @@ export async function rejectInvite (store, payload) {
}
export async function removeMember (store, payload) {
- let response = await axios.post(`/api/v4/groups/${payload.groupId}/removeMember/${payload.memberId}`, {
+ const response = await axios.post(`/api/v4/groups/${payload.groupId}/removeMember/${payload.memberId}`, {
message: payload.message,
});
@@ -161,7 +159,7 @@ export async function removeMember (store, payload) {
}
export async function invite (store, payload) {
- let response = await axios.post(`/api/v4/groups/${payload.groupId}/invite`, {
+ const response = await axios.post(`/api/v4/groups/${payload.groupId}/invite`, {
uuids: payload.invitationDetails.uuids,
emails: payload.invitationDetails.emails,
usernames: payload.invitationDetails.usernames,
@@ -173,7 +171,7 @@ export async function invite (store, payload) {
}
export async function inviteToQuest (store, payload) {
- let response = await axios.post(`/api/v4/groups/${payload.groupId}/quests/invite/${payload.key}`);
+ const response = await axios.post(`/api/v4/groups/${payload.groupId}/quests/invite/${payload.key}`);
// @TODO: Any updates?
@@ -181,7 +179,7 @@ export async function inviteToQuest (store, payload) {
}
export async function addManager (store, payload) {
- let response = await axios.post(`/api/v4/groups/${payload.groupId}/add-manager/`, {
+ const response = await axios.post(`/api/v4/groups/${payload.groupId}/add-manager/`, {
managerId: payload.memberId,
});
@@ -190,8 +188,8 @@ export async function addManager (store, payload) {
return response;
}
-export async function removeManager (store, payload) {
- let response = await axios.post(`/api/v4/groups/${payload.groupId}/remove-manager/`, {
+export async function removeManager (store, payload) {
+ const response = await axios.post(`/api/v4/groups/${payload.groupId}/remove-manager/`, {
managerId: payload.memberId,
});
@@ -201,6 +199,6 @@ export async function removeManager (store, payload) {
}
export async function getGroupPlans () {
- let response = await axios.get('/api/v4/group-plans');
+ const response = await axios.get('/api/v4/group-plans');
return response.data.data;
}
diff --git a/website/client/src/store/actions/hall.js b/website/client/src/store/actions/hall.js
index c135b0cff8..c3139e07cb 100644
--- a/website/client/src/store/actions/hall.js
+++ b/website/client/src/store/actions/hall.js
@@ -1,20 +1,20 @@
import axios from 'axios';
-export async function getHeroes () {
- let url = '/api/v4/hall/heroes';
- let response = await axios.get(url);
+export async function getHeroes () {
+ const url = '/api/v4/hall/heroes';
+ const response = await axios.get(url);
return response.data.data;
}
-export async function getHero (store, payload) {
- let url = `/api/v4/hall/heroes/${payload.uuid}`;
- let response = await axios.get(url);
+export async function getHero (store, payload) {
+ const url = `/api/v4/hall/heroes/${payload.uuid}`;
+ const response = await axios.get(url);
return response.data.data;
}
-export async function updateHero (store, payload) {
- let url = `/api/v4/hall/heroes/${payload.heroDetails._id}`;
- let response = await axios.put(url, payload.heroDetails);
+export async function updateHero (store, payload) {
+ const url = `/api/v4/hall/heroes/${payload.heroDetails._id}`;
+ const response = await axios.put(url, payload.heroDetails);
return response.data.data;
}
@@ -22,7 +22,7 @@ export async function getPatrons (store, payload) {
let page = 0;
if (payload.page) page = payload.page;
- let url = `/api/v4/hall/patrons/?page=${page}`;
- let response = await axios.get(url);
+ const url = `/api/v4/hall/patrons/?page=${page}`;
+ const response = await axios.get(url);
return response.data.data;
}
diff --git a/website/client/src/store/actions/members.js b/website/client/src/store/actions/members.js
index 0e6a523ae6..a9e80d55c3 100644
--- a/website/client/src/store/actions/members.js
+++ b/website/client/src/store/actions/members.js
@@ -2,10 +2,10 @@ import axios from 'axios';
// import omit from 'lodash/omit';
// import findIndex from 'lodash/findIndex';
-let apiv4Prefix = '/api/v4';
+const apiv4Prefix = '/api/v4';
export async function getGroupMembers (store, payload) {
- let url = `${apiv4Prefix}/groups/${payload.groupId}/members`;
+ const url = `${apiv4Prefix}/groups/${payload.groupId}/members`;
const params = {};
@@ -21,13 +21,13 @@ export async function getGroupMembers (store, payload) {
params.search = payload.searchTerm;
}
- let response = await axios.get(url, { params });
+ const response = await axios.get(url, { params });
return response.data.data;
}
export async function fetchMember (store, payload) {
- let url = `${apiv4Prefix}/members/${payload.memberId}`;
- let response = await axios.get(url);
+ const url = `${apiv4Prefix}/members/${payload.memberId}`;
+ const response = await axios.get(url);
return response;
}
@@ -36,12 +36,12 @@ export async function getGroupInvites (store, payload) {
if (payload.includeAllPublicFields) {
url += '?includeAllPublicFields=true';
}
- let response = await axios.get(url);
+ const response = await axios.get(url);
return response.data.data;
}
export async function getChallengeMembers (store, payload) {
- let url = `${apiv4Prefix}/challenges/${payload.challengeId}/members`;
+ const url = `${apiv4Prefix}/challenges/${payload.challengeId}/members`;
const params = {};
@@ -57,44 +57,44 @@ export async function getChallengeMembers (store, payload) {
params.search = payload.searchTerm;
}
- let response = await axios.get(url, { params });
+ const response = await axios.get(url, { params });
return response.data.data;
}
export async function getChallengeMemberProgress (store, payload) {
- let url = `${apiv4Prefix}/challenges/${payload.challengeId}/members/${payload.memberId}`;
- let response = await axios.get(url);
+ const url = `${apiv4Prefix}/challenges/${payload.challengeId}/members/${payload.memberId}`;
+ const response = await axios.get(url);
return response;
}
export async function sendPrivateMessage (store, payload) {
- let url = `${apiv4Prefix}/members/send-private-message`;
- let data = {
+ const url = `${apiv4Prefix}/members/send-private-message`;
+ const data = {
message: payload.message,
toUserId: payload.toUserId,
};
- let response = await axios.post(url, data);
+ const response = await axios.post(url, data);
return response;
}
export async function transferGems (store, payload) {
- let url = `${apiv4Prefix}/members/transfer-gems`;
- let data = {
+ const url = `${apiv4Prefix}/members/transfer-gems`;
+ const data = {
message: payload.message,
toUserId: payload.toUserId,
gemAmount: payload.gemAmount,
};
- let response = await axios.post(url, data);
+ const response = await axios.post(url, data);
store.state.user.data.balance -= payload.gemAmount / 4;
return response;
}
export async function removeMember (store, payload) {
- let url = `${apiv4Prefix}/groups/${payload.groupId}/removeMember/${payload.memberId}`;
- let data = {
+ const url = `${apiv4Prefix}/groups/${payload.groupId}/removeMember/${payload.memberId}`;
+ const data = {
message: payload.message,
};
- let response = await axios.post(url, data);
+ const response = await axios.post(url, data);
return response;
}
diff --git a/website/client/src/store/actions/notifications.js b/website/client/src/store/actions/notifications.js
index f2e9f34679..981260c6b7 100644
--- a/website/client/src/store/actions/notifications.js
+++ b/website/client/src/store/actions/notifications.js
@@ -1,28 +1,28 @@
import axios from 'axios';
export async function readNotification (store, payload) {
- let url = `/api/v4/notifications/${payload.notificationId}/read`;
- let response = await axios.post(url);
+ const url = `/api/v4/notifications/${payload.notificationId}/read`;
+ const response = await axios.post(url);
return response.data.data;
}
export async function readNotifications (store, payload) {
- let url = '/api/v4/notifications/read';
- let response = await axios.post(url, {
+ const url = '/api/v4/notifications/read';
+ const response = await axios.post(url, {
notificationIds: payload.notificationIds,
});
return response.data.data;
}
export async function seeNotification (store, payload) {
- let url = `/api/v4/notifications/${payload.notificationId}/see`;
- let response = await axios.post(url);
+ const url = `/api/v4/notifications/${payload.notificationId}/see`;
+ const response = await axios.post(url);
return response.data.data;
}
export async function seeNotifications (store, payload) {
- let url = '/api/v4/notifications/see';
- let response = await axios.post(url, {
+ const url = '/api/v4/notifications/see';
+ const response = await axios.post(url, {
notificationIds: payload.notificationIds,
});
return response.data.data;
diff --git a/website/client/src/store/actions/quests.js b/website/client/src/store/actions/quests.js
index 1d70f32905..03633d0211 100644
--- a/website/client/src/store/actions/quests.js
+++ b/website/client/src/store/actions/quests.js
@@ -21,7 +21,7 @@ export async function sendAction (store, payload) {
Analytics.updateUser(partyData);
- let response = await axios.post(`/api/v4/groups/${payload.groupId}/${payload.action}`);
+ const response = await axios.post(`/api/v4/groups/${payload.groupId}/${payload.action}`);
// @TODO: Update user?
// User.sync();
diff --git a/website/client/src/store/actions/shops.js b/website/client/src/store/actions/shops.js
index 84a505fd69..6e261c809f 100644
--- a/website/client/src/store/actions/shops.js
+++ b/website/client/src/store/actions/shops.js
@@ -18,7 +18,7 @@ function buyItem (store, params) {
const quantity = params.quantity || 1;
const user = store.state.user.data;
- let opResult = buyOp(user, {params, quantity});
+ const opResult = buyOp(user, { params, quantity });
return {
result: opResult,
@@ -29,7 +29,7 @@ function buyItem (store, params) {
export function buyQuestItem (store, params) {
const quantity = params.quantity || 1;
const user = store.state.user.data;
- let opResult = buyOp(user, {
+ const opResult = buyOp(user, {
params,
type: 'quest',
quantity,
@@ -37,25 +37,25 @@ export function buyQuestItem (store, params) {
return {
result: opResult,
- httpCall: axios.post(`/api/v4/user/buy/${params.key}`, {type: 'quest', quantity}),
+ httpCall: axios.post(`/api/v4/user/buy/${params.key}`, { type: 'quest', quantity }),
};
}
async function buyArmoire (store, params) {
const quantity = params.quantity || 1;
- let armoire = content.armoire;
+ const { armoire } = content;
// We need the server result because Armoire has random item in the result
- let result = await axios.post('/api/v4/user/buy/armoire', {
+ const result = await axios.post('/api/v4/user/buy/armoire', {
type: 'armoire',
quantity,
});
- let buyResult = result.data.data;
+ const buyResult = result.data.data;
if (buyResult) {
const resData = buyResult;
const item = resData.armoire;
- const message = result.data.message;
+ const { message } = result.data;
const isExperience = item.type === 'experience';
if (item.type === 'gear') {
@@ -70,16 +70,16 @@ async function buyArmoire (store, params) {
store.state.user.data.stats.gp -= armoire.value;
// @TODO: We might need to abstract notifications to library rather than mixin
- const notificationOptions = isExperience ?
- {
+ const notificationOptions = isExperience
+ ? {
text: `+ ${item.value}`,
type: 'xp',
flavorMessage: message,
- } :
- {
+ }
+ : {
text: message,
type: 'drop',
- icon: getDropClass({type: item.type, key: item.dropKey}),
+ icon: getDropClass({ type: item.type, key: item.dropKey }),
};
store.dispatch('snackbars:add', {
@@ -93,38 +93,38 @@ async function buyArmoire (store, params) {
export function purchase (store, params) {
const quantity = params.quantity || 1;
const user = store.state.user.data;
- let opResult = buyOp(user, {params, quantity});
+ const opResult = buyOp(user, { params, quantity });
return {
result: opResult,
- httpCall: axios.post(`/api/v4/user/purchase/${params.type}/${params.key}`, {quantity}),
+ httpCall: axios.post(`/api/v4/user/purchase/${params.type}/${params.key}`, { quantity }),
};
}
export function purchaseMysterySet (store, params) {
const user = store.state.user.data;
- let opResult = buyOp(user, {params, type: 'mystery'});
+ const opResult = buyOp(user, { params, type: 'mystery' });
return {
result: opResult,
- httpCall: axios.post(`/api/v4/user/buy/${params.key}`, {type: 'mystery'}),
+ httpCall: axios.post(`/api/v4/user/buy/${params.key}`, { type: 'mystery' }),
};
}
export function purchaseHourglassItem (store, params) {
const quantity = params.quantity || 1;
const user = store.state.user.data;
- let opResult = hourglassPurchaseOp(user, {params, quantity});
+ const opResult = hourglassPurchaseOp(user, { params, quantity });
return {
result: opResult,
- httpCall: axios.post(`/api/v4/user/purchase-hourglass/${params.type}/${params.key}`, {quantity}),
+ httpCall: axios.post(`/api/v4/user/purchase-hourglass/${params.type}/${params.key}`, { quantity }),
};
}
export function unlock (store, params) {
const user = store.state.user.data;
- let opResult = unlockOp(user, params);
+ const opResult = unlockOp(user, params);
return {
result: opResult,
@@ -140,12 +140,12 @@ export async function genericPurchase (store, params) {
await buyArmoire(store, params);
return;
case 'fortify': {
- let rerollResult = rerollOp(store.state.user.data, store.state.tasks.data);
+ const rerollResult = rerollOp(store.state.user.data, store.state.tasks.data);
await axios.post('/api/v4/user/reroll');
await Promise.all([
- store.dispatch('user:fetch', {forceLoad: true}),
- store.dispatch('tasks:fetchUserTasks', {forceLoad: true}),
+ store.dispatch('user:fetch', { forceLoad: true }),
+ store.dispatch('tasks:fetchUserTasks', { forceLoad: true }),
]);
return rerollResult;
@@ -156,7 +156,7 @@ export async function genericPurchase (store, params) {
case 'marketGear':
// 'marketGear' gets `type`= `gear` which is used for gem-purchasable gear
// resetting type to pinType only here
- return buyItem(store, {...params, type: params.pinType});
+ return buyItem(store, { ...params, type: params.pinType });
case 'background':
return unlock(store, {
query: {
@@ -166,17 +166,16 @@ export async function genericPurchase (store, params) {
default:
if (params.pinType === 'quests' && params.currency === 'gold') {
return buyQuestItem(store, params);
- } else if (params.currency === 'hourglasses') {
+ } if (params.currency === 'hourglasses') {
return purchaseHourglassItem(store, params);
- } else {
- return purchase(store, params);
}
+ return purchase(store, params);
}
}
export function sellItems (store, params) {
const user = store.state.user.data;
- sellOp(user, {params, query: {amount: params.amount}});
+ sellOp(user, { params, query: { amount: params.amount } });
axios.post(`/api/v4/user/sell/${params.type}/${params.key}?amount=${params.amount}`);
}
diff --git a/website/client/src/store/actions/snackbars.js b/website/client/src/store/actions/snackbars.js
index f1335d0e6c..8742afca79 100644
--- a/website/client/src/store/actions/snackbars.js
+++ b/website/client/src/store/actions/snackbars.js
@@ -1,13 +1,11 @@
import uuid from 'uuid';
export function add (store, payload) {
- let notification = Object.assign({}, payload);
+ const notification = { ...payload };
notification.uuid = uuid();
store.state.notificationStore.push(notification);
}
export function remove (store, payload) {
- store.state.notificationStore = store.state.notificationStore.filter(notification => {
- return notification.uuid !== payload.uuid;
- });
+ store.state.notificationStore = store.state.notificationStore.filter(notification => notification.uuid !== payload.uuid);
}
diff --git a/website/client/src/store/actions/tags.js b/website/client/src/store/actions/tags.js
index 577e411440..1e17e06391 100644
--- a/website/client/src/store/actions/tags.js
+++ b/website/client/src/store/actions/tags.js
@@ -1,44 +1,44 @@
import axios from 'axios';
export async function getTags () {
- let url = 'api/v4/tags';
- let response = await axios.get(url);
+ const url = 'api/v4/tags';
+ const response = await axios.get(url);
return response.data.data;
}
export async function createTag (store, payload) {
- let url = 'api/v4/tags';
- let response = await axios.post(url, {
+ const url = 'api/v4/tags';
+ const response = await axios.post(url, {
tagDetails: payload.tagDetails,
});
return response.data.data;
}
-export async function getTag (store, payload) {
- let url = `api/v4/tags/${payload.tagId}`;
- let response = await axios.get(url);
+export async function getTag (store, payload) {
+ const url = `api/v4/tags/${payload.tagId}`;
+ const response = await axios.get(url);
return response.data.data;
}
export async function updateTag (store, payload) {
- let url = `api/v4/tags/${payload.tagId}`;
- let response = await axios.put(url, {
+ const url = `api/v4/tags/${payload.tagId}`;
+ const response = await axios.put(url, {
tagDetails: payload.tagDetails,
});
return response.data.data;
}
-export async function sortTag (store, payload) {
- let url = 'api/v4/reorder-tags';
- let response = await axios.post(url, {
+export async function sortTag (store, payload) {
+ const url = 'api/v4/reorder-tags';
+ const response = await axios.post(url, {
tagId: payload.tagId,
to: payload.to,
});
return response.data.data;
}
-export async function deleteTag (store, payload) {
- let url = `api/v4/tags/${payload.tagId}`;
- let response = await axios.delete(url);
+export async function deleteTag (store, payload) {
+ const url = `api/v4/tags/${payload.tagId}`;
+ const response = await axios.delete(url);
return response.data.data;
}
diff --git a/website/client/src/store/actions/tasks.js b/website/client/src/store/actions/tasks.js
index 0b66e58c9d..5d0b94197f 100644
--- a/website/client/src/store/actions/tasks.js
+++ b/website/client/src/store/actions/tasks.js
@@ -1,7 +1,7 @@
-import { loadAsyncResource } from '@/libs/asyncResource';
import axios from 'axios';
import compact from 'lodash/compact';
import omit from 'lodash/omit';
+import { loadAsyncResource } from '@/libs/asyncResource';
export function fetchUserTasks (store, options = {}) {
return loadAsyncResource({
@@ -11,9 +11,7 @@ export function fetchUserTasks (store, options = {}) {
deserialize (response) {
// Wait for the user to be loaded before deserializing
// because user.tasksOrder is necessary
- return store.dispatch('user:fetch').then((userResource) => {
- return store.dispatch('tasks:order', [response.data.data, userResource.data.tasksOrder]);
- });
+ return store.dispatch('user:fetch').then(userResource => store.dispatch('tasks:order', [response.data.data, userResource.data.tasksOrder]));
},
forceLoad: options.forceLoad,
});
@@ -41,9 +39,7 @@ export async function fetchCompletedTodos (store) {
export async function clearCompletedTodos (store) {
await axios.post('/api/v4/tasks/clearCompletedTodos');
- store.state.tasks.data.todos = store.state.tasks.data.todos.filter(task => {
- return !task.completed;
- });
+ store.state.tasks.data.todos = store.state.tasks.data.todos.filter(task => !task.completed);
}
@@ -59,8 +55,8 @@ export function order (store, [rawTasks, tasksOrder]) {
tasks[`${task.type}s`].push(task);
});
- Object.keys(tasks).forEach((type) => {
- let tasksOfType = tasks[type];
+ Object.keys(tasks).forEach(type => {
+ const tasksOfType = tasks[type];
const orderOfType = tasksOrder[type];
const orderedTasks = new Array(tasksOfType.length);
@@ -84,9 +80,7 @@ export function order (store, [rawTasks, tasksOrder]) {
function sanitizeChecklist (task) {
if (task.checklist) {
- task.checklist = task.checklist.filter((i) => {
- return Boolean(i.text);
- });
+ task.checklist = task.checklist.filter(i => Boolean(i.text));
}
}
@@ -116,7 +110,7 @@ export async function create (store, createdTask) {
export async function save (store, editedTask) {
const taskId = editedTask._id;
- const type = editedTask.type;
+ const { type } = editedTask;
const originalTask = store.state.tasks.data[`${type}s`].find(t => t._id === taskId);
sanitizeChecklist(editedTask);
@@ -128,7 +122,7 @@ export async function save (store, editedTask) {
if (originalTask) Object.assign(originalTask, response.data.data);
}
-export async function scoreChecklistItem (store, {taskId, itemId}) {
+export async function scoreChecklistItem (store, { taskId, itemId }) {
await axios.post(`/api/v4/tasks/${taskId}/checklist/${itemId}/score`);
}
@@ -151,59 +145,59 @@ export async function destroy (store, task) {
}
export async function getChallengeTasks (store, payload) {
- let response = await axios.get(`/api/v4/tasks/challenge/${payload.challengeId}`);
+ const response = await axios.get(`/api/v4/tasks/challenge/${payload.challengeId}`);
return response.data.data;
}
export async function createChallengeTasks (store, payload) {
- let response = await axios.post(`/api/v4/tasks/challenge/${payload.challengeId}`, payload.tasks);
+ const response = await axios.post(`/api/v4/tasks/challenge/${payload.challengeId}`, payload.tasks);
return response.data.data;
}
export async function getGroupTasks (store, payload) {
- let response = await axios.get(`/api/v4/tasks/group/${payload.groupId}`);
+ const response = await axios.get(`/api/v4/tasks/group/${payload.groupId}`);
return response.data.data;
}
export async function getCompletedGroupTasks (store, payload) {
- let response = await axios.get(`/api/v4/tasks/group/${payload.groupId}?type=completedTodos`);
+ const response = await axios.get(`/api/v4/tasks/group/${payload.groupId}?type=completedTodos`);
return response.data.data;
}
export async function createGroupTasks (store, payload) {
- let response = await axios.post(`/api/v4/tasks/group/${payload.groupId}`, payload.tasks);
+ const response = await axios.post(`/api/v4/tasks/group/${payload.groupId}`, payload.tasks);
return response.data.data;
}
export async function assignTask (store, payload) {
- let response = await axios.post(`/api/v4/tasks/${payload.taskId}/assign/${payload.userId}`);
+ const response = await axios.post(`/api/v4/tasks/${payload.taskId}/assign/${payload.userId}`);
return response.data.data;
}
export async function unassignTask (store, payload) {
- let response = await axios.post(`/api/v4/tasks/${payload.taskId}/unassign/${payload.userId}`);
+ const response = await axios.post(`/api/v4/tasks/${payload.taskId}/unassign/${payload.userId}`);
return response.data.data;
}
export async function needsWork (store, payload) {
- let response = await axios.post(`/api/v4/tasks/${payload.taskId}/needs-work/${payload.userId}`);
+ const response = await axios.post(`/api/v4/tasks/${payload.taskId}/needs-work/${payload.userId}`);
return response.data.data;
}
export async function getGroupApprovals (store, payload) {
- let response = await axios.get(`/api/v4/approvals/group/${payload.groupId}`);
+ const response = await axios.get(`/api/v4/approvals/group/${payload.groupId}`);
return response.data.data;
}
export async function approve (store, payload) {
- let response = await axios.post(`/api/v4/tasks/${payload.taskId}/approve/${payload.userId}`);
+ const response = await axios.post(`/api/v4/tasks/${payload.taskId}/approve/${payload.userId}`);
return response.data.data;
}
export async function unlinkOneTask (store, payload) {
if (!payload.keep) payload.keep = 'keep';
- let task = payload.task;
+ const { task } = payload;
const list = store.state.tasks.data[`${task.type}s`];
const taskIndex = list.findIndex(t => t._id === task._id);
@@ -211,22 +205,22 @@ export async function unlinkOneTask (store, payload) {
list.splice(taskIndex, 1);
}
- let response = await axios.post(`/api/v4/tasks/unlink-one/${payload.task._id}?keep=${payload.keep}`);
+ const response = await axios.post(`/api/v4/tasks/unlink-one/${payload.task._id}?keep=${payload.keep}`);
return response.data.data;
}
export async function unlinkAllTasks (store, payload) {
if (!payload.keep) payload.keep = 'keep-all';
- let response = await axios.post(`/api/v4/tasks/unlink-all/${payload.challengeId}?keep=${payload.keep}`);
+ const response = await axios.post(`/api/v4/tasks/unlink-all/${payload.challengeId}?keep=${payload.keep}`);
return response.data.data;
}
export async function move (store, payload) {
- let response = await axios.post(`/api/v4/tasks/${payload.taskId}/move/to/${payload.position}`);
+ const response = await axios.post(`/api/v4/tasks/${payload.taskId}/move/to/${payload.position}`);
return response.data.data;
}
export async function moveGroupTask (store, payload) {
- let response = await axios.post(`/api/v4/group-tasks/${payload.taskId}/move/to/${payload.position}`);
+ const response = await axios.post(`/api/v4/group-tasks/${payload.taskId}/move/to/${payload.position}`);
return response.data.data;
}
diff --git a/website/client/src/store/actions/user.js b/website/client/src/store/actions/user.js
index a67c455108..fbb80b1849 100644
--- a/website/client/src/store/actions/user.js
+++ b/website/client/src/store/actions/user.js
@@ -1,6 +1,6 @@
-import { loadAsyncResource } from '@/libs/asyncResource';
import setProps from 'lodash/set';
import axios from 'axios';
+import { loadAsyncResource } from '@/libs/asyncResource';
import { togglePinnedItem as togglePinnedItemOp } from '@/../../common/script/ops/pinnedGearUtils';
import changeClassOp from '@/../../common/script/ops/changeClass';
@@ -22,12 +22,10 @@ export function fetch (store, options = {}) { // eslint-disable-line no-shadow
export async function set (store, changes) {
const user = store.state.user.data;
- for (let key in changes) {
+ for (const key in changes) {
if (key === 'tags') {
// Keep challenge and group tags
- const oldTags = user.tags.filter(t => {
- return t.group;
- });
+ const oldTags = user.tags.filter(t => t.group);
user.tags = changes[key].concat(oldTags);
@@ -51,7 +49,7 @@ export async function set (store, changes) {
}
}
- let response = await axios.put('/api/v4/user', changes);
+ const response = await axios.put('/api/v4/user', changes);
return response.data.data;
}
@@ -60,22 +58,22 @@ export async function sleep (store) {
user.preferences.sleep = !user.preferences.sleep;
- let response = await axios.post('/api/v4/user/sleep');
+ const response = await axios.post('/api/v4/user/sleep');
return response.data.data;
}
export async function addWebhook (store, payload) {
- let response = await axios.post('/api/v4/user/webhook', payload.webhookInfo);
+ const response = await axios.post('/api/v4/user/webhook', payload.webhookInfo);
return response.data.data;
}
export async function updateWebhook (store, payload) {
- let response = await axios.put(`/api/v4/user/webhook/${payload.webhook.id}`, payload.webhook);
+ const response = await axios.put(`/api/v4/user/webhook/${payload.webhook.id}`, payload.webhook);
return response.data.data;
}
export async function deleteWebhook (store, payload) {
- let response = await axios.delete(`/api/v4/user/webhook/${payload.webhook.id}`);
+ const response = await axios.delete(`/api/v4/user/webhook/${payload.webhook.id}`);
return response.data.data;
}
@@ -85,7 +83,7 @@ export async function changeClass (store, params) {
changeClassOp(user, params);
user.flags.classSelected = true;
- let response = await axios.post(`/api/v4/user/change-class?class=${params.query.class}`);
+ const response = await axios.post(`/api/v4/user/change-class?class=${params.query.class}`);
return response.data.data;
}
@@ -93,14 +91,14 @@ export async function disableClasses (store) {
const user = store.state.user.data;
disableClassesOp(user);
- let response = await axios.post('/api/v4/user/disable-classes');
+ const response = await axios.post('/api/v4/user/disable-classes');
return response.data.data;
}
export function togglePinnedItem (store, params) {
const user = store.state.user.data;
- let addedItem = togglePinnedItemOp(user, params);
+ const addedItem = togglePinnedItemOp(user, params);
axios.get(`/api/v4/user/toggle-pinned-item/${params.type}/${params.path}`);
// TODO
@@ -111,7 +109,7 @@ export function togglePinnedItem (store, params) {
}
export async function movePinnedItem (store, params) {
- let response = await axios.post(`/api/v4/user/move-pinned-item/${params.path}/move/to/${params.position}`);
+ const response = await axios.post(`/api/v4/user/move-pinned-item/${params.path}/move/to/${params.position}`);
return response.data.data;
}
@@ -127,7 +125,7 @@ export function castSpell (store, params) {
}
export async function openMysteryItem (store) {
- let user = store.state.user.data;
+ const user = store.state.user.data;
openMysteryItemOp(user);
return axios.post('/api/v4/user/open-mystery-item');
}
@@ -138,17 +136,16 @@ export function newStuffLater (store) {
}
export async function rebirth () {
- let result = await axios.post('/api/v4/user/rebirth');
+ const result = await axios.post('/api/v4/user/rebirth');
return result;
}
export async function togglePrivateMessagesOpt (store) {
- let response = await axios.put('/api/v4/user',
+ const response = await axios.put('/api/v4/user',
{
'inbox.optOut': !store.state.user.data.inbox.optOut,
- }
- );
+ });
store.state.user.data.inbox.optOut = !store.state.user.data.inbox.optOut;
return response;
}
diff --git a/website/client/src/store/getters/members.js b/website/client/src/store/getters/members.js
index 0902c2fa34..e9cdd958e9 100644
--- a/website/client/src/store/getters/members.js
+++ b/website/client/src/store/getters/members.js
@@ -1,12 +1,12 @@
import memberHasClass from '@/../../common/script/libs/hasClass';
export function isBuffed () {
- return (member) => {
- const buffs = member.stats.buffs;
+ return member => {
+ const { buffs } = member.stats;
return buffs.str || buffs.per || buffs.con || buffs.int;
};
}
export function hasClass () {
return memberHasClass;
-}
\ No newline at end of file
+}
diff --git a/website/client/src/store/getters/tasks.js b/website/client/src/store/getters/tasks.js
index bf6ffd05be..a604745a6d 100644
--- a/website/client/src/store/getters/tasks.js
+++ b/website/client/src/store/getters/tasks.js
@@ -1,46 +1,43 @@
+import sortBy from 'lodash/sortBy';
import { shouldDo } from '@/../../common/script/cron';
// Library / Utility function
import { orderSingleTypeTasks } from '@/libs/store/helpers/orderTasks.js';
import { getActiveFilter } from '@/libs/store/helpers/filterTasks.js';
-import sortBy from 'lodash/sortBy';
// Return all the tags belonging to an user task
export function getTagsFor (store) {
- return (task) => {
- return store.state.user.data.tags
- .filter(tag => task.tags && task.tags.indexOf(tag.id) !== -1)
- .map(tag => tag.name);
- };
+ return task => store.state.user.data.tags
+ .filter(tag => task.tags && task.tags.indexOf(tag.id) !== -1)
+ .map(tag => tag.name);
}
function getTaskColor (task) {
if (task.type === 'reward' || task.byHabitica) return 'purple';
- const value = task.value;
+ const { value } = task;
if (value < -20) {
return 'worst';
- } else if (value < -10) {
+ } if (value < -10) {
return 'worse';
- } else if (value < -1) {
+ } if (value < -1) {
return 'bad';
- } else if (value < 1) {
+ } if (value < 1) {
return 'neutral';
- } else if (value < 5) {
+ } if (value < 5) {
return 'good';
- } else if (value < 10) {
+ } if (value < 10) {
return 'better';
- } else {
- return 'best';
}
+ return 'best';
}
export function canDelete () {
- return (task) => {
- let isUserChallenge = Boolean(task.userId);
- let activeChallenge = isUserChallenge && task.challenge && task.challenge.id && !task.challenge.broken;
+ return task => {
+ const isUserChallenge = Boolean(task.userId);
+ const activeChallenge = isUserChallenge && task.challenge && task.challenge.id && !task.challenge.broken;
return !activeChallenge;
};
}
@@ -54,7 +51,7 @@ export function getTaskClasses (store) {
// Control: 'control'
return (task, purpose, dueDate) => {
if (!dueDate) dueDate = new Date();
- const type = task.type;
+ const { type } = task;
const color = getTaskColor(task);
switch (purpose) {
@@ -96,18 +93,18 @@ export function getTaskClasses (store) {
inner: `task-${color}-control-inner-daily-todo`,
icon: `task-${color}-control-icon`,
};
- } else if (type === 'reward') {
+ } if (type === 'reward') {
return {
bg: task.group && task.group.id && !task.userId ? 'task-reward-control-bg-noninteractive' : 'task-reward-control-bg',
};
- } else if (type === 'habit') {
+ } if (type === 'habit') {
return {
- up: task.up ?
- { bg: task.group && task.group.id && !task.userId ? `task-${color}-control-bg-noninteractive` : `task-${color}-control-bg`, inner: `task-${color}-control-inner-habit`, icon: `task-${color}-control-icon`} :
- { bg: 'task-disabled-habit-control-bg', inner: 'task-disabled-habit-control-inner', icon: `task-${color}-control-icon` },
- down: task.down ?
- { bg: task.group && task.group.id && !task.userId ? `task-${color}-control-bg-noninteractive` : `task-${color}-control-bg`, inner: `task-${color}-control-inner-habit`, icon: `task-${color}-control-icon`} :
- { bg: 'task-disabled-habit-control-bg', inner: 'task-disabled-habit-control-inner', icon: `task-${color}-control-icon` },
+ up: task.up
+ ? { bg: task.group && task.group.id && !task.userId ? `task-${color}-control-bg-noninteractive` : `task-${color}-control-bg`, inner: `task-${color}-control-inner-habit`, icon: `task-${color}-control-icon` }
+ : { bg: 'task-disabled-habit-control-bg', inner: 'task-disabled-habit-control-inner', icon: `task-${color}-control-icon` },
+ down: task.down
+ ? { bg: task.group && task.group.id && !task.userId ? `task-${color}-control-bg-noninteractive` : `task-${color}-control-bg`, inner: `task-${color}-control-inner-habit`, icon: `task-${color}-control-icon` }
+ : { bg: 'task-disabled-habit-control-bg', inner: 'task-disabled-habit-control-inner', icon: `task-${color}-control-icon` },
};
}
break;
@@ -118,13 +115,13 @@ export function getTaskClasses (store) {
}
// Returns all list for given task type
-export function getUnfilteredTaskList ({state}) {
- return (type) => state.tasks.data[`${type}s`];
+export function getUnfilteredTaskList ({ state }) {
+ return type => state.tasks.data[`${type}s`];
}
// Returns filtered, sorted, ordered, tag filtered, and search filtered task list
// @TODO: sort task list based on used preferences
-export function getFilteredTaskList ({state, getters}) {
+export function getFilteredTaskList ({ state, getters }) {
return ({
type,
filterType = '',
@@ -134,8 +131,8 @@ export function getFilteredTaskList ({state, getters}) {
// assumption: type will always be passed as param
let requestedTasks = getters['tasks:getUnfilteredTaskList'](type);
- let userPreferences = state.user.data.preferences;
- let taskOrderForType = state.user.data.tasksOrder[type];
+ const userPreferences = state.user.data.preferences;
+ const taskOrderForType = state.user.data.tasksOrder[type];
// order tasks based on user set task order
// Still needs unit test for this..
diff --git a/website/client/src/store/getters/user.js b/website/client/src/store/getters/user.js
index c997ec4c76..c6810b2db4 100644
--- a/website/client/src/store/getters/user.js
+++ b/website/client/src/store/getters/user.js
@@ -7,7 +7,7 @@ export function gems (store) {
}
export function buffs (store) {
- return (key) => store.state.user.data.stats.buffs[key];
+ return key => store.state.user.data.stats.buffs[key];
}
export function preferences (store) {
@@ -15,5 +15,5 @@ export function preferences (store) {
}
export function tasksOrder (store) {
- return (type) => store.state.user.tasksOrder[`${type}s`];
+ return type => store.state.user.tasksOrder[`${type}s`];
}
diff --git a/website/client/src/store/index.js b/website/client/src/store/index.js
index 54ecc77ad9..909c3d949a 100644
--- a/website/client/src/store/index.js
+++ b/website/client/src/store/index.js
@@ -1,3 +1,5 @@
+import axios from 'axios';
+import moment from 'moment';
import Store from '@/libs/store';
import deepFreeze from '@/libs/deepFreeze';
import content from '@/../../common/script/content/index';
@@ -5,8 +7,6 @@ import * as commonConstants from '@/../../common/script/constants';
import { DAY_MAPPING } from '@/../../common/script/cron';
import { asyncResourceFactory } from '@/libs/asyncResource';
import { setUpAxios } from '@/libs/auth';
-import axios from 'axios';
-import moment from 'moment';
import actions from './actions';
import getters from './getters';
@@ -16,7 +16,7 @@ const IS_TEST = process.env.NODE_ENV === 'test'; // eslint-disable-line no-proce
// Load user auth parameters and determine if it's logged in
// before trying to load data
let isUserLoggedIn = false;
-let browserTimezoneOffset = moment().zone(); // eg, 240 - this will be converted on server as -(offset/60)
+const browserTimezoneOffset = moment().zone(); // eg, 240 - this will be converted on server as -(offset/60)
axios.defaults.headers.common['x-client'] = 'habitica-web';
let AUTH_SETTINGS = localStorage.getItem('habit-mobile-settings');
@@ -91,7 +91,7 @@ export default function () {
// @TODO apply freezing to the entire codebase (the server) and not only to the client side?
// NOTE this takes about 10-15ms on a fast computer
content: deepFreeze(content),
- constants: deepFreeze({...commonConstants, DAY_MAPPING}),
+ constants: deepFreeze({ ...commonConstants, DAY_MAPPING }),
i18n: deepFreeze({
availableLanguages,
selectedLanguage,
diff --git a/website/client/tests/unit/.eslintrc.js b/website/client/tests/unit/.eslintrc.js
index c00d243367..42275b7cd9 100644
--- a/website/client/tests/unit/.eslintrc.js
+++ b/website/client/tests/unit/.eslintrc.js
@@ -1,5 +1,5 @@
module.exports = {
env: {
- mocha: true
- }
-}
\ No newline at end of file
+ mocha: true,
+ },
+};
diff --git a/website/client/tests/unit/components/avatar.spec.js b/website/client/tests/unit/components/avatar.spec.js
index 8f52e8b34b..1a22f716b2 100644
--- a/website/client/tests/unit/components/avatar.spec.js
+++ b/website/client/tests/unit/components/avatar.spec.js
@@ -1,5 +1,5 @@
-import Avatar from '@/components/avatar';
import Vue from 'vue';
+import Avatar from '@/components/avatar';
import generateStore from '@/store';
context('avatar.vue', () => {
@@ -129,10 +129,10 @@ context('avatar.vue', () => {
},
};
- expect(vm.visualBuffs).to.include({snowball: 'snowman'});
- expect(vm.visualBuffs).to.include({spookySparkles: 'ghost'});
- expect(vm.visualBuffs).to.include({shinySeed: 'avatar_floral_Warrior'});
- expect(vm.visualBuffs).to.include({seafoam: 'seafoam_star'});
+ expect(vm.visualBuffs).to.include({ snowball: 'snowman' });
+ expect(vm.visualBuffs).to.include({ spookySparkles: 'ghost' });
+ expect(vm.visualBuffs).to.include({ shinySeed: 'avatar_floral_Warrior' });
+ expect(vm.visualBuffs).to.include({ seafoam: 'seafoam_star' });
});
});
@@ -274,7 +274,7 @@ context('avatar.vue', () => {
it('does if not showing visual buffs', () => {
expect(vm.showAvatar()).to.equal(true);
- let buffs = vm.member.stats.buffs;
+ const { buffs } = vm.member.stats;
buffs.snowball = true;
expect(vm.showAvatar()).to.equal(false);
diff --git a/website/client/tests/unit/components/categories/categoryTags.spec.js b/website/client/tests/unit/components/categories/categoryTags.spec.js
index 1329c3143d..b522bb84d8 100644
--- a/website/client/tests/unit/components/categories/categoryTags.spec.js
+++ b/website/client/tests/unit/components/categories/categoryTags.spec.js
@@ -1,4 +1,4 @@
-import {mount} from '@vue/test-utils';
+import { mount } from '@vue/test-utils';
import Vue from 'vue';
import CategoryTags from '@/components/categories/categoryTags.vue';
@@ -6,7 +6,7 @@ import CategoryTags from '@/components/categories/categoryTags.vue';
describe('Category Tags', () => {
let wrapper;
- beforeEach(function () {
+ beforeEach(() => {
wrapper = mount(CategoryTags, {
propsData: {
categories: [],
@@ -15,7 +15,7 @@ describe('Category Tags', () => {
default: '
This is a slot.
',
},
mocks: {
- $t: (string) => string,
+ $t: string => string,
},
});
});
@@ -65,4 +65,4 @@ describe('Category Tags', () => {
it('displays additional content at the end', () => {
expect(wrapper.find('p').text()).to.eq('This is a slot.');
});
-});
\ No newline at end of file
+});
diff --git a/website/client/tests/unit/components/challenges/challengeDetail.spec.js b/website/client/tests/unit/components/challenges/challengeDetail.spec.js
index 0192eafa36..524f9ae511 100644
--- a/website/client/tests/unit/components/challenges/challengeDetail.spec.js
+++ b/website/client/tests/unit/components/challenges/challengeDetail.spec.js
@@ -32,13 +32,15 @@ describe('Challenge Detail', () => {
actions: {
'members:getChallengeMembers': () => {},
'challenges:getChallenge': () => [
- {_id: '1', group: { name: '', type: ''}, memberCount: 1, name: '', summary: '', description: '', leader: '', price: 1},
+ {
+ _id: '1', group: { name: '', type: '' }, memberCount: 1, name: '', summary: '', description: '', leader: '', price: 1,
+ },
],
'tasks:getChallengeTasks': () => [
- {_id: '1', type: 'habit'},
- {_id: '2', type: 'daily'},
- {_id: '3', type: 'reward'},
- {_id: '4', type: 'todo'},
+ { _id: '1', type: 'habit' },
+ { _id: '2', type: 'daily' },
+ { _id: '3', type: 'reward' },
+ { _id: '4', type: 'todo' },
],
},
getters: {
@@ -48,13 +50,13 @@ describe('Challenge Detail', () => {
store,
localVue,
mocks: {
- $t: (string) => string,
+ $t: string => string,
},
});
});
it('removes a destroyed task from task list', () => {
- let taskToRemove = {_id: '1', type: 'habit'};
+ const taskToRemove = { _id: '1', type: 'habit' };
wrapper.vm.taskDestroyed(taskToRemove);
expect(wrapper.vm.tasksByType[taskToRemove.type].length).to.eq(0);
});
diff --git a/website/client/tests/unit/components/groups/membersModal.spec.js b/website/client/tests/unit/components/groups/membersModal.spec.js
index 3dda1140fd..8148f941ef 100644
--- a/website/client/tests/unit/components/groups/membersModal.spec.js
+++ b/website/client/tests/unit/components/groups/membersModal.spec.js
@@ -1,5 +1,6 @@
import Vue from 'vue';
import MembersModalComponent from '@/components/groups/membersModal.vue';
+
describe.skip('Members Modal Component', () => {
describe('Party Sort', () => {
let CTor;
diff --git a/website/client/tests/unit/components/notifications.spec.js b/website/client/tests/unit/components/notifications.spec.js
index 4b799fa5fa..adf33286d4 100644
--- a/website/client/tests/unit/components/notifications.spec.js
+++ b/website/client/tests/unit/components/notifications.spec.js
@@ -41,7 +41,7 @@ describe('Notifications', () => {
store,
localVue,
mocks: {
- $t: (string) => string,
+ $t: string => string,
},
});
});
diff --git a/website/client/tests/unit/components/sidebarSection.spec.js b/website/client/tests/unit/components/sidebarSection.spec.js
index 6a119815ae..959da66f9b 100644
--- a/website/client/tests/unit/components/sidebarSection.spec.js
+++ b/website/client/tests/unit/components/sidebarSection.spec.js
@@ -5,7 +5,7 @@ import SidebarSection from '@/components/sidebarSection.vue';
describe('Sidebar Section', () => {
let wrapper;
- beforeEach(function () {
+ beforeEach(() => {
wrapper = mount(SidebarSection, {
propsData: {
title: 'Hello World',
@@ -26,7 +26,7 @@ describe('Sidebar Section', () => {
it('displays tooltip icon', () => {
expect(wrapper.contains('.section-info')).to.eq(false);
- wrapper.setProps({tooltip: 'This is a test'});
+ wrapper.setProps({ tooltip: 'This is a test' });
expect(wrapper.contains('.section-info')).to.eq(true);
});
diff --git a/website/client/tests/unit/components/tasks/column.spec.js b/website/client/tests/unit/components/tasks/column.spec.js
index 3def16a20a..6c2c8a8f68 100644
--- a/website/client/tests/unit/components/tasks/column.spec.js
+++ b/website/client/tests/unit/components/tasks/column.spec.js
@@ -7,15 +7,17 @@ localVue.use(Store);
describe('Task Column', () => {
let wrapper;
- let store, getters;
- let habits, taskListOverride, tasks;
+ let store; let
+ getters;
+ let habits; let taskListOverride; let
+ tasks;
function makeWrapper (additionalSetup = {}) {
- let type = 'habit';
- let mocks = {
+ const type = 'habit';
+ const mocks = {
$t () {},
};
- let stubs = ['b-modal']; //
is a custom component and not tested here
+ const stubs = ['b-modal']; // is a custom component and not tested here
return mount(TaskColumn, {
propsData: {
@@ -72,9 +74,9 @@ describe('Task Column', () => {
'tasks:getFilteredTaskList': () => () => habits,
};
- store = new Store({getters});
+ store = new Store({ getters });
- wrapper = makeWrapper({store});
+ wrapper = makeWrapper({ store });
});
it('returns task list from props for group-plan', () => {
@@ -112,7 +114,7 @@ describe('Task Column', () => {
});
it('returns all tasks if no tag is given', () => {
- let returnedTasks = wrapper.vm.filterByTagList(tasks);
+ const returnedTasks = wrapper.vm.filterByTagList(tasks);
expect(returnedTasks).to.have.lengthOf(tasks.length);
tasks.forEach((task, i) => {
expect(returnedTasks[i]).to.eq(task);
@@ -120,7 +122,7 @@ describe('Task Column', () => {
});
it('returns tasks for given single tag', () => {
- let returnedTasks = wrapper.vm.filterByTagList(tasks, [3]);
+ const returnedTasks = wrapper.vm.filterByTagList(tasks, [3]);
expect(returnedTasks).to.have.lengthOf(3);
expect(returnedTasks[0]).to.eq(tasks[0]);
@@ -129,7 +131,7 @@ describe('Task Column', () => {
});
it('returns tasks for given multiple tags', () => {
- let returnedTasks = wrapper.vm.filterByTagList(tasks, [2, 3]);
+ const returnedTasks = wrapper.vm.filterByTagList(tasks, [2, 3]);
expect(returnedTasks).to.have.lengthOf(1);
expect(returnedTasks[0]).to.eq(tasks[1]);
@@ -171,7 +173,7 @@ describe('Task Column', () => {
});
it('returns all tasks for empty search term', () => {
- let returnedTasks = wrapper.vm.filterBySearchText(tasks);
+ const returnedTasks = wrapper.vm.filterBySearchText(tasks);
expect(returnedTasks).to.have.lengthOf(tasks.length);
tasks.forEach((task, i) => {
expect(returnedTasks[i]).to.eq(task);
@@ -179,26 +181,26 @@ describe('Task Column', () => {
});
it('returns tasks for search term in title /i', () => {
- ['Title', 'TITLE', 'title', 'tItLe'].forEach((term) => {
+ ['Title', 'TITLE', 'title', 'tItLe'].forEach(term => {
expect(wrapper.vm.filterBySearchText(tasks, term)[0]).to.eq(tasks[2]);
});
});
it('returns tasks for search term in note /i', () => {
- ['Note', 'NOTE', 'note', 'nOtE'].forEach((term) => {
+ ['Note', 'NOTE', 'note', 'nOtE'].forEach(term => {
expect(wrapper.vm.filterBySearchText(tasks, term)[0]).to.eq(tasks[3]);
});
});
it('returns tasks for search term in checklist title /i', () => {
- ['Check', 'CHECK', 'check', 'cHeCK'].forEach((term) => {
- let returnedTasks = wrapper.vm.filterBySearchText(tasks, term);
+ ['Check', 'CHECK', 'check', 'cHeCK'].forEach(term => {
+ const returnedTasks = wrapper.vm.filterBySearchText(tasks, term);
expect(returnedTasks[0]).to.eq(tasks[2]);
expect(returnedTasks[1]).to.eq(tasks[3]);
});
- ['Checkitem', 'CHECKITEM', 'checkitem', 'cHeCKiTEm'].forEach((term) => {
+ ['Checkitem', 'CHECKITEM', 'checkitem', 'cHeCKiTEm'].forEach(term => {
expect(wrapper.vm.filterBySearchText(tasks, term)[0]).to.eq(tasks[3]);
});
});
diff --git a/website/client/tests/unit/components/ui/drawer.spec.js b/website/client/tests/unit/components/ui/drawer.spec.js
index 471d13a521..ef479aa450 100644
--- a/website/client/tests/unit/components/ui/drawer.spec.js
+++ b/website/client/tests/unit/components/ui/drawer.spec.js
@@ -10,9 +10,11 @@ describe('DrawerComponent', () => {
it('renders the correct title', () => {
const Ctor = Vue.extend(DrawerComponent);
- const vm = new Ctor({propsData: {
- title: 'My title',
- }}).$mount();
+ const vm = new Ctor({
+ propsData: {
+ title: 'My title',
+ },
+ }).$mount();
expect(vm.$el.textContent).to.be.equal('My title');
});
diff --git a/website/client/tests/unit/filters/floor.spec.js b/website/client/tests/unit/filters/floor.spec.js
index 1ca30c0150..7880bc60a0 100644
--- a/website/client/tests/unit/filters/floor.spec.js
+++ b/website/client/tests/unit/filters/floor.spec.js
@@ -5,4 +5,4 @@ describe('floor filter', () => {
expect(floorFilter(4.567)).to.equal(4.56);
expect(floorFilter(4.562)).to.equal(4.56);
});
-});
\ No newline at end of file
+});
diff --git a/website/client/tests/unit/filters/round.spec.js b/website/client/tests/unit/filters/round.spec.js
index 9de2591304..09fce16e79 100644
--- a/website/client/tests/unit/filters/round.spec.js
+++ b/website/client/tests/unit/filters/round.spec.js
@@ -5,4 +5,4 @@ describe('round filter', () => {
expect(roundFilter(4.567)).to.equal(4.57);
expect(roundFilter(4.562)).to.equal(4.56);
});
-});
\ No newline at end of file
+});
diff --git a/website/client/tests/unit/filters/roundBigNumber.spec.js b/website/client/tests/unit/filters/roundBigNumber.spec.js
index d9d8596d18..5017d87d02 100644
--- a/website/client/tests/unit/filters/roundBigNumber.spec.js
+++ b/website/client/tests/unit/filters/roundBigNumber.spec.js
@@ -17,4 +17,4 @@ describe('round big number filter', () => {
it('can round bilions', () => {
expect(roundBigNumberFilter(1000000000)).to.equal('1.0b');
});
-});
\ No newline at end of file
+});
diff --git a/website/client/tests/unit/libs/asyncResource.spec.js b/website/client/tests/unit/libs/asyncResource.spec.js
index fc58a22616..27c57ff12d 100644
--- a/website/client/tests/unit/libs/asyncResource.spec.js
+++ b/website/client/tests/unit/libs/asyncResource.spec.js
@@ -1,5 +1,5 @@
-import { asyncResourceFactory, loadAsyncResource } from '@/libs/asyncResource';
import axios from 'axios';
+import { asyncResourceFactory, loadAsyncResource } from '@/libs/asyncResource';
import generateStore from '@/store';
import { sleep } from '@/../../../test/helpers/sleep';
@@ -61,7 +61,7 @@ describe('async resource', () => {
it('returns the resource if it is already loaded and forceLoad is false', async () => {
const store = generateStore();
store.state.user.loadingStatus = 'LOADED';
- store.state.user.data = {_id: 1};
+ store.state.user.data = { _id: 1 };
sandbox.stub(axios, 'get');
@@ -80,7 +80,7 @@ describe('async resource', () => {
const store = generateStore();
store.state.user = asyncResourceFactory();
- sandbox.stub(axios, 'get').withArgs('/api/v4/user').returns(Promise.resolve({data: {data: {_id: 1}}}));
+ sandbox.stub(axios, 'get').withArgs('/api/v4/user').returns(Promise.resolve({ data: { data: { _id: 1 } } }));
const resource = await loadAsyncResource({
store,
@@ -101,7 +101,7 @@ describe('async resource', () => {
const store = generateStore();
store.state.user.loadingStatus = 'LOADED';
- sandbox.stub(axios, 'get').withArgs('/api/v4/user').returns(Promise.resolve({data: {data: {_id: 1}}}));
+ sandbox.stub(axios, 'get').withArgs('/api/v4/user').returns(Promise.resolve({ data: { data: { _id: 1 } } }));
const resource = await loadAsyncResource({
store,
@@ -123,7 +123,7 @@ describe('async resource', () => {
const store = generateStore();
store.state.user.loadingStatus = 'LOADING';
- sandbox.stub(axios, 'get').withArgs('/api/v4/user').returns(Promise.resolve({data: {data: {_id: 1}}}));
+ sandbox.stub(axios, 'get').withArgs('/api/v4/user').returns(Promise.resolve({ data: { data: { _id: 1 } } }));
const resourcePromise = loadAsyncResource({
store,
@@ -136,7 +136,7 @@ describe('async resource', () => {
});
await sleep(0.1);
- const userData = {_id: 1};
+ const userData = { _id: 1 };
expect(store.state.user.loadingStatus).to.equal('LOADING');
expect(axios.get).to.not.have.been.called;
@@ -148,4 +148,4 @@ describe('async resource', () => {
expect(result).to.equal(store.state.user);
});
});
-});
\ No newline at end of file
+});
diff --git a/website/client/tests/unit/libs/deepFreeze.spec.js b/website/client/tests/unit/libs/deepFreeze.spec.js
index 322530d6a1..a49ef6f738 100644
--- a/website/client/tests/unit/libs/deepFreeze.spec.js
+++ b/website/client/tests/unit/libs/deepFreeze.spec.js
@@ -2,7 +2,7 @@ import deepFreeze from '@/libs/deepFreeze';
describe('deepFreeze', () => {
it('deeply freezes an object', () => {
- let obj = {
+ const obj = {
a: 1,
b () {
return this.a;
@@ -15,11 +15,11 @@ describe('deepFreeze', () => {
},
};
- let result = deepFreeze(obj);
+ const result = deepFreeze(obj);
expect(result).to.equal(obj);
expect(Object.isFrozen(obj)).to.equal(true);
expect(Object.isFrozen(obj.nested)).to.equal(true);
expect(Object.isFrozen(obj.nested.nestedTwice)).to.equal(true);
});
-});
\ No newline at end of file
+});
diff --git a/website/client/tests/unit/libs/highlightUsers.spec.js b/website/client/tests/unit/libs/highlightUsers.spec.js
index f33c416b53..1a36d1f1fa 100644
--- a/website/client/tests/unit/libs/highlightUsers.spec.js
+++ b/website/client/tests/unit/libs/highlightUsers.spec.js
@@ -1,5 +1,5 @@
-import {highlightUsers} from '@/libs/highlightUsers';
import habiticaMarkdown from 'habitica-markdown';
+import { highlightUsers } from '@/libs/highlightUsers';
describe('highlightUserAndEmail', () => {
it('highlights displayname', () => {
diff --git a/website/client/tests/unit/libs/i18n.spec.js b/website/client/tests/unit/libs/i18n.spec.js
index 343ae1d3a6..18c14a23fb 100644
--- a/website/client/tests/unit/libs/i18n.spec.js
+++ b/website/client/tests/unit/libs/i18n.spec.js
@@ -1,6 +1,6 @@
+import Vue from 'vue';
import i18n from '@/libs/i18n';
import commoni18n from '@/../../common/script/i18n';
-import Vue from 'vue';
describe('i18n plugin', () => {
before(() => {
@@ -22,4 +22,4 @@ describe('i18n plugin', () => {
expect(result).to.equal(commoni18n.t('reportBug'));
expect(result).to.equal('Report a Bug');
});
-});
\ No newline at end of file
+});
diff --git a/website/client/tests/unit/libs/store.spec.js b/website/client/tests/unit/libs/store.spec.js
index b2cf6bc015..f40b59a28a 100644
--- a/website/client/tests/unit/libs/store.spec.js
+++ b/website/client/tests/unit/libs/store.spec.js
@@ -42,7 +42,7 @@ describe('Store', () => {
Vue.use(StoreModule);
});
- it('injects itself in all component', (done) => {
+ it('injects itself in all component', done => {
new Vue({ // eslint-disable-line no-new
store,
created () {
@@ -52,8 +52,8 @@ describe('Store', () => {
});
});
- it('can watch a function on the state', (done) => {
- store.watch(state => state.name, (newName) => {
+ it('can watch a function on the state', done => {
+ store.watch(state => state.name, newName => {
expect(newName).to.equal('test updated');
done();
});
@@ -90,7 +90,7 @@ describe('Store', () => {
});
describe('helpers', () => {
- it('mapState', (done) => {
+ it('mapState', done => {
new Vue({ // eslint-disable-line no-new
store,
data: {
@@ -103,7 +103,7 @@ describe('Store', () => {
return `${this.title} ${getters.computedName} ${state.name}`;
},
}),
- ...mapState({nestedTest: 'nested.name'}),
+ ...mapState({ nestedTest: 'nested.name' }),
},
created () {
expect(this.name).to.equal('test');
@@ -114,7 +114,7 @@ describe('Store', () => {
});
});
- it('mapGetters', (done) => {
+ it('mapGetters', done => {
new Vue({ // eslint-disable-line no-new
store,
data: {
@@ -134,7 +134,7 @@ describe('Store', () => {
});
});
- it('mapActions', (done) => {
+ it('mapActions', done => {
new Vue({ // eslint-disable-line no-new
store,
data: {
@@ -155,7 +155,7 @@ describe('Store', () => {
});
it('flattenAndNamespace', () => {
- let result = flattenAndNamespace({
+ const result = flattenAndNamespace({
nested: {
computed ({ state }, ...args) {
return [state.name, ...args];
diff --git a/website/client/tests/unit/libs/store/helpers/filterTasks.spec.js b/website/client/tests/unit/libs/store/helpers/filterTasks.spec.js
index f7e8f21ffd..6ebafb6293 100644
--- a/website/client/tests/unit/libs/store/helpers/filterTasks.spec.js
+++ b/website/client/tests/unit/libs/store/helpers/filterTasks.spec.js
@@ -15,7 +15,8 @@ describe('Filter Category for Tasks', () => {
});
describe('getFilterLabels', () => {
- let habit, daily, todo, reward;
+ let habit; let daily; let todo; let
+ reward;
beforeEach(() => {
habit = ['all', 'yellowred', 'greenblue'];
daily = ['all', 'due', 'notDue'];
@@ -45,15 +46,15 @@ describe('Filter Category for Tasks', () => {
describe('getActiveFilter', () => {
it('should return single function by default', () => {
- let activeFilter = getActiveFilter('habit');
+ const activeFilter = getActiveFilter('habit');
expect(activeFilter).to.be.an('object');
expect(activeFilter).to.have.all.keys('label', 'filterFn', 'default');
expect(activeFilter.default).to.be.true;
});
it('should return single function for given filter type', () => {
- let activeFilterLabel = 'yellowred';
- let activeFilter = getActiveFilter('habit', activeFilterLabel);
+ const activeFilterLabel = 'yellowred';
+ const activeFilter = getActiveFilter('habit', activeFilterLabel);
expect(activeFilter).to.be.an('object');
expect(activeFilter).to.have.all.keys('label', 'filterFn');
expect(activeFilter.label).to.eq(activeFilterLabel);
diff --git a/website/client/tests/unit/libs/store/helpers/orderTasks.spec.js b/website/client/tests/unit/libs/store/helpers/orderTasks.spec.js
index c909605bf1..1ce7876947 100644
--- a/website/client/tests/unit/libs/store/helpers/orderTasks.spec.js
+++ b/website/client/tests/unit/libs/store/helpers/orderTasks.spec.js
@@ -1,12 +1,13 @@
+import shuffle from 'lodash/shuffle';
import {
orderSingleTypeTasks,
// orderMultipleTypeTasks,
} from '@/libs/store/helpers/orderTasks.js';
-import shuffle from 'lodash/shuffle';
describe('Task Order Helper Function', () => {
- let tasks, shuffledTasks, taskOrderList;
+ let tasks; let shuffledTasks; let
+ taskOrderList;
beforeEach(() => {
taskOrderList = [1, 2, 3, 4];
tasks = [];
@@ -19,18 +20,18 @@ describe('Task Order Helper Function', () => {
});
it('should return tasks in expected order', () => {
- let newOrderedTasks = orderSingleTypeTasks(shuffledTasks, taskOrderList);
+ const newOrderedTasks = orderSingleTypeTasks(shuffledTasks, taskOrderList);
newOrderedTasks.forEach((item, index) => {
expect(item).to.eq(tasks[index]);
});
});
it('should return new tasks at end of expected order', () => {
- let newTaskIds = [10, 15, 20];
+ const newTaskIds = [10, 15, 20];
newTaskIds.forEach(i => tasks.push({ _id: i, id: i }));
shuffledTasks = shuffle(tasks);
- let newOrderedTasks = orderSingleTypeTasks(shuffledTasks, taskOrderList);
+ const newOrderedTasks = orderSingleTypeTasks(shuffledTasks, taskOrderList);
// checking tasks with order
newOrderedTasks.slice(0, taskOrderList.length).forEach((item, index) => {
expect(item).to.eq(tasks[index]);
diff --git a/website/client/tests/unit/mixins/groupsUtilities.spec.js b/website/client/tests/unit/mixins/groupsUtilities.spec.js
index 07667c9e46..bf69718d52 100644
--- a/website/client/tests/unit/mixins/groupsUtilities.spec.js
+++ b/website/client/tests/unit/mixins/groupsUtilities.spec.js
@@ -1,10 +1,11 @@
+import Vue from 'vue';
import groupsUtilities from '@/mixins/groupsUtilities';
import { TAVERN_ID } from '@/../../common/script/constants';
import generateStore from '@/store';
-import Vue from 'vue';
describe('Groups Utilities Mixin', () => {
- let instance, user;
+ let instance; let
+ user;
before(() => {
instance = new Vue({
@@ -60,4 +61,4 @@ describe('Groups Utilities Mixin', () => {
})).to.equal(false);
});
});
-});
\ No newline at end of file
+});
diff --git a/website/client/tests/unit/store/actions/shops.spec.js b/website/client/tests/unit/store/actions/shops.spec.js
index 8891bf30d9..74b99ac484 100644
--- a/website/client/tests/unit/store/actions/shops.spec.js
+++ b/website/client/tests/unit/store/actions/shops.spec.js
@@ -15,7 +15,7 @@ describe('shops actions', () => {
describe('genericPurchase', () => {
it('buy gear', async () => {
- let user = {
+ const user = {
id: 1,
stats: {
class: 'rogue',
@@ -35,11 +35,11 @@ describe('shops actions', () => {
store.state.user.data = user;
// select a gear item
- let gearItem = content.gear.flat.armor_rogue_1;
+ const gearItem = content.gear.flat.armor_rogue_1;
- let item = getItemInfo(user, 'marketGear', gearItem, getOfficialPinnedItems(user));
+ const item = getItemInfo(user, 'marketGear', gearItem, getOfficialPinnedItems(user));
- sandbox.stub(axios, 'post').withArgs('/api/v4/user/buy/armor_rogue_1').returns(Promise.resolve({data: {data: {}}}));
+ sandbox.stub(axios, 'post').withArgs('/api/v4/user/buy/armor_rogue_1').returns(Promise.resolve({ data: { data: {} } }));
await store.dispatch('shops:genericPurchase', {
pinType: item.pinType,
diff --git a/website/client/tests/unit/store/actions/tasks.spec.js b/website/client/tests/unit/store/actions/tasks.spec.js
index 90eb2e859b..ffb0196d7f 100644
--- a/website/client/tests/unit/store/actions/tasks.spec.js
+++ b/website/client/tests/unit/store/actions/tasks.spec.js
@@ -11,8 +11,8 @@ describe('tasks actions', () => {
describe('fetchUserTasks', () => {
xit('fetches user tasks', async () => {
expect(store.state.tasks.loadingStatus).to.equal('NOT_LOADED');
- const tasks = [{_id: 1}];
- sandbox.stub(axios, 'get').withArgs('/api/v4/tasks/user').returns(Promise.resolve({data: {data: tasks}}));
+ const tasks = [{ _id: 1 }];
+ sandbox.stub(axios, 'get').withArgs('/api/v4/tasks/user').returns(Promise.resolve({ data: { data: tasks } }));
await store.dispatch('tasks:fetchUserTasks');
@@ -21,14 +21,14 @@ describe('tasks actions', () => {
});
it('does not reload tasks by default', async () => {
- const originalTask = [{_id: 1}];
+ const originalTask = [{ _id: 1 }];
store.state.tasks = {
loadingStatus: 'LOADED',
data: originalTask,
};
- const tasks = [{_id: 2}];
- sandbox.stub(axios, 'get').withArgs('/api/v4/tasks/user').returns(Promise.resolve({data: {data: tasks}}));
+ const tasks = [{ _id: 2 }];
+ sandbox.stub(axios, 'get').withArgs('/api/v4/tasks/user').returns(Promise.resolve({ data: { data: tasks } }));
await store.dispatch('tasks:fetchUserTasks');
@@ -39,11 +39,11 @@ describe('tasks actions', () => {
xit('can reload tasks if forceLoad is true', async () => {
store.state.tasks = {
loadingStatus: 'LOADED',
- data: [{_id: 1}],
+ data: [{ _id: 1 }],
};
- const tasks = [{_id: 2}];
- sandbox.stub(axios, 'get').withArgs('/api/v4/tasks/user').returns(Promise.resolve({data: {data: tasks}}));
+ const tasks = [{ _id: 2 }];
+ sandbox.stub(axios, 'get').withArgs('/api/v4/tasks/user').returns(Promise.resolve({ data: { data: tasks } }));
await store.dispatch('tasks:fetchUserTasks', true);
@@ -51,4 +51,4 @@ describe('tasks actions', () => {
expect(store.state.tasks.loadingStatus).to.equal('LOADED');
});
});
-});
\ No newline at end of file
+});
diff --git a/website/client/tests/unit/store/actions/user.spec.js b/website/client/tests/unit/store/actions/user.spec.js
index a66b379648..e8510683a5 100644
--- a/website/client/tests/unit/store/actions/user.spec.js
+++ b/website/client/tests/unit/store/actions/user.spec.js
@@ -11,8 +11,8 @@ describe('user actions', () => {
describe('fetch', () => {
it('loads the user', async () => {
expect(store.state.user.loadingStatus).to.equal('NOT_LOADED');
- const user = {_id: 1};
- sandbox.stub(axios, 'get').withArgs('/api/v4/user').returns(Promise.resolve({data: {data: user}}));
+ const user = { _id: 1 };
+ sandbox.stub(axios, 'get').withArgs('/api/v4/user').returns(Promise.resolve({ data: { data: user } }));
await store.dispatch('user:fetch');
@@ -21,14 +21,14 @@ describe('user actions', () => {
});
it('does not reload user by default', async () => {
- const originalUser = {_id: 1};
+ const originalUser = { _id: 1 };
store.state.user = {
loadingStatus: 'LOADED',
data: originalUser,
};
- const user = {_id: 2};
- sandbox.stub(axios, 'get').withArgs('/api/v4/user').returns(Promise.resolve({data: {data: user}}));
+ const user = { _id: 2 };
+ sandbox.stub(axios, 'get').withArgs('/api/v4/user').returns(Promise.resolve({ data: { data: user } }));
await store.dispatch('user:fetch');
@@ -39,16 +39,16 @@ describe('user actions', () => {
it('can reload user if forceLoad is true', async () => {
store.state.user = {
loadingStatus: 'LOADED',
- data: {_id: 1},
+ data: { _id: 1 },
};
- const user = {_id: 2};
- sandbox.stub(axios, 'get').withArgs('/api/v4/user').returns(Promise.resolve({data: {data: user}}));
+ const user = { _id: 2 };
+ sandbox.stub(axios, 'get').withArgs('/api/v4/user').returns(Promise.resolve({ data: { data: user } }));
- await store.dispatch('user:fetch', {forceLoad: true});
+ await store.dispatch('user:fetch', { forceLoad: true });
expect(store.state.user.data).to.equal(user);
expect(store.state.user.loadingStatus).to.equal('LOADED');
});
});
-});
\ No newline at end of file
+});
diff --git a/website/client/tests/unit/store/getters/members/hasClass.spec.js b/website/client/tests/unit/store/getters/members/hasClass.spec.js
index fe705431e7..701e72f9ea 100644
--- a/website/client/tests/unit/store/getters/members/hasClass.spec.js
+++ b/website/client/tests/unit/store/getters/members/hasClass.spec.js
@@ -60,4 +60,4 @@ describe('hasClass getter', () => {
};
expect(hasClass()(member)).to.equal(true);
});
-});
\ No newline at end of file
+});
diff --git a/website/client/tests/unit/store/getters/tasks/canDelete.spec.js b/website/client/tests/unit/store/getters/tasks/canDelete.spec.js
index f136dbe890..1dec648b4b 100644
--- a/website/client/tests/unit/store/getters/tasks/canDelete.spec.js
+++ b/website/client/tests/unit/store/getters/tasks/canDelete.spec.js
@@ -5,7 +5,7 @@ describe('canDelete getter', () => {
const store = generateStore();
- const task = {userId: 1, challenge: {id: 2}};
+ const task = { userId: 1, challenge: { id: 2 } };
expect(store.getters['tasks:canDelete'](task)).to.equal(false);
});
@@ -13,7 +13,7 @@ describe('canDelete getter', () => {
const store = generateStore();
- const task = {userId: 1, challenge: {id: 2, broken: true}};
+ const task = { userId: 1, challenge: { id: 2, broken: true } };
expect(store.getters['tasks:canDelete'](task)).to.equal(true);
});
});
diff --git a/website/client/tests/unit/store/getters/tasks/getTagsFor.spec.js b/website/client/tests/unit/store/getters/tasks/getTagsFor.spec.js
index 7ea67475a7..902e80d388 100644
--- a/website/client/tests/unit/store/getters/tasks/getTagsFor.spec.js
+++ b/website/client/tests/unit/store/getters/tasks/getTagsFor.spec.js
@@ -5,12 +5,12 @@ describe('getTagsFor getter', () => {
const store = generateStore();
store.state.user.data = {
tags: [
- {id: 1, name: 'tag 1'},
- {id: 2, name: 'tag 2'},
+ { id: 1, name: 'tag 1' },
+ { id: 2, name: 'tag 2' },
],
};
- const task = {tags: [2]};
+ const task = { tags: [2] };
expect(store.getters['tasks:getTagsFor'](task)).to.deep.equal(['tag 2']);
});
-});
\ No newline at end of file
+});
diff --git a/website/client/tests/unit/store/getters/tasks/getTaskClasses.spec.js b/website/client/tests/unit/store/getters/tasks/getTaskClasses.spec.js
index 280b09c6c0..087ede96cd 100644
--- a/website/client/tests/unit/store/getters/tasks/getTaskClasses.spec.js
+++ b/website/client/tests/unit/store/getters/tasks/getTaskClasses.spec.js
@@ -1,7 +1,8 @@
import generateStore from '@/store';
describe('getTaskClasses getter', () => {
- let store, getTaskClasses;
+ let store; let
+ getTaskClasses;
beforeEach(() => {
store = generateStore();
@@ -14,93 +15,93 @@ describe('getTaskClasses getter', () => {
});
it('returns reward edit-modal-bg class', () => {
- const task = {type: 'reward'};
+ const task = { type: 'reward' };
expect(getTaskClasses(task, 'edit-modal-bg')).to.equal('task-purple-modal-bg');
});
it('returns worst task edit-modal-bg class', () => {
- const task = {type: 'todo', value: -21};
+ const task = { type: 'todo', value: -21 };
expect(getTaskClasses(task, 'edit-modal-bg')).to.equal('task-worst-modal-bg');
});
it('returns worse task edit-modal-bg class', () => {
- const task = {type: 'todo', value: -11};
+ const task = { type: 'todo', value: -11 };
expect(getTaskClasses(task, 'edit-modal-bg')).to.equal('task-worse-modal-bg');
});
it('returns bad task edit-modal-bg class', () => {
- const task = {type: 'todo', value: -6};
+ const task = { type: 'todo', value: -6 };
expect(getTaskClasses(task, 'edit-modal-bg')).to.equal('task-bad-modal-bg');
});
it('returns neutral task edit-modal-bg class', () => {
- const task = {type: 'todo', value: 0};
+ const task = { type: 'todo', value: 0 };
expect(getTaskClasses(task, 'edit-modal-bg')).to.equal('task-neutral-modal-bg');
});
it('returns good task edit-modal-bg class', () => {
- const task = {type: 'todo', value: 2};
+ const task = { type: 'todo', value: 2 };
expect(getTaskClasses(task, 'edit-modal-bg')).to.equal('task-good-modal-bg');
});
it('returns better task edit-modal-bg class', () => {
- const task = {type: 'todo', value: 6};
+ const task = { type: 'todo', value: 6 };
expect(getTaskClasses(task, 'edit-modal-bg')).to.equal('task-better-modal-bg');
});
it('returns best task edit-modal-bg class', () => {
- const task = {type: 'todo', value: 12};
+ const task = { type: 'todo', value: 12 };
expect(getTaskClasses(task, 'edit-modal-bg')).to.equal('task-best-modal-bg');
});
it('returns best task edit-modal-text class', () => {
- const task = {type: 'todo', value: 12};
+ const task = { type: 'todo', value: 12 };
expect(getTaskClasses(task, 'edit-modal-text')).to.equal('task-best-modal-text');
});
it('returns best task edit-modal-icon class', () => {
- const task = {type: 'todo', value: 12};
+ const task = { type: 'todo', value: 12 };
expect(getTaskClasses(task, 'edit-modal-icon')).to.equal('task-best-modal-icon');
});
it('returns best task edit-modal-option-disabled class', () => {
- const task = {type: 'todo', value: 12};
+ const task = { type: 'todo', value: 12 };
expect(getTaskClasses(task, 'edit-modal-option-disabled')).to.equal('task-best-modal-option-disabled');
});
it('returns best task edit-modal-control-disabled class', () => {
- const task = {type: 'todo', value: 12};
+ const task = { type: 'todo', value: 12 };
expect(getTaskClasses(task, 'edit-modal-habit-control-disabled')).to.equal('task-best-modal-habit-control-disabled');
});
it('returns create-modal-bg class', () => {
- const task = {type: 'todo'};
+ const task = { type: 'todo' };
expect(getTaskClasses(task, 'create-modal-bg')).to.equal('task-purple-modal-bg');
});
it('returns create-modal-text class', () => {
- const task = {type: 'todo'};
+ const task = { type: 'todo' };
expect(getTaskClasses(task, 'create-modal-text')).to.equal('task-purple-modal-text');
});
it('returns create-modal-icon class', () => {
- const task = {type: 'todo'};
+ const task = { type: 'todo' };
expect(getTaskClasses(task, 'create-modal-icon')).to.equal('task-purple-modal-icon');
});
it('returns create-modal-option-disabled class', () => {
- const task = {type: 'todo'};
+ const task = { type: 'todo' };
expect(getTaskClasses(task, 'create-modal-option-disabled')).to.equal('task-purple-modal-option-disabled');
});
it('returns create-modal-habit-control-disabled class', () => {
- const task = {type: 'todo'};
+ const task = { type: 'todo' };
expect(getTaskClasses(task, 'create-modal-habit-control-disabled')).to.equal('task-purple-modal-habit-control-disabled');
});
it('returns completed todo classes', () => {
- const task = {type: 'todo', value: 2, completed: true};
+ const task = { type: 'todo', value: 2, completed: true };
expect(getTaskClasses(task, 'control')).to.deep.equal({
bg: 'task-disabled-daily-todo-control-bg',
checkbox: 'task-disabled-daily-todo-control-checkbox',
@@ -110,7 +111,7 @@ describe('getTaskClasses getter', () => {
});
it('returns good todo classes', () => {
- const task = {type: 'todo', value: 2};
+ const task = { type: 'todo', value: 2 };
expect(getTaskClasses(task, 'control')).to.deep.equal({
bg: 'task-good-control-bg',
checkbox: 'task-good-control-checkbox',
@@ -120,14 +121,14 @@ describe('getTaskClasses getter', () => {
});
it('returns reward classes', () => {
- const task = {type: 'reward'};
+ const task = { type: 'reward' };
expect(getTaskClasses(task, 'control')).to.deep.equal({
bg: 'task-reward-control-bg',
});
});
it('returns habit up classes', () => {
- const task = {type: 'habit', value: 2, up: true};
+ const task = { type: 'habit', value: 2, up: true };
expect(getTaskClasses(task, 'control')).to.deep.equal({
up: {
bg: 'task-good-control-bg',
@@ -143,7 +144,7 @@ describe('getTaskClasses getter', () => {
});
it('returns noninteractive classes and padlock icons for group board tasks', () => {
- const task = {type: 'todo', value: 2, group: {id: 'group-id'}};
+ const task = { type: 'todo', value: 2, group: { id: 'group-id' } };
expect(getTaskClasses(task, 'control')).to.deep.equal({
bg: 'task-good-control-bg-noninteractive',
checkbox: 'task-good-control-checkbox',
diff --git a/website/client/tests/unit/store/getters/tasks/getTasks.spec.js b/website/client/tests/unit/store/getters/tasks/getTasks.spec.js
index 058138ddfd..c0cfa6969b 100644
--- a/website/client/tests/unit/store/getters/tasks/getTasks.spec.js
+++ b/website/client/tests/unit/store/getters/tasks/getTasks.spec.js
@@ -1,7 +1,8 @@
import generateStore from '@/store';
describe('Store Getters for Tasks', () => {
- let store, habits, dailys, todos, rewards;
+ let store; let habits; let dailys; let todos; let
+ rewards;
beforeEach(() => {
store = generateStore();
@@ -80,7 +81,7 @@ describe('Store Getters for Tasks', () => {
});
it('should return weak habits', () => {
- let returnedTasks = store.getters['tasks:getFilteredTaskList']({
+ const returnedTasks = store.getters['tasks:getFilteredTaskList']({
type: 'habit',
filterType: 'yellowred',
});
@@ -89,7 +90,7 @@ describe('Store Getters for Tasks', () => {
});
it('should return strong habits', () => {
- let returnedTasks = store.getters['tasks:getFilteredTaskList']({
+ const returnedTasks = store.getters['tasks:getFilteredTaskList']({
type: 'habit',
filterType: 'greenblue',
});
@@ -98,7 +99,7 @@ describe('Store Getters for Tasks', () => {
});
it('should return scheduled todos', () => {
- let returnedTasks = store.getters['tasks:getFilteredTaskList']({
+ const returnedTasks = store.getters['tasks:getFilteredTaskList']({
type: 'todo',
filterType: 'scheduled',
});
@@ -107,7 +108,7 @@ describe('Store Getters for Tasks', () => {
});
it('should return completed todos', () => {
- let returnedTasks = store.getters['tasks:getFilteredTaskList']({
+ const returnedTasks = store.getters['tasks:getFilteredTaskList']({
type: 'todo',
filterType: 'complete2',
});
diff --git a/website/client/tests/unit/store/getters/user/user.spec.js b/website/client/tests/unit/store/getters/user/user.spec.js
index d241dda06e..1bd84e20d4 100644
--- a/website/client/tests/unit/store/getters/user/user.spec.js
+++ b/website/client/tests/unit/store/getters/user/user.spec.js
@@ -1,4 +1,6 @@
-import { data, gems, buffs, preferences, tasksOrder } from '@/store/getters/user';
+import {
+ data, gems, buffs, preferences, tasksOrder,
+} from '@/store/getters/user';
context('user getters', () => {
describe('data', () => {
@@ -73,4 +75,4 @@ context('user getters', () => {
expect(tasksOrder()).to.not.equal('undefined');
});
});
-});
\ No newline at end of file
+});
diff --git a/website/client/vue.config.js b/website/client/vue.config.js
index b941ef21ab..e4f28e2a0f 100644
--- a/website/client/vue.config.js
+++ b/website/client/vue.config.js
@@ -1,11 +1,11 @@
const path = require('path');
const webpack = require('webpack');
const nconf = require('nconf');
-const setupNconf = require('../../website/server/libs/setupNconf');
const { DuplicatesPlugin } = require('inspectpack/plugin');
+const setupNconf = require('../../website/server/libs/setupNconf');
const pkg = require('./package.json');
-let configFile = path.join(path.resolve(__dirname, '../../config.json'));
+const configFile = path.join(path.resolve(__dirname, '../../config.json'));
// TODO abstract from server
setupNconf(configFile);
@@ -40,14 +40,14 @@ module.exports = {
configureWebpack: {
plugins: [
new DuplicatesPlugin({
- verbose: true
+ verbose: true,
}),
new webpack.EnvironmentPlugin(envObject),
new webpack.ContextReplacementPlugin(/moment[\\/]locale$/, /^\.\/(NOT_EXISTING)$/),
],
},
chainWebpack: config => {
- // Fix issue with duplicated deps in monorepos
+ // Fix issue with duplicated deps in monorepos
// https://getpocket.com/redirect?url=https%3A%2F%2Fgithub.com%2Fwebpack%2Fwebpack%2Fissues%2F8886
// Manually resolve each dependency
Object.keys(pkg.dependencies).forEach(dep => {
@@ -55,8 +55,8 @@ module.exports = {
.set(dep, path.resolve(__dirname, `./node_modules/${dep}`));
});
- const pugRule = config.module.rule('pug')
- const svgRule = config.module.rule('svg')
+ const pugRule = config.module.rule('pug');
+ const svgRule = config.module.rule('svg');
// clear all existing loaders.
// if you don't do this, the loader below will be appended to
@@ -69,10 +69,10 @@ module.exports = {
.test(/\.pug$/)
// this applies to in Vue components
.oneOf('vue-loader')
- .resourceQuery(/^\?vue/)
- .use('pug-plain')
- .loader('pug-plain-loader')
- .end()
+ .resourceQuery(/^\?vue/)
+ .use('pug-plain')
+ .loader('pug-plain-loader')
+ .end()
.end();
@@ -83,40 +83,40 @@ module.exports = {
svgRule
.test(/\.svg$/)
.oneOf('normal')
- .exclude
- .add(path.resolve(__dirname, 'src/assets/svg/for-css'))
- .end()
- .use('svg-ingline-loader')
- .loader('svg-inline-loader')
- .end()
- .use('svgo-loader')
- .loader('svgo-loader')
- .options({
- plugins: [
- {removeViewBox: false},
- {convertPathData: {noSpaceAfterFlags: false}},
- ],
- })
- .end()
- .end()
+ .exclude
+ .add(path.resolve(__dirname, 'src/assets/svg/for-css'))
+ .end()
+ .use('svg-ingline-loader')
+ .loader('svg-inline-loader')
+ .end()
+ .use('svgo-loader')
+ .loader('svgo-loader')
+ .options({
+ plugins: [
+ { removeViewBox: false },
+ { convertPathData: { noSpaceAfterFlags: false } },
+ ],
+ })
+ .end()
+ .end()
.oneOf('in-css')
- .include
- .add(path.resolve(__dirname, 'src/assets/svg/for-css'))
- .end()
- .use('svg-in-css')
- .loader('svg-url-loader')
- .options({
- limit: 10000,
- })
- .end()
- .use('svgo-loader')
- .loader('svgo-loader')
- .options({
- plugins: [
- {removeViewBox: false},
- {convertPathData: {noSpaceAfterFlags: false}},
- ],
- });
+ .include
+ .add(path.resolve(__dirname, 'src/assets/svg/for-css'))
+ .end()
+ .use('svg-in-css')
+ .loader('svg-url-loader')
+ .options({
+ limit: 10000,
+ })
+ .end()
+ .use('svgo-loader')
+ .loader('svgo-loader')
+ .options({
+ plugins: [
+ { removeViewBox: false },
+ { convertPathData: { noSpaceAfterFlags: false } },
+ ],
+ });
},
devServer: {
@@ -150,6 +150,6 @@ module.exports = {
target: DEV_BASE_URL,
changeOrigin: true,
},
- }
- }
+ },
+ },
};
diff --git a/website/common/script/content/appearance/size.js b/website/common/script/content/appearance/size.js
index b6c53bfa2b..a5a1922478 100644
--- a/website/common/script/content/appearance/size.js
+++ b/website/common/script/content/appearance/size.js
@@ -1,4 +1,4 @@
-import prefill from './prefill.js';
+import prefill from './prefill';
export default prefill({
slim: {},
diff --git a/website/common/script/content/gear/gear-helper.js b/website/common/script/content/gear/gear-helper.js
index 8acfad9297..408856ff8b 100644
--- a/website/common/script/content/gear/gear-helper.js
+++ b/website/common/script/content/gear/gear-helper.js
@@ -1,5 +1,5 @@
import isBoolean from 'lodash/isBoolean';
-export function ownsItem (item) {
+export function ownsItem (item) { // eslint-disable-line import/prefer-default-export
return user => item && isBoolean(user.items.gear.owned[item]);
}
diff --git a/website/common/script/content/gear/sets/healer.js b/website/common/script/content/gear/sets/healer.js
index 04af4c2855..49cdbcf876 100644
--- a/website/common/script/content/gear/sets/healer.js
+++ b/website/common/script/content/gear/sets/healer.js
@@ -103,7 +103,6 @@ const shield = {
};
const weapon = {
-
0: {
text: t('weaponHealer0Text'),
notes: t('weaponHealer0Notes'),
diff --git a/website/common/script/content/gear/weapon.js b/website/common/script/content/gear/weapon.js
index aa5322d588..9f3e2f0bdf 100644
--- a/website/common/script/content/gear/weapon.js
+++ b/website/common/script/content/gear/weapon.js
@@ -46,9 +46,10 @@ const rtlLanguages = [
'ur', /* 'اردو', Urdu */
'yi', /* 'ייִדיש', Yiddish */
];
-for (const key in weapon) {
+
+for (const key of Object.keys(weapon)) {
const set = weapon[key];
- for (const weaponKey in set) {
+ for (const weaponKey of Object.keys(set)) {
const item = set[weaponKey];
const oldnotes = item.notes;
item.notes = lang => {
diff --git a/website/common/script/content/index.js b/website/common/script/content/index.js
index b020eb10d0..6430467fa8 100644
--- a/website/common/script/content/index.js
+++ b/website/common/script/content/index.js
@@ -26,7 +26,7 @@ import {
import appearances from './appearance';
import { backgroundsTree, backgroundsFlat } from './appearance/backgrounds';
-import spells from './spells';
+import spells from './spells'; // eslint-disable-line import/no-cycle
import subscriptionBlocks from './subscriptionBlocks';
import faq from './faq';
import timeTravelers from './time-travelers';
diff --git a/website/common/script/content/loginIncentives.js b/website/common/script/content/loginIncentives.js
index e740a1e428..c63b8b4fdd 100644
--- a/website/common/script/content/loginIncentives.js
+++ b/website/common/script/content/loginIncentives.js
@@ -299,14 +299,24 @@ export default function getLoginIncentives (api) {
},
120: {
rewardKey: ['Pet_HatchingPotion_Base', 'Pet_HatchingPotion_Red', 'Pet_HatchingPotion_Golden'],
- reward: [api.hatchingPotions.Base, api.hatchingPotions.CottonCandyBlue, api.hatchingPotions.CottonCandyPink, api.hatchingPotions.Desert, api.hatchingPotions.Golden, api.hatchingPotions.Red, api.hatchingPotions.Shade, api.hatchingPotions.Skeleton, api.hatchingPotions.White, api.hatchingPotions.Zombie],
+ reward: [
+ api.hatchingPotions.Base, api.hatchingPotions.CottonCandyBlue,
+ api.hatchingPotions.CottonCandyPink, api.hatchingPotions.Desert,
+ api.hatchingPotions.Golden, api.hatchingPotions.Red,
+ api.hatchingPotions.Shade, api.hatchingPotions.Skeleton,
+ api.hatchingPotions.White, api.hatchingPotions.Zombie,
+ ],
rewardName: 'oneOfAllHatchingPotions',
assignReward: function assignReward (user) {
if (!user.items.hatchingPotions.Base) user.items.hatchingPotions.Base = 0;
user.items.hatchingPotions.Base += 1;
- if (!user.items.hatchingPotions.CottonCandyBlue) user.items.hatchingPotions.CottonCandyBlue = 0;
+ if (!user.items.hatchingPotions.CottonCandyBlue) {
+ user.items.hatchingPotions.CottonCandyBlue = 0;
+ }
user.items.hatchingPotions.CottonCandyBlue += 1;
- if (!user.items.hatchingPotions.CottonCandyPink) user.items.hatchingPotions.CottonCandyPink = 0;
+ if (!user.items.hatchingPotions.CottonCandyPink) {
+ user.items.hatchingPotions.CottonCandyPink = 0;
+ }
user.items.hatchingPotions.CottonCandyPink += 1;
if (!user.items.hatchingPotions.Desert) user.items.hatchingPotions.Desert = 0;
user.items.hatchingPotions.Desert += 1;
@@ -336,7 +346,11 @@ export default function getLoginIncentives (api) {
},
130: {
rewardKey: ['Pet_Food_Meat', 'Pet_Food_Potatoe', 'Pet_Food_Milk'],
- reward: [api.food.Meat, api.food.CottonCandyBlue, api.food.CottonCandyPink, api.food.Potatoe, api.food.Honey, api.food.Strawberry, api.food.Chocolate, api.food.Fish, api.food.Milk, api.food.RottenMeat],
+ reward: [
+ api.food.Meat, api.food.CottonCandyBlue, api.food.CottonCandyPink, api.food.Potatoe,
+ api.food.Honey, api.food.Strawberry, api.food.Chocolate, api.food.Fish, api.food.Milk,
+ api.food.RottenMeat,
+ ],
rewardName: 'threeOfEachFood',
assignReward: function assignReward (user) {
if (!user.items.food.Meat) user.items.food.Meat = 0;
diff --git a/website/common/script/content/quests.js b/website/common/script/content/quests.js
index 504e1440ac..748223cd16 100644
--- a/website/common/script/content/quests.js
+++ b/website/common/script/content/quests.js
@@ -3520,7 +3520,7 @@ each(quests, (v, key) => {
def: 1,
});
if (b.rage) {
- return defaults(b.rage, {
+ defaults(b.rage, {
title: t('bossRageTitle'),
description: t('bossRageDescription'),
});
diff --git a/website/common/script/content/spells.js b/website/common/script/content/spells.js
index c936cdf517..02196d4f78 100644
--- a/website/common/script/content/spells.js
+++ b/website/common/script/content/spells.js
@@ -1,8 +1,8 @@
import each from 'lodash/each';
import t from './translation';
import { NotAuthorized } from '../libs/errors';
-import statsComputed from '../libs/statsComputed';
-import crit from '../fns/crit';
+import statsComputed from '../libs/statsComputed'; // eslint-disable-line import/no-cycle
+import crit from '../fns/crit'; // eslint-disable-line import/no-cycle
import updateStats from '../fns/updateStats';
/*
@@ -207,7 +207,9 @@ spells.rogue = {
notes: t('spellRogueStealthNotes'),
cast (user) {
if (!user.stats.buffs.stealth) user.stats.buffs.stealth = 0;
- user.stats.buffs.stealth += Math.ceil(diminishingReturns(statsComputed(user).per, user.tasksOrder.dailys.length * 0.64, 55));
+ user.stats.buffs.stealth += Math.ceil(diminishingReturns(
+ statsComputed(user).per, user.tasksOrder.dailys.length * 0.64, 55,
+ ));
},
},
};
diff --git a/website/common/script/cron.js b/website/common/script/cron.js
index 3712d22e3a..9bcc5d07a0 100644
--- a/website/common/script/cron.js
+++ b/website/common/script/cron.js
@@ -128,7 +128,7 @@ export function shouldDo (day, dailyTask, options = {}) {
const daysOfTheWeek = [];
if (dailyTask.repeat) {
for (const [repeatDay, active] of Object.entries(dailyTask.repeat)) {
- if (!Number.isFinite(DAY_MAPPING_STRING_TO_NUMBER[repeatDay])) continue; // eslint-disable-line no-continue
+ if (!Number.isFinite(DAY_MAPPING_STRING_TO_NUMBER[repeatDay])) continue; // eslint-disable-line no-continue, max-len
if (active) daysOfTheWeek.push(parseInt(DAY_MAPPING_STRING_TO_NUMBER[repeatDay], 10));
}
}
diff --git a/website/common/script/fns/crit.js b/website/common/script/fns/crit.js
index 230b0c9b73..8281a615d1 100644
--- a/website/common/script/fns/crit.js
+++ b/website/common/script/fns/crit.js
@@ -1,10 +1,10 @@
import predictableRandom from './predictableRandom';
-import statsComputed from '../libs/statsComputed';
+import statsComputed from '../libs/statsComputed'; // eslint-disable-line import/no-cycle
function crit (user, stat = 'str', chance = 0.03) {
const s = statsComputed(user)[stat];
if (predictableRandom(user) <= chance * (1 + s / 100)) {
- return 1.5 + 4 * s / (s + 200);
+ return 1.5 + (4 * s) / (s + 200);
}
return 1;
}
diff --git a/website/common/script/fns/randomDrop.js b/website/common/script/fns/randomDrop.js
index 07d78cfd19..a3f8101424 100644
--- a/website/common/script/fns/randomDrop.js
+++ b/website/common/script/fns/randomDrop.js
@@ -62,9 +62,11 @@ export default function randomDrop (user, options, req = {}, analytics) {
dropMultiplier = 1;
}
+ const maxDropCount = dropMultiplier * (5 + Math.floor(statsComputed(user).per / 25) + (user.contributor.level || 0)); // eslint-disable-line max-len
+
if (
daysSince(user.items.lastDrop.date, user.preferences) === 0
- && user.items.lastDrop.count >= dropMultiplier * (5 + Math.floor(statsComputed(user).per / 25) + (user.contributor.level || 0))
+ && user.items.lastDrop.count >= maxDropCount
) {
return;
}
diff --git a/website/common/script/index.js b/website/common/script/index.js
index eb02863df8..0a824786be 100644
--- a/website/common/script/index.js
+++ b/website/common/script/index.js
@@ -1,5 +1,6 @@
// When using a common module from the website or the server NEVER import the module directly
-// but access it through `api` (the main common) module, otherwise you would require the non transpiled version of the file in production.
+// but access it through `api` (the main common) module,
+// otherwise you would require the non transpiled version of the file in production.
import content from './content/index';
import * as errors from './libs/errors';
diff --git a/website/common/script/libs/inAppRewards.js b/website/common/script/libs/inAppRewards.js
index 034fbb43e9..a0ffaf91da 100644
--- a/website/common/script/libs/inAppRewards.js
+++ b/website/common/script/libs/inAppRewards.js
@@ -38,7 +38,8 @@ export default function getPinnedItems (user) {
const officialPinnedItems = getOfficialPinnedItems(user);
const officialPinnedItemsNotUnpinned = officialPinnedItems.filter(officialPin => {
- const isUnpinned = user.unpinnedItems.findIndex(unpinned => unpinned.path === officialPin.path) > -1;
+ const isUnpinned = user.unpinnedItems
+ .findIndex(unpinned => unpinned.path === officialPin.path) > -1;
return !isUnpinned;
});
diff --git a/website/common/script/libs/preenTodos.js b/website/common/script/libs/preenTodos.js
index 9d3c44ab96..b1e3c6419c 100644
--- a/website/common/script/libs/preenTodos.js
+++ b/website/common/script/libs/preenTodos.js
@@ -4,7 +4,7 @@ import filter from 'lodash/filter';
// TODO used only in v2
export default function preenTodos (tasks) {
- return filter(tasks, t => !t.completed || t.challenge && t.challenge.id || moment(t.dateCompleted).isAfter(moment().subtract({
+ return filter(tasks, t => !t.completed || t.challenge && t.challenge.id || moment(t.dateCompleted).isAfter(moment().subtract({ // eslint-disable-line
days: 3,
})));
}
diff --git a/website/common/script/libs/shops.js b/website/common/script/libs/shops.js
index 33e32805d0..9fd1a7e27c 100644
--- a/website/common/script/libs/shops.js
+++ b/website/common/script/libs/shops.js
@@ -151,7 +151,11 @@ shops.getMarketGearCategories = function getMarketGear (user, language) {
class: classType,
},
};
- if (gearItem.specialClass === classType && user.items.gear.owned[gearItem.key] !== false) return gearItem.canOwn(classShift);
+ if (
+ gearItem.specialClass === classType
+ && user.items.gear.owned[gearItem.key] !== false
+ ) return gearItem.canOwn(classShift);
+ return false;
});
category.items = map(result, e => getItemInfo(user, 'marketGear', e, officialPinnedItems));
@@ -322,58 +326,53 @@ shops.getTimeTravelersCategories = function getTimeTravelersCategories (user, la
}
categories.push(questCategory);
- for (const type in stable) {
- if (stable.hasOwnProperty(type)) {
- const category = {
- identifier: type,
- text: i18n.t(type, language),
- items: [],
- };
+ for (const type of Object.keys(stable)) {
+ const category = {
+ identifier: type,
+ text: i18n.t(type, language),
+ items: [],
+ };
- for (const key in content.timeTravelStable[type]) {
- if (content.timeTravelStable[type].hasOwnProperty(key)) {
- if (!user.items[type][key]) {
- const item = getItemInfo(user, 'timeTravelersStable', {
- key,
- type,
- }, officialPinnedItems, language);
- category.items.push(item);
- }
- }
- }
- if (category.items.length > 0) {
- categories.push(category);
+ for (const key of Object.keys(content.timeTravelStable[type])) {
+ if (!user.items[type][key]) {
+ const item = getItemInfo(user, 'timeTravelersStable', {
+ key,
+ type,
+ }, officialPinnedItems, language);
+ category.items.push(item);
}
}
+
+ if (category.items.length > 0) {
+ categories.push(category);
+ }
}
const sets = content.timeTravelerStore(user);
- for (const setKey in sets) {
- if (sets.hasOwnProperty(setKey)) {
- const set = sets[setKey];
- const category = {
- identifier: set.key,
- text: set.text(language),
- path: `mystery.${set.key}`,
- pinType: 'mystery_set',
- purchaseAll: true,
- };
+ for (const setKey of Object.keys(sets)) {
+ const set = sets[setKey];
+ const category = {
+ identifier: set.key,
+ text: set.text(language),
+ path: `mystery.${set.key}`,
+ pinType: 'mystery_set',
+ purchaseAll: true,
+ };
- category.items = map(set.items, item => ({
- key: item.key,
- text: item.text(language),
- notes: item.notes(language),
- type: item.type,
- purchaseType: 'gear',
- value: 1,
- locked: false,
- currency: 'hourglasses',
- class: `shop_${item.key}`,
- pinKey: `timeTravelers!gear.flat.${item.key}`,
- }));
- if (category.items.length > 0) {
- categories.push(category);
- }
+ category.items = map(set.items, item => ({
+ key: item.key,
+ text: item.text(language),
+ notes: item.notes(language),
+ type: item.type,
+ purchaseType: 'gear',
+ value: 1,
+ locked: false,
+ currency: 'hourglasses',
+ class: `shop_${item.key}`,
+ pinKey: `timeTravelers!gear.flat.${item.key}`,
+ }));
+ if (category.items.length > 0) {
+ categories.push(category);
}
}
@@ -385,7 +384,10 @@ shops.getTimeTravelersCategories = function getTimeTravelersCategories (user, la
const flatGearArray = toArray(content.gear.flat);
-shops.getSeasonalGearBySet = function getSeasonalGearBySet (user, set, officialPinnedItems, language, ignoreAlreadyOwned = false) {
+shops.getSeasonalGearBySet = function getSeasonalGearBySet (
+ user, set, officialPinnedItems,
+ language, ignoreAlreadyOwned = false,
+) {
return flatGearArray.filter(gear => {
if (!ignoreAlreadyOwned && user.items.gear.owned[gear.key] !== undefined) return false;
@@ -413,7 +415,13 @@ shops.getSeasonalShop = function getSeasonalShop (user, language) {
categories: this.getSeasonalShopCategories(user, language),
featured: {
text: i18n.t(seasonalShopConfig.featuredSet),
- items: shops.getSeasonalGearBySet(user, seasonalShopConfig.featuredSet, officialPinnedItems, language, true),
+ items: shops.getSeasonalGearBySet(
+ user,
+ seasonalShopConfig.featuredSet,
+ officialPinnedItems,
+ language,
+ true,
+ ),
},
};
@@ -437,7 +445,10 @@ shops.getSeasonalShopCategories = function getSeasonalShopCategories (user, lang
const categories = [];
- const spells = pickBy(content.spells.special, (spell, key) => AVAILABLE_SPELLS.indexOf(key) !== -1);
+ const spells = pickBy(
+ content.spells.special,
+ (spell, key) => AVAILABLE_SPELLS.indexOf(key) !== -1,
+ );
if (keys(spells).length > 0) {
const category = {
@@ -445,7 +456,10 @@ shops.getSeasonalShopCategories = function getSeasonalShopCategories (user, lang
text: i18n.t('seasonalItems', language),
};
- category.items = map(spells, spell => getItemInfo(user, 'seasonalSpell', spell, officialPinnedItems, language));
+ category.items = map(
+ spells,
+ spell => getItemInfo(user, 'seasonalSpell', spell, officialPinnedItems, language),
+ );
categories.push(category);
}
diff --git a/website/common/script/libs/statsComputed.js b/website/common/script/libs/statsComputed.js
index 34b2066d24..150200f4da 100644
--- a/website/common/script/libs/statsComputed.js
+++ b/website/common/script/libs/statsComputed.js
@@ -1,7 +1,7 @@
import each from 'lodash/each';
import get from 'lodash/get';
import values from 'lodash/values';
-import content from '../content/index';
+import content from '../content/index'; // eslint-disable-line import/no-cycle
import * as statHelpers from '../statHelpers';
function equipmentStatBonusComputed (stat, user) {
diff --git a/website/common/script/ops/buy/abstractBuyOperation.js b/website/common/script/ops/buy/abstractBuyOperation.js
index 50a757dd0d..aaaf89ee38 100644
--- a/website/common/script/ops/buy/abstractBuyOperation.js
+++ b/website/common/script/ops/buy/abstractBuyOperation.js
@@ -30,7 +30,7 @@ export class AbstractBuyOperation {
* @param item
* @returns {number}
*/
- getItemValue (item) {
+ getItemValue (item) { // eslint-disable-line class-methods-use-this
return item.value;
}
@@ -39,7 +39,7 @@ export class AbstractBuyOperation {
* @param item
* @returns {String}
*/
- getItemKey (item) {
+ getItemKey (item) { // eslint-disable-line class-methods-use-this
return item.key;
}
@@ -48,7 +48,7 @@ export class AbstractBuyOperation {
* @param item
* @returns {String}
*/
- getItemType (item) {
+ getItemType (item) { // eslint-disable-line class-methods-use-this
if (!item.type) throw new NotImplementedError('item doesn\'t have a type property');
return item.type;
@@ -69,22 +69,22 @@ export class AbstractBuyOperation {
* If the Operation allows purchasing items by quantity
* @returns Boolean
*/
- multiplePurchaseAllowed () {
+ multiplePurchaseAllowed () { // eslint-disable-line class-methods-use-this
throw new NotImplementedError('multiplePurchaseAllowed');
}
/**
* Method is called to save the params as class-fields in order to access them
*/
- extractAndValidateParams () {
+ extractAndValidateParams () { // eslint-disable-line class-methods-use-this
throw new NotImplementedError('extractAndValidateParams');
}
- executeChanges () {
+ executeChanges () { // eslint-disable-line class-methods-use-this
throw new NotImplementedError('executeChanges');
}
- analyticsData () {
+ analyticsData () { // eslint-disable-line class-methods-use-this
throw new NotImplementedError('sendToAnalytics');
}
@@ -104,7 +104,7 @@ export class AbstractBuyOperation {
return resultObj;
}
- analyticsLabel () {
+ analyticsLabel () { // eslint-disable-line class-methods-use-this
return 'acquire item';
}
@@ -126,10 +126,6 @@ export class AbstractBuyOperation {
}
export class AbstractGoldItemOperation extends AbstractBuyOperation {
- constructor (user, req, analytics) {
- super(user, req, analytics);
- }
-
canUserPurchase (user, item) {
this.item = item;
const itemValue = this.getItemValue(item);
@@ -162,10 +158,6 @@ export class AbstractGoldItemOperation extends AbstractBuyOperation {
}
export class AbstractGemItemOperation extends AbstractBuyOperation {
- constructor (user, req, analytics) {
- super(user, req, analytics);
- }
-
canUserPurchase (user, item) {
this.item = item;
const itemValue = this.getItemValue(item);
@@ -196,10 +188,6 @@ export class AbstractGemItemOperation extends AbstractBuyOperation {
}
export class AbstractHourglassItemOperation extends AbstractBuyOperation {
- constructor (user, req, analytics) {
- super(user, req, analytics);
- }
-
canUserPurchase (user, item) {
this.item = item;
@@ -208,8 +196,8 @@ export class AbstractHourglassItemOperation extends AbstractBuyOperation {
}
}
- subtractCurrency (user) {
- user.purchased.plan.consecutive.trinkets--;
+ subtractCurrency (user) { // eslint-disable-line class-methods-use-this
+ user.purchased.plan.consecutive.trinkets -= 1;
}
analyticsData () {
diff --git a/website/common/script/ops/buy/buyArmoire.js b/website/common/script/ops/buy/buyArmoire.js
index 8f7dd55efd..97d5213aca 100644
--- a/website/common/script/ops/buy/buyArmoire.js
+++ b/website/common/script/ops/buy/buyArmoire.js
@@ -18,11 +18,7 @@ const YIELD_EQUIPMENT_THRESHOLD = 0.6;
const YIELD_FOOD_THRESHOLD = 0.8;
export class BuyArmoireOperation extends AbstractGoldItemOperation { // eslint-disable-line import/prefer-default-export, max-len
- constructor (user, req, analytics) {
- super(user, req, analytics);
- }
-
- multiplePurchaseAllowed () {
+ multiplePurchaseAllowed () { // eslint-disable-line class-methods-use-this
return false;
}
diff --git a/website/common/script/ops/buy/buyGem.js b/website/common/script/ops/buy/buyGem.js
index dbdd907450..7295a77278 100644
--- a/website/common/script/ops/buy/buyGem.js
+++ b/website/common/script/ops/buy/buyGem.js
@@ -9,23 +9,19 @@ import { AbstractGoldItemOperation } from './abstractBuyOperation';
import planGemLimits from '../../libs/planGemLimits';
export class BuyGemOperation extends AbstractGoldItemOperation { // eslint-disable-line import/prefer-default-export, max-len
- constructor (user, req, analytics) {
- super(user, req, analytics);
- }
-
- multiplePurchaseAllowed () {
+ multiplePurchaseAllowed () { // eslint-disable-line class-methods-use-this
return true;
}
- getItemValue () {
+ getItemValue () { // eslint-disable-line class-methods-use-this
return planGemLimits.convRate;
}
- getItemKey () {
+ getItemKey () { // eslint-disable-line class-methods-use-this
return 'gem';
}
- getItemType () {
+ getItemType () { // eslint-disable-line class-methods-use-this
return 'gems';
}
@@ -74,7 +70,7 @@ export class BuyGemOperation extends AbstractGoldItemOperation { // eslint-disab
];
}
- analyticsLabel () {
+ analyticsLabel () { // eslint-disable-line class-methods-use-this
return 'purchase gems';
}
}
diff --git a/website/common/script/ops/buy/buyHealthPotion.js b/website/common/script/ops/buy/buyHealthPotion.js
index 61e6c209af..1f21ec459e 100644
--- a/website/common/script/ops/buy/buyHealthPotion.js
+++ b/website/common/script/ops/buy/buyHealthPotion.js
@@ -6,11 +6,7 @@ import {
import { AbstractGoldItemOperation } from './abstractBuyOperation';
export class BuyHealthPotionOperation extends AbstractGoldItemOperation { // eslint-disable-line import/prefer-default-export, max-len
- constructor (user, req, analytics) {
- super(user, req, analytics);
- }
-
- multiplePurchaseAllowed () {
+ multiplePurchaseAllowed () { // eslint-disable-line class-methods-use-this
return true;
}
diff --git a/website/common/script/ops/buy/buyMarketGear.js b/website/common/script/ops/buy/buyMarketGear.js
index 62f4ec220f..ae70bf4c6e 100644
--- a/website/common/script/ops/buy/buyMarketGear.js
+++ b/website/common/script/ops/buy/buyMarketGear.js
@@ -16,11 +16,7 @@ import { AbstractGoldItemOperation } from './abstractBuyOperation';
import errorMessage from '../../libs/errorMessage';
export class BuyMarketGearOperation extends AbstractGoldItemOperation { // eslint-disable-line import/prefer-default-export, max-len
- constructor (user, req, analytics) {
- super(user, req, analytics);
- }
-
- multiplePurchaseAllowed () {
+ multiplePurchaseAllowed () { // eslint-disable-line class-methods-use-this
return false;
}
@@ -55,7 +51,7 @@ export class BuyMarketGearOperation extends AbstractGoldItemOperation { // eslin
if (Number.isInteger(itemIndex) && content.classes.includes(item.klass)) {
const previousLevelGear = key.replace(/[0-9]/, itemIndex - 1);
const hasPreviousLevelGear = user.items.gear.owned[previousLevelGear];
- const checkIndexToType = itemIndex > (item.type === 'weapon' || item.type === 'shield' && item.klass === 'rogue' ? 0 : 1);
+ const checkIndexToType = itemIndex > (item.type === 'weapon' || (item.type === 'shield' && item.klass === 'rogue') ? 0 : 1);
if (checkIndexToType && !hasPreviousLevelGear) {
throw new NotAuthorized(this.i18n('previousGearNotOwned'));
diff --git a/website/common/script/ops/buy/buyMount.js b/website/common/script/ops/buy/buyMount.js
index 92d67cb97c..660b78b1dd 100644
--- a/website/common/script/ops/buy/buyMount.js
+++ b/website/common/script/ops/buy/buyMount.js
@@ -10,11 +10,7 @@ import {
import { AbstractHourglassItemOperation } from './abstractBuyOperation';
export class BuyHourglassMountOperation extends AbstractHourglassItemOperation { // eslint-disable-line import/prefer-default-export, max-len
- constructor (user, req, analytics) {
- super(user, req, analytics);
- }
-
- multiplePurchaseAllowed () {
+ multiplePurchaseAllowed () { // eslint-disable-line class-methods-use-this
return false;
}
diff --git a/website/common/script/ops/buy/buyQuestGem.js b/website/common/script/ops/buy/buyQuestGem.js
index f5417cc738..04f3252d11 100644
--- a/website/common/script/ops/buy/buyQuestGem.js
+++ b/website/common/script/ops/buy/buyQuestGem.js
@@ -10,11 +10,7 @@ import errorMessage from '../../libs/errorMessage';
import { AbstractGemItemOperation } from './abstractBuyOperation';
export class BuyQuestWithGemOperation extends AbstractGemItemOperation { // eslint-disable-line import/prefer-default-export, max-len
- constructor (user, req, analytics) {
- super(user, req, analytics);
- }
-
- multiplePurchaseAllowed () {
+ multiplePurchaseAllowed () { // eslint-disable-line class-methods-use-this
return true;
}
@@ -22,11 +18,11 @@ export class BuyQuestWithGemOperation extends AbstractGemItemOperation { // esli
return this.key;
}
- getItemValue (item) {
+ getItemValue (item) { // eslint-disable-line class-methods-use-this
return item.value / 4;
}
- getItemType () {
+ getItemType () { // eslint-disable-line class-methods-use-this
return 'quest';
}
diff --git a/website/common/script/ops/buy/buyQuestGold.js b/website/common/script/ops/buy/buyQuestGold.js
index ee1f63d07a..ead059829c 100644
--- a/website/common/script/ops/buy/buyQuestGold.js
+++ b/website/common/script/ops/buy/buyQuestGold.js
@@ -10,15 +10,11 @@ import { AbstractGoldItemOperation } from './abstractBuyOperation';
import errorMessage from '../../libs/errorMessage';
export class BuyQuestWithGoldOperation extends AbstractGoldItemOperation { // eslint-disable-line import/prefer-default-export, max-len
- constructor (user, req, analytics) {
- super(user, req, analytics);
- }
-
- multiplePurchaseAllowed () {
+ multiplePurchaseAllowed () { // eslint-disable-line class-methods-use-this
return true;
}
- userAbleToStartMasterClasser (user) {
+ userAbleToStartMasterClasser (user) { // eslint-disable-line class-methods-use-this
return user.achievements.quests.dilatoryDistress3
&& user.achievements.quests.mayhemMistiflying3
&& user.achievements.quests.stoikalmCalamity3
@@ -29,16 +25,17 @@ export class BuyQuestWithGoldOperation extends AbstractGoldItemOperation { // es
return this.key;
}
- getItemValue (item) {
+ getItemValue (item) { // eslint-disable-line class-methods-use-this
return item.goldValue;
}
- getItemType () {
+ getItemType () { // eslint-disable-line class-methods-use-this
return 'quest';
}
extractAndValidateParams (user, req) {
- const key = this.key = get(req, 'params.key');
+ this.key = get(req, 'params.key');
+ const { key } = this;
if (!key) throw new BadRequest(errorMessage('missingKeyParam'));
const item = content.quests[key];
diff --git a/website/common/script/ops/buy/buySpell.js b/website/common/script/ops/buy/buySpell.js
index 200b5d0320..dc583bd0d6 100644
--- a/website/common/script/ops/buy/buySpell.js
+++ b/website/common/script/ops/buy/buySpell.js
@@ -10,19 +10,15 @@ import { AbstractGoldItemOperation } from './abstractBuyOperation';
import errorMessage from '../../libs/errorMessage';
export class BuySpellOperation extends AbstractGoldItemOperation { // eslint-disable-line import/prefer-default-export, max-len
- constructor (user, req, analytics) {
- super(user, req, analytics);
- }
-
getItemKey () {
return this.key;
}
- getItemType () {
+ getItemType () { // eslint-disable-line class-methods-use-this
return 'spell';
}
- multiplePurchaseAllowed () {
+ multiplePurchaseAllowed () { // eslint-disable-line class-methods-use-this
return true;
}
diff --git a/website/common/script/ops/revive.js b/website/common/script/ops/revive.js
index 52d30a5c68..e8ce46010b 100644
--- a/website/common/script/ops/revive.js
+++ b/website/common/script/ops/revive.js
@@ -63,7 +63,8 @@ export default function revive (user, req = {}, analytics) {
const itemClassEqualsUserClass = itm.klass === userClass;
const itemClassSpecial = itm.klass === 'special';
- const itemNotSpecialOrUserClassIsSpecial = !itm.specialClass || itm.specialClass === userClass;
+ const itemNotSpecialOrUserClassIsSpecial = !itm.specialClass
+ || itm.specialClass === userClass;
const itemIsSpecial = itemNotSpecialOrUserClassIsSpecial && itemClassSpecial;
const itemIsArmoire = itm.klass === 'armoire';
diff --git a/website/common/script/ops/scoreTask.js b/website/common/script/ops/scoreTask.js
index c4843bb69b..bee17ba957 100644
--- a/website/common/script/ops/scoreTask.js
+++ b/website/common/script/ops/scoreTask.js
@@ -34,7 +34,11 @@ function _calculateDelta (task, direction, cron) {
if (task.checklist && task.checklist.length > 0) {
// If the Daily, only dock them a portion based on their checklist completion
if (direction === 'down' && task.type === 'daily' && cron) {
- nextDelta *= 1 - reduce(task.checklist, (m, i) => m + (i.completed ? 1 : 0), 0) / task.checklist.length;
+ nextDelta *= 1 - reduce(
+ task.checklist,
+ (m, i) => m + (i.completed ? 1 : 0),
+ 0,
+ ) / task.checklist.length;
}
// If To-Do, point-match the TD per checklist item completed
diff --git a/website/server/.eslintrc b/website/server/.eslintrc
deleted file mode 100644
index b62d7f2160..0000000000
--- a/website/server/.eslintrc
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "extends": [
- "habitrpg/lib/node",
- ]
-}
\ No newline at end of file
diff --git a/website/server/.eslintrc.js b/website/server/.eslintrc.js
new file mode 100644
index 0000000000..c3802bf4a7
--- /dev/null
+++ b/website/server/.eslintrc.js
@@ -0,0 +1,5 @@
+module.exports = {
+ extends: [
+ "habitrpg/lib/node",
+ ]
+}
\ No newline at end of file
diff --git a/website/server/index.js b/website/server/index.js
index d04fd9a3a9..8c6277473b 100644
--- a/website/server/index.js
+++ b/website/server/index.js
@@ -7,15 +7,17 @@ if (process.env.NODE_ENV !== 'production') {
require('@babel/register');
}
+const cluster = require('cluster');
+const nconf = require('nconf');
+
+const setupNconf = require('./libs/setupNconf').default;
+
// Initialize configuration BEFORE anything
setupNconf();
-const nconf = require('nconf');
// Initialize @google-cloud/trace-agent
require('./libs/gcpTraceAgent');
-const cluster = require('cluster');
-const setupNconf = require('./libs/setupNconf').default;
const logger = require('./libs/logger').default;
const IS_PROD = nconf.get('IS_PROD');
@@ -24,7 +26,8 @@ const CORES = Number(nconf.get('WEB_CONCURRENCY')) || 0;
// Setup the cluster module
if (CORES !== 0 && cluster.isMaster && (IS_DEV || IS_PROD)) {
- // Fork workers. If config.json has WEB_CONCURRENCY=x, use that - otherwise, use all cpus-1 (production)
+ // Fork workers. If config.json has WEB_CONCURRENCY=x,
+ // use that - otherwise, use all cpus-1 (production)
for (let i = 0; i < CORES; i += 1) {
cluster.fork();
}