From 63871baf6061668b162972193c55b5a8f7490797 Mon Sep 17 00:00:00 2001 From: elijah Date: Thu, 30 Apr 2015 00:32:33 -0700 Subject: added support for email notifications of ticket changes --- app/models/anonymous_user.rb | 4 ++++ app/models/user.rb | 10 ++++++++++ 2 files changed, 14 insertions(+) (limited to 'app/models') diff --git a/app/models/anonymous_user.rb b/app/models/anonymous_user.rb index 87239eb..0c1f540 100644 --- a/app/models/anonymous_user.rb +++ b/app/models/anonymous_user.rb @@ -28,4 +28,8 @@ class AnonymousUser < Object def messages [] end + + def is_anonymous? + true + end end diff --git a/app/models/user.rb b/app/models/user.rb index 52e20dd..d44df40 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -6,6 +6,8 @@ class User < CouchRest::Model::Base property :login, String, :accessible => true property :password_verifier, String, :accessible => true property :password_salt, String, :accessible => true + property :contact_email, String, :accessible => true + property :contact_email_key, String, :accessible => true property :enabled, TrueClass, :default => true @@ -33,6 +35,10 @@ class User < CouchRest::Model::Base :confirmation => true, :format => { :with => /.{8}.*/, :message => "needs to be at least 8 characters long" } + validates :contact_email, :allow_blank => true, + :email => true, + :mx_with_fallback => true + timestamps! design do @@ -90,6 +96,10 @@ class User < CouchRest::Model::Base APP_CONFIG['admins'].include? self.login end + def is_anonymous? + false + end + def most_recent_tickets(count=3) Ticket.for_user(self).limit(count).all #defaults to having most recent updated first end -- cgit v1.2.3