-
Notifications
You must be signed in to change notification settings - Fork 113
Closed
Labels
Description
Summary
Currently AttachmentResolver.js misses important information about attachments, which leads to a lot of complexity in resolving attachments.
To make this more straight-forward (at least for "own attachment files" - a.k.a. the ones living in .attachments.<fileId>), we could do the following:
- Add an API endpoint to get the list of files in the attachment folder along with their metadata (
fileId,fileName,size,mimetype,timestamp,hasPreview, maybe evendavUrlalready). This endpoint would need to allow authentication both via Text session and via logged in user. - Always request this list when loading a Text document in
Editor.vue(asynchronously, non-blocking). - When resolving attachments in
AttachmentResolver.js, look up the attachment in the retained list and use all available information from there.
Implementation details
- The list could either be stored in vuex store or the promise of the request could be passed to
AttachmentResolverconstructor. - When a new attachment is uploaded in Text, we either have to add it to the list in frontend, or retrieve an updated list as response and replace the list. (That might be arguments to maintain the list in vuex store 🤔)
Advantages
- For "own attachments" we could return better first candidates from
AttachmentResolver.- Non-image attachments would get a first candidate with
type: media, resulting in fewer requests during<img>loads. - No extra requests required for getting metadata for attachments.
- Non-image attachments would get a first candidate with
- We would have the
fileIdof attachments available.- Allows to link to attachments in Files app (useful for Opening non-image attachments is broken #3849).
- Allows to pass the
fileIdwhen emitting events for deleted attachments, useful in Collectives.
Disadvantages
- One more backend request (at least for documents without attachments).
@juliushaertl @julien-nc @max-nextcloud for feedback.
juliusknorr
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
☑️ Done