diff options
author | Callum Dryden <callum.dryden@rightscale.com> | 2016-10-06 18:19:27 +0300 |
---|---|---|
committer | Callum Dryden <callum.dryden@rightscale.com> | 2016-10-20 03:26:45 +0300 |
commit | 9124310f2871117acaac98781be84c9fc016e2ad (patch) | |
tree | 3bb94c532a5f52dc27f483ab6de0a829f6831c19 /app/models/event.rb | |
parent | c08435e3c25f0a7a705ed8a49b16dde176b41a40 (diff) |
Differentiate the expire from leave event
At the moment we cannot see weather a user left a project due to their
membership expiring of if they themselves opted to leave the project.
This adds a new event type that allows us to make this differentiation.
Note that is not really feasable to go back and reliably fix up the
previous events. As a result the events for previous expire removals
will remain the same however events of this nature going forward will be
correctly represented.
Diffstat (limited to 'app/models/event.rb')
-rw-r--r-- | app/models/event.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/app/models/event.rb b/app/models/event.rb index 0764cb8cabd..3993b35f96d 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -12,6 +12,7 @@ class Event < ActiveRecord::Base JOINED = 8 # User joined project LEFT = 9 # User left project DESTROYED = 10 + EXPIRED = 11 # User left project due to expiry RESET_PROJECT_ACTIVITY_INTERVAL = 1.hour @@ -115,6 +116,10 @@ class Event < ActiveRecord::Base action == LEFT end + def expired? + action == EXPIRED + end + def destroyed? action == DESTROYED end @@ -124,7 +129,7 @@ class Event < ActiveRecord::Base end def membership_changed? - joined? || left? + joined? || left? || expired? end def created_project? @@ -184,6 +189,8 @@ class Event < ActiveRecord::Base 'joined' elsif left? 'left' + elsif expired? + 'removed due to membership expiration from' elsif destroyed? 'destroyed' elsif commented? |