fix visibility criterion for dmails
This commit is contained in:
@@ -17,7 +17,7 @@ class Dmail < ActiveRecord::Base
|
|||||||
scope :deleted, where(["is_deleted = ?", true])
|
scope :deleted, where(["is_deleted = ?", true])
|
||||||
scope :search_message, lambda {|query| where(["message_index @@ plainto_tsquery(?)", query])}
|
scope :search_message, lambda {|query| where(["message_index @@ plainto_tsquery(?)", query])}
|
||||||
scope :unread, where("is_read = false and is_deleted = false")
|
scope :unread, where("is_read = false and is_deleted = false")
|
||||||
scope :visible, lambda {where("(to_id = ? or from_id = ?)", CurrentUser.id, CurrentUser.id)}
|
scope :visible, lambda {where("owner_id = ?", CurrentUser.id)}
|
||||||
scope :to_name_matches, lambda {|name| where("to_id = (select _.id from users _ where lower(_.name) = ?)", name.downcase)}
|
scope :to_name_matches, lambda {|name| where("to_id = (select _.id from users _ where lower(_.name) = ?)", name.downcase)}
|
||||||
scope :from_name_matches, lambda {|name| where("from_id = (select _.id from users _ where lower(_.name) = ?)", name.downcase)}
|
scope :from_name_matches, lambda {|name| where("from_id = (select _.id from users _ where lower(_.name) = ?)", name.downcase)}
|
||||||
search_method :to_name_matches, :from_name_matches
|
search_method :to_name_matches, :from_name_matches
|
||||||
|
|||||||
Reference in New Issue
Block a user