Skip to content

Commit

Permalink
Fixes extraneous missed cal users
Browse files Browse the repository at this point in the history
  • Loading branch information
nkonev committed Jan 14, 2024
1 parent 846863a commit dc625a8
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions video/handlers/invite.go
Original file line number Diff line number Diff line change
Expand Up @@ -381,11 +381,24 @@ func (vh *InviteHandler) ProcessLeave(c echo.Context) error {
return c.NoContent(http.StatusInternalServerError)
}

videoParticipants, err := vh.userService.GetVideoParticipants(chatId, c.Request().Context())
if err != nil {
logger.GetLogEntry(c.Request().Context()).Errorf("Error %v", err)
return c.NoContent(http.StatusInternalServerError)
}

missedUsers := make([]int64, 0)
for _, redisCallUser := range usersToDial {
if !utils.Contains(videoParticipants, redisCallUser) {
missedUsers = append(missedUsers, redisCallUser)
}
}

// the owner removes all the dials by setting status
vh.removeFromCallingList(c, chatId, usersToDial, services.CallStatusRemoving)
vh.removeFromCallingList(c, chatId, missedUsers, services.CallStatusRemoving)

// for all participants to dial - send EventMissedCall notification
vh.sendMissedCallNotification(chatId, c.Request().Context(), userPrincipalDto, usersToDial)
vh.sendMissedCallNotification(chatId, c.Request().Context(), userPrincipalDto, missedUsers)
} else {
vh.removeFromCallingList(c, chatId, []int64{userPrincipalDto.UserId}, services.CallStatusRemoving)
}
Expand Down

0 comments on commit dc625a8

Please sign in to comment.