Add joined date to profiles in web UI (#16169)

This commit is contained in:
Eugen Rochko 2021-05-07 14:33:19 +02:00 committed by GitHub
parent b42a8ef7d9
commit 2c77d97e0d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 34 additions and 8 deletions

View File

@ -326,6 +326,8 @@ class Header extends ImmutablePureComponent {
{account.get('id') !== me && !suspended && <AccountNoteContainer account={account} />} {account.get('id') !== me && !suspended && <AccountNoteContainer account={account} />}
{account.get('note').length > 0 && account.get('note') !== '<p></p>' && <div className='account__header__content translate' dangerouslySetInnerHTML={content} />} {account.get('note').length > 0 && account.get('note') !== '<p></p>' && <div className='account__header__content translate' dangerouslySetInnerHTML={content} />}
<div className='account__header__joined'><FormattedMessage id='account.joined' defaultMessage='Joined {date}' values={{ date: intl.formatDate(account.get('created_at'), { year: 'numeric', month: 'short', day: '2-digit' }) }} /></div>
</div> </div>
{!suspended && ( {!suspended && (

View File

@ -909,6 +909,10 @@
{ {
"defaultMessage": "Group", "defaultMessage": "Group",
"id": "account.badges.group" "id": "account.badges.group"
},
{
"defaultMessage": "Joined {date}",
"id": "account.joined"
} }
], ],
"path": "app/javascript/mastodon/features/account/components/header.json" "path": "app/javascript/mastodon/features/account/components/header.json"
@ -1919,12 +1923,12 @@
"id": "home.hide_announcements" "id": "home.hide_announcements"
}, },
{ {
"defaultMessage": "Your home timeline is empty! Visit {public} or use search to get started and meet other users.", "defaultMessage": "Your home timeline is empty! Follow more people to fill it up. {suggestions}",
"id": "empty_column.home" "id": "empty_column.home"
}, },
{ {
"defaultMessage": "the public timeline", "defaultMessage": "See some suggestions",
"id": "empty_column.home.public_timeline" "id": "empty_column.home.suggestions"
} }
], ],
"path": "app/javascript/mastodon/features/home_timeline/index.json" "path": "app/javascript/mastodon/features/home_timeline/index.json"
@ -2417,7 +2421,7 @@
"id": "notifications.mark_as_read" "id": "notifications.mark_as_read"
}, },
{ {
"defaultMessage": "You don't have any notifications yet. Interact with others to start the conversation.", "defaultMessage": "You don't have any notifications yet. When other people interact with you, you will see it here.",
"id": "empty_column.notifications" "id": "empty_column.notifications"
} }
], ],
@ -3249,4 +3253,4 @@
], ],
"path": "app/javascript/mastodon/features/video/index.json" "path": "app/javascript/mastodon/features/video/index.json"
} }
] ]

View File

@ -6769,6 +6769,17 @@ noscript {
} }
} }
.account__header__joined {
font-size: 14px;
padding: 5px 15px;
color: $darker-text-color;
.columns-area--mobile & {
padding-left: 20px;
padding-right: 20px;
}
}
.account__header__fields { .account__header__fields {
margin: 0; margin: 0;
border-top: 1px solid lighten($ui-base-color, 12%); border-top: 1px solid lighten($ui-base-color, 12%);

View File

@ -13,7 +13,7 @@ class ActivityPub::ActorSerializer < ActivityPub::Serializer
:inbox, :outbox, :featured, :featured_tags, :inbox, :outbox, :featured, :featured_tags,
:preferred_username, :name, :summary, :preferred_username, :name, :summary,
:url, :manually_approves_followers, :url, :manually_approves_followers,
:discoverable :discoverable, :published
has_one :public_key, serializer: ActivityPub::PublicKeySerializer has_one :public_key, serializer: ActivityPub::PublicKeySerializer
@ -158,6 +158,10 @@ class ActivityPub::ActorSerializer < ActivityPub::Serializer
!object.suspended? && !object.also_known_as.empty? !object.suspended? && !object.also_known_as.empty?
end end
def published
object.created_at.midnight.iso8601
end
class CustomEmojiSerializer < ActivityPub::EmojiSerializer class CustomEmojiSerializer < ActivityPub::EmojiSerializer
end end

View File

@ -55,6 +55,10 @@ class REST::AccountSerializer < ActiveModel::Serializer
full_asset_url(object.suspended? ? object.header.default_url : object.header_static_url) full_asset_url(object.suspended? ? object.header.default_url : object.header_static_url)
end end
def created_at
object.created_at.midnight.iso8601
end
def last_status_at def last_status_at
object.last_status_at&.to_date&.iso8601 object.last_status_at&.to_date&.iso8601
end end

View File

@ -87,6 +87,7 @@ class ActivityPub::ProcessAccountService < BaseService
@account.url = url || @uri @account.url = url || @uri
@account.uri = @uri @account.uri = @uri
@account.actor_type = actor_type @account.actor_type = actor_type
@account.created_at = @json['published'] if @json['published'].present?
end end
def set_immediate_attributes! def set_immediate_attributes!
@ -101,7 +102,7 @@ class ActivityPub::ProcessAccountService < BaseService
end end
def set_fetchable_key! def set_fetchable_key!
@account.public_key = public_key || '' @account.public_key = public_key || ''
end end
def set_fetchable_attributes! def set_fetchable_attributes!

View File

@ -13,7 +13,7 @@ RSpec.describe ActivityPub::Activity::Update do
end end
let(:modified_sender) do let(:modified_sender) do
sender.dup.tap do |modified_sender| sender.tap do |modified_sender|
modified_sender.display_name = 'Totally modified now' modified_sender.display_name = 'Totally modified now'
end end
end end