Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable transfers when in maintenance mode #1243

Merged
merged 1 commit into from
Oct 25, 2023
Merged

Conversation

jazairi
Copy link
Contributor

@jazairi jazairi commented Oct 20, 2023

Why these changes are being introduced:

In anticipation of migrating to new AWS infrastructure, we will need to pause file uploads for a bit.

Relevant ticket(s):

How this addresses that need:

This adds a maintenance mode feature, toggled via the flipflop gem, that disables the thesis transfer form and changes the welcome message on transfer/new to explain what is happening. A custom message can be configured to provide additional details.

Side effects of this change:

  • It is still technically possible to post a new transfer if one were to bypass the form. I find it unlikely that transfer submitters would try to hack this, but if it's a concern, we could try a different approach.
  • Currently, maintenance mode only disables thesis transfers. I chose to give the feature a more generalized name in case we want to use it to disable additional functionality in the future.

Developer

  • All new ENV is documented in README
  • All new ENV has been added to Heroku Pipeline, Staging and Prod
  • ANDI or Wave has been run in accordance to
    our guide and
    all issues introduced by these changes have been resolved or opened as new
    issues (link to those issues in the Pull Request details above)
  • Stakeholder approval has been confirmed (or is not needed)

Code Reviewer

  • The commit message is clear and follows our guidelines
    (not just this pull request message)
  • There are appropriate tests covering any new functionality
  • The documentation has been updated or is unnecessary
  • The changes have been verified
  • New dependencies are appropriate or there were no changes

Requires database migrations?

NO

Includes new or updated dependencies?

YES

@mitlib mitlib temporarily deployed to thesis-submit-pr-1243 October 20, 2023 20:11 Inactive
@coveralls
Copy link

coveralls commented Oct 20, 2023

Coverage Status

coverage: 98.311%. remained the same when pulling 27b96b3 on etd-649-maintenance-mode into 456ea47 on main.

@jazairi jazairi temporarily deployed to thesis-submit-pr-1243 October 20, 2023 20:15 Inactive
@JPrevost JPrevost self-assigned this Oct 24, 2023
@@ -0,0 +1,9 @@
<div class="well maintenance-message">
<% if ENV.fetch('MAINTENANCE_MESSAGE_TRANSFER', false) %>
<h4 class="hd-5"><%= ENV['MAINTENANCE_MESSAGE_TRANSFER'].to_s %></h4>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should be able to trust this input and making this .html_safe instead of .to_s would allow more flexibility in the custom messages.


<% if Flipflop.enabled?(:maintenance_mode) %>
<script type="text/javascript">
$(':input').prop('disabled', true);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding
$('#new_transfer').hide();
in addition to disabling feels like it would be slightly less confusing to someone that stumbled across this. Thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's a good suggestion. I don't see any downside to hiding the form as well.

Copy link
Member

@JPrevost JPrevost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏻

Why these changes are being introduced:

In anticipation of migrating to new AWS infrastructure, we will
need to pause file uploads for a bit.

Relevant ticket(s):

* https://mitlibraries.atlassian.net/browse/ETD-649

How this addresses that need:

This adds a maintenance mode feature, toggled via the flipflop
gem, that disables and hides the thesis transfer form and changes
the welcome message on `transfer/new` to explain what is happening.
A custom message can be configured to provide additional details.

Side effects of this change:

* It is still technically possible to post a new transfer if one
were to bypass the form. I find it unlikely that transfer submitters
would try to hack this, but if it's a concern, we could try a
different approach.
* Currently, maintenance mode only disables thesis transfers. I chose
to give the feature a more generalized name in case we want to use
it to disable additional functionality in the future.
@jazairi jazairi merged commit b539012 into main Oct 25, 2023
3 checks passed
@jazairi jazairi deleted the etd-649-maintenance-mode branch October 25, 2023 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants