fix(bitbucket): fix rebasing mistakes in bitbucket backend and deps (#1522)

This commit is contained in:
Shawn Erquhart 2018-07-26 13:42:19 -04:00 committed by GitHub
parent 6eb86957d0
commit bdfd9443db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 9 additions and 11 deletions

View File

@ -1,6 +1,6 @@
import { flow } from "lodash"; import { flow, has } from "lodash";
import { import {
LocalForage, localForage,
unsentRequest, unsentRequest,
responseParser, responseParser,
then, then,
@ -67,13 +67,13 @@ export default class API {
readFile = async (path, sha, { ref = this.branch, parseText = true } = {}) => { readFile = async (path, sha, { ref = this.branch, parseText = true } = {}) => {
const cacheKey = parseText ? `bb.${ sha }` : `bb.${ sha }.blob`; const cacheKey = parseText ? `bb.${ sha }` : `bb.${ sha }.blob`;
const cachedFile = sha ? await LocalForage.getItem(cacheKey) : null; const cachedFile = sha ? await localForage.getItem(cacheKey) : null;
if (cachedFile) { return cachedFile; } if (cachedFile) { return cachedFile; }
const result = await this.request({ const result = await this.request({
url: `${ this.repoURL }/src/${ ref }/${ path }`, url: `${ this.repoURL }/src/${ ref }/${ path }`,
cache: "no-store", cache: "no-store",
}).then(parseText ? responseParser({ format: "text" }) : responseParser({ format: "blob" })); }).then(parseText ? responseParser({ format: "text" }) : responseParser({ format: "blob" }));
if (sha) { LocalForage.setItem(cacheKey, result); } if (sha) { localForage.setItem(cacheKey, result); }
return result; return result;
} }

View File

@ -35,10 +35,12 @@ export default class BitbucketAuthenticationPage extends React.Component {
}; };
render() { render() {
const { inProgress } = this.props;
return ( return (
<AuthenticationPage <AuthenticationPage
onLogin={this.handleLogin} onLogin={this.handleLogin}
loginDisabled={this.props.inProgress} loginDisabled={inProgress}
loginErrorMessage={this.state.loginError} loginErrorMessage={this.state.loginError}
renderButtonContent={() => ( renderButtonContent={() => (
<React.Fragment> <React.Fragment>

View File

@ -81,7 +81,7 @@ export default class Bitbucket {
base_url: this.base_url, base_url: this.base_url,
site_id: this.site_id, site_id: this.site_id,
}; };
this.authenticator = new Authenticator(cfg); this.authenticator = new NetlifyAuthenticator(cfg);
} }
this.refreshedTokenPromise = this.authenticator.refresh({ provider: "bitbucket", refresh_token: this.refreshToken }) this.refreshedTokenPromise = this.authenticator.refresh({ provider: "bitbucket", refresh_token: this.refreshToken })

View File

@ -147,8 +147,6 @@ export default class GitGatewayAuthenticationPage extends React.Component {
); );
} }
console.log('returning');
return ( return (
<AuthenticationPage renderPageContent={() => ( <AuthenticationPage renderPageContent={() => (
<AuthForm onSubmit={this.handleLogin}> <AuthForm onSubmit={this.handleLogin}>

View File

@ -113,7 +113,6 @@ export default class GitGateway {
requestFunction: this.requestFunction, requestFunction: this.requestFunction,
hasWriteAccess: async () => true, hasWriteAccess: async () => true,
}); });
console.log(this.api);
this.backend = new BitBucketBackend(this.config, { proxied: true, API: this.api }); this.backend = new BitBucketBackend(this.config, { proxied: true, API: this.api });
} }

View File

@ -61,7 +61,6 @@ class Authenticator {
cb(null, data); cb(null, data);
} }
if (e.data.indexOf('authorization:' + options.provider + ':error:') === 0) { if (e.data.indexOf('authorization:' + options.provider + ':error:') === 0) {
console.log('Got authorization error');
const err = JSON.parse(e.data.match(new RegExp('^authorization:' + options.provider + ':error:(.+)$'))[1]); const err = JSON.parse(e.data.match(new RegExp('^authorization:' + options.provider + ':error:(.+)$'))[1]);
window.removeEventListener('message', fn, false); window.removeEventListener('message', fn, false);
this.authWindow.close(); this.authWindow.close();

View File

@ -5,3 +5,4 @@ export localForage from './localForage';
export { resolvePath, basename, fileExtensionWithSeparator, fileExtension } from './path'; export { resolvePath, basename, fileExtensionWithSeparator, fileExtension } from './path';
export { filterPromises, resolvePromiseProperties, then } from './promise'; export { filterPromises, resolvePromiseProperties, then } from './promise';
export unsentRequest from './unsentRequest'; export unsentRequest from './unsentRequest';
export { filterByPropExtension, parseResponse, responseParser } from './backendUtil';

View File

@ -37,7 +37,6 @@ const AuthenticationPage = ({
renderButtonContent, renderButtonContent,
renderPageContent, renderPageContent,
}) => { }) => {
console.log(renderPageContent);
return ( return (
<StyledAuthenticationPage> <StyledAuthenticationPage>
<PageLogoIcon size="300px" type="netlify-cms"/> <PageLogoIcon size="300px" type="netlify-cms"/>