models: remove nonexistent associations.

Remove the WikiPageVersion#artist and Post#updater associations. Neither
of these existed and they caused problems with searching includable
associations in the API.
This commit is contained in:
evazion
2021-01-07 02:24:30 -06:00
parent 59d64a76f3
commit e356fd0fd5
2 changed files with 3 additions and 5 deletions

View File

@@ -39,7 +39,6 @@ class Post < ApplicationRecord
after_commit :remove_iqdb_async, :on => :destroy
after_commit :update_iqdb_async, :on => :create
belongs_to :updater, :class_name => "User", optional: true # this is handled in versions
belongs_to :approver, class_name: "User", optional: true
belongs_to :uploader, :class_name => "User", :counter_cache => "post_upload_count"
belongs_to :parent, class_name: "Post", optional: true
@@ -1295,7 +1294,7 @@ class Post < ApplicationRecord
:is_note_locked, :is_rating_locked, :is_status_locked, :is_pending,
:is_flagged, :is_deleted, :is_banned, :last_comment_bumped_at,
:last_commented_at, :last_noted_at, :uploader_ip_addr,
:uploader, :updater, :approver, :parent, :upload, :artist_commentary,
:uploader, :approver, :parent, :upload, :artist_commentary,
:flags, :appeals, :notes, :comments, :children, :approvals,
:replacements, :pixiv_ugoira_frame_data
)

View File

@@ -2,12 +2,11 @@ class WikiPageVersion < ApplicationRecord
array_attribute :other_names
belongs_to :wiki_page
belongs_to_updater
belongs_to :artist, optional: true
belongs_to :tag, primary_key: :name, foreign_key: :title, optional: true
module SearchMethods
def search(params)
q = search_attributes(params, :id, :created_at, :updated_at, :title, :body, :other_names, :is_locked, :is_deleted, :updater, :wiki_page, :artist, :tag)
q = search_attributes(params, :id, :created_at, :updated_at, :title, :body, :other_names, :is_locked, :is_deleted, :updater, :wiki_page, :tag)
q = q.text_attribute_matches(:title, params[:title_matches])
q = q.text_attribute_matches(:body, params[:body_matches])
@@ -76,6 +75,6 @@ class WikiPageVersion < ApplicationRecord
end
def self.available_includes
[:updater, :wiki_page, :artist, :tag]
[:updater, :wiki_page, :tag]
end
end