@@ -146,8 +146,7 @@ func (m *msgServer) MarkConversationAsRead(ctx context.Context, req *msg.MarkCon
146146 var seqs []int64
147147
148148 log .ZDebug (ctx , "MarkConversationAsRead" , "hasReadSeq" , hasReadSeq , "req.HasReadSeq" , req .HasReadSeq )
149- switch conversation .ConversationType {
150- case constant .SingleChatType :
149+ if conversation .ConversationType == constant .SingleChatType {
151150 for i := hasReadSeq + 1 ; i <= req .HasReadSeq ; i ++ {
152151 seqs = append (seqs , i )
153152 }
@@ -172,7 +171,8 @@ func (m *msgServer) MarkConversationAsRead(ctx context.Context, req *msg.MarkCon
172171 }
173172 m .sendMarkAsReadNotification (ctx , req .ConversationID , conversation .ConversationType , req .UserID ,
174173 m .conversationAndGetRecvID (conversation , req .UserID ), seqs , hasReadSeq )
175- case constant .ReadGroupChatType , constant .NotificationChatType :
174+ } else if conversation .ConversationType == constant .ReadGroupChatType ||
175+ conversation .ConversationType == constant .NotificationChatType {
176176 if req .HasReadSeq > hasReadSeq {
177177 err = m .MsgDatabase .SetHasReadSeq (ctx , req .UserID , req .ConversationID , req .HasReadSeq )
178178 if err != nil {
@@ -184,16 +184,15 @@ func (m *msgServer) MarkConversationAsRead(ctx context.Context, req *msg.MarkCon
184184 req .UserID , seqs , hasReadSeq )
185185 }
186186
187- switch conversation .ConversationType {
188- case constant .SingleChatType :
187+ if conversation .ConversationType == constant .SingleChatType {
189188 reqCall := & cbapi.CallbackSingleMsgReadReq {
190189 ConversationID : conversation .ConversationID ,
191190 UserID : conversation .OwnerUserID ,
192191 Seqs : req .Seqs ,
193192 ContentType : conversation .ConversationType ,
194193 }
195194 m .webhookAfterSingleMsgRead (ctx , & m .config .WebhooksConfig .AfterSingleMsgRead , reqCall )
196- case constant .ReadGroupChatType :
195+ } else if conversation . ConversationType == constant .ReadGroupChatType {
197196 reqCall := & cbapi.CallbackGroupMsgReadReq {
198197 SendID : conversation .OwnerUserID ,
199198 ReceiveID : req .UserID ,
0 commit comments