From: Lucas Di Pentima Date: Mon, 8 Feb 2021 22:01:41 +0000 (-0300) Subject: 16736: Simplifies conditionals. X-Git-Tag: 2.2.0~119^2~1 X-Git-Url: https://git.arvados.org/arvados.git/commitdiff_plain/71fd7a7a8bc1d00ef0ed3a9e6e5240c13b7967a0 16736: Simplifies conditionals. Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima --- diff --git a/services/api/app/models/api_client_authorization.rb b/services/api/app/models/api_client_authorization.rb index 03e1b38fdc..ee63c4d934 100644 --- a/services/api/app/models/api_client_authorization.rb +++ b/services/api/app/models/api_client_authorization.rb @@ -390,9 +390,7 @@ class ApiClientAuthorization < ArvadosModel def clamp_token_expiration if !current_user.andand.is_admin && Rails.configuration.API.MaxTokenLifetime > 0 max_token_expiration = db_current_time + Rails.configuration.API.MaxTokenLifetime - if self.new_record? && (self.expires_at.nil? || self.expires_at > max_token_expiration) - self.expires_at = max_token_expiration - elsif !self.new_record? && self.expires_at_changed? && (self.expires_at.nil? || self.expires_at > max_token_expiration) + if (self.new_record? || self.expires_at_changed?) && (self.expires_at.nil? || self.expires_at > max_token_expiration) self.expires_at = max_token_expiration end end