diff --git a/app/controllers/artists_controller.rb b/app/controllers/artists_controller.rb index e0790d171..97fd01578 100644 --- a/app/controllers/artists_controller.rb +++ b/app/controllers/artists_controller.rb @@ -44,7 +44,7 @@ class ArtistsController < ApplicationController end def create - @artist = Artist.create(artist_params.merge(creator: CurrentUser.user)) + @artist = Artist.create(artist_params) respond_with(@artist) end diff --git a/app/controllers/notes_controller.rb b/app/controllers/notes_controller.rb index 3e7cf43c1..cbe959a42 100644 --- a/app/controllers/notes_controller.rb +++ b/app/controllers/notes_controller.rb @@ -7,7 +7,7 @@ class NotesController < ApplicationController def index @notes = Note.paginated_search(params) - @notes = @notes.includes(:creator, :post) if request.format.html? + @notes = @notes.includes(:post) if request.format.html? respond_with(@notes) end @@ -20,7 +20,7 @@ class NotesController < ApplicationController end def create - @note = Note.create(note_params(:create).merge(creator: CurrentUser.user)) + @note = Note.create(note_params(:create)) respond_with(@note) do |fmt| fmt.json do if @note.errors.any? diff --git a/app/controllers/pools_controller.rb b/app/controllers/pools_controller.rb index 410483ddd..282682ae8 100644 --- a/app/controllers/pools_controller.rb +++ b/app/controllers/pools_controller.rb @@ -18,7 +18,6 @@ class PoolsController < ApplicationController def index @pools = Pool.paginated_search(params, count_pages: true) - @pools = @pools.includes(:creator) if request.format.html? respond_with(@pools) end @@ -40,7 +39,7 @@ class PoolsController < ApplicationController end def create - @pool = Pool.create(pool_params.merge(creator: CurrentUser.user)) + @pool = Pool.create(pool_params) flash[:notice] = @pool.valid? ? "Pool created" : @pool.errors.full_messages.join("; ") respond_with(@pool) end diff --git a/app/models/artist.rb b/app/models/artist.rb index 650eb0637..3e53346b2 100644 --- a/app/models/artist.rb +++ b/app/models/artist.rb @@ -11,7 +11,6 @@ class Artist < ApplicationRecord after_save :clear_url_string_changed validate :validate_tag_category validates :name, tag_name: true, uniqueness: true - belongs_to :creator, class_name: "User" has_many :members, :class_name => "Artist", :foreign_key => "group_name", :primary_key => "name" has_many :urls, :dependent => :destroy, :class_name => "ArtistUrl", :autosave => true has_many :versions, -> {order("artist_versions.id ASC")}, :class_name => "ArtistVersion" @@ -386,7 +385,7 @@ class Artist < ApplicationRecord def search(params) q = super - q = q.search_attributes(params, :is_active, :is_banned, :creator, :name, :group_name, :other_names) + q = q.search_attributes(params, :is_active, :is_banned, :name, :group_name, :other_names) if params[:any_other_name_like] q = q.any_other_name_like(params[:any_other_name_like]) @@ -446,6 +445,6 @@ class Artist < ApplicationRecord end def self.available_includes - [:creator, :members, :urls, :wiki_page, :tag_alias, :tag] + [:members, :urls, :wiki_page, :tag_alias, :tag] end end diff --git a/app/models/note.rb b/app/models/note.rb index 428a070be..9675cc440 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -3,7 +3,6 @@ class Note < ApplicationRecord attr_accessor :html_id belongs_to :post - belongs_to :creator, class_name: "User" has_many :versions, -> {order("note_versions.id ASC")}, :class_name => "NoteVersion", :dependent => :destroy validates_presence_of :x, :y, :width, :height, :body validate :note_within_image @@ -19,7 +18,7 @@ class Note < ApplicationRecord def search(params) q = super - q = q.search_attributes(params, :creator, :post, :is_active, :x, :y, :width, :height, :body, :version) + q = q.search_attributes(params, :post, :is_active, :x, :y, :width, :height, :body, :version) q = q.text_attribute_matches(:body, params[:body_matches], index_column: :body_index) q.apply_default_order(params) @@ -123,9 +122,8 @@ class Note < ApplicationRecord save! end - def copy_to(new_post, creator: CurrentUser.user) + def copy_to(new_post) new_note = dup - new_note.creator = creator new_note.post_id = new_post.id new_note.version = 0 @@ -154,6 +152,6 @@ class Note < ApplicationRecord end def self.available_includes - [:creator, :post] + [:post] end end diff --git a/app/models/pool.rb b/app/models/pool.rb index 679134772..5c84db978 100644 --- a/app/models/pool.rb +++ b/app/models/pool.rb @@ -3,7 +3,6 @@ class Pool < ApplicationRecord POOL_ORDER_LIMIT = 1000 array_attribute :post_ids, parse: /\d+/, cast: :to_i - belongs_to :creator, class_name: "User" validates_uniqueness_of :name, case_sensitive: false, if: :name_changed? validate :validate_name, if: :name_changed? @@ -53,7 +52,7 @@ class Pool < ApplicationRecord def search(params) q = super - q = q.search_attributes(params, :creator, :is_deleted, :name, :description, :post_ids) + q = q.search_attributes(params, :is_deleted, :name, :description, :post_ids) q = q.text_attribute_matches(:description, params[:description_matches]) if params[:post_tags_match] @@ -300,8 +299,4 @@ class Pool < ApplicationRecord errors[:base] << "You cannot removes posts from pools within the first week of sign up" end end - - def self.available_includes - [:creator] - end end diff --git a/app/views/artists/_search.html.erb b/app/views/artists/_search.html.erb index 174900da4..ccca9f484 100644 --- a/app/views/artists/_search.html.erb +++ b/app/views/artists/_search.html.erb @@ -1,7 +1,6 @@ <%= search_form_for(artists_path) do |f| %> <%= f.input :any_name_matches, label: "Name", hint: "Use * for wildcard", input_html: { value: params[:search][:any_name_matches], data: { autocomplete: "artist" }} %> <%= f.input :url_matches, label: "URL", as: "string", input_html: { value: params[:search][:url_matches] } %> - <%= f.input :creator_name, label: "Creator", input_html: { value: params[:search][:creator_name], data: { autocomplete: "user" } } %> <%= f.input :is_active, label: "Active?", collection: [["Yes", true], ["No", false]], include_blank: true, selected: params[:search][:is_active] %> <%= f.input :is_banned, label: "Banned?", collection: [["Yes", true], ["No", false]], include_blank: true, selected: params[:search][:is_banned] %> <%= f.input :has_tag, label: "Has tag?", collection: [["Yes", true], ["No", false]], include_blank: true, selected: params[:search][:has_tag] %> diff --git a/app/views/notes/index.html.erb b/app/views/notes/index.html.erb index 3558ebc77..6b29a33bb 100644 --- a/app/views/notes/index.html.erb +++ b/app/views/notes/index.html.erb @@ -19,8 +19,6 @@ <% end %> <% end %> <% t.column "Created" do |note| %> - <%= link_to_user note.creator %> - <%= link_to "ยป", notes_path(search: { creator_name: note.creator.name }) %>