mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-29 15:12:58 +03:00
e74e2e039e
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
24 lines
628 B
JavaScript
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');
|
|
}
|
|
});
|