summaryrefslogtreecommitdiff
path: root/app/models/concerns/expirable.rb
diff options
context:
space:
mode:
authorCallum Dryden <callum.dryden@rightscale.com>2016-10-06 15:19:27 +0000
committerCallum Dryden <callum.dryden@rightscale.com>2016-10-20 00:26:45 +0000
commit9124310f2871117acaac98781be84c9fc016e2ad (patch)
tree3bb94c532a5f52dc27f483ab6de0a829f6831c19 /app/models/concerns/expirable.rb
parentc08435e3c25f0a7a705ed8a49b16dde176b41a40 (diff)
downloadgitlab-ce-9124310f2871117acaac98781be84c9fc016e2ad.tar.gz
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/concerns/expirable.rb')
-rw-r--r--app/models/concerns/expirable.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/models/concerns/expirable.rb b/app/models/concerns/expirable.rb
index be93435453b..b66ba08dc59 100644
--- a/app/models/concerns/expirable.rb
+++ b/app/models/concerns/expirable.rb
@@ -5,11 +5,15 @@ module Expirable
scope :expired, -> { where('expires_at <= ?', Time.current) }
end
+ def expired?
+ expires? && expires_at <= Time.current
+ end
+
def expires?
expires_at.present?
end
def expires_soon?
- expires_at < 7.days.from_now
+ expires? && expires_at < 7.days.from_now
end
end