Properly check for early access role in package select

This commit is contained in:
James Rowe 2019-11-07 10:56:22 -07:00
parent c176658e28
commit 1639e74b98
2 changed files with 17 additions and 23 deletions

View file

@ -129,15 +129,9 @@ var app = new Vue({
that.is_authenticated = Object.keys(that.jwt_token).length !== 0 && that.jwt_token.constructor === Object;
if (that.is_authenticated) {
// Give all permissions to vip roles
if (that.jwt_token.roles.indexOf("vip") > -1) {
that.is_linked = true;
that.is_subscribed = true;
that.has_reward_tier = true;
} else {
that.is_linked = that.jwt_token.isPatreonAccountLinked;
that.is_subscribed = that.jwt_token.isPatreonSubscriptionActive;
that.has_reward_tier = that.jwt_token.releaseChannels.indexOf("early-access") > -1;
}
that.is_linked = that.jwt_token.isPatreonAccountLinked;
that.is_subscribed = that.jwt_token.isPatreonSubscriptionActive;
that.has_reward_tier = that.jwt_token.releaseChannels.indexOf("early-access") > -1;
}
if (success) {
success();

View file

@ -6,7 +6,19 @@
<div class="tile is-ancestor">
<div class="tile is-parent" v-for="Lpackage in $root.$data.config.packages" :key="Lpackage.name" :index="Lpackage.name">
<div class="tile is-child">
<div class="box clickable-box" v-if="Lpackage.requires_authorization && !$root.$data.is_authenticated" v-on:click="show_authentication">
<div class="box clickable-box" v-if="!Lpackage.requires_authorization || (Lpackage.requires_authorization && $root.$data.has_reward_tier)" v-on:click.capture.stop="Lpackage.default = !Lpackage.default">
<div class="ribbon" v-if="Lpackage.is_new"><span>New!</span></div>
<label class="checkbox">
<b-checkbox v-model="Lpackage.default">
{{ Lpackage.name }}
</b-checkbox>
<span v-if="Lpackage.installed"><i>(installed)</i></span>
</label>
<p>
{{ Lpackage.description }}
</p>
</div>
<div class="box clickable-box" v-else-if="Lpackage.requires_authorization && !$root.$data.is_authenticated" v-on:click="show_authentication">
<div class="ribbon" v-if="Lpackage.is_new"><span>New!</span></div>
<b-checkbox>
{{ Lpackage.name }}
@ -33,7 +45,7 @@
{{Lpackage.need_subscription_description}}
</p>
</div>
<div class="box clickable-box" v-else-if="Lpackage.requires_authorization && !$root.$data.has_reward_tier" v-on:click="show_authorization">
<div class="box clickable-box" v-else v-on:click="show_authorization">
<div class="ribbon" v-if="Lpackage.is_new"><span>New!</span></div>
<b-checkbox>
{{ Lpackage.name }}
@ -42,18 +54,6 @@
{{Lpackage.need_reward_tier_description}}
</p>
</div>
<div class="box clickable-box" v-else v-on:click.capture.stop="Lpackage.default = !Lpackage.default">
<div class="ribbon" v-if="Lpackage.is_new"><span>New!</span></div>
<label class="checkbox">
<b-checkbox v-model="Lpackage.default">
{{ Lpackage.name }}
</b-checkbox>
<span v-if="Lpackage.installed"><i>(installed)</i></span>
</label>
<p>
{{ Lpackage.description }}
</p>
</div>
</div>
</div>
</div>