summaryrefslogtreecommitdiff
path: root/app/controllers/messages_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/messages_controller.rb')
-rw-r--r--app/controllers/messages_controller.rb36
1 files changed, 18 insertions, 18 deletions
diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb
index 2bb9b05..d87065d 100644
--- a/app/controllers/messages_controller.rb
+++ b/app/controllers/messages_controller.rb
@@ -18,11 +18,11 @@
class MessagesController < ApplicationController
- before_filter :late_initialize
- before_filter :authentication
- before_filter :add_cookie_header
- before_filter :get_record, :only => [:show, :update, :destroy]
- after_filter :touch_participant_ttl
+ before_action :late_initialize
+ before_action :authentication
+ before_action :add_cookie_header
+ before_action :get_record, :only => [:show, :update, :destroy]
+ after_action :touch_participant_ttl
def initialize
super
@@ -110,7 +110,7 @@ class MessagesController < ApplicationController
if details.empty? then no_data_to_render = true end
end
if no_data_to_render
- render :text => "", :content_type => "application/json", :layout => false
+ render :plain => "", :content_type => "application/json", :layout => false
else
respond_to do |format|
format.json { render :json => JSON.pretty_generate(details) }
@@ -160,15 +160,15 @@ protected
all ||= params["all"] ? params["all"] : nil
case
when sender == "true"
- @list = Message.for_participant_sender(@participant).for_resource(@app_namespace,@ressource_name).for_not_removed.uniq
+ @list = Message.for_participant_sender(@participant).for_resource(@app_namespace,@ressource_name).for_not_removed.distinct.to_a
when receiver == "true"
- @list = Message.for_participant_receiver(@participant).for_resource(@app_namespace,@ressource_name).for_not_removed.uniq
+ @list = Message.for_participant_receiver(@participant).for_resource(@app_namespace,@ressource_name).for_not_removed.distinct.to_a
when all == "true"
list1 = Message.for_participant_sender(@participant).for_resource(@app_namespace,@ressource_name).for_not_removed
list2 = Message.for_participant_receiver(@participant).for_resource(@app_namespace,@ressource_name).for_not_removed
- @list = list1.concat(list2).uniq
+ @list = list1.to_a.concat(list2.to_a).uniq
else
- @list = Message.for_participant_receiver(@participant).for_resource(@app_namespace,@ressource_name).for_not_removed.uniq
+ @list = Message.for_participant_receiver(@participant).for_resource(@app_namespace,@ressource_name).for_not_removed.distinct
end
end
@@ -216,11 +216,11 @@ protected
end
def empty_render
- render :text => "", :content_type => "application/json"
+ render :plain => "", :content_type => "application/json"
end
def index_render
- render :text => @body, :content_type => "text/uri-list"
+ render plain: @body, :content_type => "text/uri-list"
end
def show_render
@@ -238,7 +238,7 @@ protected
end unless @memberships.blank?
headers["X-EcsReceiverCommunities"]= x_ecs_receiver_communities unless x_ecs_receiver_communities.blank?
headers["X-EcsSender"]= x_ecs_sender unless x_ecs_sender.blank?
- @render_cmd='render :text => @body, :layout => false, :status => 200, :content_type => Mime::Type.lookup(@record.content_type)'
+ @render_cmd='render plain: @body, :layout => false, :status => 200, :content_type => Mime::Type.lookup(@record.content_type)'
end
def create_render
@@ -249,9 +249,9 @@ protected
location += request.path.gsub(/\/*$/,'') + "/" + @record.id.to_s
logger.info "Location: #{location}"
if @app_namespace == 'sys' and @ressource_name == 'auths'
- render :text => @body, :layout => false, :status => 201, :location => location, :content_type => Mime::Type.lookup_by_extension("json")
+ render plain: @body, :layout => false, :status => 201, :location => location, :content_type => Mime::Type.lookup_by_extension("json")
else
- render :text => "", :layout => false, :status => 201, :location => location, :content_type => Mime::Type.lookup(@record.content_type)
+ render plain: "", :layout => false, :status => 201, :location => location, :content_type => Mime::Type.lookup(@record.content_type)
end
end
@@ -259,13 +259,13 @@ protected
location = request.protocol + request.host
location += request.headers["SCRIPT_NAME"] if request.headers["SCRIPT_NAME"]
location += request.path.gsub(/\/*$/,'')
- render :text => "", :layout => false, :status => 200,
+ render plain: "", :layout => false, :status => 200,
:location => location
end
def destroy_render
- render :nothing => true, :layout => false, :status => 200,
- :content_type => "application/json"
+ render plain: "", :layout => false, :status => 200,
+ :location => location
end
end