Ghost/ghost/admin/app/validators/slack-integration.js
Kevin Ansfield e74e2e039e Update code to match eslint rules
no issue
- switch `jscs` and `jshint` inline config to `eslint` config
- fix eslint errors, predominantly in tests where the config now the main app config more closely
2016-11-14 13:26:00 +00:00

24 lines
628 B
JavaScript

import BaseValidator from './base';
export default BaseValidator.create({
properties: ['url'],
url(model) {
let url = model.get('url');
let hasValidated = model.get('hasValidated');
let urlRegex = new RegExp(/(^https:\/\/hooks\.slack\.com\/services\/)(\S+)/);
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>'
);
this.invalidate();
}
hasValidated.addObject('url');
}
});