-
Notifications
You must be signed in to change notification settings - Fork 79
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
UploadField still displays “draft” label after a file has been published #960
Comments
…anged regardless of its ID set matching Fixes silverstripe#960
I'm still seeing a similar issue in 4.5: Steps:
|
Yep, seems to happen for any standard UploadField. e.g. on the new Silverstripe demo, just add a new blog post, upload a "Featured Image", then click Publish. It will still show the image as "Draft" but if you refresh the page the label dissapears. |
bump? |
Any chance of the fix for this in 4.6? I've had quite few CMS editors get confused by this bug. |
This has been high on our product team's list to get a fix in for 4.6 but unfortunately it's not looking like we're going to be able to get to it before the change freeze cut-off, although we'll keep pushing. Also noting that there's a similar issue that hasn't been linked before: #1001 |
I've been looking into this today, some notes Adding the following within the
However, this does not solve the original issue because entwine and redux provide different sets of file data The entwine / refresh() code will provide Redux will provide a similar looking but ultimately separate Some of the code within UploadField.js uses The draft|modified text is derived from the redux A couple of options: a) b) Though I'm not sure what side effects this would have. I tried changing it and straight off the bat it was buggy when I attempted to delete an existing upload. |
In case you haven't seen it, just noting that there is an old PR for this issue: #974. There were concerns raised with how changing redux states might inadvertently affect (inline editable) elemental blocks with upload fields. |
Cool thanks I'm not sure that particular PR will fix this particular issue though. There seems to be a bit of a deeper issue here where we have two source of truth:
I suspect something similar is going on elsewhere in asset-admin, for instance that sporadic bug where recently uploaded files show in the wrong folder I'm fairly worried that any changes we make are going to cause regressions elsewhere. Upload fields basically require behat tests which tend to have the lowest amount of coverage. |
|
Hi team, this was recently flagged from one of our bespoke projects by the PO, just checking if there's any further developments on this? 🙂 |
@pjayme no further developments that I'm aware of. There's been a couple of attempts to resolve this (and related issues) without success. I'll see if we can get back to this in the next month or so... |
Hi, this issue is still present in 4.7 and has been confusing for our content editors, resulting in an uptick in support tickets :( In lieu of a fix being available, I applied this workaround to hide the orange ---
Name: workaound-uploadfieldleftandmain
---
## workarounds.yml
# Ref: https://github.com/silverstripe/silverstripe-asset-admin/issues/960
SilverStripe\Admin\LeftAndMain:
extra_requirements_css:
- 'vendor/path/to/leftandmain.css'
// leftandmain.css
// Ref: https://github.com/silverstripe/silverstripe-asset-admin/issues/960
.uploadfield-item__meta .uploadfield-item__status {
visibility : hidden;
} We also applied an extension to the Upload Field, adding a right title text snippet with words to the effect of "Uploaded files remain in the draft state until they or this record is published" |
This issue is also present in 4.8 - I usually add a description to the upload field asking the content administrator to refresh the CMS page if the image is still appearing with the draft label in the CMS. Will this persist in future releases? |
@kinglozzer this is the biggest bug in the SS CMS right now. Is there a plan to fix it? |
I’m on the core committers team, but I don’t work for SS Ltd (and unfortunately I’m not familiar enough with Redux to have a go at fixing this myself) so I’m afraid I don’t know. I agree this issue should have received more attention than it has so far. |
@kinglozzer - sorry, I just saw your name. Can you maybe raise it at the next meeting or ping the person in charge? Every site we deliver for our clients, we have to explain that this is a known bug, but we have explained this for over two years now and it really ought to get a bit of love. |
This is still a thing in 4.9, hiding the orange "Draft" label per prev. workaround is still in place but that's not a permanent fix. There is an open pull request at #974 - how do we move this along? |
@here - it would be great to see this resolved. |
I haven't seen this mentioned in the 4.10.0 release notes from Jan 25 so I'm assuming it remains an issue in 4.10 @unclecheese? I was really hoping for a fix this release |
Niklas Forsdahl suggested on Slack to change getSchemaStateDefaults() method on UploadField. "What I did was subclass UploadField, and override getSchemaStateDefaults to force react to always render the field by mismatching it's files state" This can be tested like this: injector.yml
Added subclass of UploadField:
Tried it on a couple of sites and it works as a temporary fix. |
So can we simply change the getSchemaStateDefaults method in UploadField?
To this:
|
Can anyone assist in this change? The PR has failed checks, not sure why. Let's get this issue resolved. |
@RVXD can you please tests kinglozzer's PR to see if it still works for you as expected? |
FIX: Update UploadField redux state when form schema data changes (fixes #960)
I’ve seen a few other people report this on Slack. For me, it‘s:
has_one => File::class
private static $owns
set up correctlyModelAdmin
interfaceUploading a new file correctly displays as draft. Hitting “Apply Changes” on the DataObject publishes the file as expected, but the DRAFT label remains on the UploadField. Other observations:
Notes
The text was updated successfully, but these errors were encountered: