File tree Expand file tree Collapse file tree 1 file changed +16
-6
lines changed Expand file tree Collapse file tree 1 file changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -838,19 +838,29 @@ class RoturExtension {
838
838
839
839
myFriends ( ) {
840
840
if ( ! ( this . authenticated && this . is_connected ) ) return [ "Not Authenticated" ] ;
841
- let keys = [ ] ;
842
- for ( let key of this . user [ "sys.friends" ] ) {
843
- keys . push ( key ) ;
841
+ let keys = this . user [ "sys.friends" ] ;
842
+ if ( typeof keys === "string" ) {
843
+ try {
844
+ keys = JSON . parse ( keys ) ;
845
+ } catch ( e ) {
846
+ console . error ( "Failed to parse friends list:" , e ) ;
847
+ return [ "Invalid Friends List" ] ;
848
+ }
844
849
}
845
850
if ( keys . length === 0 ) return [ "No Friends" ] ;
846
851
else return keys ;
847
852
}
848
853
849
854
myRequests ( ) {
850
855
if ( ! ( this . authenticated && this . is_connected ) ) return [ "Not Authenticated" ] ;
851
- let keys = [ ] ;
852
- for ( let key of this . user [ "sys.requests" ] ) {
853
- keys . push ( key ) ;
856
+ let keys = this . user [ "sys.requests" ] ;
857
+ if ( typeof keys === "string" ) {
858
+ try {
859
+ keys = JSON . parse ( keys ) ;
860
+ } catch ( e ) {
861
+ console . error ( "Failed to parse requests list:" , e ) ;
862
+ return [ "Invalid Requests List" ] ;
863
+ }
854
864
}
855
865
if ( keys . length === 0 ) return [ "No Requests" ] ;
856
866
else return keys ;
You can’t perform that action at this time.
0 commit comments