Browse Source

fix files page not working when logged out.

master 1.6.1
Gisle Aune 4 years ago
parent
commit
a10b29a0ea
  1. 4
      marko/page/data/components/files-page/index.marko
  2. 4
      routes/data/files.js

4
marko/page/data/components/files-page/index.marko

@ -1,9 +1,9 @@
<data-menu categories=input.categories selected=(input.selected || {}) user=input.user on-open("open") />
<main class="data-file-page">
<h1 class="file-list-headers color-primary">Your Private Files</h1>
<h1 if(state.privates && state.privates.length > 0) class="file-list-headers color-primary">Your Private Files</h1>
<file-list user=input.user files=state.privates on-removed("fileRemoved") on-edited("fileEdited") on-nicks("fileNicksChanged") />
<h1 class="file-list-headers color-primary">Public Files</h1>
<h1 if(state.publics && state.publics.length > 0) class="file-list-headers color-primary">Public Files</h1>
<file-list user=input.user files=state.publics on-removed("fileRemoved") on-edited("fileEdited") on-nicks("fileNicksChanged") />
</main>
<add-channel-modal enabled=(state.modal === "channel.add") user=input.user on-close("close") />

4
routes/data/files.js

@ -8,13 +8,13 @@ const filesTemplate = require("../../marko/page/data/files.marko")
router.get("/", async(req, res) => {
let privates = []
if (res.locals.user) {
if (res.locals.user && res.locals.user.loggedIn) {
privates = fileApi.list({public: false}, {token: generateToken(res.locals.user.name)})
}
res.markoAsync(filesTemplate, {
privates: privates,
publics: fileApi.list(),
publics: fileApi.list({public: true}),
selected: {files: true},
})
})

Loading…
Cancel
Save