/dmails: remove unused search[owner_id] param.
/dmails is restricted to viewing dmails for CurrentUser only (due to Dmail.visible in the index action). Remove owner_id from subnavbar links in /dmails, and don't support it in /dmails?search[owner_id], since it doesn't actually do anything. Also removes related dead methods and fixes tests that didn't test owner_id properly.
This commit is contained in:
@@ -86,18 +86,6 @@ class Dmail < ActiveRecord::Base
|
||||
end
|
||||
|
||||
module SearchMethods
|
||||
def for(user)
|
||||
where("owner_id = ?", user)
|
||||
end
|
||||
|
||||
def inbox
|
||||
where("to_id = owner_id")
|
||||
end
|
||||
|
||||
def sent
|
||||
where("from_id = owner_id")
|
||||
end
|
||||
|
||||
def active
|
||||
where("is_deleted = ?", false)
|
||||
end
|
||||
@@ -139,10 +127,6 @@ class Dmail < ActiveRecord::Base
|
||||
q = q.search_message(params[:message_matches])
|
||||
end
|
||||
|
||||
if params[:owner_id].present?
|
||||
q = q.for(params[:owner_id].to_i)
|
||||
end
|
||||
|
||||
if params[:to_name].present?
|
||||
q = q.to_name_matches(params[:to_name])
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user