mirror of https://gitee.com/answerdev/answer.git
feat(notification): add notification for invited to answer
This commit is contained in:
parent
f5bb3ff6e5
commit
15438f0403
|
@ -35,4 +35,6 @@ const (
|
|||
NotificationYourAnswerWasDeleted = "notification.action.your_answer_was_deleted"
|
||||
// NotificationYourCommentWasDeleted your comment was deleted
|
||||
NotificationYourCommentWasDeleted = "notification.action.your_comment_was_deleted"
|
||||
// NotificationInvitedYouToAnswer invited you to answer
|
||||
NotificationInvitedYouToAnswer = "notification.action.invited_you_to_answer"
|
||||
)
|
||||
|
|
|
@ -579,9 +579,25 @@ func (qs *QuestionService) UpdateQuestionInviteUser(ctx context.Context, req *sc
|
|||
if saveerr != nil {
|
||||
return saveerr
|
||||
}
|
||||
qs.notificationInviteUser(ctx, inviteUser, req.ID, req.UserID)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (qs *QuestionService) notificationInviteUser(
|
||||
ctx context.Context, invitedUserIDs []string, questionID, questionUserID string) {
|
||||
for _, userID := range invitedUserIDs {
|
||||
msg := &schema.NotificationMsg{
|
||||
ReceiverUserID: userID,
|
||||
TriggerUserID: questionUserID,
|
||||
Type: schema.NotificationTypeInbox,
|
||||
ObjectID: questionID,
|
||||
}
|
||||
msg.ObjectType = constant.QuestionObjectType
|
||||
msg.NotificationAction = constant.NotificationInvitedYouToAnswer
|
||||
notice_queue.AddNotification(msg)
|
||||
}
|
||||
}
|
||||
|
||||
// UpdateQuestion update question
|
||||
func (qs *QuestionService) UpdateQuestion(ctx context.Context, req *schema.QuestionUpdate) (questionInfo any, err error) {
|
||||
var canUpdate bool
|
||||
|
|
Loading…
Reference in New Issue