Skip to content
This repository has been archived by the owner on Dec 22, 2018. It is now read-only.

Commit

Permalink
Merge pull request #329 from git-jls/fix_save_with_label
Browse files Browse the repository at this point in the history
Fixed issue with saved_with_label called upon a ticket
  • Loading branch information
frenkel authored Dec 15, 2016
2 parents 4d738b3 + 531a237 commit daec6ef
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- Fixed signature and logic around recaptcha. Contributed by @git-jls.
- Fixed issue for non signed in users not able to create tickets from the web gui when the captcha is disabled. Contributed by @git-jls.
- Fixed issue with zone not being properly taken into account if schedule is set and ticket is created. by @git-jls.
- Fixed issue with save_with_label method being called on a reply. Constributed by @git-jls.

### Security

Expand Down
8 changes: 4 additions & 4 deletions app/controllers/tickets_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def update
end

def new
if @tenant.ticket_creation_is_open_to_the_world == false &&
if !@tenant.ticket_creation_is_open_to_the_world? &&
current_user.nil?
render status: :forbidden, text: t(:access_denied)
else
Expand Down Expand Up @@ -177,11 +177,11 @@ def create
@ticket = Ticket.new(ticket_params)
end

if @tenant.ticket_creation_is_open_to_the_world == false &&
if !@tenant.ticket_creation_is_open_to_the_world? &&
current_user.nil? && !using_hook
render status: :forbidden, text: t(:access_denied)
elsif can_create_a_ticket(using_hook) &&
@ticket.save_with_label(params[:label])
elsif can_create_a_ticket(using_hook) &&
(@ticket.is_a?(Reply) || @ticket.save_with_label(params[:label]))
notify_incoming @ticket

respond_to do |format|
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class AddDefaultTicketCreationIsOpenToTheWorldToTenants < ActiveRecord::Migration
def up
change_column :tenants, :ticket_creation_is_open_to_the_world, :boolean, default: true
Tenant.where(ticket_creation_is_open_to_the_world: nil).update_all(ticket_creation_is_open_to_the_world: true)
end

def down
change_column :tenants, :ticket_creation_is_open_to_the_world, :boolean, default: nil
Tenant.where(ticket_creation_is_open_to_the_world: true).update_all(ticket_creation_is_open_to_the_world: nil)
end
end

0 comments on commit daec6ef

Please sign in to comment.