From 28d48790b12a42f37917dfc980d62cc558b7b664 Mon Sep 17 00:00:00 2001 From: rkaldung Date: Sun, 15 Feb 2015 10:23:55 +0100 Subject: [PATCH] less literals, less typos --- app/controllers/application_controller.rb | 2 +- app/controllers/tickets_controller.rb | 2 +- app/models/ticket.rb | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 2a32b3e78..97b5066b7 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -82,7 +82,7 @@ class ApplicationController < ActionController::Base #session[:ping] = Time.now.utc.iso8601 session[:ping] = DateTime.now.iso8601 - # check if remote ip need to be updated + # check if remote ip need to be updated @TODO Move this into model if !session[:remote_id] || session[:remote_id] != request.remote_ip session[:remote_id] = request.remote_ip session[:geo] = GeoIp.location( request.remote_ip ) diff --git a/app/controllers/tickets_controller.rb b/app/controllers/tickets_controller.rb index c7e7fff1f..8cddb61a2 100644 --- a/app/controllers/tickets_controller.rb +++ b/app/controllers/tickets_controller.rb @@ -80,7 +80,7 @@ class TicketsController < ApplicationController def destroy ticket = Ticket.find( params[:id] ) - # permissin check + # permission check return if !ticket_permission(ticket) ticket.destroy diff --git a/app/models/ticket.rb b/app/models/ticket.rb index c5d60dc7a..e53059863 100644 --- a/app/models/ticket.rb +++ b/app/models/ticket.rb @@ -74,14 +74,14 @@ returns =end def agent_of_group - Group.find( self.group_id ).users.where( :active => true ).joins(:roles).where( 'roles.name' => 'Agent', 'roles.active' => true ).uniq() + Group.find( self.group_id ).users.where( :active => true ).joins(:roles).where( 'roles.name' => Z_ROLENAME_AGENT, 'roles.active' => true ).uniq() end =begin get user access conditions - connditions = Ticket.access_condition( User.find(1) ) + conditions = Ticket.access_condition( User.find(1) ) returns @@ -91,7 +91,7 @@ returns def self.access_condition(user) access_condition = [] - if user.is_role('Agent') + if user.is_role(Z_ROLENAME_AGENT) group_ids = Group.select( 'groups.id' ).joins(:users). where( 'groups_users.user_id = ?', user.id ). where( 'groups.active = ?', true ). @@ -136,7 +136,7 @@ returns Ticket::Article.create( :ticket_id => self.id, :type_id => Ticket::Article::Type.lookup( :name => 'note' ).id, - :sender_id => Ticket::Article::Sender.lookup( :name => 'Agent' ).id, + :sender_id => Ticket::Article::Sender.lookup( :name => Z_ROLENAME_AGENT ).id, :body => 'merged', :internal => false )