-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
[WIP] feat: commit media with post #2823
Conversation
|
||
const entry = state.entryDraft.get('entry'); | ||
const useWorkflow = state.config.getIn(['publish_mode']) === EDITORIAL_WORKFLOW; | ||
const draft = entry && !entry.isEmpty() && useWorkflow; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this the best way to check if we're in edit mode?
Approach sounds dead on 👍🏼👍🏼 Sent with GitHawk |
const files = [...metadataFiles, ...filesList]; | ||
await Promise.all( | ||
metadataFiles.map(file => | ||
this.deleteFile(file.path, options.commitMessage, { branch: branchName }), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of the re-uploading changes and deleting previously-stored media files, which will still occur if the draft change didn't add any new media file. Why don't we make use of the uploaded
flag that is set here and then filter the loaded draft media files using this flag to get newly added media file(s), and then push the new media file(s) on draft update and concat here with previous ones.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @barthc I haven't finished the part of deleting media files from the pr. I'll look into the uploaded
flag.
closing for now to avoid unnecessary builds - will re-open when ready. |
@erezrokah Would be good to not have this PR closed so that people can have visibility of it. Great work thus far! |
I'm opening a new one soon (can't re-open since I did a force merge). I just didn't want to hog build minutes on every new commit I push since I knew the tests were failing (specifically the cypress tests take longer to fail) |
Fixes #1344
STILL WORK IN PROGRESS.
I just wanted to share my approach as it is different than the one here #2397.
The GitHub backend already supports pushing multiple files with one commit and the draft entry has some initial support to link media files to assets.
As a result I decided to handle everything in the client until the entry is saved. It is done using the draft entry
mediaFiles
field that can be used to link the media file to its corresponding asset.When a user opens the media gallery while creating/editing an entry in editorial workflow any new uploaded media file will not be persisted immediately, but added to the
mediaFiles
list.Once the entry is saved everything will be pushed in a single commit.
I also needed to make sure the media files and their assets are stored in the local backup.
Items left: