Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
O
OHR Support
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
97
Issues
97
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
OHR Support
Commits
23ef9fed
Commit
23ef9fed
authored
May 13, 2011
by
Eric Davis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[
#123
] Port the send_notification feature to aaj
parent
216619d3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
1 deletion
+18
-1
journal_observer.rb
...lugins/acts_as_journalized/app/models/journal_observer.rb
+18
-1
No files found.
vendor/plugins/acts_as_journalized/app/models/journal_observer.rb
View file @
23ef9fed
...
...
@@ -16,10 +16,13 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class
JournalObserver
<
ActiveRecord
::
Observer
attr_accessor
:send_notification
def
after_create
(
journal
)
if
journal
.
type
==
"IssueJournal"
and
journal
.
version
>
1
if
journal
.
type
==
"IssueJournal"
and
journal
.
version
>
1
and
self
.
send_notification
after_create_issue_journal
(
journal
)
end
clear_notification
end
def
after_create_issue_journal
(
journal
)
...
...
@@ -30,4 +33,18 @@ class JournalObserver < ActiveRecord::Observer
Mailer
.
deliver_issue_edit
(
journal
)
end
end
# Wrap send_notification so it defaults to true, when it's nil
def
send_notification
return
true
if
@send_notification
.
nil?
return
@send_notification
end
private
# Need to clear the notification setting after each usage otherwise it might be cached
def
clear_notification
@send_notification
=
true
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment