New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FIX: Don't allow editing seeded category security settings #3749
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ class CategorySerializer < BasicCategorySerializer | |
:suppress_from_homepage, | ||
:can_delete, | ||
:cannot_delete_reason, | ||
:is_special, | ||
:allow_badges, | ||
:custom_fields | ||
|
||
|
@@ -37,6 +38,11 @@ def can_delete | |
true | ||
end | ||
|
||
def is_special | ||
[SiteSetting.lounge_category_id, SiteSetting.meta_category_id, SiteSetting.staff_category_id, SiteSetting.uncategorized_category_id] | ||
.include? object.id | ||
end | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One thing I prefer to do to keep JSON size down is have boolean values return true always, then use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. b706c59 |
||
|
||
def include_can_delete? | ||
scope && scope.can_delete?(object) | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why
group + ""
? Is that to avoid callingtoString()
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, looks like I triggered a format there. Same code as before.