@@ -938,6 +938,11 @@ func (m *Messenger) handleAcceptContactRequestMessage(state *ReceivedMessageStat
938
938
}
939
939
state .Response .AddMessage (updateMessage )
940
940
941
+ err = chat .UpdateFromMessage (updateMessage , m .getTimesource ())
942
+ if err != nil {
943
+ return err
944
+ }
945
+ chat .UnviewedMessagesCount ++
941
946
state .Response .AddChat (chat )
942
947
state .AllChats .Store (chat .ID , chat )
943
948
}
@@ -974,7 +979,7 @@ func (m *Messenger) HandleAcceptContactRequest(state *ReceivedMessageState, mess
974
979
return nil
975
980
}
976
981
977
- func (m * Messenger ) handleRetractContactRequest (response * MessengerResponse , contact * Contact , message protobuf.RetractContactRequest ) error {
982
+ func (m * Messenger ) handleRetractContactRequest (state * ReceivedMessageState , contact * Contact , message protobuf.RetractContactRequest ) error {
978
983
if contact .ID == m .myHexIdentity () {
979
984
m .logger .Debug ("retraction coming from us, ignoring" )
980
985
return nil
@@ -992,6 +997,7 @@ func (m *Messenger) handleRetractContactRequest(response *MessengerResponse, con
992
997
if err != nil {
993
998
return err
994
999
}
1000
+
995
1001
timestamp := m .getTimesource ().GetCurrentTime ()
996
1002
updateMessage , err := m .prepareMutualStateUpdateMessage (contact .ID , MutualStateUpdateTypeRemoved , clock , timestamp , false )
997
1003
if err != nil {
@@ -1003,8 +1009,14 @@ func (m *Messenger) handleRetractContactRequest(response *MessengerResponse, con
1003
1009
if err != nil {
1004
1010
return err
1005
1011
}
1006
- response .AddMessage (updateMessage )
1007
- response .AddChat (chat )
1012
+ state .Response .AddMessage (updateMessage )
1013
+
1014
+ err = chat .UpdateFromMessage (updateMessage , m .getTimesource ())
1015
+ if err != nil {
1016
+ return err
1017
+ }
1018
+ chat .UnviewedMessagesCount ++
1019
+ state .Response .AddChat (chat )
1008
1020
1009
1021
notification := & ActivityCenterNotification {
1010
1022
ID : types .FromHex (uuid .New ().String ()),
@@ -1017,7 +1029,7 @@ func (m *Messenger) handleRetractContactRequest(response *MessengerResponse, con
1017
1029
UpdatedAt : m .getCurrentTimeInMillis (),
1018
1030
}
1019
1031
1020
- err = m .addActivityCenterNotification (response , notification )
1032
+ err = m .addActivityCenterNotification (state . Response , notification )
1021
1033
if err != nil {
1022
1034
m .logger .Warn ("failed to create activity center notification" , zap .Error (err ))
1023
1035
return err
@@ -1030,7 +1042,7 @@ func (m *Messenger) handleRetractContactRequest(response *MessengerResponse, con
1030
1042
1031
1043
func (m * Messenger ) HandleRetractContactRequest (state * ReceivedMessageState , message protobuf.RetractContactRequest ) error {
1032
1044
contact := state .CurrentMessageState .Contact
1033
- err := m .handleRetractContactRequest (state . Response , contact , message )
1045
+ err := m .handleRetractContactRequest (state , contact , message )
1034
1046
if err != nil {
1035
1047
return err
1036
1048
}
0 commit comments