diff options
author | ThibG <thib@sitedethib.com> | 2019-07-29 23:37:14 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-29 23:37:14 +0200 |
commit | f48c7689d230b915ed740a4774736bd5998cbc66 (patch) | |
tree | 3d883f06fe8e3abbc5653e029ac8612ae114f135 /app/models/invite.rb | |
parent | a4a81c5434c73139f7c1d66f2687039237c5208a (diff) | |
parent | 51411267fda00db576230a270a10e31992378c18 (diff) |
Merge pull request #1179 from ThibG/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/models/invite.rb')
-rw-r--r-- | app/models/invite.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/app/models/invite.rb b/app/models/invite.rb index fe2322462..02ab8e0b2 100644 --- a/app/models/invite.rb +++ b/app/models/invite.rb @@ -17,7 +17,7 @@ class Invite < ApplicationRecord include Expireable - belongs_to :user + belongs_to :user, inverse_of: :invites has_many :users, inverse_of: :invite scope :available, -> { where(expires_at: nil).or(where('expires_at >= ?', Time.now.utc)) } @@ -25,7 +25,7 @@ class Invite < ApplicationRecord before_validation :set_code def valid_for_use? - (max_uses.nil? || uses < max_uses) && !expired? + (max_uses.nil? || uses < max_uses) && !expired? && !(user.nil? || user.disabled?) end private |