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 () {
508
508
// setNeedRefresh();
509
509
} )
510
510
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
+
511
518
// replace url if user have not rights to veiw source code
512
519
function replaceUrl ( url ) {
513
520
const urlHasEditOrBoth = / \? e d i t | \? b o t h / ;
@@ -2159,7 +2166,14 @@ socket.on('refresh', function (data) {
2159
2166
updateInfo ( data )
2160
2167
updatePermission ( data . permission )
2161
2168
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
+ }
2163
2177
if ( ui . toolbar . edit . data ( 'blockSource' ) && blockSourceView ) { replaceUrl ( window . location . href ) }
2164
2178
if ( ! window . loaded ) {
2165
2179
// auto change mode if no content detected
You can’t perform that action at this time.
0 commit comments