Skip to content

Commit

Permalink
rename can_reopen to reopenable
Browse files Browse the repository at this point in the history
  • Loading branch information
JeSuisUnCaillou committed Feb 6, 2025
1 parent 477ff9d commit 702c2d9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class TransitionAuthorizationRequestToStageOfAuthorization < ApplicationInteractor
def call
context.fail! unless context.authorization.can_reopen?
context.fail! unless context.authorization.reopenable?

return if context.authorization_request.is_a? context.authorization.authorization_request_class.constantize

Expand Down
4 changes: 2 additions & 2 deletions app/models/authorization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def request_as_validated
end
# rubocop:enable Metrics/AbcSize

def can_reopen?
def reopenable?
latest?
end

Expand All @@ -82,7 +82,7 @@ def definition
authorization_request_class.constantize.definition
end

def can_reopen_to_another_stage?
def reopenable_to_another_stage?
authorization_request.latest_authorizations_of_each_stage.count > 1
end

Expand Down
6 changes: 3 additions & 3 deletions app/views/reopen_authorizations/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
<%= t('.invalid_request') %>
</p>
<% end %>
<% if @authorization.can_reopen_to_another_stage? %>

<% if @authorization.reopenable_to_another_stage? %>
<div class="fr-alert fr-alert--warning">
<h3 class="fr-alert__title"><%= t('.warning_for_stages.title') %></h3>
<p><%= t('.warning_for_stages.content').html_safe %>
Expand All @@ -25,7 +25,7 @@
</div>

<div class="fr-modal__footer">
<% if @authorization.can_reopen_to_another_stage? %>
<% if @authorization.reopenable_to_another_stage? %>
<div class="reopen-stage-buttons-container">
<div class="reopen-stage-buttons">
<% @authorization.request.latest_authorizations_of_each_stage.each do |authorization| %>
Expand Down

0 comments on commit 702c2d9

Please sign in to comment.