/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:
evazion
2017-02-23 20:23:33 -06:00
parent 6de350cd7d
commit d852f98e4f
5 changed files with 28 additions and 26 deletions

View File

@@ -2,11 +2,23 @@ module DmailsHelper
def dmails_current_folder_path
case cookies[:dmail_folder]
when "sent"
dmails_path(:search => {:owner_id => CurrentUser.id, :from_id => CurrentUser.id}, :folder => "sent")
when "all"
dmails_path(:search => {:owner_id => CurrentUser.id}, :folder => "all")
sent_dmails_path
when "received"
received_dmails_path
else
dmails_path(:search => {:owner_id => CurrentUser.id, :to_id => CurrentUser.id}, :folder => "received")
all_dmails_path
end
end
def all_dmails_path(params = {})
dmails_path(folder: "all", **params)
end
def sent_dmails_path(params = {})
dmails_path(search: {from_id: CurrentUser.id}, folder: "sent", **params)
end
def received_dmails_path(params = {})
dmails_path(search: {to_id: CurrentUser.id}, folder: "received", **params)
end
end