dmails: add unread folder, show only received messages by default.

* Add unread and deleted dmail folders.
* Remove dmail_folder cookie (wasn't used).
* Default to the received folder so that we don't show sent messages by default.
This commit is contained in:
evazion
2020-01-30 22:51:26 -06:00
parent f8db577c25
commit d8eba59cfa
7 changed files with 37 additions and 62 deletions

View File

@@ -1,28 +0,0 @@
module DmailsHelper
def dmails_current_folder_path
case cookies[:dmail_folder]
when "sent"
sent_dmails_path
when "received"
received_dmails_path
else
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 spam_dmails_path
dmails_path(search: {to_id: CurrentUser.id, is_spam: true}, folder: "spam")
end
def received_dmails_path(params = {})
dmails_path(search: {to_id: CurrentUser.id}, folder: "received", **params)
end
end