This repository was archived by the owner on Jun 27, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +6
-11
lines changed Expand file tree Collapse file tree 3 files changed +6
-11
lines changed Original file line number Diff line number Diff line change @@ -21,19 +21,14 @@ module.exports = function (options = {}) { // eslint-disable-line no-unused-vars
21
21
try {
22
22
/* eslint no-use-before-define: 0 */ // --> OFF
23
23
const content = sanitizeHtml ( hook . data [ options . field ] , sanitizeOptions )
24
- . replace ( / \< b r \> | \< \/ b r \> | \< \/ b r \> | \< b r \> | \< b r \\ \> / ig, "\n" )
25
- . replace ( / \< p \> \< b r \> \< \/ p \> / ig, ' ' )
24
+ . replace ( / \< b r \s * \> | \< b r \s * \/ \> / ig, "\n" )
26
25
. replace ( / ( \ ) { 2 , } / ig, ' ' )
27
26
. trim ( ) ;
28
27
hook . data [ `${ options . field } Excerpt` ] = trunc ( content , options . length , {
29
28
ignoreTags : [ 'img' , 'script' , 'iframe' ]
30
29
} ) . html ;
31
30
} catch ( err ) {
32
- if ( hook . data . teaserImg ) {
33
- hook . data [ `${ options . field } Excerpt` ] = '-----' ;
34
- } else {
35
- throw new Error ( 'Text content needed!' ) ;
36
- }
31
+ throw new Error ( 'Text content needed!' ) ;
37
32
}
38
33
hook . data [ options . field ] = hook . data [ options . field ]
39
34
. replace ( / ( \ ) { 2 , } / ig, ' ' )
Original file line number Diff line number Diff line change 1
1
// Check if user is moderator
2
2
module . exports = ( ) => hook => {
3
- if ( ! hook . params || ! hook . params . user || ! [ 'admin' , 'moderator' ] . includes ( hook . params . user . role ) ) {
3
+ if ( ! hook . params || ! hook . params . user ) {
4
4
return false ;
5
5
}
6
- return true ;
6
+ return [ 'admin' , 'moderator' ] . includes ( hook . params . user . role ) ;
7
7
} ;
Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ module.exports = {
43
43
) ,
44
44
associateCurrentUser ( ) ,
45
45
createSlug ( { field : 'name' } ) ,
46
- createExcerpt ( { field : 'description ' } ) ,
46
+ createExcerpt ( { field : 'description' } ) ,
47
47
saveRemoteImages ( [ 'logo' , 'coverImg' ] )
48
48
] ,
49
49
update : [
@@ -56,7 +56,7 @@ module.exports = {
56
56
restrictToOwner ( )
57
57
) ,
58
58
createSlug ( { field : 'name' , overwrite : true } ) ,
59
- createExcerpt ( { field : 'description ' } ) ,
59
+ createExcerpt ( { field : 'description' } ) ,
60
60
saveRemoteImages ( [ 'logo' , 'coverImg' ] )
61
61
] ,
62
62
patch : [
You can’t perform that action at this time.
0 commit comments