mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-03 16:38:22 +03:00
Merge pull request #357 from kevinansfield/eslint
Switch from jshint/jscs to eslint
This commit is contained in:
commit
1d7723e858
29
ghost/admin/.eslintrc.js
Normal file
29
ghost/admin/.eslintrc.js
Normal file
@ -0,0 +1,29 @@
|
||||
module.exports = {
|
||||
root: true,
|
||||
parserOptions: {
|
||||
ecmaVersion: 6,
|
||||
sourceType: 'module'
|
||||
},
|
||||
extends: [
|
||||
'eslint:recommended',
|
||||
'plugin:ember-suave/recommended'
|
||||
],
|
||||
env: {
|
||||
browser: true
|
||||
},
|
||||
rules: {
|
||||
indent: ['error', 4],
|
||||
'space-before-function-paren': ['error', {anonymous: 'ignore', named: 'never'}],
|
||||
'object-curly-spacing': ['error', 'never'],
|
||||
'array-bracket-spacing': ['error', 'never'],
|
||||
'key-spacing': ['error', {mode: 'minimum'}],
|
||||
'keyword-spacing': ['error', {overrides: {
|
||||
'catch': {'after': true}
|
||||
}}],
|
||||
'ember-suave/require-access-in-comments': 'off'
|
||||
},
|
||||
globals: {
|
||||
moment: false,
|
||||
validator: false
|
||||
}
|
||||
};
|
@ -1,14 +0,0 @@
|
||||
{
|
||||
"preset": "ember-suave",
|
||||
"validateIndentation": 4,
|
||||
"disallowSpacesInFunction": null,
|
||||
"disallowSpacesInNamedFunctionExpression": {
|
||||
"beforeOpeningRoundBrace": true
|
||||
},
|
||||
"disallowSpacesInFunctionDeclaration": {
|
||||
"beforeOpeningRoundBrace": true
|
||||
},
|
||||
"disallowSpacesInsideObjectBrackets": "all",
|
||||
"requireCommentsToIncludeAccess": null,
|
||||
"requireSpacesInsideObjectBrackets": null
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
{
|
||||
"predef": [
|
||||
"server",
|
||||
"document",
|
||||
"window",
|
||||
"-Promise",
|
||||
"-Notification",
|
||||
"validator",
|
||||
"moment"
|
||||
],
|
||||
"browser": true,
|
||||
"boss": true,
|
||||
"curly": true,
|
||||
"debug": false,
|
||||
"devel": true,
|
||||
"eqeqeq": true,
|
||||
"evil": true,
|
||||
"forin": false,
|
||||
"immed": false,
|
||||
"laxbreak": false,
|
||||
"newcap": true,
|
||||
"noarg": true,
|
||||
"noempty": false,
|
||||
"nonew": false,
|
||||
"nomen": false,
|
||||
"onevar": false,
|
||||
"plusplus": false,
|
||||
"regexp": false,
|
||||
"undef": true,
|
||||
"sub": true,
|
||||
"strict": false,
|
||||
"white": false,
|
||||
"eqnull": true,
|
||||
"esversion": 6,
|
||||
"unused": true
|
||||
}
|
@ -9,11 +9,6 @@ env:
|
||||
global:
|
||||
- GITHUB_OAUTH_KEY=003a44d58f12089d0c0261338298af3813330949
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- node_js: "4"
|
||||
env: TEST_SUITE=lint
|
||||
|
||||
branches:
|
||||
except:
|
||||
- /^greenkeeper-.+$/
|
||||
@ -43,4 +38,4 @@ before_script:
|
||||
- export DISPLAY=:99; sh -e /etc/init.d/xvfb start; sleep 3;
|
||||
|
||||
script:
|
||||
- if [ "$TEST_SUITE" == "lint" ]; then grunt lint; else npm test; fi
|
||||
- if [ "$TEST_SUITE" == "lint" ]; then npm run lint; else npm test; fi
|
||||
|
@ -1,6 +1,5 @@
|
||||
/* global -moment */
|
||||
/* jshint node: true */
|
||||
/* jscs:disable */
|
||||
/* eslint-env node */
|
||||
/* eslint-disable no-var, one-var, object-shorthand, prefer-template */
|
||||
var _ = require('lodash'),
|
||||
fs = require('fs-extra'),
|
||||
path = require('path'),
|
||||
@ -35,53 +34,6 @@ module.exports = function(grunt) {
|
||||
}
|
||||
},
|
||||
|
||||
jshint: {
|
||||
options: {
|
||||
jshintrc: true,
|
||||
ignores: [
|
||||
'node_modules/**',
|
||||
'bower_components/**',
|
||||
'tmp/**',
|
||||
'dist/**',
|
||||
'vendor/**'
|
||||
]
|
||||
},
|
||||
|
||||
all: ['**/*.js']
|
||||
},
|
||||
|
||||
jscs: {
|
||||
app: {
|
||||
options: {
|
||||
config: '.jscsrc',
|
||||
excludeFiles: [
|
||||
'node_modules/**',
|
||||
'bower_components/**',
|
||||
'tests/**',
|
||||
'tmp/**',
|
||||
'dist/**',
|
||||
'vendor/**'
|
||||
]
|
||||
},
|
||||
|
||||
files: {
|
||||
src: ['**/*.js']
|
||||
}
|
||||
},
|
||||
|
||||
tests: {
|
||||
options: {
|
||||
config: 'tests/.jscsrc'
|
||||
},
|
||||
|
||||
files: {
|
||||
src: [
|
||||
'tests/**/*.js'
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// ### grunt-bg-shell
|
||||
// Used to run ember-cli watch in the background
|
||||
bgShell: {
|
||||
@ -110,11 +62,10 @@ module.exports = function(grunt) {
|
||||
ember: {
|
||||
command: function (mode) {
|
||||
switch (mode) {
|
||||
case 'prod':
|
||||
return 'npm run build -- --environment=production --silent';
|
||||
|
||||
case 'dev':
|
||||
return 'npm run build';
|
||||
case 'prod':
|
||||
return 'npm run build -- --environment=production --silent';
|
||||
case 'dev':
|
||||
return 'npm run build';
|
||||
}
|
||||
},
|
||||
options: {
|
||||
@ -146,10 +97,6 @@ module.exports = function(grunt) {
|
||||
['shell:npm-install', 'shell:bower-install']
|
||||
);
|
||||
|
||||
grunt.registerTask('lint', 'Run the code style checks and linter',
|
||||
['jshint', 'jscs', 'shell:csscomblint']
|
||||
);
|
||||
|
||||
// ### Build About Page *(Utility Task)*
|
||||
// Builds the github contributors partial template used on the about page,
|
||||
// and downloads the avatar for each of the users.
|
||||
@ -215,9 +162,9 @@ module.exports = function(grunt) {
|
||||
})
|
||||
).then(function (results) {
|
||||
var contributors = mergeContribs(results[1], results[2]),
|
||||
contributorTemplate = '<article>\n <a href="<%= githubUrl %>" title="<%= name %>">\n' +
|
||||
' <img src="{{gh-path "asset" "/img/contributors"}}/<%= name %>" alt="<%= name %>" />\n' +
|
||||
' </a>\n</article>',
|
||||
contributorTemplate = '<article>\n <a href="<%= githubUrl %>" title="<%= name %>">\n'
|
||||
+ ' <img src="{{gh-path "asset" "/img/contributors"}}/<%= name %>" alt="<%= name %>" />\n'
|
||||
+ ' </a>\n</article>',
|
||||
|
||||
downloadImagePromise = function (url, name) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
@ -119,9 +119,9 @@ export default BaseAdapter.extend({
|
||||
// Iterate through the model's relationships and build a list
|
||||
// of those that need to be pulled in via "include" from the API
|
||||
model.eachRelationship(function (name, meta) {
|
||||
if (meta.kind === 'hasMany' &&
|
||||
Object.prototype.hasOwnProperty.call(meta.options, 'embedded') &&
|
||||
meta.options.embedded === 'always') {
|
||||
if (meta.kind === 'hasMany'
|
||||
&& Object.prototype.hasOwnProperty.call(meta.options, 'embedded')
|
||||
&& meta.options.embedded === 'always') {
|
||||
ret.push(name);
|
||||
}
|
||||
});
|
||||
|
@ -1,4 +1,3 @@
|
||||
/* jscs:disable requireCamelCaseOrUpperCaseIdentifiers */
|
||||
import Oauth2Authenticator from './oauth2';
|
||||
import RSVP from 'rsvp';
|
||||
import run from 'ember-runloop';
|
||||
@ -17,6 +16,7 @@ export default Oauth2Authenticator.extend({
|
||||
let serverTokenEndpoint = this.get('serverTokenEndpoint');
|
||||
let scopesString = wrap(scope).join(' ');
|
||||
|
||||
// eslint-disable-next-line camelcase
|
||||
data.grant_type = 'authorization_code';
|
||||
|
||||
if (!isEmpty(scopesString)) {
|
||||
|
@ -31,10 +31,10 @@ export default Authenticator.extend({
|
||||
}),
|
||||
|
||||
makeRequest(url, data) {
|
||||
/* jscs:disable requireCamelCaseOrUpperCaseIdentifiers */
|
||||
/* eslint-disable camelcase */
|
||||
data.client_id = this.get('config.clientId');
|
||||
data.client_secret = this.get('config.clientSecret');
|
||||
/* jscs:enable requireCamelCaseOrUpperCaseIdentifiers */
|
||||
/* eslint-enable camelcase */
|
||||
|
||||
let options = {
|
||||
data,
|
||||
@ -71,10 +71,10 @@ export default Authenticator.extend({
|
||||
}
|
||||
this.makeRequest(serverTokenEndpoint, data, headers).then((response) => {
|
||||
run(() => {
|
||||
/* jscs:disable requireCamelCaseOrUpperCaseIdentifiers */
|
||||
/* eslint-disable camelcase */
|
||||
let expiresAt = this._absolutizeExpirationTime(response.expires_in);
|
||||
this._scheduleAccessTokenRefresh(response.expires_in, expiresAt, response.refresh_token);
|
||||
/* jscs:enable requireCamelCaseOrUpperCaseIdentifiers */
|
||||
/* eslint-enable camelcase */
|
||||
|
||||
if (!isEmpty(expiresAt)) {
|
||||
response = assign(response, {'expires_at': expiresAt});
|
||||
|
@ -6,7 +6,7 @@ import {isBlank} from 'ember-utils';
|
||||
import run from 'ember-runloop';
|
||||
import {isEmberArray} from 'ember-array/utils';
|
||||
|
||||
import { invoke, invokeAction } from 'ember-invoke-action';
|
||||
import {invoke, invokeAction} from 'ember-invoke-action';
|
||||
import {
|
||||
isVersionMismatchError,
|
||||
isRequestEntityTooLargeError,
|
||||
@ -212,9 +212,8 @@ export default Component.extend({
|
||||
fileSelected(fileList) {
|
||||
// can't use array destructuring here as FileList is not a strict
|
||||
// array and fails in Safari
|
||||
// jscs:disable requireArrayDestructuring
|
||||
// eslint-disable-next-line ember-suave/prefer-destructuring
|
||||
let file = fileList[0];
|
||||
// jscs:enable requireArrayDestructuring
|
||||
let validationResult = this._validate(file);
|
||||
|
||||
this.set('file', file);
|
||||
|
@ -232,9 +232,8 @@ export default Component.extend({
|
||||
fileSelected(fileList) {
|
||||
// can't use array destructuring here as FileList is not a strict
|
||||
// array and fails in Safari
|
||||
// jscs:disable requireArrayDestructuring
|
||||
// eslint-disable-next-line ember-suave/prefer-destructuring
|
||||
let file = fileList[0];
|
||||
// jscs:enable requireArrayDestructuring
|
||||
let validationResult = this._validate(file);
|
||||
|
||||
this.set('file', file);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* global key */
|
||||
/* jscs:disable requireCamelCaseOrUpperCaseIdentifiers */
|
||||
/* eslint-disable camelcase */
|
||||
import Component from 'ember-component';
|
||||
import RSVP from 'rsvp';
|
||||
import computed from 'ember-computed';
|
||||
@ -16,8 +16,7 @@ export function computedGroup(category) {
|
||||
return this.get('content').filter((item) => {
|
||||
let search = new RegExp(this.get('currentSearch'), 'ig');
|
||||
|
||||
return (item.category === category) &&
|
||||
item.title.match(search);
|
||||
return (item.category === category) && item.title.match(search);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* jscs:disable requireCamelCaseOrUpperCaseIdentifiers */
|
||||
/* eslint-disable camelcase */
|
||||
import {A as emberA, isEmberArray} from 'ember-array/utils';
|
||||
import computed from 'ember-computed';
|
||||
import {isBlank} from 'ember-utils';
|
||||
|
@ -1,4 +1,3 @@
|
||||
/*jshint scripturl:true*/
|
||||
import $ from 'jquery';
|
||||
import Component from 'ember-component';
|
||||
import {htmlSafe} from 'ember-string';
|
||||
|
@ -1,4 +1,4 @@
|
||||
/*global device*/
|
||||
/* global device */
|
||||
import computed from 'ember-computed';
|
||||
import GhostInput from 'ghost-admin/components/gh-input';
|
||||
|
||||
|
@ -7,8 +7,8 @@ export default Controller.extend({
|
||||
session: injectService(),
|
||||
|
||||
showNavMenu: computed('currentPath', 'session.isAuthenticated', function () {
|
||||
return (this.get('currentPath') !== 'error404' || this.get('session.isAuthenticated')) &&
|
||||
!this.get('currentPath').match(/(signin|signup|setup|reset)/);
|
||||
return (this.get('currentPath') !== 'error404' || this.get('session.isAuthenticated'))
|
||||
&& !this.get('currentPath').match(/(signin|signup|setup|reset)/);
|
||||
}),
|
||||
|
||||
topNotificationCount: 0,
|
||||
|
@ -258,8 +258,8 @@ export default Controller.extend(SettingsMenuMixin, {
|
||||
|
||||
// Validate new Published date
|
||||
if (!newPublishedAt.isValid()) {
|
||||
errMessage = 'Published Date must be a valid date with format: ' +
|
||||
'DD MMM YY @ HH:mm (e.g. 6 Dec 14 @ 15:00)';
|
||||
errMessage = 'Published Date must be a valid date with format: '
|
||||
+ 'DD MMM YY @ HH:mm (e.g. 6 Dec 14 @ 15:00)';
|
||||
}
|
||||
|
||||
// Date is a valid date, so now make it UTC
|
||||
|
@ -166,16 +166,16 @@ export default Controller.extend(SettingsSaveMixin, {
|
||||
let username = [];
|
||||
|
||||
if (newUrl.match(/(?:facebook\.com\/)(\S+)/)) {
|
||||
[ , username ] = newUrl.match(/(?:facebook\.com\/)(\S+)/);
|
||||
[, username] = newUrl.match(/(?:facebook\.com\/)(\S+)/);
|
||||
} else {
|
||||
[ , username ] = newUrl.match(/(?:https\:\/\/|http\:\/\/)?(?:www\.)?(?:\w+\.\w+\/+)?(\S+)/mi);
|
||||
[, username] = newUrl.match(/(?:https\:\/\/|http\:\/\/)?(?:www\.)?(?:\w+\.\w+\/+)?(\S+)/mi);
|
||||
}
|
||||
|
||||
// check if we have a /page/username or without
|
||||
if (username.match(/^(?:\/)?(pages?\/\S+)/mi)) {
|
||||
// we got a page url, now save the username without the / in the beginning
|
||||
|
||||
[ , username ] = username.match(/^(?:\/)?(pages?\/\S+)/mi);
|
||||
[, username] = username.match(/^(?:\/)?(pages?\/\S+)/mi);
|
||||
} else if (username.match(/^(http|www)|(\/)/) || !username.match(/^([a-z\d\.]{5,50})$/mi)) {
|
||||
errMessage = !username.match(/^([a-z\d\.]{5,50})$/mi) ? 'Your Page name is not a valid Facebook Page name' : 'The URL must be in a format like https://www.facebook.com/yourPage';
|
||||
|
||||
@ -198,8 +198,8 @@ export default Controller.extend(SettingsSaveMixin, {
|
||||
});
|
||||
});
|
||||
} else {
|
||||
errMessage = 'The URL must be in a format like ' +
|
||||
'https://www.facebook.com/yourPage';
|
||||
errMessage = 'The URL must be in a format like '
|
||||
+ 'https://www.facebook.com/yourPage';
|
||||
this.get('model.errors').add('facebook', errMessage);
|
||||
this.get('model.hasValidated').pushObject('facebook');
|
||||
return;
|
||||
@ -233,7 +233,7 @@ export default Controller.extend(SettingsSaveMixin, {
|
||||
let username = [];
|
||||
|
||||
if (newUrl.match(/(?:twitter\.com\/)(\S+)/)) {
|
||||
[ , username] = newUrl.match(/(?:twitter\.com\/)(\S+)/);
|
||||
[, username] = newUrl.match(/(?:twitter\.com\/)(\S+)/);
|
||||
} else {
|
||||
[username] = newUrl.match(/([^/]+)\/?$/mi);
|
||||
}
|
||||
@ -261,8 +261,8 @@ export default Controller.extend(SettingsSaveMixin, {
|
||||
});
|
||||
});
|
||||
} else {
|
||||
errMessage = 'The URL must be in a format like ' +
|
||||
'https://twitter.com/yourUsername';
|
||||
errMessage = 'The URL must be in a format like '
|
||||
+ 'https://twitter.com/yourUsername';
|
||||
this.get('model.errors').add('twitter', errMessage);
|
||||
this.get('model.hasValidated').pushObject('twitter');
|
||||
return;
|
||||
|
@ -88,8 +88,8 @@ export default Controller.extend({
|
||||
validationResult.forEach((error) => {
|
||||
// Only one error type here so far, but one day the errors might be more detailed
|
||||
switch (error.error) {
|
||||
case 'email':
|
||||
errors.add(property, `${error.user} is not a valid email.`);
|
||||
case 'email':
|
||||
errors.add(property, `${error.user} is not a valid email.`);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -44,9 +44,9 @@ export default Controller.extend({
|
||||
}),
|
||||
|
||||
deleteUserActionIsVisible: computed('currentUser', 'canAssignRoles', 'user', function () {
|
||||
if ((this.get('canAssignRoles') && this.get('isNotOwnProfile') && !this.get('user.isOwner')) ||
|
||||
(this.get('currentUser.isEditor') && (this.get('isNotOwnProfile') ||
|
||||
this.get('user.isAuthor')))) {
|
||||
if ((this.get('canAssignRoles') && this.get('isNotOwnProfile') && !this.get('user.isOwner'))
|
||||
|| (this.get('currentUser.isEditor') && (this.get('isNotOwnProfile')
|
||||
|| this.get('user.isAuthor')))) {
|
||||
return true;
|
||||
}
|
||||
}),
|
||||
@ -235,16 +235,16 @@ export default Controller.extend({
|
||||
let username = [];
|
||||
|
||||
if (newUrl.match(/(?:facebook\.com\/)(\S+)/)) {
|
||||
[ , username ] = newUrl.match(/(?:facebook\.com\/)(\S+)/);
|
||||
[, username] = newUrl.match(/(?:facebook\.com\/)(\S+)/);
|
||||
} else {
|
||||
[ , username ] = newUrl.match(/(?:https\:\/\/|http\:\/\/)?(?:www\.)?(?:\w+\.\w+\/+)?(\S+)/mi);
|
||||
[, username] = newUrl.match(/(?:https\:\/\/|http\:\/\/)?(?:www\.)?(?:\w+\.\w+\/+)?(\S+)/mi);
|
||||
}
|
||||
|
||||
// check if we have a /page/username or without
|
||||
if (username.match(/^(?:\/)?(pages?\/\S+)/mi)) {
|
||||
// we got a page url, now save the username without the / in the beginning
|
||||
|
||||
[ , username ] = username.match(/^(?:\/)?(pages?\/\S+)/mi);
|
||||
[, username] = username.match(/^(?:\/)?(pages?\/\S+)/mi);
|
||||
} else if (username.match(/^(http|www)|(\/)/) || !username.match(/^([a-z\d\.]{5,50})$/mi)) {
|
||||
errMessage = !username.match(/^([a-z\d\.]{5,50})$/mi) ? 'Your Username is not a valid Facebook Username' : 'The URL must be in a format like https://www.facebook.com/yourUsername';
|
||||
|
||||
@ -268,8 +268,8 @@ export default Controller.extend({
|
||||
});
|
||||
});
|
||||
} else {
|
||||
errMessage = 'The URL must be in a format like ' +
|
||||
'https://www.facebook.com/yourUsername';
|
||||
errMessage = 'The URL must be in a format like '
|
||||
+ 'https://www.facebook.com/yourUsername';
|
||||
this.get('user.errors').add('facebook', errMessage);
|
||||
this.get('user.hasValidated').pushObject('facebook');
|
||||
return;
|
||||
@ -304,7 +304,7 @@ export default Controller.extend({
|
||||
let username = [];
|
||||
|
||||
if (newUrl.match(/(?:twitter\.com\/)(\S+)/)) {
|
||||
[ , username] = newUrl.match(/(?:twitter\.com\/)(\S+)/);
|
||||
[, username] = newUrl.match(/(?:twitter\.com\/)(\S+)/);
|
||||
} else {
|
||||
[username] = newUrl.match(/([^/]+)\/?$/mi);
|
||||
}
|
||||
@ -333,8 +333,8 @@ export default Controller.extend({
|
||||
});
|
||||
});
|
||||
} else {
|
||||
errMessage = 'The URL must be in a format like ' +
|
||||
'https://twitter.com/yourUsername';
|
||||
errMessage = 'The URL must be in a format like '
|
||||
+ 'https://twitter.com/yourUsername';
|
||||
this.get('user.errors').add('twitter', errMessage);
|
||||
this.get('user.hasValidated').pushObject('twitter');
|
||||
return;
|
||||
|
@ -17,9 +17,9 @@ export default helper(function (params) {
|
||||
'<pre class="iframe-embed-placeholder">Embedded iFrame</pre>');
|
||||
|
||||
// sanitize HTML
|
||||
// jscs:disable requireCamelCaseOrUpperCaseIdentifiers
|
||||
/* eslint-disable camelcase */
|
||||
escapedhtml = html_sanitize(escapedhtml, cajaSanitizers.url, cajaSanitizers.id);
|
||||
// jscs:enable requireCamelCaseOrUpperCaseIdentifiers
|
||||
/* eslint-enable camelcase */
|
||||
|
||||
return htmlSafe(escapedhtml);
|
||||
});
|
||||
|
@ -1,8 +1,9 @@
|
||||
/* global Showdown, html_sanitize*/
|
||||
/* global Showdown, html_sanitize */
|
||||
import {helper} from 'ember-helper';
|
||||
import {htmlSafe} from 'ember-string';
|
||||
import cajaSanitizers from 'ghost-admin/utils/caja-sanitizers';
|
||||
|
||||
// eslint-disable-next-line new-cap
|
||||
let showdown = new Showdown.converter({extensions: ['ghostimagepreview', 'ghostgfm', 'footnotes', 'highlight']});
|
||||
|
||||
export function formatMarkdown(params) {
|
||||
@ -23,9 +24,8 @@ export function formatMarkdown(params) {
|
||||
'<pre class="iframe-embed-placeholder">Embedded iFrame</pre>');
|
||||
|
||||
// sanitize html
|
||||
// jscs:disable requireCamelCaseOrUpperCaseIdentifiers
|
||||
/* eslint-disable-next-line camelcase */
|
||||
escapedhtml = html_sanitize(escapedhtml, cajaSanitizers.url, cajaSanitizers.id);
|
||||
// jscs:enable requireCamelCaseOrUpperCaseIdentifiers
|
||||
|
||||
return htmlSafe(escapedhtml);
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ export function timeToSchedule(params) {
|
||||
return;
|
||||
}
|
||||
|
||||
let [ , blogTimezone] = params;
|
||||
let [, blogTimezone] = params;
|
||||
let [time] = params;
|
||||
|
||||
if (blogTimezone.get('isFulfilled')) {
|
||||
|
@ -24,21 +24,21 @@ export default helper(function (params) {
|
||||
}
|
||||
|
||||
switch (path.toString()) {
|
||||
case 'blog':
|
||||
base = paths.blogRoot;
|
||||
break;
|
||||
case 'admin':
|
||||
base = paths.adminRoot;
|
||||
break;
|
||||
case 'asset':
|
||||
base = paths.assetRoot;
|
||||
break;
|
||||
case 'api':
|
||||
base = paths.apiRoot;
|
||||
break;
|
||||
default:
|
||||
base = paths.blogRoot;
|
||||
break;
|
||||
case 'blog':
|
||||
base = paths.blogRoot;
|
||||
break;
|
||||
case 'admin':
|
||||
base = paths.adminRoot;
|
||||
break;
|
||||
case 'asset':
|
||||
base = paths.assetRoot;
|
||||
break;
|
||||
case 'api':
|
||||
base = paths.apiRoot;
|
||||
break;
|
||||
default:
|
||||
base = paths.blogRoot;
|
||||
break;
|
||||
}
|
||||
|
||||
// handle leading and trailing slashes
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* jscs:disable requireCamelCaseOrUpperCaseIdentifiers */
|
||||
/* eslint-disable camelcase */
|
||||
import Mirage from 'ember-cli-mirage';
|
||||
import {isBlank} from 'ember-utils';
|
||||
import $ from 'jquery';
|
||||
@ -31,10 +31,9 @@ export default function mockAuthentication(server) {
|
||||
});
|
||||
|
||||
server.post('/authentication/passwordreset', function (db, request) {
|
||||
// jscs:disable requireObjectDestructuring
|
||||
let {passwordreset} = JSON.parse(request.requestBody);
|
||||
// eslint-disable-next-line ember-suave/prefer-destructuring
|
||||
let email = passwordreset[0].email;
|
||||
// jscs:enable requireObjectDestructuring
|
||||
|
||||
if (email === 'unknown@example.com') {
|
||||
return new Mirage.Response(404, {}, {
|
||||
|
@ -33,7 +33,7 @@ export default function mockInvites(server) {
|
||||
db.invites.remove(oldInvite.id);
|
||||
}
|
||||
|
||||
/* jscs:disable requireCamelCaseOrUpperCaseIdentifiers */
|
||||
/* eslint-disable camelcase */
|
||||
attrs.token = `${db.invites.length}-token`;
|
||||
attrs.expires = moment.utc().add(1, 'day').unix();
|
||||
attrs.created_at = moment.utc().format();
|
||||
@ -41,7 +41,7 @@ export default function mockInvites(server) {
|
||||
attrs.updated_at = moment.utc().format();
|
||||
attrs.updated_by = 1;
|
||||
attrs.status = 'sent';
|
||||
/* jscs:enable requireCamelCaseOrUpperCaseIdentifiers */
|
||||
/* eslint-enable camelcase */
|
||||
|
||||
let invite = db.invites.insert(attrs);
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
export default function mockRoles(server) {
|
||||
server.get('/roles/', function (db, request) {
|
||||
if (request.queryParams.permissions === 'assign') {
|
||||
let roles = db.roles.find([1,2,3]);
|
||||
let roles = db.roles.find([1, 2, 3]);
|
||||
return {roles};
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* jscs:disable requireCamelCaseOrUpperCaseIdentifiers */
|
||||
/* eslint-disable camelcase */
|
||||
import Mirage from 'ember-cli-mirage';
|
||||
import {paginatedResponse} from '../utils';
|
||||
|
||||
@ -48,7 +48,7 @@ export default function mockSubscribers(server) {
|
||||
return new Mirage.Response(204, {}, {});
|
||||
});
|
||||
|
||||
server.post('/subscribers/csv/', function (/*db, request*/) {
|
||||
server.post('/subscribers/csv/', function () {
|
||||
// NB: we get a raw FormData object with no way to inspect it in Chrome
|
||||
// until version 50 adds the additional read methods
|
||||
// https://developer.mozilla.org/en-US/docs/Web/API/FormData#Browser_compatibility
|
||||
|
@ -3,7 +3,7 @@ import Mirage from 'ember-cli-mirage';
|
||||
let themeCount = 1;
|
||||
|
||||
export default function mockThemes(server) {
|
||||
server.post('/themes/upload/', function (db/*, request*/) {
|
||||
server.post('/themes/upload/', function (db) {
|
||||
let [availableThemes] = db.settings.where({key: 'availableThemes'});
|
||||
// pretender/mirage doesn't currently process FormData so we can't use
|
||||
// any info passed in through the request
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* jscs:disable requireCamelCaseOrUpperCaseIdentifiers */
|
||||
/* eslint-disable camelcase */
|
||||
import Mirage from 'ember-cli-mirage';
|
||||
import {isBlank} from 'ember-utils';
|
||||
import {assign} from 'ember-platform';
|
||||
|
6
ghost/admin/app/mirage/factories/.eslintrc.js
Normal file
6
ghost/admin/app/mirage/factories/.eslintrc.js
Normal file
@ -0,0 +1,6 @@
|
||||
module.exports = {
|
||||
rules: {
|
||||
'brace-style': 'off',
|
||||
'camelcase': 'off'
|
||||
}
|
||||
};
|
@ -1,4 +1,3 @@
|
||||
/* jscs:disable */
|
||||
import Mirage from 'ember-cli-mirage';
|
||||
|
||||
export default Mirage.Factory.extend({
|
||||
|
@ -1,4 +1,3 @@
|
||||
/* jscs:disable */
|
||||
import Mirage from 'ember-cli-mirage';
|
||||
|
||||
export default Mirage.Factory.extend({
|
||||
|
@ -1,4 +1,3 @@
|
||||
/* jscs:disable */
|
||||
import Mirage, {faker} from 'ember-cli-mirage';
|
||||
|
||||
export default Mirage.Factory.extend({
|
||||
|
@ -1,4 +1,3 @@
|
||||
/* jscs:disable */
|
||||
import Mirage from 'ember-cli-mirage';
|
||||
|
||||
export default Mirage.Factory.extend({
|
||||
|
@ -1,4 +1,3 @@
|
||||
/* jscs:disable */
|
||||
import Mirage from 'ember-cli-mirage';
|
||||
|
||||
export default Mirage.Factory.extend({
|
||||
|
@ -6,8 +6,7 @@ let randomDate = function randomDate(start = moment().subtract(30, 'days').toDat
|
||||
|
||||
let statuses = ['pending', 'subscribed'];
|
||||
|
||||
// jscs:disable requireBlocksOnNewline
|
||||
// jscs:disable requireCamelCaseOrUpperCaseIdentifiers
|
||||
/* eslint-disable camelcase, brace-style */
|
||||
export default Mirage.Factory.extend({
|
||||
uuid(i) { return `subscriber-${i}`; },
|
||||
name() { return `${faker.name.firstName()} ${faker.name.lastName()}`; },
|
||||
|
@ -1,4 +1,3 @@
|
||||
/* jscs:disable */
|
||||
import Mirage from 'ember-cli-mirage';
|
||||
|
||||
export default Mirage.Factory.extend({
|
||||
@ -19,5 +18,5 @@ export default Mirage.Factory.extend({
|
||||
return {
|
||||
posts: 1
|
||||
};
|
||||
},
|
||||
}
|
||||
});
|
||||
|
@ -1,4 +1,3 @@
|
||||
/* jscs:disable */
|
||||
import Mirage from 'ember-cli-mirage';
|
||||
|
||||
export default Mirage.Factory.extend({
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* jscs:disable requireCamelCaseOrUpperCaseIdentifiers */
|
||||
/* eslint-disable camelcase */
|
||||
export default [
|
||||
{
|
||||
id: 1,
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* jscs:disable requireCamelCaseOrUpperCaseIdentifiers */
|
||||
/* eslint-disable camelcase */
|
||||
export default [
|
||||
{
|
||||
created_at: '2015-09-11T09:44:30.805Z',
|
||||
|
@ -172,8 +172,8 @@ export default Mixin.create({
|
||||
|
||||
// if the two "scratch" properties (title and content) match the model, then
|
||||
// it's ok to set hasDirtyAttributes to false
|
||||
if (model.get('titleScratch') === model.get('title') &&
|
||||
JSON.stringify(model.get('scratch')) === JSON.stringify(model.get('mobiledoc'))) {
|
||||
if (model.get('titleScratch') === model.get('title')
|
||||
&& JSON.stringify(model.get('scratch')) === JSON.stringify(model.get('mobiledoc'))) {
|
||||
this.set('hasDirtyAttributes', false);
|
||||
}
|
||||
},
|
||||
@ -241,11 +241,11 @@ export default Mixin.create({
|
||||
|
||||
// used on window.onbeforeunload
|
||||
unloadDirtyMessage() {
|
||||
return '==============================\n\n' +
|
||||
'Hey there! It looks like you\'re in the middle of writing' +
|
||||
' something and you haven\'t saved all of your content.' +
|
||||
'\n\nSave before you go!\n\n' +
|
||||
'==============================';
|
||||
return '==============================\n\n'
|
||||
+ 'Hey there! It looks like you\'re in the middle of writing'
|
||||
+ ' something and you haven\'t saved all of your content.'
|
||||
+ '\n\nSave before you go!\n\n'
|
||||
+ '==============================';
|
||||
},
|
||||
|
||||
// TODO: This has to be moved to the I18n localization file.
|
||||
@ -318,7 +318,7 @@ export default Mixin.create({
|
||||
let errorMessage;
|
||||
|
||||
function isString(str) {
|
||||
/*global toString*/
|
||||
/* global toString */
|
||||
return toString.call(str) === '[object String]';
|
||||
}
|
||||
|
||||
|
@ -59,14 +59,14 @@ export default Mixin.create(styleBody, ShortcutsRoute, {
|
||||
}, 100);
|
||||
}
|
||||
|
||||
fromNewToEdit = this.get('routeName') === 'editor.new' &&
|
||||
transition.targetName === 'editor.edit' &&
|
||||
transition.intent.contexts &&
|
||||
transition.intent.contexts[0] &&
|
||||
transition.intent.contexts[0].id === model.get('id');
|
||||
fromNewToEdit = this.get('routeName') === 'editor.new'
|
||||
&& transition.targetName === 'editor.edit'
|
||||
&& transition.intent.contexts
|
||||
&& transition.intent.contexts[0]
|
||||
&& transition.intent.contexts[0].id === model.get('id');
|
||||
|
||||
deletedWithoutChanges = state.isDeleted &&
|
||||
(state.isSaving || !state.hasDirtyAttributes);
|
||||
deletedWithoutChanges = state.isDeleted
|
||||
&& (state.isSaving || !state.hasDirtyAttributes);
|
||||
|
||||
if (!fromNewToEdit && !deletedWithoutChanges && controllerIsDirty) {
|
||||
transition.abort();
|
||||
|
@ -1,11 +1,11 @@
|
||||
/* jscs:disable requireCamelCaseOrUpperCaseIdentifiers */
|
||||
/* eslint-disable camelcase */
|
||||
import Ember from 'ember';
|
||||
import computed, {equal, filterBy} from 'ember-computed';
|
||||
import injectService from 'ember-service/inject';
|
||||
|
||||
import Model from 'ember-data/model';
|
||||
import attr from 'ember-data/attr';
|
||||
import { belongsTo, hasMany } from 'ember-data/relationships';
|
||||
import {belongsTo, hasMany} from 'ember-data/relationships';
|
||||
|
||||
import ValidationEngine from 'ghost-admin/mixins/validation-engine';
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* jscs:disable requireCamelCaseOrUpperCaseIdentifiers */
|
||||
/* eslint-disable camelcase */
|
||||
import computed from 'ember-computed';
|
||||
import Model from 'ember-data/model';
|
||||
import attr from 'ember-data/attr';
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* jscs:disable requireCamelCaseOrUpperCaseIdentifiers */
|
||||
/* eslint-disable camelcase */
|
||||
import Model from 'ember-data/model';
|
||||
import attr from 'ember-data/attr';
|
||||
import ValidationEngine from 'ghost-admin/mixins/validation-engine';
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* jscs:disable requireCamelCaseOrUpperCaseIdentifiers */
|
||||
/* eslint-disable camelcase */
|
||||
import {equal} from 'ember-computed';
|
||||
import observer from 'ember-metal/observer';
|
||||
import injectService from 'ember-service/inject';
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* jscs:disable requireCamelCaseOrUpperCaseIdentifiers */
|
||||
/* eslint-disable camelcase */
|
||||
import Model from 'ember-data/model';
|
||||
import attr from 'ember-data/attr';
|
||||
import {hasMany} from 'ember-data/relationships';
|
||||
|
@ -161,44 +161,44 @@ export default Route.extend(ApplicationRouteMixin, ShortcutsRoute, {
|
||||
error(error, transition) {
|
||||
if (error && isEmberArray(error.errors)) {
|
||||
switch (error.errors[0].errorType) {
|
||||
case 'NotFoundError': {
|
||||
if (transition) {
|
||||
transition.abort();
|
||||
}
|
||||
|
||||
case 'NotFoundError':
|
||||
if (transition) {
|
||||
transition.abort();
|
||||
}
|
||||
let routeInfo = transition.handlerInfos[transition.handlerInfos.length - 1];
|
||||
let router = this.get('router');
|
||||
let params = [];
|
||||
|
||||
let routeInfo = transition.handlerInfos[transition.handlerInfos.length - 1];
|
||||
let router = this.get('router');
|
||||
let params = [];
|
||||
for (let key of Object.keys(routeInfo.params)) {
|
||||
params.push(routeInfo.params[key]);
|
||||
}
|
||||
|
||||
for (let key of Object.keys(routeInfo.params)) {
|
||||
params.push(routeInfo.params[key]);
|
||||
}
|
||||
return this.transitionTo('error404', router.generate(routeInfo.name, ...params).replace('/ghost/', '').replace(/^\//g, ''));
|
||||
}
|
||||
case 'VersionMismatchError': {
|
||||
if (transition) {
|
||||
transition.abort();
|
||||
}
|
||||
|
||||
return this.transitionTo('error404', router.generate(routeInfo.name, ...params).replace('/ghost/', '').replace(/^\//g, ''));
|
||||
this.get('upgradeStatus').requireUpgrade();
|
||||
return false;
|
||||
}
|
||||
case 'Maintenance': {
|
||||
if (transition) {
|
||||
transition.abort();
|
||||
}
|
||||
|
||||
case 'VersionMismatchError':
|
||||
if (transition) {
|
||||
transition.abort();
|
||||
}
|
||||
|
||||
this.get('upgradeStatus').requireUpgrade();
|
||||
this.get('upgradeStatus').maintenanceAlert();
|
||||
return false;
|
||||
}
|
||||
default: {
|
||||
this.get('notifications').showAPIError(error);
|
||||
// don't show the 500 page if we weren't navigating
|
||||
if (!transition) {
|
||||
return false;
|
||||
|
||||
case 'Maintenance':
|
||||
if (transition) {
|
||||
transition.abort();
|
||||
}
|
||||
|
||||
this.get('upgradeStatus').maintenanceAlert();
|
||||
return false;
|
||||
|
||||
default:
|
||||
this.get('notifications').showAPIError(error);
|
||||
// don't show the 500 page if we weren't navigating
|
||||
if (!transition) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* jscs:disable requireCamelCaseOrUpperCaseIdentifiers */
|
||||
/* eslint-disable camelcase */
|
||||
import AuthenticatedRoute from 'ghost-admin/routes/authenticated';
|
||||
import base from 'ghost-admin/mixins/editor-base-route';
|
||||
|
||||
@ -12,13 +12,13 @@ export default AuthenticatedRoute.extend(base, {
|
||||
},
|
||||
|
||||
model(params) {
|
||||
/* jscs:disable requireCamelCaseOrUpperCaseIdentifiers */
|
||||
/* eslint-disable camelcase */
|
||||
let query = {
|
||||
id: params.post_id,
|
||||
status: 'all',
|
||||
staticPages: 'all'
|
||||
};
|
||||
/* jscs:enable requireCamelCaseOrUpperCaseIdentifiers */
|
||||
/* eslint-enable camelcase */
|
||||
|
||||
return this.store.query('post', query).then((records) => {
|
||||
let post = records.get('firstObject');
|
||||
|
@ -17,8 +17,8 @@ export default AuthenticatedRoute.extend(ShortcutsRoute, PaginationMixin, {
|
||||
|
||||
return this.get('session.user').then((user) => {
|
||||
if (user.get('isAuthor')) {
|
||||
paginationSettings.filter = paginationSettings.filter ?
|
||||
`${paginationSettings.filter}+author:${user.get('slug')}` : `author:${user.get('slug')}`;
|
||||
paginationSettings.filter = paginationSettings.filter
|
||||
? `${paginationSettings.filter}+author:${user.get('slug')}` : `author:${user.get('slug')}`;
|
||||
}
|
||||
|
||||
return this.loadFirstPage().then(() => {
|
||||
|
@ -3,14 +3,14 @@ import ShortcutsRoute from 'ghost-admin/mixins/shortcuts-route';
|
||||
|
||||
export default AuthenticatedRoute.extend(ShortcutsRoute, {
|
||||
model(params) {
|
||||
/* jscs:disable requireCamelCaseOrUpperCaseIdentifiers */
|
||||
/* eslint-disable camelcase */
|
||||
let post = this.store.peekRecord('post', params.post_id);
|
||||
let query = {
|
||||
id: params.post_id,
|
||||
status: 'all',
|
||||
staticPages: 'all'
|
||||
};
|
||||
/* jscs:enable requireCamelCaseOrUpperCaseIdentifiers */
|
||||
/* eslint-enable camelcase */
|
||||
|
||||
if (post) {
|
||||
return post;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* jscs:disable requireCamelCaseOrUpperCaseIdentifiers */
|
||||
/* eslint-disable camelcase */
|
||||
import AuthenticatedRoute from 'ghost-admin/routes/authenticated';
|
||||
|
||||
export default AuthenticatedRoute.extend({
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* jscs:disable requireCamelCaseOrUpperCaseIdentifiers */
|
||||
/* eslint-disable camelcase */
|
||||
import AuthenticatedRoute from 'ghost-admin/routes/authenticated';
|
||||
import CurrentUserSettings from 'ghost-admin/mixins/current-user-settings';
|
||||
import styleBody from 'ghost-admin/mixins/style-body';
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* jscs:disable requireCamelCaseOrUpperCaseIdentifiers */
|
||||
/* eslint-disable camelcase */
|
||||
import Ember from 'ember';
|
||||
import ApplicationSerializer from 'ghost-admin/serializers/application';
|
||||
import EmbeddedRecordsMixin from 'ember-data/serializers/embedded-records-mixin';
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* jscs:disable requireCamelCaseOrUpperCaseIdentifiers */
|
||||
/* eslint-disable camelcase */
|
||||
import Ember from 'ember';
|
||||
import ApplicationSerializer from 'ghost-admin/serializers/application';
|
||||
|
||||
|
@ -218,15 +218,15 @@ let ajaxService = AjaxService.extend({
|
||||
return isVersionMismatchError(status, payload);
|
||||
},
|
||||
|
||||
isServerUnreachableError(status/*, headers, payload */) {
|
||||
isServerUnreachableError(status) {
|
||||
return isServerUnreachableError(status);
|
||||
},
|
||||
|
||||
isRequestEntityTooLargeError(status/*, headers, payload */) {
|
||||
isRequestEntityTooLargeError(status) {
|
||||
return isRequestEntityTooLargeError(status);
|
||||
},
|
||||
|
||||
isUnsupportedMediaTypeError(status/*, headers, payload */) {
|
||||
isUnsupportedMediaTypeError(status) {
|
||||
return isUnsupportedMediaTypeError(status);
|
||||
},
|
||||
|
||||
|
@ -25,7 +25,7 @@ export default Service.extend(_ProxyMixin, {
|
||||
let timezonesUrl = this.get('ghostPaths.url').api('configuration', 'timezones');
|
||||
|
||||
return this.get('ajax').request(timezonesUrl).then((configTimezones) => {
|
||||
let [ timezonesObj ] = configTimezones.configuration;
|
||||
let [timezonesObj] = configTimezones.configuration;
|
||||
|
||||
timezonesObj = timezonesObj.timezones;
|
||||
|
||||
|
@ -4,8 +4,7 @@ import Evented from 'ember-evented';
|
||||
import BodyEventListener from 'ghost-admin/mixins/body-event-listener';
|
||||
|
||||
export default Service.extend(Evented, BodyEventListener, {
|
||||
bodyClick(event) {
|
||||
/*jshint unused:false */
|
||||
bodyClick() {
|
||||
this.closeDropdowns();
|
||||
},
|
||||
|
||||
|
@ -71,7 +71,7 @@ export default Service.extend({
|
||||
// we'll always have an errors object unless we hit a
|
||||
// validation error
|
||||
if (!error) {
|
||||
throw new EmberError(`Validation of the feature service settings model failed when updating labs.`);
|
||||
throw new EmberError('Validation of the feature service settings model failed when updating labs.');
|
||||
}
|
||||
|
||||
this.get('notifications').showAPIError(error);
|
||||
|
@ -2,7 +2,7 @@ import AdaptiveStore from 'ember-simple-auth/session-stores/adaptive';
|
||||
import ghostPaths from 'ghost-admin/utils/ghost-paths';
|
||||
|
||||
const paths = ghostPaths();
|
||||
const keyName = `ghost${(paths.subdir.indexOf('/') === 0 ? `-${paths.subdir.substr(1)}` : ``) }:session`;
|
||||
const keyName = `ghost${(paths.subdir.indexOf('/') === 0 ? `-${paths.subdir.substr(1)}` : '') }:session`;
|
||||
|
||||
export default AdaptiveStore.extend({
|
||||
localStorageKey: keyName,
|
||||
|
@ -3,7 +3,7 @@ import Transform from 'ember-data/transform';
|
||||
export default Transform.extend({
|
||||
deserialize(serialized) {
|
||||
if (serialized) {
|
||||
let [ , user ] = serialized.match(/(\S+)/);
|
||||
let [, user] = serialized.match(/(\S+)/);
|
||||
|
||||
return `https://www.facebook.com/${user}`;
|
||||
}
|
||||
@ -12,7 +12,7 @@ export default Transform.extend({
|
||||
|
||||
serialize(deserialized) {
|
||||
if (deserialized) {
|
||||
let [ , user] = deserialized.match(/(?:https:\/\/)(?:www\.)(?:facebook\.com)\/(?:#!\/)?(\w+\/?\S+)/mi);
|
||||
let [, user] = deserialized.match(/(?:https:\/\/)(?:www\.)(?:facebook\.com)\/(?:#!\/)?(\w+\/?\S+)/mi);
|
||||
|
||||
return user;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* jscs:disable requireCamelCaseOrUpperCaseIdentifiers */
|
||||
/* eslint-disable camelcase */
|
||||
import {A as emberA, isEmberArray} from 'ember-array/utils';
|
||||
import Transform from 'ember-data/transform';
|
||||
import SlackObject from 'ghost-admin/models/slack-integration';
|
||||
|
@ -3,7 +3,7 @@ import Transform from 'ember-data/transform';
|
||||
export default Transform.extend({
|
||||
deserialize(serialized) {
|
||||
if (serialized) {
|
||||
let [ , user ] = serialized.match(/@?([^\/]*)/);
|
||||
let [, user] = serialized.match(/@?([^\/]*)/);
|
||||
|
||||
return `https://twitter.com/${user}`;
|
||||
}
|
||||
@ -12,7 +12,7 @@ export default Transform.extend({
|
||||
|
||||
serialize(deserialized) {
|
||||
if (deserialized) {
|
||||
let [ , user] = deserialized.match(/(?:https:\/\/)(?:twitter\.com)\/(?:#!\/)?@?([^\/]*)/);
|
||||
let [, user] = deserialized.match(/(?:https:\/\/)(?:twitter\.com)\/(?:#!\/)?@?([^\/]*)/);
|
||||
|
||||
return `@${user}`;
|
||||
}
|
||||
|
@ -1,17 +1,16 @@
|
||||
/* global moment */
|
||||
// jscs: disable disallowSpacesInsideParentheses
|
||||
|
||||
const parseDateFormats = ['DD MMM YY @ HH:mm', 'DD MMM YY HH:mm',
|
||||
'D MMM YY @ HH:mm', 'D MMM YY HH:mm',
|
||||
'DD MMM YYYY @ HH:mm', 'DD MMM YYYY HH:mm',
|
||||
'D MMM YYYY @ HH:mm', 'D MMM YYYY HH:mm',
|
||||
'DD/MM/YY @ HH:mm', 'DD/MM/YY HH:mm',
|
||||
'DD/MM/YYYY @ HH:mm', 'DD/MM/YYYY HH:mm',
|
||||
'DD-MM-YY @ HH:mm', 'DD-MM-YY HH:mm',
|
||||
'DD-MM-YYYY @ HH:mm', 'DD-MM-YYYY HH:mm',
|
||||
'YYYY-MM-DD @ HH:mm', 'YYYY-MM-DD HH:mm',
|
||||
'DD MMM @ HH:mm', 'DD MMM HH:mm',
|
||||
'D MMM @ HH:mm', 'D MMM HH:mm'];
|
||||
const parseDateFormats = [
|
||||
'DD MMM YY @ HH:mm', 'DD MMM YY HH:mm',
|
||||
'D MMM YY @ HH:mm', 'D MMM YY HH:mm',
|
||||
'DD MMM YYYY @ HH:mm', 'DD MMM YYYY HH:mm',
|
||||
'D MMM YYYY @ HH:mm', 'D MMM YYYY HH:mm',
|
||||
'DD/MM/YY @ HH:mm', 'DD/MM/YY HH:mm',
|
||||
'DD/MM/YYYY @ HH:mm', 'DD/MM/YYYY HH:mm',
|
||||
'DD-MM-YY @ HH:mm', 'DD-MM-YY HH:mm',
|
||||
'DD-MM-YYYY @ HH:mm', 'DD-MM-YYYY HH:mm',
|
||||
'YYYY-MM-DD @ HH:mm', 'YYYY-MM-DD HH:mm',
|
||||
'DD MMM @ HH:mm', 'DD MMM HH:mm',
|
||||
'D MMM @ HH:mm', 'D MMM HH:mm'
|
||||
];
|
||||
|
||||
const displayDateFormat = 'DD MMM YY @ HH:mm';
|
||||
|
||||
|
@ -3,6 +3,9 @@
|
||||
const {toString} = Object.prototype;
|
||||
|
||||
export default function (value) {
|
||||
return typeof value === 'number' ||
|
||||
value && typeof value === 'object' && toString.call(value) === '[object Number]' || false;
|
||||
return typeof value === 'number'
|
||||
|| value
|
||||
&& typeof value === 'object'
|
||||
&& toString.call(value) === '[object Number]'
|
||||
|| false;
|
||||
}
|
||||
|
@ -1,7 +1,9 @@
|
||||
import {capitalize} from 'ember-string';
|
||||
const lowerWords = ['of', 'a', 'the', 'and', 'an', 'or', 'nor', 'but', 'is', 'if',
|
||||
'then', 'else', 'when', 'at', 'from', 'by', 'on', 'off', 'for',
|
||||
'in', 'out', 'over', 'to', 'into', 'with'];
|
||||
const lowerWords = [
|
||||
'of', 'a', 'the', 'and', 'an', 'or', 'nor', 'but', 'is', 'if',
|
||||
'then', 'else', 'when', 'at', 'from', 'by', 'on', 'off', 'for',
|
||||
'in', 'out', 'over', 'to', 'into', 'with'
|
||||
];
|
||||
|
||||
export default function (input) {
|
||||
let words = input.split(' ').map((word, index) => {
|
||||
|
@ -1,4 +1,4 @@
|
||||
// jscs: disable
|
||||
/* eslint-disable */
|
||||
|
||||
export default function (s) {
|
||||
// replaces previous XRegExp("[^\\s\\d\\p{L}]", 'g') that was causing
|
||||
|
@ -18,9 +18,9 @@ export default BaseValidator.create({
|
||||
url(model) {
|
||||
let url = model.get('url');
|
||||
let hasValidated = model.get('hasValidated');
|
||||
/* jscs:disable requireCamelCaseOrUpperCaseIdentifiers */
|
||||
/* eslint-disable camelcase */
|
||||
let validatorOptions = {require_protocol: true};
|
||||
/* jscs:enable requireCamelCaseOrUpperCaseIdentifiers */
|
||||
/* eslint-enable camelcase */
|
||||
let urlRegex = new RegExp(/^(\/|#|[a-zA-Z0-9\-]+:)/);
|
||||
|
||||
if (validator.empty(url)) {
|
||||
|
@ -12,8 +12,7 @@ export default BaseValidator.create({
|
||||
if (!validator.empty(url) && !url.match(urlRegex)) {
|
||||
model.get('errors').add(
|
||||
'url',
|
||||
'The URL must be in a format like ' +
|
||||
'https://hooks.slack.com/services/<your personal key>'
|
||||
'The URL must be in a format like https://hooks.slack.com/services/<your personal key>'
|
||||
);
|
||||
|
||||
this.invalidate();
|
||||
|
@ -55,18 +55,16 @@ export default BaseValidator.create({
|
||||
|
||||
website(model) {
|
||||
let website = model.get('website');
|
||||
// eslint-disable-next-line camelcase
|
||||
let isInvalidWebsite = !validator.isURL(website, {require_protocol: false})
|
||||
|| !validator.isLength(website, 0, 2000);
|
||||
|
||||
/* jscs:disable requireCamelCaseOrUpperCaseIdentifiers */
|
||||
if (this.isActive(model)) {
|
||||
if (!validator.empty(website) &&
|
||||
(!validator.isURL(website, {require_protocol: false}) ||
|
||||
!validator.isLength(website, 0, 2000))) {
|
||||
|
||||
if (!validator.empty(website) && isInvalidWebsite) {
|
||||
model.get('errors').add('website', 'Website is not a valid url');
|
||||
this.invalidate();
|
||||
}
|
||||
}
|
||||
/* jscs:enable requireCamelCaseOrUpperCaseIdentifiers */
|
||||
},
|
||||
|
||||
roles(model) {
|
||||
|
@ -1,6 +1,7 @@
|
||||
{
|
||||
"name": "ghost-admin",
|
||||
"dependencies": {
|
||||
"Faker": "3.1.0",
|
||||
"devicejs": "0.2.7",
|
||||
"ember": "2.9.0",
|
||||
"ember-cli-shims": "0.1.3",
|
||||
@ -10,8 +11,8 @@
|
||||
"google-caja": "6005.0.0",
|
||||
"jquery-file-upload": "9.12.3",
|
||||
"jquery-ui": "1.11.4",
|
||||
"jqueryui-touch-punch": "furf/jquery-ui-touch-punch#4bc009145202d9c7483ba85f3a236a8f3470354d",
|
||||
"jquery.simulate.drag-sortable": "0.1.0",
|
||||
"jqueryui-touch-punch": "furf/jquery-ui-touch-punch#4bc009145202d9c7483ba85f3a236a8f3470354d",
|
||||
"keymaster": "1.6.3",
|
||||
"lodash": "3.7.0",
|
||||
"normalize.css": "3.0.3",
|
||||
|
@ -1,5 +1,4 @@
|
||||
/* jshint node: true */
|
||||
/* jscs:disable */
|
||||
/* eslint-env node */
|
||||
|
||||
module.exports = function (environment) {
|
||||
var ENV = {
|
||||
@ -38,7 +37,7 @@ module.exports = function (environment) {
|
||||
},
|
||||
|
||||
torii: {
|
||||
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* jscs:disable */
|
||||
/* eslint-disable */
|
||||
/* global require, module */
|
||||
|
||||
var EmberApp = require('ember-cli/lib/broccoli/ember-app'),
|
||||
@ -86,7 +86,6 @@ module.exports = function (defaults) {
|
||||
compress: mythCompress,
|
||||
outputFile: isProduction ? 'ghost.min.css' : 'ghost.css'
|
||||
},
|
||||
hinting: false,
|
||||
fingerprint: disabled,
|
||||
nodeAssets: {
|
||||
'blueimp-md5': {
|
||||
|
@ -1,4 +0,0 @@
|
||||
{
|
||||
"node": true,
|
||||
"browser": false
|
||||
}
|
@ -18,7 +18,8 @@
|
||||
"scripts": {
|
||||
"start": "ember server",
|
||||
"build": "ember build",
|
||||
"test": "ember test"
|
||||
"test": "ember test",
|
||||
"lint": "ember test --launch phantomjs -f 'ESLint'"
|
||||
},
|
||||
"engines": {
|
||||
"node": "~0.12.0 || ^4.2.0"
|
||||
@ -42,10 +43,10 @@
|
||||
"ember-cli-content-security-policy": "0.5.0",
|
||||
"ember-cli-dependency-checker": "1.3.0",
|
||||
"ember-cli-deprecation-workflow": "0.2.3",
|
||||
"ember-cli-eslint": "3.0.0",
|
||||
"ember-cli-fastclick": "1.3.0",
|
||||
"ember-cli-htmlbars": "1.1.0",
|
||||
"ember-cli-htmlbars-inline-precompile": "0.3.6",
|
||||
"ember-cli-jshint": "2.0.1",
|
||||
"ember-cli-mirage": "0.1.14",
|
||||
"ember-cli-mocha": "0.11.0",
|
||||
"ember-cli-node-assets": "0.1.4",
|
||||
@ -69,19 +70,17 @@
|
||||
"ember-simple-auth": "1.1.0",
|
||||
"ember-sinon": "0.5.1",
|
||||
"ember-sortable": "1.9.0",
|
||||
"ember-suave": "4.0.1",
|
||||
"ember-watson": "0.8.3",
|
||||
"ember-wormhole": "0.5.1",
|
||||
"emberx-file-input": "1.1.0",
|
||||
"eslint-plugin-ember-suave": "1.0.0",
|
||||
"fs-extra": "1.0.0",
|
||||
"ghost-editor": "0.1.4",
|
||||
"glob": "7.1.1",
|
||||
"grunt": "1.0.1",
|
||||
"grunt-bg-shell": "2.3.3",
|
||||
"grunt-contrib-clean": "1.0.0",
|
||||
"grunt-contrib-jshint": "1.0.0",
|
||||
"grunt-contrib-watch": "1.0.0",
|
||||
"grunt-jscs": "3.0.1",
|
||||
"grunt-shell": "1.3.1",
|
||||
"jquery-deparam": "0.5.2",
|
||||
"liquid-fire": "0.26.4",
|
||||
@ -106,9 +105,7 @@
|
||||
"grunt",
|
||||
"grunt-bg-shell",
|
||||
"grunt-contrib-clean",
|
||||
"grunt-contrib-jshint",
|
||||
"grunt-contrib-watch",
|
||||
"grunt-jscs",
|
||||
"grunt-shell"
|
||||
]
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/*jshint node:true*/
|
||||
/* eslint-env node */
|
||||
module.exports = {
|
||||
'framework': 'mocha',
|
||||
'test_page': 'tests/index.html?hidepassed',
|
||||
|
11
ghost/admin/tests/.eslintrc.js
Normal file
11
ghost/admin/tests/.eslintrc.js
Normal file
@ -0,0 +1,11 @@
|
||||
module.exports = {
|
||||
env: {
|
||||
'embertest': true,
|
||||
'mocha': true
|
||||
},
|
||||
globals: {
|
||||
server: false,
|
||||
expect: false,
|
||||
fileUpload: false
|
||||
}
|
||||
};
|
@ -1,4 +0,0 @@
|
||||
{
|
||||
"preset": "../.jscsrc",
|
||||
"requireBlocksOnNewline": null
|
||||
}
|
@ -1,59 +0,0 @@
|
||||
{
|
||||
"predef": [
|
||||
"server",
|
||||
"authenticateSession",
|
||||
"invalidateSession",
|
||||
"currentSession",
|
||||
"document",
|
||||
"window",
|
||||
"location",
|
||||
"setTimeout",
|
||||
"-Promise",
|
||||
"define",
|
||||
"console",
|
||||
"visit",
|
||||
"exists",
|
||||
"fillIn",
|
||||
"click",
|
||||
"keyEvent",
|
||||
"triggerEvent",
|
||||
"find",
|
||||
"findWithAssert",
|
||||
"wait",
|
||||
"DS",
|
||||
"andThen",
|
||||
"currentURL",
|
||||
"currentPath",
|
||||
"currentRouteName",
|
||||
"expect",
|
||||
"fileUpload",
|
||||
"moment"
|
||||
],
|
||||
"mocha": true,
|
||||
"node": false,
|
||||
"browser": false,
|
||||
"boss": true,
|
||||
"curly": false,
|
||||
"debug": false,
|
||||
"devel": false,
|
||||
"eqeqeq": true,
|
||||
"evil": true,
|
||||
"expr": true,
|
||||
"forin": false,
|
||||
"immed": false,
|
||||
"laxbreak": false,
|
||||
"newcap": true,
|
||||
"noarg": true,
|
||||
"noempty": false,
|
||||
"nonew": false,
|
||||
"nomen": false,
|
||||
"onevar": false,
|
||||
"plusplus": false,
|
||||
"regexp": false,
|
||||
"undef": true,
|
||||
"sub": true,
|
||||
"strict": false,
|
||||
"white": false,
|
||||
"eqnull": true,
|
||||
"esversion": 6
|
||||
}
|
@ -5,12 +5,12 @@ import {
|
||||
beforeEach,
|
||||
afterEach
|
||||
} from 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import {expect} from 'chai';
|
||||
import $ from 'jquery';
|
||||
import run from 'ember-runloop';
|
||||
import startApp from '../helpers/start-app';
|
||||
import destroyApp from '../helpers/destroy-app';
|
||||
import { authenticateSession, currentSession, invalidateSession } from 'ghost-admin/tests/helpers/ember-simple-auth';
|
||||
import {authenticateSession, invalidateSession} from 'ghost-admin/tests/helpers/ember-simple-auth';
|
||||
import Mirage from 'ember-cli-mirage';
|
||||
import windowProxy from 'ghost-admin/utils/window-proxy';
|
||||
import ghostPaths from 'ghost-admin/utils/ghost-paths';
|
||||
@ -38,7 +38,7 @@ describe('Acceptance: Authentication', function () {
|
||||
|
||||
server.loadFixtures();
|
||||
let role = server.create('role', {name: 'Administrator'});
|
||||
let user = server.create('user', {roles: [role], slug: 'test-user'});
|
||||
server.create('user', {roles: [role], slug: 'test-user'});
|
||||
});
|
||||
|
||||
afterEach(function () {
|
||||
@ -47,7 +47,7 @@ describe('Acceptance: Authentication', function () {
|
||||
|
||||
it('invalidates session on 401 API response', function () {
|
||||
// return a 401 when attempting to retrieve users
|
||||
server.get('/users/', (db, request) => {
|
||||
server.get('/users/', () => {
|
||||
return new Mirage.Response(401, {}, {
|
||||
errors: [
|
||||
{message: 'Access denied.', errorType: 'UnauthorizedError'}
|
||||
@ -106,7 +106,7 @@ describe('Acceptance: Authentication', function () {
|
||||
|
||||
it('displays re-auth modal attempting to save with invalid session', function () {
|
||||
let role = server.create('role', {name: 'Administrator'});
|
||||
let user = server.create('user', {roles: [role]});
|
||||
server.create('user', {roles: [role]});
|
||||
|
||||
// simulate an invalid session when saving the edited post
|
||||
server.put('/posts/:id/', (db, request) => {
|
||||
@ -162,20 +162,20 @@ describe('Acceptance: Authentication', function () {
|
||||
|
||||
it('adds auth headers to jquery ajax', function (done) {
|
||||
let role = server.create('role', {name: 'Administrator'});
|
||||
let user = server.create('user', {roles: [role]});
|
||||
server.create('user', {roles: [role]});
|
||||
|
||||
server.post('/uploads', (db, request) => {
|
||||
return request;
|
||||
});
|
||||
server.loadFixtures();
|
||||
|
||||
// jscs:disable requireCamelCaseOrUpperCaseIdentifiers
|
||||
/* eslint-disable camelcase */
|
||||
authenticateSession(application, {
|
||||
access_token: 'test_token',
|
||||
expires_in: 3600,
|
||||
token_type: 'Bearer'
|
||||
});
|
||||
// jscs:enable requireCamelCaseOrUpperCaseIdentifiers
|
||||
/* eslint-enable camelcase */
|
||||
|
||||
// necessary to visit a page to fully boot the app in testing
|
||||
visit('/').andThen(() => {
|
||||
|
@ -5,10 +5,10 @@ import {
|
||||
beforeEach,
|
||||
afterEach
|
||||
} from 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import {expect} from 'chai';
|
||||
import startApp from '../helpers/start-app';
|
||||
import destroyApp from '../helpers/destroy-app';
|
||||
import { invalidateSession, authenticateSession } from 'ghost-admin/tests/helpers/ember-simple-auth';
|
||||
import {invalidateSession, authenticateSession} from 'ghost-admin/tests/helpers/ember-simple-auth';
|
||||
import Mirage from 'ember-cli-mirage';
|
||||
import sinon from 'sinon';
|
||||
|
||||
@ -36,7 +36,7 @@ describe('Acceptance: Editor', function() {
|
||||
|
||||
it('does not redirect to team page when authenticated as author', function () {
|
||||
let role = server.create('role', {name: 'Author'});
|
||||
let user = server.create('user', {roles: [role], slug: 'test-user'});
|
||||
server.create('user', {roles: [role], slug: 'test-user'});
|
||||
server.create('post');
|
||||
|
||||
authenticateSession(application);
|
||||
@ -49,7 +49,7 @@ describe('Acceptance: Editor', function() {
|
||||
|
||||
it('does not redirect to team page when authenticated as editor', function () {
|
||||
let role = server.create('role', {name: 'Editor'});
|
||||
let user = server.create('user', {roles: [role], slug: 'test-user'});
|
||||
server.create('user', {roles: [role], slug: 'test-user'});
|
||||
server.create('post');
|
||||
|
||||
authenticateSession(application);
|
||||
@ -62,7 +62,7 @@ describe('Acceptance: Editor', function() {
|
||||
|
||||
it('displays 404 when post does not exist', function () {
|
||||
let role = server.create('role', {name: 'Editor'});
|
||||
let user = server.create('user', {roles: [role], slug: 'test-user'});
|
||||
server.create('user', {roles: [role], slug: 'test-user'});
|
||||
|
||||
authenticateSession(application);
|
||||
visit('/editor/1');
|
||||
@ -77,7 +77,7 @@ describe('Acceptance: Editor', function() {
|
||||
|
||||
beforeEach(function () {
|
||||
let role = server.create('role', {name: 'Administrator'});
|
||||
let user = server.create('user', {roles: [role]});
|
||||
server.create('user', {roles: [role]});
|
||||
|
||||
server.loadFixtures();
|
||||
|
||||
@ -85,7 +85,7 @@ describe('Acceptance: Editor', function() {
|
||||
});
|
||||
|
||||
it('renders the editor correctly, PSM Publish Date and Save Button', function () {
|
||||
let posts = server.createList('post', 2);
|
||||
server.createList('post', 2);
|
||||
let plusTenMinPacific = moment().tz('Pacific/Kwajalein').add(10, 'minutes').format('DD MMM YY @ HH:mm').toString();
|
||||
let plusTwoMinPacific = moment().tz('Pacific/Kwajalein').add(2, 'minutes').format('DD MMM YY @ HH:mm').toString();
|
||||
|
||||
@ -392,7 +392,7 @@ describe('Acceptance: Editor', function() {
|
||||
});
|
||||
|
||||
it('handles title validation errors correctly', function () {
|
||||
let post = server.createList('post', 1);
|
||||
server.createList('post', 1);
|
||||
|
||||
// post id 1 is a draft, checking for draft behaviour now
|
||||
visit('/editor/1');
|
||||
@ -421,11 +421,11 @@ describe('Acceptance: Editor', function() {
|
||||
});
|
||||
|
||||
it('renders first countdown notification before scheduled time', function () {
|
||||
/* jscs:disable requireCamelCaseOrUpperCaseIdentifiers */
|
||||
/* eslint-disable camelcase */
|
||||
let clock = sinon.useFakeTimers(moment().valueOf());
|
||||
let post = server.create('post', {published_at: moment.utc().add(4, 'minutes'), status: 'scheduled'});
|
||||
let compareDate = moment().tz('Etc/UTC').add(4, 'minutes').format('DD MMM YY @ HH:mm').toString();
|
||||
let settings = server.create('setting', {activeTimezone: 'Europe/Dublin'});
|
||||
server.create('post', {published_at: moment.utc().add(4, 'minutes'), status: 'scheduled'});
|
||||
server.create('setting', {activeTimezone: 'Europe/Dublin'});
|
||||
|
||||
visit('/editor/1');
|
||||
|
||||
@ -451,11 +451,10 @@ describe('Acceptance: Editor', function() {
|
||||
});
|
||||
|
||||
it('only shows option to unschedule post 2 minutes before scheduled time', function () {
|
||||
/* jscs:disable requireCamelCaseOrUpperCaseIdentifiers */
|
||||
/* eslint-disable camelcase */
|
||||
let clock = sinon.useFakeTimers(moment().valueOf());
|
||||
let post = server.create('post', {published_at: moment.utc().add(2, 'minutes'), status: 'scheduled'});
|
||||
let compareDate = moment().tz('Europe/Dublin').add(2, 'minutes').format('DD MMM YY @ HH:mm').toString();
|
||||
let settings = server.create('setting', {activeTimezone: 'Europe/Dublin'});
|
||||
server.create('post', {published_at: moment.utc().add(2, 'minutes'), status: 'scheduled'});
|
||||
server.create('setting', {activeTimezone: 'Europe/Dublin'});
|
||||
|
||||
visit('/editor/1');
|
||||
|
||||
@ -475,11 +474,10 @@ describe('Acceptance: Editor', function() {
|
||||
});
|
||||
|
||||
it.skip('lets user unschedule the post shortly before scheduled date', function () {
|
||||
/* jscs:disable requireCamelCaseOrUpperCaseIdentifiers */
|
||||
/* eslint-disable camelcase */
|
||||
let clock = sinon.useFakeTimers(moment().valueOf());
|
||||
let post = server.create('post', {published_at: moment.utc().add(1, 'minute'), status: 'scheduled'});
|
||||
let compareDate = moment().tz('Europe/Dublin').add(1, 'minute').format('DD MMM YY @ HH:mm').toString();
|
||||
let settings = server.create('setting', {activeTimezone: 'Europe/Dublin'});
|
||||
server.create('post', {published_at: moment.utc().add(1, 'minute'), status: 'scheduled'});
|
||||
server.create('setting', {activeTimezone: 'Europe/Dublin'});
|
||||
|
||||
visit('/editor/1');
|
||||
|
||||
|
@ -5,10 +5,10 @@ import {
|
||||
beforeEach,
|
||||
afterEach
|
||||
} from 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import {expect} from 'chai';
|
||||
import startApp from '../helpers/start-app';
|
||||
import destroyApp from '../helpers/destroy-app';
|
||||
import { authenticateSession } from 'ghost-admin/tests/helpers/ember-simple-auth';
|
||||
import {authenticateSession} from 'ghost-admin/tests/helpers/ember-simple-auth';
|
||||
|
||||
const originalAgent = window.navigator.userAgent;
|
||||
|
||||
@ -47,7 +47,7 @@ describe('Acceptance: Ghost Desktop', function() {
|
||||
describe('update alerts for broken versions', function () {
|
||||
beforeEach(function() {
|
||||
let role = server.create('role', {name: 'Administrator'});
|
||||
let user = server.create('user', {roles: [role]});
|
||||
server.create('user', {roles: [role]});
|
||||
|
||||
server.loadFixtures();
|
||||
|
||||
|
@ -5,7 +5,7 @@ import {
|
||||
beforeEach,
|
||||
afterEach
|
||||
} from 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import {expect} from 'chai';
|
||||
import startApp from '../helpers/start-app';
|
||||
import destroyApp from '../helpers/destroy-app';
|
||||
|
||||
|
@ -1,16 +1,16 @@
|
||||
/* jshint expr:true */
|
||||
/* jscs:disable requireCamelCaseOrUpperCaseIdentifiers */
|
||||
/* eslint-disable camelcase */
|
||||
import {
|
||||
describe,
|
||||
it,
|
||||
beforeEach,
|
||||
afterEach
|
||||
} from 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import {expect} from 'chai';
|
||||
import startApp from '../../helpers/start-app';
|
||||
import destroyApp from '../../helpers/destroy-app';
|
||||
import { invalidateSession, authenticateSession } from 'ghost-admin/tests/helpers/ember-simple-auth';
|
||||
import { errorOverride, errorReset } from 'ghost-admin/tests/helpers/adapter-error';
|
||||
import {authenticateSession} from 'ghost-admin/tests/helpers/ember-simple-auth';
|
||||
import {errorOverride, errorReset} from 'ghost-admin/tests/helpers/adapter-error';
|
||||
import Mirage from 'ember-cli-mirage';
|
||||
|
||||
describe('Acceptance: Posts - Post', function() {
|
||||
@ -27,7 +27,7 @@ describe('Acceptance: Posts - Post', function() {
|
||||
describe('when logged in', function () {
|
||||
beforeEach(function () {
|
||||
let role = server.create('role', {name: 'Administrator'});
|
||||
let user = server.create('user', {roles: [role]});
|
||||
server.create('user', {roles: [role]});
|
||||
|
||||
// load the settings fixtures
|
||||
// TODO: this should always be run for acceptance tests
|
||||
|
@ -5,11 +5,10 @@ import {
|
||||
beforeEach,
|
||||
afterEach
|
||||
} from 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import run from 'ember-runloop';
|
||||
import {expect} from 'chai';
|
||||
import startApp from '../../helpers/start-app';
|
||||
import destroyApp from '../../helpers/destroy-app';
|
||||
import { invalidateSession, authenticateSession } from 'ghost-admin/tests/helpers/ember-simple-auth';
|
||||
import {invalidateSession, authenticateSession} from 'ghost-admin/tests/helpers/ember-simple-auth';
|
||||
|
||||
describe('Acceptance: Settings - Apps', function () {
|
||||
let application;
|
||||
@ -33,7 +32,7 @@ describe('Acceptance: Settings - Apps', function () {
|
||||
|
||||
it('redirects to team page when authenticated as author', function () {
|
||||
let role = server.create('role', {name: 'Author'});
|
||||
let user = server.create('user', {roles: [role], slug: 'test-user'});
|
||||
server.create('user', {roles: [role], slug: 'test-user'});
|
||||
|
||||
authenticateSession(application);
|
||||
visit('/settings/apps');
|
||||
@ -45,7 +44,7 @@ describe('Acceptance: Settings - Apps', function () {
|
||||
|
||||
it('redirects to team page when authenticated as editor', function () {
|
||||
let role = server.create('role', {name: 'Editor'});
|
||||
let user = server.create('user', {roles: [role], slug: 'test-user'});
|
||||
server.create('user', {roles: [role], slug: 'test-user'});
|
||||
|
||||
authenticateSession(application);
|
||||
visit('/settings/apps');
|
||||
@ -58,7 +57,7 @@ describe('Acceptance: Settings - Apps', function () {
|
||||
describe('when logged in', function () {
|
||||
beforeEach(function () {
|
||||
let role = server.create('role', {name: 'Administrator'});
|
||||
let user = server.create('user', {roles: [role]});
|
||||
server.create('user', {roles: [role]});
|
||||
|
||||
server.loadFixtures();
|
||||
|
||||
|
@ -5,11 +5,11 @@ import {
|
||||
beforeEach,
|
||||
afterEach
|
||||
} from 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import {expect} from 'chai';
|
||||
import $ from 'jquery';
|
||||
import startApp from '../../helpers/start-app';
|
||||
import destroyApp from '../../helpers/destroy-app';
|
||||
import { invalidateSession, authenticateSession } from 'ghost-admin/tests/helpers/ember-simple-auth';
|
||||
import {invalidateSession, authenticateSession} from 'ghost-admin/tests/helpers/ember-simple-auth';
|
||||
|
||||
describe('Acceptance: Settings - Code-Injection', function() {
|
||||
let application;
|
||||
@ -33,7 +33,7 @@ describe('Acceptance: Settings - Code-Injection', function() {
|
||||
|
||||
it('redirects to team page when authenticated as author', function () {
|
||||
let role = server.create('role', {name: 'Author'});
|
||||
let user = server.create('user', {roles: [role], slug: 'test-user'});
|
||||
server.create('user', {roles: [role], slug: 'test-user'});
|
||||
|
||||
authenticateSession(application);
|
||||
visit('/settings/code-injection');
|
||||
@ -45,7 +45,7 @@ describe('Acceptance: Settings - Code-Injection', function() {
|
||||
|
||||
it('redirects to team page when authenticated as editor', function () {
|
||||
let role = server.create('role', {name: 'Editor'});
|
||||
let user = server.create('user', {roles: [role], slug: 'test-user'});
|
||||
server.create('user', {roles: [role], slug: 'test-user'});
|
||||
|
||||
authenticateSession(application);
|
||||
visit('/settings/code-injection');
|
||||
@ -58,7 +58,7 @@ describe('Acceptance: Settings - Code-Injection', function() {
|
||||
describe('when logged in', function () {
|
||||
beforeEach(function () {
|
||||
let role = server.create('role', {name: 'Administrator'});
|
||||
let user = server.create('user', {roles: [role]});
|
||||
server.create('user', {roles: [role]});
|
||||
|
||||
server.loadFixtures();
|
||||
|
||||
|
@ -5,12 +5,11 @@ import {
|
||||
beforeEach,
|
||||
afterEach
|
||||
} from 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import {expect} from 'chai';
|
||||
import $ from 'jquery';
|
||||
import run from 'ember-runloop';
|
||||
import startApp from '../../helpers/start-app';
|
||||
import destroyApp from '../../helpers/destroy-app';
|
||||
import { invalidateSession, authenticateSession } from 'ghost-admin/tests/helpers/ember-simple-auth';
|
||||
import {invalidateSession, authenticateSession} from 'ghost-admin/tests/helpers/ember-simple-auth';
|
||||
import Mirage from 'ember-cli-mirage';
|
||||
import mockThemes from 'ghost-admin/mirage/config/themes';
|
||||
|
||||
@ -36,7 +35,7 @@ describe('Acceptance: Settings - General', function () {
|
||||
|
||||
it('redirects to team page when authenticated as author', function () {
|
||||
let role = server.create('role', {name: 'Author'});
|
||||
let user = server.create('user', {roles: [role], slug: 'test-user'});
|
||||
server.create('user', {roles: [role], slug: 'test-user'});
|
||||
|
||||
authenticateSession(application);
|
||||
visit('/settings/general');
|
||||
@ -48,7 +47,7 @@ describe('Acceptance: Settings - General', function () {
|
||||
|
||||
it('redirects to team page when authenticated as editor', function () {
|
||||
let role = server.create('role', {name: 'Editor'});
|
||||
let user = server.create('user', {roles: [role], slug: 'test-user'});
|
||||
server.create('user', {roles: [role], slug: 'test-user'});
|
||||
|
||||
authenticateSession(application);
|
||||
visit('/settings/general');
|
||||
@ -61,7 +60,7 @@ describe('Acceptance: Settings - General', function () {
|
||||
describe('when logged in', function () {
|
||||
beforeEach(function () {
|
||||
let role = server.create('role', {name: 'Administrator'});
|
||||
let user = server.create('user', {roles: [role]});
|
||||
server.create('user', {roles: [role]});
|
||||
|
||||
server.loadFixtures();
|
||||
|
||||
|
@ -5,11 +5,11 @@ import {
|
||||
beforeEach,
|
||||
afterEach
|
||||
} from 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import {expect} from 'chai';
|
||||
import $ from 'jquery';
|
||||
import startApp from '../../helpers/start-app';
|
||||
import destroyApp from '../../helpers/destroy-app';
|
||||
import { invalidateSession, authenticateSession } from 'ghost-admin/tests/helpers/ember-simple-auth';
|
||||
import {invalidateSession, authenticateSession} from 'ghost-admin/tests/helpers/ember-simple-auth';
|
||||
|
||||
describe('Acceptance: Settings - Labs', function() {
|
||||
let application;
|
||||
@ -33,7 +33,7 @@ describe('Acceptance: Settings - Labs', function() {
|
||||
|
||||
it('redirects to team page when authenticated as author', function () {
|
||||
let role = server.create('role', {name: 'Author'});
|
||||
let user = server.create('user', {roles: [role], slug: 'test-user'});
|
||||
server.create('user', {roles: [role], slug: 'test-user'});
|
||||
|
||||
authenticateSession(application);
|
||||
visit('/settings/labs');
|
||||
@ -45,7 +45,7 @@ describe('Acceptance: Settings - Labs', function() {
|
||||
|
||||
it('redirects to team page when authenticated as editor', function () {
|
||||
let role = server.create('role', {name: 'Editor'});
|
||||
let user = server.create('user', {roles: [role], slug: 'test-user'});
|
||||
server.create('user', {roles: [role], slug: 'test-user'});
|
||||
|
||||
authenticateSession(application);
|
||||
visit('/settings/labs');
|
||||
@ -58,7 +58,7 @@ describe('Acceptance: Settings - Labs', function() {
|
||||
describe('when logged in', function () {
|
||||
beforeEach(function () {
|
||||
let role = server.create('role', {name: 'Administrator'});
|
||||
let user = server.create('user', {roles: [role]});
|
||||
server.create('user', {roles: [role]});
|
||||
|
||||
server.loadFixtures();
|
||||
|
||||
|
@ -1,15 +1,15 @@
|
||||
/* jshint expr:true */
|
||||
/* jscs:disable requireCamelCaseOrUpperCaseIdentifiers */
|
||||
/* eslint-disable camelcase */
|
||||
import {
|
||||
describe,
|
||||
it,
|
||||
beforeEach,
|
||||
afterEach
|
||||
} from 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import {expect} from 'chai';
|
||||
import startApp from '../../helpers/start-app';
|
||||
import destroyApp from '../../helpers/destroy-app';
|
||||
import { invalidateSession, authenticateSession } from 'ghost-admin/tests/helpers/ember-simple-auth';
|
||||
import {invalidateSession, authenticateSession} from 'ghost-admin/tests/helpers/ember-simple-auth';
|
||||
|
||||
describe('Acceptance: Settings - Navigation', function () {
|
||||
let application;
|
||||
@ -33,7 +33,7 @@ describe('Acceptance: Settings - Navigation', function () {
|
||||
|
||||
it('redirects to team page when authenticated as author', function () {
|
||||
let role = server.create('role', {name: 'Author'});
|
||||
let user = server.create('user', {roles: [role], slug: 'test-user'});
|
||||
server.create('user', {roles: [role], slug: 'test-user'});
|
||||
|
||||
authenticateSession(application);
|
||||
visit('/settings/navigation');
|
||||
@ -46,7 +46,7 @@ describe('Acceptance: Settings - Navigation', function () {
|
||||
describe('when logged in', function () {
|
||||
beforeEach(function () {
|
||||
let role = server.create('role', {name: 'Administrator'});
|
||||
let user = server.create('user', {roles: [role]});
|
||||
server.create('user', {roles: [role]});
|
||||
|
||||
// load the settings fixtures
|
||||
// TODO: this should always be run for acceptance tests
|
||||
|
@ -5,12 +5,11 @@ import {
|
||||
beforeEach,
|
||||
afterEach
|
||||
} from 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import run from 'ember-runloop';
|
||||
import {expect} from 'chai';
|
||||
import startApp from '../../helpers/start-app';
|
||||
import destroyApp from '../../helpers/destroy-app';
|
||||
import Mirage from 'ember-cli-mirage';
|
||||
import { invalidateSession, authenticateSession } from 'ghost-admin/tests/helpers/ember-simple-auth';
|
||||
import {invalidateSession, authenticateSession} from 'ghost-admin/tests/helpers/ember-simple-auth';
|
||||
|
||||
describe('Acceptance: Settings - Apps - Slack', function () {
|
||||
let application;
|
||||
@ -34,7 +33,7 @@ describe('Acceptance: Settings - Apps - Slack', function () {
|
||||
|
||||
it('redirects to team page when authenticated as author', function () {
|
||||
let role = server.create('role', {name: 'Author'});
|
||||
let user = server.create('user', {roles: [role], slug: 'test-user'});
|
||||
server.create('user', {roles: [role], slug: 'test-user'});
|
||||
|
||||
authenticateSession(application);
|
||||
visit('/settings/apps/slack');
|
||||
@ -46,7 +45,7 @@ describe('Acceptance: Settings - Apps - Slack', function () {
|
||||
|
||||
it('redirects to team page when authenticated as editor', function () {
|
||||
let role = server.create('role', {name: 'Editor'});
|
||||
let user = server.create('user', {roles: [role], slug: 'test-user'});
|
||||
server.create('user', {roles: [role], slug: 'test-user'});
|
||||
|
||||
authenticateSession(application);
|
||||
visit('/settings/apps/slack');
|
||||
@ -59,7 +58,7 @@ describe('Acceptance: Settings - Apps - Slack', function () {
|
||||
describe('when logged in', function () {
|
||||
beforeEach(function () {
|
||||
let role = server.create('role', {name: 'Administrator'});
|
||||
let user = server.create('user', {roles: [role]});
|
||||
server.create('user', {roles: [role]});
|
||||
|
||||
server.loadFixtures();
|
||||
|
||||
@ -93,7 +92,7 @@ describe('Acceptance: Settings - Apps - Slack', function () {
|
||||
});
|
||||
|
||||
andThen(() => {
|
||||
server.put('/settings/', function (db, request) {
|
||||
server.put('/settings/', function () {
|
||||
return new Mirage.Response(402, {}, {
|
||||
errors: [
|
||||
{
|
||||
|
@ -1,18 +1,18 @@
|
||||
/* jshint expr:true */
|
||||
/* jscs:disable requireCamelCaseOrUpperCaseIdentifiers */
|
||||
/* eslint-disable camelcase */
|
||||
import {
|
||||
describe,
|
||||
it,
|
||||
beforeEach,
|
||||
afterEach
|
||||
} from 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import {expect} from 'chai';
|
||||
import $ from 'jquery';
|
||||
import run from 'ember-runloop';
|
||||
import startApp from '../../helpers/start-app';
|
||||
import destroyApp from '../../helpers/destroy-app';
|
||||
import { invalidateSession, authenticateSession } from 'ghost-admin/tests/helpers/ember-simple-auth';
|
||||
import { errorOverride, errorReset } from 'ghost-admin/tests/helpers/adapter-error';
|
||||
import {invalidateSession, authenticateSession} from 'ghost-admin/tests/helpers/ember-simple-auth';
|
||||
import {errorOverride, errorReset} from 'ghost-admin/tests/helpers/adapter-error';
|
||||
import Mirage from 'ember-cli-mirage';
|
||||
|
||||
// Grabbed from keymaster's testing code because Ember's `keyEvent` helper
|
||||
@ -64,7 +64,7 @@ describe('Acceptance: Settings - Tags', function () {
|
||||
|
||||
it('redirects to team page when authenticated as author', function () {
|
||||
let role = server.create('role', {name: 'Author'});
|
||||
let user = server.create('user', {roles: [role], slug: 'test-user'});
|
||||
server.create('user', {roles: [role], slug: 'test-user'});
|
||||
|
||||
authenticateSession(application);
|
||||
visit('/settings/navigation');
|
||||
@ -77,7 +77,7 @@ describe('Acceptance: Settings - Tags', function () {
|
||||
describe('when logged in', function () {
|
||||
beforeEach(function () {
|
||||
let role = server.create('role', {name: 'Administrator'});
|
||||
let user = server.create('user', {roles: [role]});
|
||||
server.create('user', {roles: [role]});
|
||||
|
||||
// load the settings fixtures
|
||||
// TODO: this should always be run for acceptance tests
|
||||
|
@ -1,18 +1,16 @@
|
||||
/* jshint expr:true */
|
||||
import Ember from 'ember';
|
||||
import {
|
||||
describe,
|
||||
it,
|
||||
beforeEach,
|
||||
afterEach
|
||||
} from 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import {expect} from 'chai';
|
||||
import startApp from '../helpers/start-app';
|
||||
import destroyApp from '../helpers/destroy-app';
|
||||
import { invalidateSession, authenticateSession } from '../helpers/ember-simple-auth';
|
||||
import { enableGhostOAuth } from '../helpers/configuration';
|
||||
import {invalidateSession, authenticateSession} from '../helpers/ember-simple-auth';
|
||||
import {enableGhostOAuth} from '../helpers/configuration';
|
||||
import Mirage from 'ember-cli-mirage';
|
||||
import $ from 'jquery';
|
||||
import {
|
||||
stubSuccessfulOAuthConnect,
|
||||
stubFailedOAuthConnect
|
||||
@ -31,7 +29,7 @@ describe('Acceptance: Setup', function () {
|
||||
|
||||
it('redirects if already authenticated', function () {
|
||||
let role = server.create('role', {name: 'Author'});
|
||||
let user = server.create('user', {roles: [role], slug: 'test-user'});
|
||||
server.create('user', {roles: [role], slug: 'test-user'});
|
||||
|
||||
authenticateSession(application);
|
||||
|
||||
@ -296,7 +294,7 @@ describe('Acceptance: Setup', function () {
|
||||
}
|
||||
|
||||
// TODO: duplicated from mirage/config/invites - extract method?
|
||||
/* jscs:disable requireCamelCaseOrUpperCaseIdentifiers */
|
||||
/* eslint-disable camelcase */
|
||||
params.token = `${db.invites.length}-token`;
|
||||
params.expires = moment.utc().add(1, 'day').unix();
|
||||
params.created_at = moment.utc().format();
|
||||
@ -304,7 +302,7 @@ describe('Acceptance: Setup', function () {
|
||||
params.updated_at = moment.utc().format();
|
||||
params.updated_by = 1;
|
||||
params.status = 'sent';
|
||||
/* jscs:enable requireCamelCaseOrUpperCaseIdentifiers */
|
||||
/* eslint-enable camelcase */
|
||||
|
||||
// valid
|
||||
invite = db.invites.insert(params);
|
||||
|
@ -5,12 +5,12 @@ import {
|
||||
beforeEach,
|
||||
afterEach
|
||||
} from 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import {expect} from 'chai';
|
||||
import $ from 'jquery';
|
||||
import startApp from '../helpers/start-app';
|
||||
import destroyApp from '../helpers/destroy-app';
|
||||
import { invalidateSession, authenticateSession } from '../helpers/ember-simple-auth';
|
||||
import { enableGhostOAuth } from '../helpers/configuration';
|
||||
import {invalidateSession, authenticateSession} from '../helpers/ember-simple-auth';
|
||||
import {enableGhostOAuth} from '../helpers/configuration';
|
||||
import Mirage from 'ember-cli-mirage';
|
||||
import {
|
||||
stubSuccessfulOAuthConnect,
|
||||
@ -30,7 +30,7 @@ describe('Acceptance: Signin', function() {
|
||||
|
||||
it('redirects if already authenticated', function () {
|
||||
let role = server.create('role', {name: 'Author'});
|
||||
let user = server.create('user', {roles: [role], slug: 'test-user'});
|
||||
server.create('user', {roles: [role], slug: 'test-user'});
|
||||
|
||||
authenticateSession(application);
|
||||
|
||||
@ -43,10 +43,10 @@ describe('Acceptance: Signin', function() {
|
||||
describe('when attempting to signin', function () {
|
||||
beforeEach(function () {
|
||||
let role = server.create('role', {name: 'Administrator'});
|
||||
let user = server.create('user', {roles: [role], slug: 'test-user'});
|
||||
server.create('user', {roles: [role], slug: 'test-user'});
|
||||
|
||||
server.post('/authentication/token', function (db, request) {
|
||||
// jscs:disable requireCamelCaseOrUpperCaseIdentifiers
|
||||
/* eslint-disable camelcase */
|
||||
let {
|
||||
grant_type: grantType,
|
||||
username,
|
||||
@ -73,7 +73,7 @@ describe('Acceptance: Signin', function() {
|
||||
}]
|
||||
});
|
||||
}
|
||||
// jscs:enable requireCamelCaseOrUpperCaseIdentifiers
|
||||
/* eslint-enable camelcase */
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -5,11 +5,10 @@ import {
|
||||
beforeEach,
|
||||
afterEach
|
||||
} from 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import {expect} from 'chai';
|
||||
import startApp from '../helpers/start-app';
|
||||
import destroyApp from '../helpers/destroy-app';
|
||||
import $ from 'jquery';
|
||||
import { enableGhostOAuth } from '../helpers/configuration';
|
||||
import {enableGhostOAuth} from '../helpers/configuration';
|
||||
import {
|
||||
stubSuccessfulOAuthConnect,
|
||||
stubFailedOAuthConnect
|
||||
@ -29,7 +28,7 @@ describe('Acceptance: Signup', function() {
|
||||
});
|
||||
|
||||
it('can signup successfully', function() {
|
||||
server.get('/authentication/invitation', function (db, request) {
|
||||
server.get('/authentication/invitation', function () {
|
||||
return {
|
||||
invitation: [{valid: true}]
|
||||
};
|
||||
@ -151,12 +150,12 @@ describe('Acceptance: Signup', function() {
|
||||
|
||||
let user = server.create('user', {name: 'Test Invite Creator'});
|
||||
|
||||
/* jscs:disable requireCamelCaseOrUpperCaseIdentifiers */
|
||||
/* eslint-disable camelcase */
|
||||
server.create('invite', {
|
||||
email: 'kevin+test2@ghost.org',
|
||||
created_by: user.id
|
||||
});
|
||||
/* jscs:enable requireCamelCaseOrUpperCaseIdentifiers */
|
||||
/* eslint-enable camelcase */
|
||||
});
|
||||
|
||||
it('can sign up sucessfully', function () {
|
||||
|
@ -5,10 +5,10 @@ import {
|
||||
beforeEach,
|
||||
afterEach
|
||||
} from 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import {expect} from 'chai';
|
||||
import startApp from '../helpers/start-app';
|
||||
import destroyApp from '../helpers/destroy-app';
|
||||
import { invalidateSession, authenticateSession } from 'ghost-admin/tests/helpers/ember-simple-auth';
|
||||
import {invalidateSession, authenticateSession} from 'ghost-admin/tests/helpers/ember-simple-auth';
|
||||
|
||||
describe('Acceptance: Subscribers', function() {
|
||||
let application;
|
||||
@ -32,7 +32,7 @@ describe('Acceptance: Subscribers', function() {
|
||||
|
||||
it('redirects editors to posts', function () {
|
||||
let role = server.create('role', {name: 'Editor'});
|
||||
let user = server.create('user', {roles: [role]});
|
||||
server.create('user', {roles: [role]});
|
||||
|
||||
authenticateSession(application);
|
||||
visit('/subscribers');
|
||||
@ -46,7 +46,7 @@ describe('Acceptance: Subscribers', function() {
|
||||
|
||||
it('redirects authors to posts', function () {
|
||||
let role = server.create('role', {name: 'Author'});
|
||||
let user = server.create('user', {roles: [role]});
|
||||
server.create('user', {roles: [role]});
|
||||
|
||||
authenticateSession(application);
|
||||
visit('/subscribers');
|
||||
@ -61,7 +61,7 @@ describe('Acceptance: Subscribers', function() {
|
||||
describe('an admin', function () {
|
||||
beforeEach(function () {
|
||||
let role = server.create('role', {name: 'Administrator'});
|
||||
let user = server.create('user', {roles: [role]});
|
||||
server.create('user', {roles: [role]});
|
||||
|
||||
server.loadFixtures();
|
||||
|
||||
|
@ -5,14 +5,13 @@ import {
|
||||
beforeEach,
|
||||
afterEach
|
||||
} from 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import {expect} from 'chai';
|
||||
import startApp from '../helpers/start-app';
|
||||
import destroyApp from '../helpers/destroy-app';
|
||||
import { invalidateSession, authenticateSession } from '../helpers/ember-simple-auth';
|
||||
import { errorOverride, errorReset } from '../helpers/adapter-error';
|
||||
import { enableGhostOAuth } from '../helpers/configuration';
|
||||
import {invalidateSession, authenticateSession} from '../helpers/ember-simple-auth';
|
||||
import {errorOverride, errorReset} from '../helpers/adapter-error';
|
||||
import {enableGhostOAuth} from '../helpers/configuration';
|
||||
import Mirage from 'ember-cli-mirage';
|
||||
import $ from 'jquery';
|
||||
|
||||
describe('Acceptance: Team', function () {
|
||||
let application;
|
||||
@ -36,7 +35,7 @@ describe('Acceptance: Team', function () {
|
||||
|
||||
it('redirects correctly when authenticated as author', function () {
|
||||
let role = server.create('role', {name: 'Author'});
|
||||
let user = server.create('user', {roles: [role], slug: 'test-user'});
|
||||
server.create('user', {roles: [role], slug: 'test-user'});
|
||||
|
||||
server.create('user', {slug: 'no-access'});
|
||||
|
||||
@ -50,7 +49,7 @@ describe('Acceptance: Team', function () {
|
||||
|
||||
it('redirects correctly when authenticated as editor', function () {
|
||||
let role = server.create('role', {name: 'Editor'});
|
||||
let user = server.create('user', {roles: [role], slug: 'test-user'});
|
||||
server.create('user', {roles: [role], slug: 'test-user'});
|
||||
|
||||
server.create('user', {slug: 'no-access'});
|
||||
|
||||
@ -75,7 +74,7 @@ describe('Acceptance: Team', function () {
|
||||
});
|
||||
|
||||
it('it renders and navigates correctly', function () {
|
||||
let user1 = server.create('user');
|
||||
server.create('user');
|
||||
let user2 = server.create('user');
|
||||
|
||||
visit('/team');
|
||||
@ -115,8 +114,6 @@ describe('Acceptance: Team', function () {
|
||||
});
|
||||
|
||||
it('can manage invites', function () {
|
||||
let emailInputField = '.fullscreen-modal input[name="email"]';
|
||||
|
||||
visit('/team');
|
||||
|
||||
andThen(() => {
|
||||
@ -354,11 +351,10 @@ describe('Acceptance: Team', function () {
|
||||
});
|
||||
|
||||
it('can delete users', function () {
|
||||
/* jscs:disable requireCamelCaseOrUpperCaseIdentifiers */
|
||||
let user1 = server.create('user');
|
||||
let user2 = server.create('user');
|
||||
let post1 = server.create('post', {author_id: user2.id});
|
||||
/* jscs:disable requireCamelCaseOrUpperCaseIdentifiers */
|
||||
// eslint-disable-next-line camelcase
|
||||
server.create('post', {author_id: user2.id});
|
||||
|
||||
visit('/team');
|
||||
click(`a.user-list-item:contains("${user1.name}")`);
|
||||
@ -691,11 +687,10 @@ describe('Acceptance: Team', function () {
|
||||
expect(lastRequest.url, 'password request URL')
|
||||
.to.match(/\/users\/password/);
|
||||
|
||||
/* jscs:disable requireCamelCaseOrUpperCaseIdentifiers */
|
||||
// eslint-disable-next-line camelcase
|
||||
expect(params.password[0].user_id).to.equal(user.id.toString());
|
||||
expect(params.password[0].newPassword).to.equal('password');
|
||||
expect(params.password[0].ne2Password).to.equal('password');
|
||||
/* jscs:enable requireCamelCaseOrUpperCaseIdentifiers */
|
||||
|
||||
// clears the fields
|
||||
expect(
|
||||
@ -814,12 +809,12 @@ describe('Acceptance: Team', function () {
|
||||
});
|
||||
|
||||
describe('when logged in as author', function () {
|
||||
let author, authorRole, adminRole;
|
||||
let adminRole, authorRole;
|
||||
|
||||
beforeEach(function () {
|
||||
adminRole = server.create('role', {name: 'Administrator'});
|
||||
authorRole = server.create('role', {name: 'Author'});
|
||||
author = server.create('user', {roles: [authorRole]});
|
||||
server.create('user', {roles: [authorRole]});
|
||||
|
||||
server.loadFixtures();
|
||||
|
||||
@ -836,8 +831,8 @@ describe('Acceptance: Team', function () {
|
||||
});
|
||||
|
||||
it('can access the team page', function () {
|
||||
let user1 = server.create('user', {roles: [adminRole]});
|
||||
let invite1 = server.create('invite', {roles: [authorRole]});
|
||||
server.create('user', {roles: [adminRole]});
|
||||
server.create('invite', {roles: [authorRole]});
|
||||
|
||||
errorOverride();
|
||||
|
||||
|
@ -5,10 +5,10 @@ import {
|
||||
beforeEach,
|
||||
afterEach
|
||||
} from 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import {expect} from 'chai';
|
||||
import startApp from '../helpers/start-app';
|
||||
import destroyApp from '../helpers/destroy-app';
|
||||
import { invalidateSession, authenticateSession } from 'ghost-admin/tests/helpers/ember-simple-auth';
|
||||
import {authenticateSession} from 'ghost-admin/tests/helpers/ember-simple-auth';
|
||||
import Mirage from 'ember-cli-mirage';
|
||||
|
||||
let versionMismatchResponse = function () {
|
||||
@ -34,7 +34,7 @@ describe('Acceptance: Version Mismatch', function() {
|
||||
describe('logged in', function () {
|
||||
beforeEach(function () {
|
||||
let role = server.create('role', {name: 'Administrator'});
|
||||
let user = server.create('user', {roles: [role]});
|
||||
server.create('user', {roles: [role]});
|
||||
|
||||
server.loadFixtures();
|
||||
|
||||
|
@ -7,8 +7,7 @@ import Test from 'ember-test';
|
||||
// ember-cli-shims doesn't export Logger
|
||||
const {Logger} = Ember;
|
||||
|
||||
let originalException;
|
||||
let originalLoggerError;
|
||||
let originalException, originalLoggerError;
|
||||
|
||||
export function errorOverride() {
|
||||
originalException = Test.adapter.exception;
|
||||
|
@ -16,6 +16,7 @@ export function createFile(content = ['test'], options = {}) {
|
||||
|
||||
export function fileUpload($element, content, options) {
|
||||
let file = createFile(content, options);
|
||||
// eslint-disable-next-line new-cap
|
||||
let event = $.Event('change', {
|
||||
testingFiles: [file]
|
||||
});
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* jscs:disable */
|
||||
import { module } from 'qunit';
|
||||
import {module} from 'qunit';
|
||||
import RSVP from 'rsvp';
|
||||
import startApp from '../helpers/start-app';
|
||||
import destroyApp from '../helpers/destroy-app';
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user