hide index fields from api; closes #1739
This commit is contained in:
@@ -306,6 +306,24 @@ class Artist < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
module ApiMethods
|
||||||
|
def hidden_attributes
|
||||||
|
super + [:other_names_index]
|
||||||
|
end
|
||||||
|
|
||||||
|
def legacy_api_hash
|
||||||
|
return {
|
||||||
|
:id => id,
|
||||||
|
:name => name,
|
||||||
|
:other_names => other_names,
|
||||||
|
:group_name => group_name,
|
||||||
|
:urls => artist_urls.map {|x| x.url},
|
||||||
|
:is_active => is_active?,
|
||||||
|
:updater_id => 0
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
include UrlMethods
|
include UrlMethods
|
||||||
include NameMethods
|
include NameMethods
|
||||||
include GroupMethods
|
include GroupMethods
|
||||||
@@ -315,6 +333,7 @@ class Artist < ActiveRecord::Base
|
|||||||
include TagMethods
|
include TagMethods
|
||||||
include BanMethods
|
include BanMethods
|
||||||
extend SearchMethods
|
extend SearchMethods
|
||||||
|
include ApiMethods
|
||||||
|
|
||||||
def status
|
def status
|
||||||
if is_banned? && is_active?
|
if is_banned? && is_active?
|
||||||
@@ -328,18 +347,6 @@ class Artist < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def legacy_api_hash
|
|
||||||
return {
|
|
||||||
:id => id,
|
|
||||||
:name => name,
|
|
||||||
:other_names => other_names,
|
|
||||||
:group_name => group_name,
|
|
||||||
:urls => artist_urls.map {|x| x.url},
|
|
||||||
:is_active => is_active?,
|
|
||||||
:updater_id => 0
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
def initialize_creator
|
def initialize_creator
|
||||||
self.creator_id = CurrentUser.user.id
|
self.creator_id = CurrentUser.user.id
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -140,6 +140,10 @@ class Comment < ActiveRecord::Base
|
|||||||
def editable_by?(user)
|
def editable_by?(user)
|
||||||
creator_id == user.id || user.is_janitor?
|
creator_id == user.id || user.is_janitor?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def hidden_attributes
|
||||||
|
super + [:body_index]
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
Comment.connection.extend(PostgresExtensions)
|
Comment.connection.extend(PostgresExtensions)
|
||||||
|
|||||||
@@ -188,4 +188,8 @@ class Dmail < ActiveRecord::Base
|
|||||||
def visible_to?(user)
|
def visible_to?(user)
|
||||||
user.is_moderator? || owner_id == user.id
|
user.is_moderator? || owner_id == user.id
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def hidden_attributes
|
||||||
|
super + [:message_index]
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -161,4 +161,8 @@ class ForumPost < ActiveRecord::Base
|
|||||||
x.body = x.quoted_response
|
x.body = x.quoted_response
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def hidden_attributes
|
||||||
|
super + [:text_index]
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -96,4 +96,8 @@ class ForumTopic < ActiveRecord::Base
|
|||||||
def presenter(forum_posts)
|
def presenter(forum_posts)
|
||||||
@presenter ||= ForumTopicPresenter.new(self, forum_posts)
|
@presenter ||= ForumTopicPresenter.new(self, forum_posts)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def hidden_attributes
|
||||||
|
super + [:text_index]
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -61,6 +61,10 @@ class Note < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
module ApiMethods
|
module ApiMethods
|
||||||
|
def hidden_attributes
|
||||||
|
super + [:body_index]
|
||||||
|
end
|
||||||
|
|
||||||
def serializable_hash(options = {})
|
def serializable_hash(options = {})
|
||||||
options ||= {}
|
options ||= {}
|
||||||
options[:except] ||= []
|
options[:except] ||= []
|
||||||
|
|||||||
@@ -58,6 +58,10 @@ class WikiPage < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
module ApiMethods
|
module ApiMethods
|
||||||
|
def hidden_attributes
|
||||||
|
super + [:body_index]
|
||||||
|
end
|
||||||
|
|
||||||
def serializable_hash(options = {})
|
def serializable_hash(options = {})
|
||||||
options ||= {}
|
options ||= {}
|
||||||
options[:except] ||= []
|
options[:except] ||= []
|
||||||
|
|||||||
Reference in New Issue
Block a user