feat: sync recent call and channel fixes

This commit is contained in:
A 2026-07-01 14:34:59 +08:00
parent e5e0080216
commit 866a87583e
65 changed files with 6680 additions and 229 deletions

View file

@ -436,7 +436,7 @@ func tgChannel(viewerUserID int64, ch domain.Channel, self *domain.ChannelMember
switch self.Role {
case domain.ChannelRoleCreator:
out.Creator = true
out.SetAdminRights(tgChatAdminRights(self.AdminRights))
out.SetAdminRights(tgChatAdminRights(creatorProjectionAdminRights(self.AdminRights)))
case domain.ChannelRoleAdmin:
out.SetAdminRights(tgChatAdminRights(self.AdminRights))
}
@ -611,7 +611,7 @@ func tgChannelParticipant(selfUserID int64, member domain.ChannelMember) tg.Chan
case domain.ChannelRoleCreator:
out := &tg.ChannelParticipantCreator{
UserID: member.UserID,
AdminRights: tgChatAdminRights(member.AdminRights),
AdminRights: tgChatAdminRights(creatorProjectionAdminRights(member.AdminRights)),
}
if member.Rank != "" {
out.SetRank(member.Rank)
@ -779,6 +779,13 @@ func tgChatAdminRights(rights domain.ChannelAdminRights) tg.ChatAdminRights {
}
}
func creatorProjectionAdminRights(rights domain.ChannelAdminRights) domain.ChannelAdminRights {
creatorRights := domain.CreatorChannelAdminRights()
creatorRights.Anonymous = rights.Anonymous
creatorRights.ManageDirectMessages = rights.ManageDirectMessages
return creatorRights
}
func domainChannelAdminRights(rights tg.ChatAdminRights) domain.ChannelAdminRights {
return domain.ChannelAdminRights{
ChangeInfo: rights.ChangeInfo,