Skip to content

Commit

Permalink
fix(attachments): Don't use currentSession for fetching attachments
Browse files Browse the repository at this point in the history
When switching pages in Collectives, `currentSession` might still be the
session from the last page. The readonly view (`MarkdownContentEditor`)
doesn't get a session, so the outdated session is used.

Instead, always pass the session from `AttachmentResolver` to
`setAttachmentList`.

Fixes: nextcloud/collectives#1096
Fixes: nextcloud/collectives#1112

Signed-off-by: Jonas <jonas@freesources.org>
  • Loading branch information
mejo- committed Mar 14, 2024
1 parent e2ad77e commit 201a363
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/services/AttachmentResolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export default class AttachmentResolver {
}

async #updateAttachmentList() {
return setAttachmentList({ documentId: this.#documentId, shareToken: this.#shareToken })
return setAttachmentList({ documentId: this.#documentId, session: this.#session, shareToken: this.#shareToken })
}

/*
Expand Down
8 changes: 4 additions & 4 deletions src/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,11 @@ export const textModule = {
setHeadings({ commit }, value) {
commit(SET_HEADINGS, value)
},
async setAttachmentList({ commit, state }, { documentId, shareToken }) {
async setAttachmentList({ commit }, { documentId, session, shareToken }) {
const response = await axios.post(generateUrl('/apps/text/attachments'), {
documentId: state.currentSession?.documentId ?? documentId,
sessionId: state.currentSession?.id,
sessionToken: state.currentSession?.token,
documentId: session?.documentId ?? documentId,
sessionId: session?.id,
sessionToken: session?.token,
shareToken,
})

Expand Down

0 comments on commit 201a363

Please sign in to comment.