mirror of https://gitee.com/answerdev/answer.git
Merge branch 'dev' into fix/1.1.3/qa
# Conflicts: # internal/repo/activity/answer_repo.go
This commit is contained in:
commit
750fdb0eef
|
@ -126,7 +126,7 @@ func (am *AuthUserMiddleware) AdminAuth() gin.HandlerFunc {
|
|||
return
|
||||
}
|
||||
userInfo, err := am.authService.GetAdminUserCacheInfo(ctx, token)
|
||||
if err != nil {
|
||||
if err != nil || userInfo == nil {
|
||||
handler.HandleResponse(ctx, errors.Forbidden(reason.UnauthorizedError), nil)
|
||||
ctx.Abort()
|
||||
return
|
||||
|
|
|
@ -47,6 +47,7 @@ var (
|
|||
&entity.UserRoleRel{},
|
||||
&entity.PluginConfig{},
|
||||
&entity.UserExternalLogin{},
|
||||
&entity.UserNotificationConfig{},
|
||||
}
|
||||
|
||||
roles = []*entity.Role{
|
||||
|
|
|
@ -285,12 +285,11 @@ func (ar *AnswerActivityRepo) sendAcceptAnswerNotification(
|
|||
Type: schema.NotificationTypeAchievement,
|
||||
ObjectID: op.AnswerObjectID,
|
||||
ReceiverUserID: act.ActivityUserID,
|
||||
TriggerUserID: act.TriggerUserID,
|
||||
}
|
||||
if act.ActivityUserID == op.QuestionUserID {
|
||||
msg.TriggerUserID = op.AnswerUserID
|
||||
msg.ObjectType = constant.AnswerObjectType
|
||||
} else {
|
||||
msg.TriggerUserID = op.QuestionUserID
|
||||
msg.ObjectType = constant.AnswerObjectType
|
||||
}
|
||||
if msg.TriggerUserID != msg.ReceiverUserID {
|
||||
|
@ -303,9 +302,9 @@ func (ar *AnswerActivityRepo) sendAcceptAnswerNotification(
|
|||
ReceiverUserID: act.ActivityUserID,
|
||||
Type: schema.NotificationTypeInbox,
|
||||
ObjectID: op.AnswerObjectID,
|
||||
TriggerUserID: op.TriggerUserID,
|
||||
}
|
||||
if act.ActivityUserID != op.QuestionUserID {
|
||||
msg.TriggerUserID = op.TriggerUserID
|
||||
msg.ObjectType = constant.AnswerObjectType
|
||||
msg.NotificationAction = constant.NotificationAcceptAnswer
|
||||
ar.notificationQueueService.Send(ctx, msg)
|
||||
|
@ -317,15 +316,14 @@ func (ar *AnswerActivityRepo) sendCancelAcceptAnswerNotification(
|
|||
ctx context.Context, op *schema.AcceptAnswerOperationInfo) {
|
||||
for _, act := range op.Activities {
|
||||
msg := &schema.NotificationMsg{
|
||||
TriggerUserID: act.TriggerUserID,
|
||||
ReceiverUserID: act.ActivityUserID,
|
||||
Type: schema.NotificationTypeAchievement,
|
||||
ObjectID: op.AnswerObjectID,
|
||||
}
|
||||
if act.ActivityUserID == op.QuestionObjectID {
|
||||
msg.TriggerUserID = op.AnswerObjectID
|
||||
msg.ObjectType = constant.QuestionObjectType
|
||||
} else {
|
||||
msg.TriggerUserID = op.QuestionObjectID
|
||||
msg.ObjectType = constant.AnswerObjectType
|
||||
}
|
||||
if msg.TriggerUserID != msg.ReceiverUserID {
|
||||
|
|
Loading…
Reference in New Issue