Skip to content

Commit

Permalink
Lodash was auto-handling null cases
Browse files Browse the repository at this point in the history
  • Loading branch information
angusmcleod committed Sep 4, 2020
1 parent 69b67a3 commit b86bb68
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions assets/javascripts/discourse/lib/retort.js.es6
Expand Up @@ -44,11 +44,12 @@ export default Ember.Object.create({
const post = this.postFor(postId)
if (!post) { return true }
if (!post.topic.details.can_create_post) { return true }

if (post.get('topic.archived')) { return true }

const categoryName = post.get('topic.category.name');
const disabledCategories = this.disabledCategories();
let categoryName = post.get('topic.category.name').toString().toLowerCase();

return disabledCategories.includes(categoryName) || post.get('topic.archived')
return categoryName &&
disabledCategories.includes(categoryName.toString().toLowerCase());
},

openPicker(post) {
Expand Down

0 comments on commit b86bb68

Please sign in to comment.