feat: 为系统通知添加明确的操作结果摘要
为风险挑战确认和好友申请处理场景添加对应操作结果的中文摘要,替代原有的状态文本,让用户能更清晰地理解系统通知内容。
This commit is contained in:
+8
-2
@@ -1494,8 +1494,12 @@ func serveIMRiskChallengeConfirm(wrt http.ResponseWriter, req *http.Request) {
|
||||
if imReliableHTTPEventsEnabled(req) {
|
||||
eventType := "security.risk." + decision
|
||||
eventID := stableIMEventID("risk", challengeID, decision, challenge.State)
|
||||
summary := "你已取消本次操作"
|
||||
if decision == "continue" {
|
||||
summary = "你已确认继续执行该操作"
|
||||
}
|
||||
if err = createIMSystemNotification(principal.TenantID, principal.Uid,
|
||||
stableIMEventID(eventID, "notification"), eventType, "安全操作确认", decision,
|
||||
stableIMEventID(eventID, "notification"), eventType, "安全操作确认", summary,
|
||||
types.KVMap{"risk_challenge_id": challengeID}); err != nil {
|
||||
writeIMError(wrt, req, http.StatusInternalServerError, 90000, imReasonInternal, "internal error", nil)
|
||||
return
|
||||
@@ -6410,11 +6414,13 @@ func serveIMFriendRequestAction(wrt http.ResponseWriter, req *http.Request) {
|
||||
if imReliableHTTPEventsEnabled(req) {
|
||||
eventType := "friend.request." + status
|
||||
action := types.KVMap{}
|
||||
summary := "对方已婉拒你的好友申请"
|
||||
if status == types.FriendRequestAccepted {
|
||||
action["topic"] = updated.ApplicantID.P2PName(updated.TargetID)
|
||||
summary = "对方已同意你的好友申请"
|
||||
}
|
||||
if err = publishIMRelationEventWithAction(principal.TenantID, principal.Uid, updated.ApplicantID,
|
||||
updated.RequestID+":"+status, eventType, "好友申请已处理", status, action); err != nil {
|
||||
updated.RequestID+":"+status, eventType, "好友申请已处理", summary, action); err != nil {
|
||||
writeIMError(wrt, req, http.StatusInternalServerError, 90000, imReasonInternal, "internal error", nil)
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user