From c7177593aaf2b1b8fd8dbd53b9cfb6562e1411d7 Mon Sep 17 00:00:00 2001 From: jessib Date: Mon, 5 Nov 2012 13:18:43 -0800 Subject: Use the same URL for viewing tickets when authenticated or not---the couchdb ID will be the random string for the secret URL. Tickets created when user was unauthenticated will be viewable by anybody who knows the URL. --- help/app/models/ticket.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'help/app/models/ticket.rb') diff --git a/help/app/models/ticket.rb b/help/app/models/ticket.rb index 6301e9e..eaad574 100644 --- a/help/app/models/ticket.rb +++ b/help/app/models/ticket.rb @@ -23,14 +23,14 @@ class Ticket < CouchRest::Model::Base #property :user_verified, TrueClass, :default => false #will be true exactly when user is set #admins - property :code, String, :protected => true # only should be set if created_by is nil + #property :code, String, :protected => true # only should be set if created_by is nil #instead we will just use couchdb ID property :is_open, TrueClass, :default => true property :comments, [TicketComment] timestamps! #before_validation :set_created_by, :set_code, :set_email, :on => :create - before_validation :set_code, :set_email, :on => :create + before_validation :set_email, :on => :create #named_scope :open, :conditions => {:is_open => true} #?? @@ -59,10 +59,12 @@ class Ticket < CouchRest::Model::Base !!created_by end - def set_code +=begin + def set_code #let's not use this---can use same show url # ruby 1.9 provides url-safe option---this is not necessarily url-safe self.code = SecureRandom.hex(8) if !is_creator_validated? end +=end def set_email -- cgit v1.2.3