Fix comment input #40

Merged
romanskijdev merged 1 commits from fix-permissions into main 2026-06-29 14:08:06 +03:00
3 changed files with 12 additions and 7 deletions

View File

@ -92,18 +92,23 @@ func (u *ApprovalCommentDB) CreateApprovalCommentDB(ctx context.Context, tx pgx.
})
if err != nil {
return nil, tx, err
return nil, nil, err
}
returnObjBool := len(returnObj) > 0 && returnObj[0]
if returnObjBool && insertedID > 0 {
if returnObjBool {
if insertedID == 0 {
return nil, nil, errors.New("inserted ID is 0 after insert")
}
created, err := u.GetApprovalCommentByIDDB(ctx, insertedID)
return created, tx, err
if err != nil {
return nil, nil, err
}
return created, nil, nil
}
return nil, tx, nil
return nil, nil, nil
}
func (u *ApprovalCommentDB) UpdateApprovalCommentDB(ctx context.Context, tx pgx.Tx, paramsUpdate *typescore.ApprovalComment, returnObj ...bool) (*typescore.ApprovalComment, pgx.Tx, error) {
if paramsUpdate.ID == nil {
return nil, nil, errors.New("ApprovalComment obj is nil")

View File

@ -40,7 +40,7 @@ func NewUpdateHandler(ipc *types.InternalProviderControl) *UpdateHandler {
// TODO: вызывается только после обновлений
//go handler.broadcastBotUpdated()
go handler.sendSupportNotification()
//go handler.sendSupportNotification()
return handler
}

View File

@ -384,7 +384,7 @@ func (h *Handler) HandleCommentReplyInput(bot *tgbotapi.BotAPI, msg *tgbotapi.Me
UserID: user.ID,
Comment: &msg.Text,
}
created, _, err := h.ipc.Database.ApprovalComment.CreateApprovalCommentDB(ctx, nil, comment, true) //nolint:errcheck
_, _, err = h.ipc.Database.ApprovalComment.CreateApprovalCommentDB(ctx, nil, comment)
if err != nil {
sendText(bot, chatID, "⚠️ Ошибка при создании комментария: "+err.Error())
return false