feat: enable specifying custom open authoring commit message (#2810)

This commit is contained in:
Erez Rokah
2019-10-28 21:29:47 +02:00
committed by Shawn Erquhart
parent f206e7e5a1
commit 2841ff9ffe
8 changed files with 294 additions and 45 deletions

View File

@ -45,7 +45,7 @@ export default class API {
p => p.catch(err => Promise.reject(new APIError(err.message, null, 'BitBucket'))),
])(req);
user = () => this.request('/user');
user = () => this.requestJSON('/user');
hasWriteAccess = async () => {
const response = await this.request(this.repoURL);

View File

@ -72,8 +72,7 @@ export default class BitbucketBackend {
api_root: this.api_root,
});
const user = await this.api.user();
const isCollab = await this.api.hasWriteAccess(user).catch(error => {
const isCollab = await this.api.hasWriteAccess().catch(error => {
error.message = stripIndent`
Repo "${this.repo}" not found.
@ -89,8 +88,16 @@ export default class BitbucketBackend {
throw new Error('Your BitBucket user account does not have access to this repo.');
}
const user = await this.api.user();
// Authorized user
return { ...user, token: state.token, refresh_token: state.refresh_token };
return {
...user,
name: user.display_name,
login: user.username,
token: state.token,
refresh_token: state.refresh_token,
};
}
getRefreshedAccessToken() {