mirror of https://gitee.com/answerdev/answer.git
fix(notification): missing unsubscribe code
This commit is contained in:
parent
2bd8f7f771
commit
3b1324b83b
|
@ -4,6 +4,7 @@ import (
|
|||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/answerdev/answer/pkg/token"
|
||||
"time"
|
||||
|
||||
"github.com/answerdev/answer/internal/base/constant"
|
||||
|
@ -22,7 +23,6 @@ import (
|
|||
"github.com/answerdev/answer/internal/service/revision_common"
|
||||
"github.com/answerdev/answer/internal/service/role"
|
||||
usercommon "github.com/answerdev/answer/internal/service/user_common"
|
||||
"github.com/answerdev/answer/pkg/encryption"
|
||||
"github.com/answerdev/answer/pkg/uid"
|
||||
"github.com/segmentfault/pacman/errors"
|
||||
"github.com/segmentfault/pacman/log"
|
||||
|
@ -626,7 +626,7 @@ func (as *AnswerService) notificationAnswerTheQuestion(ctx context.Context,
|
|||
QuestionID: questionID,
|
||||
AnswerID: answerID,
|
||||
AnswerSummary: answerSummary,
|
||||
UnsubscribeCode: encryption.MD5(receiverUserInfo.Pass),
|
||||
UnsubscribeCode: token.GenerateToken(),
|
||||
}
|
||||
answerUser, _, _ := as.userCommon.GetUserBasicInfoByID(ctx, answerUserID)
|
||||
if answerUser != nil {
|
||||
|
|
|
@ -2,6 +2,7 @@ package comment
|
|||
|
||||
import (
|
||||
"context"
|
||||
"github.com/answerdev/answer/pkg/token"
|
||||
"time"
|
||||
|
||||
"github.com/answerdev/answer/internal/base/constant"
|
||||
|
@ -17,7 +18,6 @@ import (
|
|||
"github.com/answerdev/answer/internal/service/object_info"
|
||||
"github.com/answerdev/answer/internal/service/permission"
|
||||
usercommon "github.com/answerdev/answer/internal/service/user_common"
|
||||
"github.com/answerdev/answer/pkg/encryption"
|
||||
"github.com/answerdev/answer/pkg/htmltext"
|
||||
"github.com/answerdev/answer/pkg/uid"
|
||||
"github.com/jinzhu/copier"
|
||||
|
@ -508,7 +508,7 @@ func (cs *CommentService) notificationQuestionComment(ctx context.Context, quest
|
|||
QuestionID: questionID,
|
||||
CommentID: commentID,
|
||||
CommentSummary: commentSummary,
|
||||
UnsubscribeCode: encryption.MD5(receiverUserInfo.Pass),
|
||||
UnsubscribeCode: token.GenerateToken(),
|
||||
}
|
||||
commentUser, _, _ := cs.userCommon.GetUserBasicInfoByID(ctx, commentUserID)
|
||||
if commentUser != nil {
|
||||
|
@ -556,7 +556,7 @@ func (cs *CommentService) notificationAnswerComment(ctx context.Context,
|
|||
AnswerID: answerID,
|
||||
CommentID: commentID,
|
||||
CommentSummary: commentSummary,
|
||||
UnsubscribeCode: encryption.MD5(receiverUserInfo.Pass),
|
||||
UnsubscribeCode: token.GenerateToken(),
|
||||
}
|
||||
commentUser, _, _ := cs.userCommon.GetUserBasicInfoByID(ctx, commentUserID)
|
||||
if commentUser != nil {
|
||||
|
|
|
@ -4,6 +4,7 @@ import (
|
|||
"context"
|
||||
"github.com/answerdev/answer/internal/base/constant"
|
||||
"github.com/answerdev/answer/internal/schema"
|
||||
"github.com/answerdev/answer/pkg/token"
|
||||
"github.com/segmentfault/pacman/i18n"
|
||||
"github.com/segmentfault/pacman/log"
|
||||
"time"
|
||||
|
@ -31,9 +32,11 @@ func (ns *ExternalNotificationService) handleNewQuestionNotification(ctx context
|
|||
switch channel.Key {
|
||||
case constant.EmailChannel:
|
||||
ns.sendNewQuestionNotificationEmail(ctx, subscriber.UserID, &schema.NewQuestionTemplateRawData{
|
||||
QuestionTitle: msg.NewQuestionTemplateRawData.QuestionTitle,
|
||||
QuestionID: msg.NewQuestionTemplateRawData.QuestionID,
|
||||
Tags: msg.NewQuestionTemplateRawData.Tags,
|
||||
QuestionTitle: msg.NewQuestionTemplateRawData.QuestionTitle,
|
||||
QuestionID: msg.NewQuestionTemplateRawData.QuestionID,
|
||||
UnsubscribeCode: token.GenerateToken(),
|
||||
Tags: msg.NewQuestionTemplateRawData.Tags,
|
||||
TagIDs: msg.NewQuestionTemplateRawData.TagIDs,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import (
|
|||
"fmt"
|
||||
"github.com/answerdev/answer/internal/service/notification"
|
||||
"github.com/answerdev/answer/internal/service/siteinfo_common"
|
||||
"github.com/answerdev/answer/pkg/token"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
|
@ -28,7 +29,6 @@ import (
|
|||
tagcommon "github.com/answerdev/answer/internal/service/tag_common"
|
||||
usercommon "github.com/answerdev/answer/internal/service/user_common"
|
||||
"github.com/answerdev/answer/pkg/converter"
|
||||
"github.com/answerdev/answer/pkg/encryption"
|
||||
"github.com/answerdev/answer/pkg/htmltext"
|
||||
"github.com/answerdev/answer/pkg/uid"
|
||||
"github.com/jinzhu/copier"
|
||||
|
@ -663,7 +663,7 @@ func (qs *QuestionService) notificationInviteUser(
|
|||
InviterDisplayName: inviter.DisplayName,
|
||||
QuestionTitle: questionTitle,
|
||||
QuestionID: questionID,
|
||||
UnsubscribeCode: encryption.MD5(receiverUserInfo.Pass),
|
||||
UnsubscribeCode: token.GenerateToken(),
|
||||
}
|
||||
externalNotificationMsg.NewInviteAnswerTemplateRawData = rawData
|
||||
qs.externalNotificationQueueService.Send(ctx, externalNotificationMsg)
|
||||
|
|
Loading…
Reference in New Issue