mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 16:11:08 +08:00
FEATURE: Optionally show local time for user in card (#9527)
This adds a site setting (default off) to optionally show a user's local time and timezone in their user card. For example, I live in Brisbane, and if at 3:30PM my time I were to open a user who lives in California's card I would see 22:30 (PST).
This commit is contained in:
@ -60,7 +60,8 @@ class UserCardSerializer < BasicUserSerializer
|
||||
:primary_group_flair_url,
|
||||
:primary_group_flair_bg_color,
|
||||
:primary_group_flair_color,
|
||||
:featured_topic
|
||||
:featured_topic,
|
||||
:timezone
|
||||
|
||||
untrusted_attributes :bio_excerpt,
|
||||
:website,
|
||||
@ -194,6 +195,14 @@ class UserCardSerializer < BasicUserSerializer
|
||||
object.user_profile.featured_topic
|
||||
end
|
||||
|
||||
def include_timezone?
|
||||
SiteSetting.display_local_time_in_user_card?
|
||||
end
|
||||
|
||||
def timezone
|
||||
object.user_option.timezone
|
||||
end
|
||||
|
||||
def card_background_upload_url
|
||||
object.card_background_upload&.url
|
||||
end
|
||||
|
Reference in New Issue
Block a user