Skip to content

Commit

Permalink
Fix: 概要画面でエラーの発生する場合がある問題
Browse files Browse the repository at this point in the history
  • Loading branch information
kmycode committed Oct 16, 2023
1 parent 7d6684f commit 2de0dbd
Showing 1 changed file with 18 additions and 11 deletions.
29 changes: 18 additions & 11 deletions app/javascript/mastodon/features/about/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,10 @@ class About extends PureComponent {
const { multiColumn, intl, server, extendedDescription, domainBlocks } = this.props;
const isLoading = server.get('isLoading');

const fedibirdCapabilities = server.get('fedibird_capabilities');
const fedibirdCapabilities = server.get('fedibird_capabilities') || [];
const isPublicUnlistedVisibility = fedibirdCapabilities.includes('kmyblue_visibility_public_unlisted');
const isEmojiReaction = fedibirdCapabilities.includes('emoji_reaction');
const capabilitiesError = !server.get('fedibird_capabilities');

return (
<Column bindToDocument={!multiColumn} label={intl.formatMessage(messages.title)}>
Expand Down Expand Up @@ -192,16 +193,22 @@ class About extends PureComponent {
</Section>

<Section title={intl.formatMessage(messages.capabilities)}>
<p><FormattedMessage id='about.kmyblue_capability' defaultMessage='This server is using kmyblue, a fork of Mastodon. On this server, kmyblues unique features are configured as follows.' /></p>
{!isLoading && (
<ol className='rules-list'>
<li>
<span className='rules-list__text'>{intl.formatMessage(messages.emojiReaction)}: {intl.formatMessage(isEmojiReaction ? messages.enabled : messages.disabled)}</span>
</li>
<li>
<span className='rules-list__text'>{intl.formatMessage(messages.publicUnlistedVisibility)}: {intl.formatMessage(isPublicUnlistedVisibility ? messages.enabled : messages.disabled)}</span>
</li>
</ol>
{capabilitiesError ? (
<p><FormattedMessage id='about.kmyblue_capability.error' defaultMessage='An error is occured! Please reload this page.' /></p>
) : (
<>
<p><FormattedMessage id='about.kmyblue_capability' defaultMessage='This server is using kmyblue, a fork of Mastodon. On this server, kmyblues unique features are configured as follows.' /></p>
{!isLoading && (
<ol className='rules-list'>
<li>
<span className='rules-list__text'>{intl.formatMessage(messages.emojiReaction)}: {intl.formatMessage(isEmojiReaction ? messages.enabled : messages.disabled)}</span>
</li>
<li>
<span className='rules-list__text'>{intl.formatMessage(messages.publicUnlistedVisibility)}: {intl.formatMessage(isPublicUnlistedVisibility ? messages.enabled : messages.disabled)}</span>
</li>
</ol>
)}
</>
)}
</Section>

Expand Down

0 comments on commit 2de0dbd

Please sign in to comment.