FIX: `include_` serializer methods must end with ? (#14407)

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.

diff --git a/app/serializers/category_serializer.rb b/app/serializers/category_serializer.rb
index 0efe3f5..28f88a0 100644
--- a/app/serializers/category_serializer.rb
+++ b/app/serializers/category_serializer.rb
@@ -75,7 +75,7 @@ class CategorySerializer < SiteCategorySerializer
     scope && scope.cannot_delete_category_reason(object)
   end
 
-  def include_cannot_delete_reason
+  def include_cannot_delete_reason?
     !include_can_delete? && scope && scope.can_edit?(object)
   end
 
diff --git a/app/serializers/group_user_serializer.rb b/app/serializers/group_user_serializer.rb
index aa191cf..0c1d9a4 100644
--- a/app/serializers/group_user_serializer.rb
+++ b/app/serializers/group_user_serializer.rb
@@ -10,7 +10,7 @@ class GroupUserSerializer < BasicUserSerializer
              :added_at,
              :timezone
 
-  def include_added_at
+  def include_added_at?
     object.respond_to? :added_at
   end
 
diff --git a/app/serializers/invited_user_record_serializer.rb b/app/serializers/invited_user_record_serializer.rb
index d98f475..027e8f6 100644
--- a/app/serializers/invited_user_record_serializer.rb
+++ b/app/serializers/invited_user_record_serializer.rb
@@ -47,7 +47,7 @@ class InvitedUserRecordSerializer < BasicUserSerializer
     ((Time.now - object.created_at) / 60 / 60 / 24).ceil
   end
 
-  def include_days_since_created
+  def include_days_since_created?
     can_see_invite_details?
   end
 
diff --git a/app/serializers/user_card_serializer.rb b/app/serializers/user_card_serializer.rb
index 4ff67b9..dd41c2c 100644
--- a/app/serializers/user_card_serializer.rb
+++ b/app/serializers/user_card_serializer.rb
@@ -107,10 +107,6 @@ class UserCardSerializer < BasicUserSerializer
     uri.host.sub(/^www\./, '') + uri.path
   end
 
-  def include_website_name
-    website.present?
-  end
-
   def ignored
     scope_ignored_user_ids = scope.user&.ignored_user_ids || []
     scope_ignored_user_ids.include?(object.id)
diff --git a/spec/requests/api/schemas/json/category_create_response.json b/spec/requests/api/schemas/json/category_create_response.json
index 5382380..47af86d 100644
--- a/spec/requests/api/schemas/json/category_create_response.json
+++ b/spec/requests/api/schemas/json/category_create_response.json
@@ -215,12 +215,6 @@
         "can_delete": {
           "type": "boolean"
         },
-        "cannot_delete_reason": {
-          "type": [
-            "string",
-            "null"
-          ]
-        },
         "allow_badges": {
           "type": "boolean"
         },
@@ -287,7 +281,6 @@
         "mailinglist_mirror",
         "all_topics_wiki",
         "can_delete",
-        "cannot_delete_reason",
         "allow_badges",
         "topic_featured_link_allowed",
         "search_priority",
diff --git a/spec/requests/api/schemas/json/category_update_response.json b/spec/requests/api/schemas/json/category_update_response.json
index f15c082..26d9aa8 100644
--- a/spec/requests/api/schemas/json/category_update_response.json
+++ b/spec/requests/api/schemas/json/category_update_response.json
@@ -218,12 +218,6 @@
         "can_delete": {
           "type": "boolean"
         },
-        "cannot_delete_reason": {
-          "type": [
-            "string",
-            "null"
-          ]
-        },
         "allow_badges": {
           "type": "boolean"
         },
@@ -290,7 +284,6 @@
         "mailinglist_mirror",
         "all_topics_wiki",
         "can_delete",
-        "cannot_delete_reason",
         "allow_badges",
         "topic_featured_link_allowed",
         "search_priority",

GitHub sha: 2e085915ccee7cab15c4f379055af7b9031a9453

This commit appears in #14407 which was approved by tgxworld and CvX. It was merged by udan11.