fix for #219
This commit is contained in:
@@ -14,9 +14,8 @@ class DmailsController < ApplicationController
|
||||
end
|
||||
|
||||
def index
|
||||
@search = Dmail.search(params[:search])
|
||||
@search = Dmail.visible.search(params[:search])
|
||||
@dmails = @search.paginate(params[:page]).order("dmails.created_at desc")
|
||||
@dmails.each {|x| check_privilege(x)}
|
||||
respond_with(@dmails)
|
||||
end
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ class Dmail < ActiveRecord::Base
|
||||
scope :deleted, where(["is_deleted = ?", true])
|
||||
scope :search_message, lambda {|query| where(["message_index @@ plainto_tsquery(?)", query])}
|
||||
scope :unread, where("is_read = false and is_deleted = false")
|
||||
scope :visible, lambda {where("(to_id = ? or from_id = ?)", CurrentUser.id, CurrentUser.id)}
|
||||
|
||||
module AddressMethods
|
||||
def to_name
|
||||
|
||||
Reference in New Issue
Block a user