Commit cdb2262 Fernando Alvarez-Castellanos Rojo
authored
1 parent 865f149 commit cdb2262 Copy full SHA for cdb2262
File tree 1 file changed +12
-1
lines changed
user/user-tool-prefs/tool/src/webapp/js
1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -127,7 +127,7 @@ $(function () {
127
127
var confirmMsg = $ . trim ( $ ( '#reallyHideConfirm' ) . text ( ) ) ;
128
128
var checkedHiddenSites = $ ( '.site-hidden:checked' ) ;
129
129
130
- if ( clicked_button === 'hidden_sites_form:submit' && checkedHiddenSites . length > 0 && ! confirm ( confirmMsg ) ) {
130
+ if ( clicked_button === 'hidden_sites_form:submit' && checkedHiddenSites . length > 0 && wereFavoritesPreviously ( checkedHiddenSites ) && ! confirm ( confirmMsg ) ) {
131
131
return false ;
132
132
}
133
133
@@ -169,4 +169,15 @@ $(function () {
169
169
}
170
170
} ) ;
171
171
} ) ;
172
+
173
+ function wereFavoritesPreviously ( checkedSites ) {
174
+ let hasFavorites = 0 ;
175
+ checkedSites . each ( function ( ) {
176
+ if ( $ ( this ) . parent ( ) . hasClass ( 'favorite-site' ) && hiddenSites . indexOf ( $ ( this ) . data ( 'site-id' ) ) < 0 ) {
177
+ hasFavorites ++ ;
178
+ return false ;
179
+ }
180
+ } ) ;
181
+ return hasFavorites > 0 ;
182
+ }
172
183
} ) ;
You can’t perform that action at this time.
0 commit comments