fix: stop syncing email in panel descriptions
This commit is contained in:
@@ -1014,7 +1014,6 @@ def _telegram_id_for_user(user: User) -> Optional[int]:
|
||||
|
||||
def _panel_description_for_user(user: User) -> str:
|
||||
lines = [
|
||||
user.email or "",
|
||||
user.username or "",
|
||||
user.first_name or "",
|
||||
user.last_name or "",
|
||||
|
||||
@@ -143,6 +143,15 @@ def _panel_identity_update_payload(user: User, description_text: str) -> dict[st
|
||||
return payload
|
||||
|
||||
|
||||
def _panel_description_for_user(user: User) -> str:
|
||||
lines = [
|
||||
user.username or "",
|
||||
user.first_name or "",
|
||||
user.last_name or "",
|
||||
]
|
||||
return "\n".join(line for line in lines if line).strip()
|
||||
|
||||
|
||||
def _datetime_matches(current: Optional[datetime], desired: datetime) -> bool:
|
||||
if current is None:
|
||||
return False
|
||||
@@ -454,17 +463,7 @@ def _panel_identity_payload_with_expiry(
|
||||
*,
|
||||
expire_at: datetime,
|
||||
) -> dict[str, Any]:
|
||||
description_text = "\n".join(
|
||||
line
|
||||
for line in [
|
||||
user.email or "",
|
||||
user.username or "",
|
||||
user.first_name or "",
|
||||
user.last_name or "",
|
||||
]
|
||||
if line
|
||||
)
|
||||
payload = _panel_identity_update_payload(user, description_text)
|
||||
payload = _panel_identity_update_payload(user, _panel_description_for_user(user))
|
||||
payload["expireAt"] = expire_at.isoformat(timespec="milliseconds").replace("+00:00", "Z")
|
||||
if expire_at > datetime.now(timezone.utc):
|
||||
payload["status"] = "ACTIVE"
|
||||
@@ -1013,16 +1012,7 @@ async def _perform_sync_impl(
|
||||
# Ensure panel description contains Telegram fields
|
||||
try:
|
||||
if panel_uuid and existing_user and not is_duplicate_panel_identity:
|
||||
description_text = "\n".join(
|
||||
line
|
||||
for line in [
|
||||
existing_user.email or "",
|
||||
existing_user.username or "",
|
||||
existing_user.first_name or "",
|
||||
existing_user.last_name or "",
|
||||
]
|
||||
if line
|
||||
)
|
||||
description_text = _panel_description_for_user(existing_user)
|
||||
# Update description only when it differs from the current one on panel
|
||||
desired_description = description_text.strip()
|
||||
(
|
||||
|
||||
@@ -61,7 +61,6 @@ class ProfileSyncMiddleware(BaseMiddleware):
|
||||
if panel_service and db_user.panel_user_uuid:
|
||||
description_text = "\n".join(
|
||||
[
|
||||
db_user.email or "",
|
||||
username_for_display(tg_user.username, with_at=False)
|
||||
if sanitized_username is not None
|
||||
else "",
|
||||
|
||||
@@ -58,7 +58,6 @@ class PanelIdentityMixin:
|
||||
|
||||
def _panel_description_for_user(self, db_user: User) -> str:
|
||||
lines = [
|
||||
db_user.email or "",
|
||||
db_user.username or "",
|
||||
db_user.first_name or "",
|
||||
db_user.last_name or "",
|
||||
|
||||
Reference in New Issue
Block a user