Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/javascript/mastodon/api_types/accounts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export interface BaseApiAccountJSON {
other_settings: ApiAccountOtherSettingsJSON;
roles?: ApiAccountJSON[];
server_features: ApiServerFeaturesJSON;
software: string;
statuses_count: number;
uri: string;
url?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ import { Icon } from 'mastodon/components/icon';
export const DomainPill: React.FC<{
domain: string;
username: string;
software: string;
isSelf: boolean;
}> = ({ domain, username, isSelf }) => {
}> = ({ domain, username, software, isSelf }) => {
const accessibilityId = useId();
const [open, setOpen] = useState(false);
const [expanded, setExpanded] = useState(false);
Expand Down Expand Up @@ -126,6 +127,11 @@ export const DomainPill: React.FC<{
id='domain_pill.server'
defaultMessage='Server'
/>
{!isSelf && software && (
<span className='account__domain-pill__popout__parts__header-software-name'>
({software})
</span>
)}
</h6>
<p>
{isSelf ? (
Expand All @@ -134,10 +140,25 @@ export const DomainPill: React.FC<{
defaultMessage='Your digital home, where all of your posts live. Don’t like this one? Transfer servers at any time and bring your followers, too.'
/>
) : (
<FormattedMessage
id='domain_pill.their_server'
defaultMessage='Their digital home, where all of their posts live.'
/>
<>
<FormattedMessage
id='domain_pill.their_server'
defaultMessage='Their digital home, where all of their posts live.'
/>
{software && (
<FormattedMessage
id='domain_pill.their_server_software'
defaultMessage='This server is using <software>unknown</software> software, but you can view posts and participate in conversations just like other users.'
values={{
software: () => (
<span className='account__domain-pill__popout__parts__software-name'>
{software}
</span>
),
}}
/>
)}
</>
)}
</p>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -926,6 +926,7 @@ export const AccountHeader: React.FC<{
<DomainPill
username={username ?? ''}
domain={domain ?? ''}
software={account.software}
isSelf={me === account.id}
/>
{lockedIcon}
Expand Down
1 change: 1 addition & 0 deletions app/javascript/mastodon/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,7 @@
"domain_pill.server": "Server",
"domain_pill.their_handle": "Their handle:",
"domain_pill.their_server": "Their digital home, where all of their posts live.",
"domain_pill.their_server_software": "This server is using <software>unknown</software> software, but you can view posts and participate in conversations just like other users.",
"domain_pill.their_username": "Their unique identifier on their server. It’s possible to find users with the same username on different servers.",
"domain_pill.username": "Username",
"domain_pill.whats_in_a_handle": "What's in a handle?",
Expand Down
1 change: 1 addition & 0 deletions app/javascript/mastodon/locales/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,7 @@
"domain_pill.server": "サーバー",
"domain_pill.their_handle": "このユーザーのハンドル:",
"domain_pill.their_server": "ユーザーの仮想の住所です。そのユーザーIDによるすべての投稿を保持しています。",
"domain_pill.their_server_software": "このサーバーは<software>unknown</software>という名前のソフトウェアを使用していますが、他のサーバーと同様に投稿を表示したり、会話に参加できます。",
"domain_pill.their_username": "ユーザーを識別する名前です。ユーザー名はひとつのサーバー内においては唯一無二の名前ですが、ほかのサーバーには同名のユーザーがいることもあります。",
"domain_pill.username": "ユーザー名",
"domain_pill.whats_in_a_handle": "ユーザーハンドルについて",
Expand Down
1 change: 1 addition & 0 deletions app/javascript/mastodon/models/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ export const accountDefaultValues: AccountShape = {
display_name: '',
display_name_html: '',
server_features: AccountServerFeaturesFactory(),
software: '',
emojis: ImmutableList<CustomEmoji>(),
fields: ImmutableList<AccountField>(),
group: false,
Expand Down
10 changes: 10 additions & 0 deletions app/javascript/styles/mastodon/components.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2259,6 +2259,16 @@
font-weight: 500;
color: $primary-text-color;
}

&__software-name {
font-weight: 500;
color: $highlight-text-color;
}

&__header-software-name {
font-size: 12px;
margin-inline-start: 8px;
}
}
}
}
Expand Down
1 change: 1 addition & 0 deletions app/javascript/testing/factories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export const accountFactory: FactoryFunction<ApiAccountJSON> = ({
noindex: false,
roles: [],
hide_collections: false,
software: 'mastodon',
other_settings: {
hide_followers_count: false,
hide_following_count: false,
Expand Down
10 changes: 6 additions & 4 deletions app/models/instance_info.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ def no_language_flag_software?(domain)
NO_LANGUAGE_FLAG_SOFTWARES.include?(software_name(domain))
end

def software_name(domain)
return 'kmyblue' unless domain

Rails.cache.fetch("software_name:#{domain}") { load_software_name(domain) }
end

private

def load_available_features(domain)
Expand Down Expand Up @@ -118,10 +124,6 @@ def metadata_features(info)
info.data['metadata']['features']
end

def software_name(domain)
Rails.cache.fetch("software_name:#{domain}") { load_software_name(domain) }
end

def load_software_name(domain)
return 'threads' if domain == 'threads.net'

Expand Down
6 changes: 5 additions & 1 deletion app/serializers/rest/account_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class REST::AccountSerializer < ActiveModel::Serializer
attributes :id, :username, :acct, :display_name, :locked, :bot, :discoverable, :indexable, :group, :created_at,
:note, :url, :uri, :avatar, :avatar_static, :header, :header_static, :subscribable,
:followers_count, :following_count, :statuses_count, :last_status_at, :hide_collections, :other_settings, :noindex,
:server_features
:server_features, :software

has_one :moved_to_account, key: :moved, serializer: REST::AccountSerializer, if: :moved_and_not_nested?

Expand Down Expand Up @@ -124,6 +124,10 @@ def server_features
InstanceInfo.available_features(object.domain)
end

def software
InstanceInfo.software_name(object.domain)
end

def moved_to_account
object.unavailable? ? nil : AccountDecorator.new(object.moved_to_account)
end
Expand Down
2 changes: 1 addition & 1 deletion lib/mastodon/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

module Mastodon
module Version
KMYBLUE_API_VERSION = 4
KMYBLUE_API_VERSION = 5

module_function

Expand Down