diff --git a/server/db/mysql/tenant_adapter.go b/server/db/mysql/tenant_adapter.go index a3ec1b0..2214828 100644 --- a/server/db/mysql/tenant_adapter.go +++ b/server/db/mysql/tenant_adapter.go @@ -6887,7 +6887,7 @@ func (a *adapter) TenantFriendRequestAccept(id t.TenantID, requestID string, act eventType := "friend.request." + t.FriendRequestAccepted applicantEventID := t.StableEventID("relation", row.RequestID+":"+t.FriendRequestAccepted, eventType, applicant.UserId()) if err = insertSystemNotificationTx(tx, id, applicant, t.StableEventID(applicantEventID, "notification"), eventType, - "好友申请已处理", t.FriendRequestAccepted, map[string]any{"type": "friend_request", "request_id": row.RequestID, "user_id": actor.UserId(), "topic": topic}); err != nil { + "好友申请已处理", "对方已同意你的好友申请", map[string]any{"type": "friend_request", "request_id": row.RequestID, "user_id": actor.UserId(), "topic": topic}); err != nil { return nil, err } if err = tx.Commit(); err != nil { @@ -6939,8 +6939,12 @@ func (a *adapter) TenantFriendRequestResolve(id t.TenantID, requestID string, ac } eventType := "friend.request." + status eventID := t.StableEventID("relation", req.RequestID+":"+status, eventType, req.ApplicantID.UserId()) + summary := "对方已婉拒你的好友申请" + if status == t.FriendRequestAccepted { + summary = "对方已同意你的好友申请" + } if err = insertSystemNotificationTx(tx, id, req.ApplicantID, t.StableEventID(eventID, "notification"), eventType, - "好友申请已处理", status, map[string]any{"type": "friend_request", "request_id": req.RequestID, "user_id": actor.UserId()}); err != nil { + "好友申请已处理", summary, map[string]any{"type": "friend_request", "request_id": req.RequestID, "user_id": actor.UserId()}); err != nil { return nil, err } if err = tx.Commit(); err != nil { diff --git a/server/im_http.go b/server/im_http.go index c1e42ad..a0bbeb0 100644 --- a/server/im_http.go +++ b/server/im_http.go @@ -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 }