@@ -631,12 +631,20 @@ function b2f_new_event(e) { // incoming SSB log event: we get map with three ent
631631 if ( ! ( ch . timeline instanceof Timeline ) )
632632 ch . timeline = Timeline . fromJSON ( ch . timeline )
633633
634+ var ESID = encodeScuttlebuttId ( a [ 2 ] ) ;
635+ if ( ! ( ESID in tremola . contacts ) ) {
636+ var shortID = id2b32 ( ESID ) ;
637+ console . log ( "XX" , a [ 2 ] , ESID , shortID )
638+ tremola . contacts [ ESID ] = {
639+ "alias" : shortID , "initial" : shortID . substring ( 0 , 1 ) . toUpperCase ( ) ,
640+ "color" : colors [ Math . floor ( colors . length * Math . random ( ) ) ] ,
641+ "iam" : "" , "forgotten" : false
642+ }
643+ }
634644 // console.log("new post 1 ", ch)
635645 if ( ! ( e . header . ref in ch . posts ) ) { // new post
636- var a = e . confid ;
637-
638646 //get alias from fid
639- var alias = tremola . contacts [ encodeScuttlebuttId ( a [ 2 ] ) ] . alias ;
647+ var alias = tremola . contacts [ ESID ] . alias ;
640648 var p = {
641649 "key" : e . header . ref , "from" : e . header . fid , "body" : "Set contact: " + alias + "'s trust level to " + a [ 3 ] ,
642650 "when" : a [ 4 ] * 1000 , "prev" : a [ 1 ]
@@ -655,6 +663,8 @@ function b2f_new_event(e) { // incoming SSB log event: we get map with three ent
655663 }
656664 // if (curr_scenario == "chats") // the updated conversation could bubble up
657665 load_chat_list ( ) ;
666+ load_contact_list ( ) ;
667+ reloadChatTrustLevels ( ) ;
658668 }
659669 if ( a [ 0 ] == 'TAV' )
660670 rcpts = a [ 5 ] ;
@@ -744,10 +754,12 @@ function b2f_new_contact(fid, trustLevel="untrusted", alias="") {
744754 if ( alias == "" ) {
745755 alias = id2b32 ( fid ) ;
746756 }
747- tremola . contacts [ fid ] = {
748- "alias" : alias , "initial" : alias . substring ( 0 , 1 ) . toUpperCase ( ) ,
749- "color" : colors [ Math . floor ( colors . length * Math . random ( ) ) ] ,
750- "iam" : "" , "forgotten" : false , "trusted" : trusted
757+ if ( ! ( fid in tremola . contacts ) ) {
758+ tremola . contacts [ fid ] = {
759+ "alias" : alias , "initial" : alias . substring ( 0 , 1 ) . toUpperCase ( ) ,
760+ "color" : colors [ Math . floor ( colors . length * Math . random ( ) ) ] ,
761+ "iam" : "" , "forgotten" : false , "trusted" : trusted
762+ } ;
751763 } ;
752764 backend ( "contacts:checkDeleted " + decodeScuttlebuttId ( fid ) ) ;
753765 console . log ( tremola . contacts [ fid ] ) ;
0 commit comments