hide index fields from api; closes #1739
This commit is contained in:
@@ -306,26 +306,9 @@ class Artist < ActiveRecord::Base
|
||||
end
|
||||
end
|
||||
|
||||
include UrlMethods
|
||||
include NameMethods
|
||||
include GroupMethods
|
||||
include VersionMethods
|
||||
extend FactoryMethods
|
||||
include NoteMethods
|
||||
include TagMethods
|
||||
include BanMethods
|
||||
extend SearchMethods
|
||||
|
||||
def status
|
||||
if is_banned? && is_active?
|
||||
"Banned"
|
||||
elsif is_banned?
|
||||
"Banned Deleted"
|
||||
elsif is_active?
|
||||
"Active"
|
||||
else
|
||||
"Deleted"
|
||||
end
|
||||
module ApiMethods
|
||||
def hidden_attributes
|
||||
super + [:other_names_index]
|
||||
end
|
||||
|
||||
def legacy_api_hash
|
||||
@@ -339,6 +322,30 @@ class Artist < ActiveRecord::Base
|
||||
:updater_id => 0
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
include UrlMethods
|
||||
include NameMethods
|
||||
include GroupMethods
|
||||
include VersionMethods
|
||||
extend FactoryMethods
|
||||
include NoteMethods
|
||||
include TagMethods
|
||||
include BanMethods
|
||||
extend SearchMethods
|
||||
include ApiMethods
|
||||
|
||||
def status
|
||||
if is_banned? && is_active?
|
||||
"Banned"
|
||||
elsif is_banned?
|
||||
"Banned Deleted"
|
||||
elsif is_active?
|
||||
"Active"
|
||||
else
|
||||
"Deleted"
|
||||
end
|
||||
end
|
||||
|
||||
def initialize_creator
|
||||
self.creator_id = CurrentUser.user.id
|
||||
|
||||
@@ -140,6 +140,10 @@ class Comment < ActiveRecord::Base
|
||||
def editable_by?(user)
|
||||
creator_id == user.id || user.is_janitor?
|
||||
end
|
||||
|
||||
def hidden_attributes
|
||||
super + [:body_index]
|
||||
end
|
||||
end
|
||||
|
||||
Comment.connection.extend(PostgresExtensions)
|
||||
|
||||
@@ -188,4 +188,8 @@ class Dmail < ActiveRecord::Base
|
||||
def visible_to?(user)
|
||||
user.is_moderator? || owner_id == user.id
|
||||
end
|
||||
|
||||
def hidden_attributes
|
||||
super + [:message_index]
|
||||
end
|
||||
end
|
||||
|
||||
@@ -161,4 +161,8 @@ class ForumPost < ActiveRecord::Base
|
||||
x.body = x.quoted_response
|
||||
end
|
||||
end
|
||||
|
||||
def hidden_attributes
|
||||
super + [:text_index]
|
||||
end
|
||||
end
|
||||
|
||||
@@ -96,4 +96,8 @@ class ForumTopic < ActiveRecord::Base
|
||||
def presenter(forum_posts)
|
||||
@presenter ||= ForumTopicPresenter.new(self, forum_posts)
|
||||
end
|
||||
|
||||
def hidden_attributes
|
||||
super + [:text_index]
|
||||
end
|
||||
end
|
||||
|
||||
@@ -61,6 +61,10 @@ class Note < ActiveRecord::Base
|
||||
end
|
||||
|
||||
module ApiMethods
|
||||
def hidden_attributes
|
||||
super + [:body_index]
|
||||
end
|
||||
|
||||
def serializable_hash(options = {})
|
||||
options ||= {}
|
||||
options[:except] ||= []
|
||||
|
||||
@@ -58,6 +58,10 @@ class WikiPage < ActiveRecord::Base
|
||||
end
|
||||
|
||||
module ApiMethods
|
||||
def hidden_attributes
|
||||
super + [:body_index]
|
||||
end
|
||||
|
||||
def serializable_hash(options = {})
|
||||
options ||= {}
|
||||
options[:except] ||= []
|
||||
|
||||
Reference in New Issue
Block a user