-
Notifications
You must be signed in to change notification settings - Fork 91
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
Refactor attachment loading #5042
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mejo-
force-pushed
the
feat/attachments_controller
branch
2 times, most recently
from
November 27, 2023 13:25
e49e197
to
0c32f8a
Compare
This was
linked to
issues
Nov 27, 2023
mejo-
added a commit
to nextcloud/collectives
that referenced
this pull request
Nov 27, 2023
Only do this if editor API is version 1.1 or newer to not break usage with older Text versions. This builds on nextcloud/text#5042. Signed-off-by: Jonas <[email protected]>
4 tasks
mejo-
added a commit
to nextcloud/collectives
that referenced
this pull request
Nov 27, 2023
Only do this if editor API is version 1.1 or newer to not break usage with older Text versions. This builds on nextcloud/text#5042. Fixes: #620 Fixes: #964 Signed-off-by: Jonas <[email protected]>
mejo-
force-pushed
the
feat/attachments_controller
branch
from
November 27, 2023 14:00
0c32f8a
to
99520ae
Compare
juliusknorr
reviewed
Nov 27, 2023
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.
Some first feedback :)
lib/Middleware/Attribute/RequireDocumentSessionUserOrShareToken.php
Outdated
Show resolved
Hide resolved
mejo-
force-pushed
the
feat/attachments_controller
branch
3 times, most recently
from
November 28, 2023 15:41
8bdc322
to
c893b43
Compare
5 tasks
mejo-
force-pushed
the
feat/attachments_controller
branch
3 times, most recently
from
November 28, 2023 18:34
5469eab
to
a40b537
Compare
juliusknorr
reviewed
Nov 28, 2023
juliusknorr
reviewed
Nov 28, 2023
juliusknorr
reviewed
Nov 28, 2023
juliusknorr
requested changes
Nov 28, 2023
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.
Some more comments, but look great so far already.
Signed-off-by: Jonas <[email protected]>
This format was only used from 03.01.2022 to 23.05.2022. Signed-off-by: Jonas <[email protected]>
…ment Signed-off-by: Jonas <[email protected]>
Signed-off-by: Jonas <[email protected]>
Signed-off-by: Jonas <[email protected]>
When viewer is available, not in use and supports the mimetype, and we're not in a public share, open the attachment in viewer. Otherwise, download the attachment. Fixes: #3849 Fixes: #4723 Fixes: #5030 Signed-off-by: Jonas <[email protected]>
Signed-off-by: Jonas <[email protected]>
Signed-off-by: Jonas <[email protected]>
Signed-off-by: Jonas <[email protected]>
Signed-off-by: Jonas <[email protected]>
Signed-off-by: Jonas <[email protected]>
Also don't set any davPath at all in public share. We probably don't have DAV access there anyway. Signed-off-by: Jonas <[email protected]>
…ctoring Signed-off-by: Jonas <[email protected]>
Instead of just opening native image attachments, query the HTML document to get all loaded attachments (regardless whether native, via direct URL or via DAV) and list them. Signed-off-by: Jonas <[email protected]>
Signed-off-by: Jonas <[email protected]>
Signed-off-by: Jonas <[email protected]>
mejo-
force-pushed
the
feat/attachments_controller
branch
from
November 29, 2023 10:50
97a80d6
to
978cbc6
Compare
Signed-off-by: Jonas <[email protected]>
juliusknorr
approved these changes
Nov 29, 2023
/backport to stable28 |
/backport to stable27 |
mejo-
added a commit
to nextcloud/collectives
that referenced
this pull request
Dec 5, 2023
Only do this if editor API is version 1.1 or newer to not break usage with older Text versions. This builds on nextcloud/text#5042. Fixes: #620 Fixes: #964 Signed-off-by: Jonas <[email protected]>
mejo-
added a commit
to nextcloud/collectives
that referenced
this pull request
Dec 5, 2023
Only do this if editor API is version 1.1 or newer to not break usage with older Text versions. This builds on nextcloud/text#5042. Fixes: #620 Fixes: #964 Signed-off-by: Jonas <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
📝 Summary
Introduces an API endpoint to fetch a list of native attachments (all files in
.attachments.<fileId>
folder). Frontend fetches this list whenAttachmentResolver
is initialized and uses it when resolving attachments.The main advantage is that all metadata about native attachments is available instantaneously. This obsoletes the logic to iterate through candidates in the frontend code for determining whether it's an image or non-image attachment.
Additionally, it allows to decide in frontend what to do with non-image attachments. When viewer is available and not in use, supports the attachment mimetype and we're not in a public share, we open the attachment in viewer now. Otherwise we download the attachment.
The editor API now uses
MarkdownContentEditor.vue
whenfileId
is passed along withuseSession = false
. We need thefileId
inMarkdownContentEditor.vue
for using theAttachmentResolver
in a meaningful way. Also required: the backend allows to get the attachment list without a document session.Also:
ShowImageModal
text://
syntaxhasPreview=true
query parameter in attachment URLs/core/preview/
)🚧 TODO
getMediaMetadataUrl
in frontendAttachmentController.
additional scenarios
.attachments/<wrongId>
data:...
imagequestions
hasPreview=true
URL parameter about?further
text://
syntax support&hasPreview=true
supportimageFileId()
,getQueryVariable()
,isSupportedImage()
inImageView.vue
internalLinkOrImage()
in ImageView.vuetests
🏁 Checklist
npm run lint
/npm run stylelint
/composer run cs:check
)