修复精准查找对拉黑关系显示"添加",跟实际能不能添加对不上(第5章复测发现)
/users/search 返回结果本身带 relationship 字段,服务端 imRelationshipAction() 对 blocked_by_me/blocked_by_peer 都明确映射成 action:"none"(不允许发起添加)——但 前端 actionLabel 只认 friend/pending_outbound/pending_inbound 三种,其余(含两种 拉黑关系)一律落到兜底的"添加"文案。点进去虽然会跳到资料页、由资料页自己的 cannotAddReason 挡住(不会真的误发出申请),但列表这一行本身的文案是误导的。 补上跟 Profile 组件里已有的 cannotAddReason 一致的两条文案(已拉黑/无法添加), 只是精简成适合一行列表项的长度。 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
7340b5e135
commit
d21d046443
@@ -265,8 +265,14 @@ function AddFriend({result = false, onToast, onOpenScanner}) {
|
||||
return undefined;
|
||||
}).catch(err => onToast(err.message || '生成邀请链接失败'));
|
||||
};
|
||||
// Real search results carry a relationship for blocked pairs too (blocked_by_me/blocked_by_peer),
|
||||
// which previously fell through to the same generic "添加" as an untouched stranger -- misleading
|
||||
// since tapping through leads to a profile page whose own cannotAddReason (see the Profile
|
||||
// component below) already refuses to let the request go anywhere. Matches that component's
|
||||
// wording, just condensed to fit this one-line list item.
|
||||
const actionLabel = item => item.relationship === 'friend' ? '已是好友' :
|
||||
item.relationship === 'pending_outbound' ? '已申请' : item.relationship === 'pending_inbound' ? '待通过' : '添加';
|
||||
item.relationship === 'pending_outbound' ? '已申请' : item.relationship === 'pending_inbound' ? '待通过' :
|
||||
item.relationship === 'blocked_by_me' ? '已拉黑' : item.relationship === 'blocked_by_peer' ? '无法添加' : '添加';
|
||||
return <div className="people-page"><Header title="添加好友" back="address-book" />
|
||||
<Search value={query} onChange={v => { setQuery(v); if (!v.trim()) { setSearched(false); setResults([]); } }} placeholder="查找账号" onSubmit={() => runSearch(query)} />
|
||||
<main>
|
||||
|
||||
Reference in New Issue
Block a user