From 6c3cbbd0e81dc62f79996951904bc6ab4db13240 Mon Sep 17 00:00:00 2001 From: mod242 <40213799+mod242@users.noreply.github.com> Date: Fri, 23 Jan 2026 14:59:29 +0100 Subject: [PATCH 1/3] Add authorPictureUrl to CommentPost schema --- server/graph/schemas/comment.graphql | 1 + 1 file changed, 1 insertion(+) diff --git a/server/graph/schemas/comment.graphql b/server/graph/schemas/comment.graphql index df73496a..e8eac5e1 100644 --- a/server/graph/schemas/comment.graphql +++ b/server/graph/schemas/comment.graphql @@ -81,6 +81,7 @@ type CommentPost { render: String! authorId: Int! authorName: String! + authorPictureUrl: String authorEmail: String! @auth(requires: ["manage:system"]) authorIP: String! @auth(requires: ["manage:system"]) createdAt: Date! From 693dab7685b97fe7100ac1b5e91ccaf10e4e44e0 Mon Sep 17 00:00:00 2001 From: mod242 <40213799+mod242@users.noreply.github.com> Date: Fri, 23 Jan 2026 15:02:34 +0100 Subject: [PATCH 2/3] Resolve authorPictureUrl for comment list and single --- server/graph/resolvers/comment.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/server/graph/resolvers/comment.js b/server/graph/resolvers/comment.js index 1c894943..8d3566a2 100644 --- a/server/graph/resolvers/comment.js +++ b/server/graph/resolvers/comment.js @@ -47,12 +47,19 @@ module.exports = { }) if (page) { if (WIKI.auth.checkAccess(context.req.user, ['read:comments'], { tags: page.tags, ...args })) { - const comments = await WIKI.models.comments.query().where('pageId', page.id).orderBy('createdAt') + const comments = await WIKI.models.comments.query() + .where('pageId', page.id) + .withGraphJoined('author') + .modifyGraph('author', builder => { + builder.select('id', 'pictureUrl') + }) + .orderBy('createdAt') return comments.map(c => ({ ...c, authorName: c.name, authorEmail: c.email, - authorIP: c.ip + authorIP: c.ip, + authorPictureUrl: _.get(c, 'author.pictureUrl', '') })) } else { throw new WIKI.Error.CommentViewForbidden() @@ -69,6 +76,7 @@ module.exports = { if (!cm || !cm.pageId) { throw new WIKI.Error.CommentNotFound() } + const author = await WIKI.models.users.query().select('pictureUrl').findById(cm.authorId) const page = await WIKI.models.pages.query().select('localeCode', 'path').findById(cm.pageId) .withGraphJoined('tags') .modifyGraph('tags', builder => { @@ -84,7 +92,8 @@ module.exports = { ...cm, authorName: cm.name, authorEmail: cm.email, - authorIP: cm.ip + authorIP: cm.ip, + authorPictureUrl: _.get(author, 'pictureUrl', '') } } else { throw new WIKI.Error.CommentViewForbidden() From 0fdcc78b95a9c0aa12242df61ce891ae29518ab0 Mon Sep 17 00:00:00 2001 From: mod242 <40213799+mod242@users.noreply.github.com> Date: Fri, 23 Jan 2026 15:03:47 +0100 Subject: [PATCH 3/3] Render comment avatars with fallback to initials --- client/components/comments.vue | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/client/components/comments.vue b/client/components/comments.vue index 4091c902..ec2ce768 100644 --- a/client/components/comments.vue +++ b/client/components/comments.vue @@ -78,8 +78,8 @@ ) template(v-slot:icon) v-avatar(color='blue-grey') - //- v-img(src='http://i.pravatar.cc/64') - span.white--text.title {{cm.initials}} + v-img(v-if='cm.pictureUrl', :src='cm.pictureUrl') + span.white--text.title(v-else) {{cm.initials}} v-card.elevation-1 v-card-text .comments-post-actions(v-if='permissions.manage && !isBusy && commentEditId === 0') @@ -182,7 +182,9 @@ export default { list(locale: $locale, path: $path) { id render + authorId authorName + authorPictureUrl createdAt updatedAt } @@ -201,6 +203,10 @@ export default { if (nameParts.length > 1) { initials += _.last(nameParts).charAt(0) } + const pictureUrl = (c.authorPictureUrl === 'internal') + ? `/_userav/${c.authorId}` + : c.authorPictureUrl + c.pictureUrl = pictureUrl c.initials = initials return c })