feat(conversations): align typing events
This commit is contained in:
@@ -890,18 +890,21 @@ func (h *ConversationHandler) ToggleTyping(c *gin.Context) {
|
||||
}
|
||||
|
||||
var req struct {
|
||||
TypingStatus string `json:"typing_status" binding:"required"`
|
||||
TypingStatus string `json:"typing_status"`
|
||||
IsPrivate bool `json:"is_private"`
|
||||
}
|
||||
if err := c.ShouldBindJSON(&req); err != nil {
|
||||
response.AbortWithStatusError(c, http.StatusBadRequest, response.ErrValidation, err.Error())
|
||||
return
|
||||
if c.Request.Body != nil && c.Request.ContentLength != 0 {
|
||||
if err := c.ShouldBindJSON(&req); err != nil && !errors.Is(err, io.EOF) {
|
||||
response.AbortWithStatusError(c, http.StatusBadRequest, response.ErrValidation, err.Error())
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
conversation, ok := h.resolveConversationRoute(c, accountID, conversationID)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
svcErr := h.conversationSvc.ToggleTyping(c.Request.Context(), accountID, conversation.ID, req.TypingStatus)
|
||||
svcErr := h.conversationSvc.ToggleTyping(c.Request.Context(), accountID, conversation.ID, currentUserID(c), req.TypingStatus, req.IsPrivate)
|
||||
if svcErr != nil {
|
||||
handleServiceError(c, svcErr)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user