Skip to content

Commit a91921d

Browse files
x0sinaImMohammad20000
authored andcommitted
fix(subscription): prioritize admin profile_title over settings
1 parent e12ea81 commit a91921d

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

app/models/admin.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ class AdminContactInfo(AdminBase):
2626
telegram_id: int | None = None
2727
discord_webhook: str | None = None
2828
sub_domain: str | None = None
29+
profile_title: str | None = None
30+
support_url: str | None = None
2931

3032
model_config = ConfigDict(from_attributes=True)
3133

app/operation/subscription.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def _format_profile_title(
5050
user: UsersResponseWithInbounds, format_variables: dict, sub_settings: SubSettings
5151
) -> str:
5252
"""Format profile title with dynamic variables, falling back to default if needed."""
53-
# Use getattr to safely access profile_title which may not exist on AdminContactInfo
53+
# Prefer admin's profile_title over subscription settings
5454
profile_title = (
5555
getattr(user.admin, "profile_title", None) if user.admin else None
5656
) or sub_settings.profile_title
@@ -80,7 +80,7 @@ def create_response_headers(user: UsersResponseWithInbounds, request_url: str, s
8080
format_variables = setup_format_variables(user)
8181
formatted_title = SubscriptionOperation._format_profile_title(user, format_variables, sub_settings)
8282

83-
# Get support URL (use getattr since AdminContactInfo may not have support_url)
83+
# Prefer admin's support_url over subscription settings
8484
support_url = (getattr(user.admin, "support_url", None) if user.admin else None) or sub_settings.support_url
8585

8686
return {

dashboard/src/service/api/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1911,6 +1911,10 @@ export type AdminContactInfoDiscordWebhook = string | null
19111911

19121912
export type AdminContactInfoTelegramId = number | null
19131913

1914+
export type AdminContactInfoProfileTitle = string | null
1915+
1916+
export type AdminContactInfoSupportUrl = string | null
1917+
19141918
/**
19151919
* Base model containing the core admin identification fields.
19161920
*/
@@ -1919,6 +1923,8 @@ export interface AdminContactInfo {
19191923
telegram_id?: AdminContactInfoTelegramId
19201924
discord_webhook?: AdminContactInfoDiscordWebhook
19211925
sub_domain?: AdminContactInfoSubDomain
1926+
profile_title?: AdminContactInfoProfileTitle
1927+
support_url?: AdminContactInfoSupportUrl
19221928
}
19231929

19241930
/**

0 commit comments

Comments
 (0)