Skip to content

A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.

feat(notification): self-questioning does not generate notifications

LinkinStars276e87af085e
diff --git a/i18n/en_US.yaml b/i18n/en_US.yaml
index 9b897709..0defa754 100644
--- a/i18n/en_US.yaml
+++ b/i18n/en_US.yaml
@@ -339,6 +339,16 @@ backend:
other: Your answer has been deleted
your_comment_was_deleted:
other: Your comment has been deleted
+ up_voted_question:
+ other: upvoted question
+ down_voted_question:
+ other: downvoted question
+ up_voted_answer:
+ other: upvoted answer
+ down_voted_answer:
+ other: downvoted answer
+ up_voted_comment:
+ other: upvoted comment
# The following fields are used for interface presentation(Front-end)
ui:
diff --git a/i18n/zh_CN.yaml b/i18n/zh_CN.yaml
index c272caad..b82a2879 100644
--- a/i18n/zh_CN.yaml
+++ b/i18n/zh_CN.yaml
@@ -329,6 +329,16 @@ backend:
other: 你的答案已被删除
your_comment_was_deleted:
other: 你的评论已被删除
+ up_voted_question:
+ other: 赞了问题
+ down_voted_question:
+ other: 踩了问题
+ up_voted_answer:
+ other: 赞了答案
+ down_voted_answer:
+ other: 踩了答案
+ up_voted_comment:
+ other: 赞了评论
#The following fields are used for interface presentation(Front-end)
ui:
how_to_format:
diff --git a/internal/repo/activity/answer_repo.go b/internal/repo/activity/answer_repo.go
index cb0d25f2..15271da8 100644
--- a/internal/repo/activity/answer_repo.go
+++ b/internal/repo/activity/answer_repo.go
@@ -202,7 +202,9 @@ func (ar *AnswerActivityRepo) AcceptAnswer(ctx context.Context,
msg.TriggerUserID = questionUserID
msg.ObjectType = constant.AnswerObjectType
}
- notice_queue.AddNotification(msg)
+ if msg.TriggerUserID != msg.ReceiverUserID {
+ notice_queue.AddNotification(msg)
+ }
}
for _, act := range addActivityList {
diff --git a/internal/service/notification/notification_service.go b/internal/service/notification/notification_service.go
index 6f5e5b0e..554ea132 100644
--- a/internal/service/notification/notification_service.go
+++ b/internal/service/notification/notification_service.go
@@ -5,8 +5,8 @@ import (
"encoding/json"
"fmt"
- "github.com/answerdev/answer/internal/base/constant"
"github.com/answerdev/answer/internal/base/data"
+ "github.com/answerdev/answer/internal/base/handler"
"github.com/answerdev/answer/internal/base/pager"
"github.com/answerdev/answer/internal/base/translator"
"github.com/answerdev/answer/internal/schema"
@@ -14,7 +14,6 @@ import (
"github.com/answerdev/answer/internal/service/revision_common"
"github.com/answerdev/answer/pkg/uid"
"github.com/jinzhu/copier"
- "github.com/segmentfault/pacman/i18n"
"github.com/segmentfault/pacman/log"
)
@@ -134,7 +133,7 @@ func (ns *NotificationService) GetNotificationPage(ctx context.Context, searchCo
log.Error("NotificationContent Unmarshal Error", err.Error())
continue
}
- lang, _ := ctx.Value(constant.AcceptLanguageFlag).(i18n.Language)
+ lang := handler.GetLangByCtx(ctx)
item.NotificationAction = translator.Tr(lang, item.NotificationAction)
item.ID = notificationInfo.ID
item.UpdateTime = notificationInfo.UpdatedAt.Unix()