Skip to content

Commit

Permalink
Fix category permissions bug
Browse files Browse the repository at this point in the history
  • Loading branch information
smallhacks committed Aug 22, 2018
1 parent 174b79b commit 8930c79
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@
{{#each categories}}
<option {{selectedOption name}}>{{name}}</option>
{{/each}}
<option style="color:red" value="add-category">{{_ 'live-feed-post-submit--add-category'}}</option>
{{#if liveFeedAddCategory}}
<option style="color:red" value="add-category">{{_ 'live-feed-post-submit--add-category'}}</option>
{{/if}}
</select>
</div>
</div>
Expand Down
6 changes: 3 additions & 3 deletions src/client/templates/space/live_feed/live_feed_post_submit.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ Template.liveFeedPostSubmit.helpers({
if (Session.get('liveFeedCategory') == option)
return 'selected'
},
permissionAddCategories: function(template) {
if (this.space.permissions.addCategories || Roles.userIsInRole(Meteor.userId(), ['admin']) || Meteor.userId() == this.space.userId)
liveFeedAddCategory: function(template) {
if (this.space.permissions.liveFeedAddCategory || Roles.userIsInRole(Meteor.userId(), ['admin']) || Meteor.userId() == this.space.userId)
return true
else
return false
Expand All @@ -175,5 +175,5 @@ Template.liveFeedPostSubmit.helpers({
spaceId: this.space._id,
type: "liveFeed"
}
}
},
});
4 changes: 2 additions & 2 deletions src/client/templates/space/space_sidebar.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<li class="align-middle nav-item sidebar-item w-100 small">
<a class="align-bottom nav-link space-sidebar--filter-live-feed-category pl-1 py-1 text-nowrap text-dark filter-live-feed-category {{selectedLiveFeedCategory}} pl-4 py-2 py-lg-2" data-category="{{name}}" href="#"><span class="align-bottom pl-1" data-category="{{name}}">{{name}}</span>
<span class="align-baseline text-secondary small ml-1" data-category="{{name}}">{{nRefs}}</span>
{{#if liveFeedAddCategories}}
{{#if ownSpace}}
<a class="align-middle space-sidebar--live-feed-category-edit small ml-2" data-category="{{name}}">
<i class="align-middle fas fa-pencil-alt" data-category="{{name}}"></i>
</a>
Expand All @@ -34,7 +34,7 @@
</li>
{{/each}}
<div class="pl-3 ml-2 mt-1">
{{#if permissionAddCategories}}
{{#if liveFeedAddCategory}}
<a href="#" class="small pt-1 pl-1 font-weight-light" data-toggle="modal" data-target="#liveFeedCategorySubmit">
<span class="pl-1"><i class="fas fa-plus"></i> {{_ 'space-sidebar--add-category'}}</span>
</a>
Expand Down
10 changes: 8 additions & 2 deletions src/client/templates/space/space_sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,14 @@ Template.spaceSidebar.helpers({
resources: function() {
return this.space.resources
},
liveFeedAddCategories: function() {
if (this.space.permissions.liveFeedAddCategories || Roles.userIsInRole(Meteor.userId(), ['admin']) || Meteor.userId() == this.space.userId)
ownSpace: function() {
if (Meteor.userId() == Template.parentData(2).space.userId || Roles.userIsInRole(Meteor.userId(), ['admin']))
return true
else
return false
},
liveFeedAddCategory: function() {
if (this.space.permissions.liveFeedAddCategory || Roles.userIsInRole(Meteor.userId(), ['admin']) || Meteor.userId() == this.space.userId)
return true
else
return false
Expand Down

0 comments on commit 8930c79

Please sign in to comment.