From c69e5281053d3b3018268e55743123c2660c338e Mon Sep 17 00:00:00 2001 From: Gisle Aune Date: Sun, 17 Mar 2019 20:15:35 +0100 Subject: [PATCH] Added UI for Commit entries to change history --- marko/page/data/components/change/component.js | 15 +++++++++++++++ rpdata/api/Change.js | 5 +++++ 2 files changed, 20 insertions(+) diff --git a/marko/page/data/components/change/component.js b/marko/page/data/components/change/component.js index 5de85af..1c28257 100644 --- a/marko/page/data/components/change/component.js +++ b/marko/page/data/components/change/component.js @@ -72,6 +72,21 @@ module.exports = class { break } + case "Comment": { + const storyKey = data.keys.find(k => k.model === "Story") || {} + const chapterKey = data.keys.find(k => k.model === "Chapter") + const chapter = data.objects.find(o => o.type === "Chapter") || {} + const comment = data.objects.find(o => o.type === "Comment") || {} + + this.state.operation += ' ' + comment.characterName + " comment in chapter" + this.state.links = [{ + text: chapter.title || `ID (${chapterKey.id})`, + href: `/story/${storyKey.id}#${chapterKey.id}`, + }] + + break + } + case "Log": { const key = data.keys.find(k => k.id !== "*") diff --git a/rpdata/api/Change.js b/rpdata/api/Change.js index e84bf68..a5f5084 100644 --- a/rpdata/api/Change.js +++ b/rpdata/api/Change.js @@ -68,6 +68,11 @@ class ChangesAPI { time nick } + + ...on Comment { + chapterId + characterName + } } } }