notification method added for clients and also sorting fixed

This commit is contained in:
Harry Bomrah 2016-05-23 19:12:16 +08:00
parent f31d43619a
commit 05ff4b488c
3 changed files with 9 additions and 1 deletions

View File

@ -80,7 +80,7 @@ class Admin::TicketsApiController < ApplicationController
tickets = {}
if !site.nil?
if params[:type].nil? && params[:query].nil?
site_tickets = site.tickets.desc(:created_at).page(params[:page]).per(5)
site_tickets = site.tickets.order_by([:status, :desc],[:created_at, :desc]).page(params[:page]).per(5)
else
q = params[:query]
t = params[:type]

View File

@ -196,6 +196,9 @@ class Admin::TicketsController < OrbitAdminController
response.internal_response = params[:internal_response] if params[:internal_response].present?
response.user_tags = params[:user_tags] if params[:user_tags].present?
response.save
if !response.internal_response
notify_response_to_client(tq.ticket) rescue nil
end
tq.ticket_query_responses << response
if params[:user_tags].present?
Thread.new do

View File

@ -23,6 +23,11 @@ module TicketsHelper
return html
end
def notify_response_to_client(ticket)
network = ONetwork.new("http://" + ticket.registered_site.site_domain, "post") rescue nil
network.request("/store/ticket_response_update",{"ticket_id" => ticket.uid}) if !network.nil?
end
def send_notification_emails(response, ticket)
response.user_tags.each do |u|
user = User.find(u) rescue nil