Bug: Fixed private note being sent to customer (#837)

This commit is contained in:
sony-mathew 2020-05-10 13:14:57 +05:30
parent 628e0c8423
commit a75f49ddcc
2 changed files with 3 additions and 3 deletions

View file

@ -9,8 +9,8 @@ class ConversationReplyMailer < ApplicationMailer
@contact = @conversation.contact
@agent = @conversation.assignee
recap_messages = @conversation.messages.where('created_at < ?', message_queued_time).order(created_at: :asc).last(10)
new_messages = @conversation.messages.where('created_at >= ?', message_queued_time)
recap_messages = @conversation.messages.chat.where('created_at < ?', message_queued_time).last(10)
new_messages = @conversation.messages.chat.where('created_at >= ?', message_queued_time)
@messages = recap_messages + new_messages
@messages = @messages.select(&:reportable?)

View file

@ -59,7 +59,7 @@ class Message < ApplicationRecord
# .succ is a hack to avoid https://makandracards.com/makandra/1057-why-two-ruby-time-objects-are-not-equal-although-they-appear-to-be
scope :unread_since, ->(datetime) { where('EXTRACT(EPOCH FROM created_at) > (?)', datetime.to_i.succ) }
scope :chat, -> { where.not(message_type: :activity).where.not(private: true) }
scope :chat, -> { where.not(message_type: :activity).where(private: false) }
default_scope { order(created_at: :asc) }
belongs_to :account