fixes #2418 (includes hiding deleted dmails and allowing filtering on user name)
This commit is contained in:
@@ -17,7 +17,7 @@ class DmailsController < ApplicationController
|
||||
if params[:folder] && params[:set_default_folder]
|
||||
cookies.permanent[:dmail_folder] = params[:folder]
|
||||
end
|
||||
@query = Dmail.visible.search(params[:search])
|
||||
@query = Dmail.active.visible.search(params[:search])
|
||||
@dmails = @query.order("dmails.created_at desc").paginate(params[:page], :limit => params[:limit])
|
||||
respond_with(@dmails) do |format|
|
||||
format.xml do
|
||||
|
||||
29
app/controllers/maintenance/user/dmail_filters_controller.rb
Normal file
29
app/controllers/maintenance/user/dmail_filters_controller.rb
Normal file
@@ -0,0 +1,29 @@
|
||||
module Maintenance
|
||||
module User
|
||||
class DmailFiltersController < ApplicationController
|
||||
before_filter :ensure_ownership
|
||||
before_filter :member_only
|
||||
|
||||
def edit
|
||||
@dmail_filter = CurrentUser.dmail_filter || DmailFilter.new
|
||||
end
|
||||
|
||||
def update
|
||||
@dmail_filter = CurrentUser.dmail_filter || DmailFilter.new
|
||||
@dmail_filter.update_attributes(params[:dmail_filter])
|
||||
flash[:notice] = "Filter updated"
|
||||
redirect_to(dmail_path(@dmail.id))
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def ensure_ownership
|
||||
@dmail = Dmail.find(params[:dmail_id])
|
||||
|
||||
if @dmail.owner_id != CurrentUser.user.id
|
||||
raise User::PrivilegeError.new
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user