feat: 文章锁定/解锁时触发系统通知
- 新增 NotifyPostLocked/NotifyPostUnlocked 通知类型 - Lock/Unlock 方法执行后通过 notifier 发送通知给作者 - 锁定时通知含锁定理由,解锁时通知已解除锁定 - 新增类型归入稿件审核分类和 system tab
This commit is contained in:
@ -47,7 +47,7 @@ func countUIDs(uids string) int {
|
||||
func categoryTypes(category string) []string {
|
||||
switch category {
|
||||
case "system":
|
||||
return []string{model.NotifyAuditApproved, model.NotifyAuditRejected, model.NotifyPostApproved, model.NotifyPostRejected, model.NotifyLevelUp}
|
||||
return []string{model.NotifyAuditApproved, model.NotifyAuditRejected, model.NotifyPostApproved, model.NotifyPostRejected, model.NotifyPostLocked, model.NotifyPostUnlocked, model.NotifyLevelUp}
|
||||
case "mention":
|
||||
return []string{model.NotifyComment, model.NotifyCommentReply}
|
||||
case "like":
|
||||
@ -111,6 +111,24 @@ func (s *NotificationService) NotifyPostRejected(userID uint, postTitle, reason
|
||||
_ = s.Create(userID, model.NotifyPostRejected, title, content, &postID, nil)
|
||||
}
|
||||
|
||||
// NotifyPostLocked 稿件锁定通知
|
||||
func (s *NotificationService) NotifyPostLocked(userID uint, postTitle, reason string, postID uint) {
|
||||
title := "稿件被锁定"
|
||||
content := "你的稿件《" + postTitle + "》已被锁定"
|
||||
if reason != "" {
|
||||
content += ",理由:" + reason
|
||||
}
|
||||
_ = s.Create(userID, model.NotifyPostLocked, title, content, &postID, nil)
|
||||
}
|
||||
|
||||
// NotifyPostUnlocked 稿件解除锁定通知
|
||||
func (s *NotificationService) NotifyPostUnlocked(userID uint, postTitle string, postID uint) {
|
||||
_ = s.Create(userID, model.NotifyPostUnlocked,
|
||||
"稿件被解除锁定",
|
||||
"你的稿件《"+postTitle+"》已被解除锁定",
|
||||
&postID, nil)
|
||||
}
|
||||
|
||||
// NotifyFollow 关注通知(followerID 关注了 followeeID)
|
||||
func (s *NotificationService) NotifyFollow(followerID, followeeID uint) {
|
||||
// 获取关注者用户名
|
||||
|
||||
Reference in New Issue
Block a user