fix(weixin): 扫码确认时把主人user_id并入allow_users白名单——修复主人消息被当stranger静默不回复
This commit is contained in:
1 parent
5dfaa75a06
commit
fb646552b9
1 file changed
+17
-1
@@ -149,12 +149,28 @@ func (s *Server) persistWeixinConfirmed(platform, accountID, token, botID, owner
|
|||||||
if ownerID != "" {
|
if ownerID != "" {
|
||||||
cfg["owner_id"] = ownerID
|
cfg["owner_id"] = ownerID
|
||||||
}
|
}
|
||||||
|
// Ensure the binding user (the scanner) lands in the channel's allow list, so
|
||||||
|
// the bridge recognises it as the owner and replies instead of silencing it as
|
||||||
|
// a stranger (actor_role=unknown / env=stranger).
|
||||||
|
allowUsers := append([]string(nil), base.AllowUsers...)
|
||||||
|
if ownerID != "" {
|
||||||
|
found := false
|
||||||
|
for _, u := range allowUsers {
|
||||||
|
if u == ownerID {
|
||||||
|
found = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !found {
|
||||||
|
allowUsers = append(allowUsers, ownerID)
|
||||||
|
}
|
||||||
|
}
|
||||||
acct := config.ChannelAccount{
|
acct := config.ChannelAccount{
|
||||||
ID: base.ID,
|
ID: base.ID,
|
||||||
Config: cfg,
|
Config: cfg,
|
||||||
AllowGroups: base.AllowGroups,
|
AllowGroups: base.AllowGroups,
|
||||||
DenyGroups: base.DenyGroups,
|
DenyGroups: base.DenyGroups,
|
||||||
AllowUsers: base.AllowUsers,
|
AllowUsers: allowUsers,
|
||||||
DenyUsers: base.DenyUsers,
|
DenyUsers: base.DenyUsers,
|
||||||
GroupMsgPerMin: base.GroupMsgPerMin,
|
GroupMsgPerMin: base.GroupMsgPerMin,
|
||||||
MsgPerMin: base.MsgPerMin,
|
MsgPerMin: base.MsgPerMin,
|
||||||
|
|||||||
Reference in new issue
Block a user