show folder's comment also after entering the folder

Massimo Melina committed Mar 2, 2024 at 14:20 UTC 24d033ef49ec860fadbd8b82218b6f7439363ffe
4 files changed +5 -1
frontend/src/BrowseFiles.ts
+1
@@ -46,6 +46,7 @@ export function BrowseFiles() {
46 h(CustomCode, { name: 'beforeHeader' }),
47 h(Head),
48 h(CustomCode, { name: 'afterHeader' }),
49 + props?.comment && h('div', { className: 'entry-comment' }, props.comment),
50 error ? h(ErrorMsg, { err: error }) : h(FilesList),
51 h(CustomCode, { name: 'afterList' }),
52 h(ClipBar),
frontend/src/index.scss
+1
@@ -353,6 +353,7 @@ ul.dir {
353 display: inline;
354 white-space: pre-wrap;
355 word-break: break-word;
356 + margin-bottom: .5em; // affecting only the layout of the current-folder-comment
357 &::before, &::after {
358 font-size: 1.5em;
359 font-family: serif;
frontend/src/state.ts
+1
@@ -31,6 +31,7 @@ export const state = proxy<typeof FRONTEND_OPTIONS & {
31 can_archive?: boolean
32 can_comment?: boolean
33 can_overwrite?: boolean
34 + comment?: string
35 }
36 canChangePassword: boolean
37 }>({
src/api.get_file_list.ts
+2 -1
@@ -40,7 +40,8 @@ export const get_file_list: ApiHandler = async ({ uri='/', offset, limit, search
40 const can_archive = admin || hasPermission(node, 'can_archive', ctx)
41 const can_comment = can_upload && areCommentsEnabled()
42 const can_overwrite = can_upload && (can_delete || !dontOverwriteUploading.get())
43 - const props = { can_archive, can_upload, can_delete, can_overwrite, accept: node.accept, can_comment }
43 + const comment = await getCommentFor(node.source)
44 + const props = { can_archive, can_upload, can_delete, can_overwrite, can_comment, comment, accept: node.accept }
45 ctx.state.browsing = uri.replace(/\/{2,}/g, '/')
46 updateConnectionForCtx(ctx)
47 if (!list)