File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -508,6 +508,13 @@ $(window).on('error', function () {
508508 // setNeedRefresh();
509509} )
510510
511+ //
512+ function checkParametr ( isLogin , permission ) {
513+ if ( typeof isLogin !== 'boolean' || ! permission ) {
514+ throw new Error ( 'one or more parametr is incorrect' )
515+ } else return allowVisibleSource ( isLogin , permission )
516+ }
517+
511518// replace url if user have not rights to veiw source code
512519function replaceUrl ( url ) {
513520 const urlHasEditOrBoth = / \? e d i t | \? b o t h / ;
@@ -2159,7 +2166,14 @@ socket.on('refresh', function (data) {
21592166 updateInfo ( data )
21602167 updatePermission ( data . permission )
21612168 currentPermission = data . permission
2162- if ( ui . toolbar . edit . data ( 'blockSource' ) ) { allowVisibleSource ( userIsLogin ( personalInfo ) , currentPermission ) }
2169+ // run allowVisebleSource functionality
2170+ if ( ui . toolbar . edit . data ( 'blockSource' ) ) {
2171+ try {
2172+ checkParametr ( userIsLogin ( personalInfo ) , currentPermission )
2173+ } catch ( error ) {
2174+ console . log ( error )
2175+ }
2176+ }
21632177 if ( ui . toolbar . edit . data ( 'blockSource' ) && blockSourceView ) { replaceUrl ( window . location . href ) }
21642178 if ( ! window . loaded ) {
21652179 // auto change mode if no content detected
You can’t perform that action at this time.
0 commit comments