Skip to content

Commit

Permalink
Merge 64cca46 into 6a057af
Browse files Browse the repository at this point in the history
  • Loading branch information
angelsl committed Jun 26, 2021
2 parents 6a057af + 64cca46 commit e162847
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-development.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
yarn run build
env:
REACT_APP_URL_SHORTENER_SIGNATURE: ${{ secrets.REACT_APP_URL_SHORTENER_SIGNATURE }}
REACT_APP_URL_SHORTENER_DOMAIN: ${{ secrets.REACT_APP_URL_SHORTENER_DOMAIN }}
REACT_APP_URL_SHORTENER_BASE: ${{ secrets.REACT_APP_URL_SHORTENER_BASE }}
REACT_APP_SENTRY_DSN: ${{ secrets.REACT_APP_SENTRY_DSN }}
REACT_APP_GOOGLE_CLIENT_ID: ${{ secrets.REACT_APP_GOOGLE_CLIENT_ID }}
REACT_APP_GOOGLE_API_KEY: ${{ secrets.REACT_APP_GOOGLE_API_KEY }}
Expand Down
8 changes: 1 addition & 7 deletions src/commons/controlBar/ControlBarShareButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,6 @@ export class ControlBarShareButton extends React.PureComponent<ControlBarShareBu
}

public render() {
let url = '';
const { urlShortener } = Constants;
if (urlShortener) {
url = urlShortener.split('/').slice(0, -1).join('/') + '/';
}

const shareButtonPopoverContent =
this.props.queryString === undefined ? (
<Text>
Expand All @@ -66,7 +60,7 @@ export class ControlBarShareButton extends React.PureComponent<ControlBarShareBu
{!this.props.shortURL || this.props.shortURL === 'ERROR' ? (
!this.state.isLoading || this.props.shortURL === 'ERROR' ? (
<div>
{url}&nbsp;
{Constants.urlShortenerBase}&nbsp;
<input
placeholder={'custom string (optional)'}
onChange={this.handleChange}
Expand Down
4 changes: 2 additions & 2 deletions src/commons/sagas/PlaygroundSaga.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export default function* PlaygroundSaga(): SagaIterator {
if (resp.status !== 'success') {
yield call(showSuccessMessage, resp.message);
}
yield put(updateShortURL(resp.shorturl));
yield put(updateShortURL(Constants.urlShortenerBase + resp.url.keyword));
});
}

Expand Down Expand Up @@ -110,7 +110,7 @@ export async function shortenURLRequest(
}, new FormData())
};

const resp = await fetch(Constants.urlShortener!, fetchOpts);
const resp = await fetch(`${Constants.urlShortenerBase}yourls-api.php`, fetchOpts);
if (!resp || !resp.ok) {
return null;
}
Expand Down
2 changes: 2 additions & 0 deletions src/commons/sagas/__tests__/PlaygroundSaga.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ import {
OverallState
} from '../../application/ApplicationTypes';
import { ExternalLibraryName } from '../../application/types/ExternalTypes';
import Constants from '../../utils/Constants';
import { showSuccessMessage, showWarningMessage } from '../../utils/NotificationsHelper';
import PlaygroundSaga, { shortenURLRequest } from '../PlaygroundSaga';

describe('Playground saga tests', () => {
Constants.urlShortenerBase = 'http://url-shortener.com/';
const errMsg = 'Something went wrong trying to create the link.';

test('puts changeQueryString action with undefined argument when passed the default value', () => {
Expand Down
4 changes: 2 additions & 2 deletions src/commons/utils/Constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const defaultSourceVariant = 'default';
const defaultQuestionId = 0;
const maxBrowseIndex = 50;
const mobileBreakpoint = 768;
const urlShortener = process.env.REACT_APP_URL_SHORTENER_DOMAIN;
const urlShortenerBase = process.env.REACT_APP_URL_SHORTENER_BASE;
const urlShortenerSignature = process.env.REACT_APP_URL_SHORTENER_SIGNATURE;
const moduleBackendUrl = process.env.REACT_APP_MODULE_BACKEND_URL || 'modules';
const sharedbBackendUrl = process.env.REACT_APP_SHAREDB_BACKEND_URL || '';
Expand Down Expand Up @@ -110,7 +110,7 @@ const Constants = {
defaultQuestionId,
maxBrowseIndex,
mobileBreakpoint,
urlShortener,
urlShortenerBase,
urlShortenerSignature,
moduleBackendUrl,
authProviders,
Expand Down

0 comments on commit e162847

Please sign in to comment.