Skip to content
This repository has been archived by the owner on Jul 24, 2021. It is now read-only.

Commit

Permalink
Merge pull request #292 from joyent/dustin/v4.x/bug-fixes
Browse files Browse the repository at this point in the history
Bug fixes
  • Loading branch information
dustinryerson authored Nov 30, 2020
2 parents 9ef18e9 + 9f0ae00 commit cf0bc22
Show file tree
Hide file tree
Showing 8 changed files with 290 additions and 266 deletions.
23 changes: 13 additions & 10 deletions src/views/Builds/Build.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@
v-if="currentBuild.started && !currentBuild.completed"
class="control"
>
<a class="button is-success" @click="updateBuild('complete')">
<a
v-if="userIsAdmin"
class="button is-success"
@click="updateBuild('complete')"
>
Complete Build
</a>
</p>
Expand Down Expand Up @@ -169,20 +173,19 @@ export default {
return tabs;
},
userIsAdmin() {
const build = this.currentBuild;
const user = this.currentUser;
if (user && user.is_admin) {
if (
(user && user.is_admin) ||
(build &&
build.admins &&
build.admins.length &&
build.admins.map(admin => admin.id).includes(user.id))
) {
return true;
}
if (user && user.builds && user.builds.length) {
const build = user.builds.find(build => build.id === this.buildId);
if (build && build.role === 'admin') {
return true;
}
}
return false;
},
},
Expand Down
Loading

0 comments on commit cf0bc22

Please sign in to comment.