Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Duplicate maintenance mode message displayed.
Steps to reproduce
- On any content type that has a simple file field, create a node with an attachment file.
- Put the site in maintenance mode.
- Edit the node and remove the file attachment by clicking on the "Remove" button beside the file.
- Now when the file is removed, the form has the "Operating in maintenance mode. Go Online" message at 2 more places on the form, apart from the usual top message.
Proposed resolution
Display on one message, at the top of the screen.
Remaining tasks
Write a test
Add new before screenshot to the User interface changes section of the Issue Summary
Add an after screenshot to the User interface changes section of the Issue Summary
Review
User interface changes
Before
After
API changes
N/A
Data model changes
N/A
Release notes snippet
N/A
Comment | File | Size | Author |
---|---|---|---|
#56 | 2724829-56.patch | 4.18 KB | dww |
|
Comments
Comment #2
saitanay CreditAttribution: saitanay at Acquia commentedComment #3
scythian CreditAttribution: scythian at FFW commentedComment #4
scythian CreditAttribution: scythian at FFW commentedError is related to element rendering. By some reason AJAX wrapper with same ID applied twice http://take.ms/tux7C, also validation callback triggered twice too.
Comment #5
aneek CreditAttribution: aneek as a volunteer commentedThis same issue can be observed while in the configuration export (single) page.
Screenshot:
Comment #6
aneek CreditAttribution: aneek as a volunteer commentedUploading a new patch which fixes this in the
\Drupal\Core\EventSubscriber\MaintenanceModeSubscriber
Comment #7
aneek CreditAttribution: aneek as a volunteer commentedComment #16
quietone CreditAttribution: quietone as a volunteer commented@aneek, thanks for the report and the patch.
I tested this on Drupal 4.x and confirmed the problem still exists. In order to test the patch I rerolled it. I'm attaching the patch but not running tests because this also needs a test. Adding a tag for the test.
Updated the IS. Un-assigning because it has been more than 5 years since this was working ed.
Comment #18
smustgrave CreditAttribution: smustgrave at Mobomo commentedComment #20
smustgrave CreditAttribution: smustgrave at Mobomo commentedMoving back to NR. Test fails were caused by broken dev branch.
Comment #21
yashingole CreditAttribution: yashingole at QED42 for Drupal India Association commentedComment #22
yashingole CreditAttribution: yashingole at QED42 for Drupal India Association commentedVerified and tested patch #18 on Drupal 9.5.x-dev. Patch applied successfully and looks good to me.
Testing steps:
1. Add Content Article type.
2. Add an image.
3. Save the page.
4. Put the site in maintenance mode.
5. Edit the node and remove the file attachment by clicking on the "Remove" button beside the file.
6. Observe that the "Operating in maintenance mode. Go online." message appears twice at the top and in the image section.
Testing Result:
1. After applying the patch the "Operating in maintenance mode. Go online." message appears at the top only.
Can be move to RTBC
Comment #23
quietone CreditAttribution: quietone as a volunteer commented@yashingole, thanks for the manual testing! It would help if you added the screens shots to the issue summary.
The remaining tasks in the issue summary need to be updated.
What I don't see here is any review of the code changes. My comment below is not a full review of the code.
This is not wrapped at 80 columns
Comment #24
smustgrave CreditAttribution: smustgrave at Mobomo commentedFixed the wrapping text. Not sure what needs to be updated in the IS though? It's got clear steps and screenshot.
Comment #25
Munavijayalakshmi CreditAttribution: Munavijayalakshmi at Valuebound for Valuebound commentedignore please
Comment #26
Munavijayalakshmi CreditAttribution: Munavijayalakshmi at Valuebound for Valuebound commented#24 patch working fine.
Comment #27
Munavijayalakshmi CreditAttribution: Munavijayalakshmi at Valuebound for Valuebound commentedComment #28
quietone CreditAttribution: quietone commentedReviewing RTBC issues to check they pass the core gates.
An issue summary update was asked for in #23, that has not happened, adding tag. There is no evidence of a code review here.
There are several steps, or gates, that an issue must pass before it is marked RTBC. For most issues following step 10 in the Review a patch or merge request task of the Contributor guide is sufficient. The complete list of core gates has more topics. Also, check the tags on the issue and make sure they are complete.
Therefor, credit has been removed per How is credit granted for Drupal core issues. And remember to read the issue summary and the comments before working on issue.
Comment #29
smustgrave CreditAttribution: smustgrave at Mobomo commentedComment #30
Manibharathi E R CreditAttribution: Manibharathi E R for Material commentedPatch #24 tested and Applied successfully on Drupal 9.5.x.
Before patch:
After Patch:
Comment #31
nikhilraut CreditAttribution: nikhilraut at QED42 for Drupal India Association commentedComment #32
nikhilraut CreditAttribution: nikhilraut at QED42 for Drupal India Association commentedPatch #24 working fine on drupal 9.5
Comment #33
alexpottLet's change this to:
It's a bit more readable and less levels of ifs.
to
Comment #34
smustgrave CreditAttribution: smustgrave at Mobomo commentedAddressed the points in #33
Comment #35
alexpottThe rest of this test is file test... I'm not sure that using the file field to test this is correct... but even so the rest of the test should stay in the file module. There are a number of modules in system test modules that provide ajax routes.
Comment #36
alexpottSee the ajax_test module for example and \Drupal\FunctionalJavascriptTests\Ajax\MessageCommandTest::testMessageCommand
Comment #37
smustgrave CreditAttribution: smustgrave at Mobomo commentedWent back to the original patch in #24
Addressed 2 and 3 in #33
For #1 could this remain in the file module? The test was written to tie into an existing test.
Comment #38
smustgrave CreditAttribution: smustgrave at Mobomo commentedMoved test
Comment #40
alexpottWe're not testing the file widget we're testing the maintenance mode with AjAX requests.
I think we should change the test to use the ajax_test module.
Comment #41
smustgrave CreditAttribution: smustgrave at Mobomo commentedUpdated the tests to be more accurate.
Tried updating to ajax_test but all those URLs are not accessible when logged in. Could not figure that out.
Comment #43
smustgrave CreditAttribution: smustgrave at Mobomo commentedWrong namespace
Comment #44
prasanth_kp CreditAttribution: prasanth_kp as a volunteer and at Zyxware Technologies commentedThanks for the patch 2724829-43.patch, Its working perfectly fine on 9.5.x-dev
Comment #46
smustgrave CreditAttribution: smustgrave at Mobomo commentedRerunning for 10.1
Comment #47
gaurav-mathur CreditAttribution: gaurav-mathur at Dotsquares Ltd. commentedComment #48
gaurav-mathur CreditAttribution: gaurav-mathur at Dotsquares Ltd. commentedHi i applied patch#43. it is work fine and looks good.
Steps of testing:-
1. Add image field on article content type.
2. Add content on using article.
3. Add an title and image or save the page.
4. Put the site in maintenance mode.
5. Edit the node and remove the file attachment by clicking on the Remove button beside the file.
6. Observe that the Operating in maintenance mode. Go online. message appears twice at the top and in the image section.
Result After Apply Patch:-
1. After applying the patch the Operating in maintenance mode. Go online. message appears at the top only.
Adding screenshot for the reference.
Thank You
Comment #49
jungleAgree with @alexpott in #40,and the test could be simplified by using ajax_test, or ajax_form_test.
Comment #50
smustgrave CreditAttribution: smustgrave at Mobomo commentedWill give it another shot but was having issues with those test modules
Thanks!
Comment #51
smustgrave CreditAttribution: smustgrave at Mobomo commentedFixed up tests.
Comment #53
Tanuj. CreditAttribution: Tanuj. as a volunteer and at Material for Drupal India Association commentedTested and verified patch #51 with drupal: 10.1.x and the patch applied successfully and fixed the issue of multiple message on page. adding screenshots for reference. RTBC+1
Comment #54
larowlanMicro-optimisation, but I think we can enable this by setting the flag direct in state rather than needing to submit the form, will save a few HTTP requests and speed up the test
Other than that, makes sense to me
Comment #55
smustgrave CreditAttribution: smustgrave at Mobomo commentedUpdated.
Comment #56
dwwThe test-only patch is failing exactly as expected:
I closely reviewed the code here. Almost all looked great. Found a couple of very trivial nits. Fixing those as a new patch and RTBC'ing.
Comment #57
dwwComment #59
catchCommitted dbd6132 and pushed to 10.1.x. Thanks!
Comment #60
alexpottI was going to make the above changes on commit. Not important enough to do a revert but maybe someone wants to do a followup. We don't need the adminUser variable on test object and the $page and $assert_session variables are unnecessary and not even used consistently.