From 4a94f4127b57176f73e7de136137aa7efe9a0140 Mon Sep 17 00:00:00 2001 From: Claire Date: Wed, 8 Sep 2021 13:47:48 +0200 Subject: [PATCH] Fix glitch-soc front-end not linking to the provided SOURCE_URL --- .../flavours/glitch/components/error_boundary.js | 8 +++++++- .../glitch/features/ui/components/link_footer.js | 4 ++-- .../features/ui/components/onboarding_modal.js | 15 +++++++++++++-- .../flavours/glitch/util/initial_state.js | 2 ++ 4 files changed, 24 insertions(+), 5 deletions(-) diff --git a/app/javascript/flavours/glitch/components/error_boundary.js b/app/javascript/flavours/glitch/components/error_boundary.js index 8e6cd14617..4537bde1d4 100644 --- a/app/javascript/flavours/glitch/components/error_boundary.js +++ b/app/javascript/flavours/glitch/components/error_boundary.js @@ -1,6 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { FormattedMessage } from 'react-intl'; +import { source_url } from 'flavours/glitch/util/initial_state'; import { preferencesLink } from 'flavours/glitch/util/backend_links'; import StackTrace from 'stacktrace-js'; @@ -64,6 +65,11 @@ export default class ErrorBoundary extends React.PureComponent { debugInfo += 'React component stack\n---------------------\n\n```\n' + componentStack.toString() + '\n```'; } + let issueTracker = source_url; + if (source_url.match(/^https:\/\/github\.com\/[^/]+\/[^/]+\/?$/)) { + issueTracker = source_url + '/issues'; + } + return (
@@ -84,7 +90,7 @@ export default class ErrorBoundary extends React.PureComponent { }} + values={{ issuetracker: }} /> { debugInfo !== '' && (
diff --git a/app/javascript/flavours/glitch/features/ui/components/link_footer.js b/app/javascript/flavours/glitch/features/ui/components/link_footer.js index 722b47140e..d9579e9c9a 100644 --- a/app/javascript/flavours/glitch/features/ui/components/link_footer.js +++ b/app/javascript/flavours/glitch/features/ui/components/link_footer.js @@ -3,7 +3,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { FormattedMessage, defineMessages, injectIntl } from 'react-intl'; import { Link } from 'react-router-dom'; -import { invitesEnabled, version, limitedFederationMode, repository, source_url } from 'flavours/glitch/util/initial_state'; +import { invitesEnabled, limitedFederationMode, version, repository, source_url } from 'flavours/glitch/util/initial_state'; import { signOutLink, securityLink } from 'flavours/glitch/util/backend_links'; import { logOut } from 'flavours/glitch/util/log_out'; import { openModal } from 'flavours/glitch/actions/modal'; @@ -61,7 +61,7 @@ class LinkFooter extends React.PureComponent { id='getting_started.open_source_notice' defaultMessage='Glitchsoc is open source software, a friendly fork of {Mastodon}. You can contribute or report issues on GitHub at {github}.' values={{ - github: glitch-soc/mastodon (v{version}), + github: {repository} (v{version}), Mastodon: Mastodon }} />

diff --git a/app/javascript/flavours/glitch/features/ui/components/onboarding_modal.js b/app/javascript/flavours/glitch/features/ui/components/onboarding_modal.js index 935c26be69..e0872927ac 100644 --- a/app/javascript/flavours/glitch/features/ui/components/onboarding_modal.js +++ b/app/javascript/flavours/glitch/features/ui/components/onboarding_modal.js @@ -10,7 +10,7 @@ import ComposeForm from 'flavours/glitch/features/compose/components/compose_for import DrawerAccount from 'flavours/glitch/features/compose/components/navigation_bar'; import Search from 'flavours/glitch/features/compose/components/search'; import ColumnHeader from './column_header'; -import { me } from 'flavours/glitch/util/initial_state'; +import { me, source_url } from 'flavours/glitch/util/initial_state'; const noop = () => { }; @@ -141,7 +141,18 @@ const PageSix = ({ admin, domain }) => {

{adminSection} -

fork, Mastodon: Mastodon, github: GitHub }} />

+

+ fork, + Mastodon: Mastodon, + github: GitHub, + }} + /> +

}} />

diff --git a/app/javascript/flavours/glitch/util/initial_state.js b/app/javascript/flavours/glitch/util/initial_state.js index 370d982d27..7154e020be 100644 --- a/app/javascript/flavours/glitch/util/initial_state.js +++ b/app/javascript/flavours/glitch/util/initial_state.js @@ -25,6 +25,8 @@ export const maxChars = (initialState && initialState.max_toot_chars) || 500; export const pollLimits = (initialState && initialState.poll_limits); export const invitesEnabled = getMeta('invites_enabled'); export const limitedFederationMode = getMeta('limited_federation_mode'); +export const repository = getMeta('repository'); +export const source_url = getMeta('source_url'); export const version = getMeta('version'); export const mascot = getMeta('mascot'); export const profile_directory = getMeta('profile_directory');