FIX: `include_` serializer methods must end with ? (#14407)
Otherwise, they are simply dead code and the attribute is visible by default. These bugs did not expose any sensitive information.
This commit is contained in:
parent
dd091fbf36
commit
2e085915cc
|
@ -75,7 +75,7 @@ class CategorySerializer < SiteCategorySerializer
|
||||||
scope && scope.cannot_delete_category_reason(object)
|
scope && scope.cannot_delete_category_reason(object)
|
||||||
end
|
end
|
||||||
|
|
||||||
def include_cannot_delete_reason
|
def include_cannot_delete_reason?
|
||||||
!include_can_delete? && scope && scope.can_edit?(object)
|
!include_can_delete? && scope && scope.can_edit?(object)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ class GroupUserSerializer < BasicUserSerializer
|
||||||
:added_at,
|
:added_at,
|
||||||
:timezone
|
:timezone
|
||||||
|
|
||||||
def include_added_at
|
def include_added_at?
|
||||||
object.respond_to? :added_at
|
object.respond_to? :added_at
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ class InvitedUserRecordSerializer < BasicUserSerializer
|
||||||
((Time.now - object.created_at) / 60 / 60 / 24).ceil
|
((Time.now - object.created_at) / 60 / 60 / 24).ceil
|
||||||
end
|
end
|
||||||
|
|
||||||
def include_days_since_created
|
def include_days_since_created?
|
||||||
can_see_invite_details?
|
can_see_invite_details?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -107,10 +107,6 @@ class UserCardSerializer < BasicUserSerializer
|
||||||
uri.host.sub(/^www\./, '') + uri.path
|
uri.host.sub(/^www\./, '') + uri.path
|
||||||
end
|
end
|
||||||
|
|
||||||
def include_website_name
|
|
||||||
website.present?
|
|
||||||
end
|
|
||||||
|
|
||||||
def ignored
|
def ignored
|
||||||
scope_ignored_user_ids = scope.user&.ignored_user_ids || []
|
scope_ignored_user_ids = scope.user&.ignored_user_ids || []
|
||||||
scope_ignored_user_ids.include?(object.id)
|
scope_ignored_user_ids.include?(object.id)
|
||||||
|
|
|
@ -215,12 +215,6 @@
|
||||||
"can_delete": {
|
"can_delete": {
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
},
|
},
|
||||||
"cannot_delete_reason": {
|
|
||||||
"type": [
|
|
||||||
"string",
|
|
||||||
"null"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"allow_badges": {
|
"allow_badges": {
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
},
|
},
|
||||||
|
@ -287,7 +281,6 @@
|
||||||
"mailinglist_mirror",
|
"mailinglist_mirror",
|
||||||
"all_topics_wiki",
|
"all_topics_wiki",
|
||||||
"can_delete",
|
"can_delete",
|
||||||
"cannot_delete_reason",
|
|
||||||
"allow_badges",
|
"allow_badges",
|
||||||
"topic_featured_link_allowed",
|
"topic_featured_link_allowed",
|
||||||
"search_priority",
|
"search_priority",
|
||||||
|
|
|
@ -218,12 +218,6 @@
|
||||||
"can_delete": {
|
"can_delete": {
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
},
|
},
|
||||||
"cannot_delete_reason": {
|
|
||||||
"type": [
|
|
||||||
"string",
|
|
||||||
"null"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"allow_badges": {
|
"allow_badges": {
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
},
|
},
|
||||||
|
@ -290,7 +284,6 @@
|
||||||
"mailinglist_mirror",
|
"mailinglist_mirror",
|
||||||
"all_topics_wiki",
|
"all_topics_wiki",
|
||||||
"can_delete",
|
"can_delete",
|
||||||
"cannot_delete_reason",
|
|
||||||
"allow_badges",
|
"allow_badges",
|
||||||
"topic_featured_link_allowed",
|
"topic_featured_link_allowed",
|
||||||
"search_priority",
|
"search_priority",
|
||||||
|
|
Loading…
Reference in New Issue