fix: sync account freeze peer visibility
This commit is contained in:
parent
d9875b5caa
commit
eba402946a
26 changed files with 1034 additions and 19 deletions
|
|
@ -32,6 +32,7 @@ type AdminCommand struct {
|
|||
type AccountFreeze struct {
|
||||
UserID int64
|
||||
Frozen bool
|
||||
Version int64
|
||||
Since time.Time
|
||||
Until time.Time
|
||||
AppealURL string
|
||||
|
|
@ -40,3 +41,15 @@ type AccountFreeze struct {
|
|||
CommandID string
|
||||
UpdatedAt time.Time
|
||||
}
|
||||
|
||||
// AccountFreezeNotification is a durable, coalesced online refresh for one
|
||||
// viewer. UpdateUser itself has no pts; offline clients always recover from the
|
||||
// authoritative viewer-scoped user projection instead of replaying this row.
|
||||
type AccountFreezeNotification struct {
|
||||
ID int64
|
||||
TargetUserID int64
|
||||
FrozenUserID int64
|
||||
Version int64
|
||||
Frozen bool
|
||||
Attempts int
|
||||
}
|
||||
|
|
|
|||
|
|
@ -104,6 +104,10 @@ type User struct {
|
|||
Contact bool
|
||||
Mutual bool
|
||||
CloseFriend bool
|
||||
// RestrictionReasons are transient, viewer-scoped unavailability reasons.
|
||||
// They are produced after loading the viewer-independent base user and must
|
||||
// never be persisted in users or the base-user cache.
|
||||
RestrictionReasons []UserRestrictionReason
|
||||
// ContactNote/ContactNoteEntities are transient viewer-scoped contact
|
||||
// projection fields. They must never be persisted into users or a
|
||||
// viewer-independent base-user cache.
|
||||
|
|
@ -153,6 +157,23 @@ type User struct {
|
|||
AccountDeleteAt time.Time
|
||||
}
|
||||
|
||||
// UserRestrictionReason is the protocol-neutral form of Telegram's
|
||||
// restrictionReason. Platform "all" applies to TDesktop and official mobile
|
||||
// clients; Text is intentionally server supplied and directly user-visible.
|
||||
type UserRestrictionReason struct {
|
||||
Platform string
|
||||
Reason string
|
||||
Text string
|
||||
}
|
||||
|
||||
func AccountFrozenRestrictionReasons() []UserRestrictionReason {
|
||||
return []UserRestrictionReason{{
|
||||
Platform: "all",
|
||||
Reason: "frozen",
|
||||
Text: "This account is frozen.",
|
||||
}}
|
||||
}
|
||||
|
||||
// PremiumActiveAt 报告用户在 now(Unix 秒)时刻是否为有效会员。
|
||||
// bot 永不为会员(官方语义;授予路径同样排除 bot,这里是双保险)。
|
||||
func (u User) PremiumActiveAt(now int64) bool {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue