From aee9754ecc30e7fcb120706ece3c73f25fad6b35 Mon Sep 17 00:00:00 2001 From: kory33 <6561358+kory33@users.noreply.github.com> Date: Sun, 26 Nov 2017 12:30:55 +0900 Subject: [PATCH] separate embed for new wiki page --- lib/redmine_discord/embed_objects/wiki_embeds.rb | 11 +++++++++++ lib/redmine_discord/listener.rb | 6 +++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/lib/redmine_discord/embed_objects/wiki_embeds.rb b/lib/redmine_discord/embed_objects/wiki_embeds.rb index 38a261b..6e9392f 100644 --- a/lib/redmine_discord/embed_objects/wiki_embeds.rb +++ b/lib/redmine_discord/embed_objects/wiki_embeds.rb @@ -26,4 +26,15 @@ def get_fields_color 255 end end + + class WikiNewEmbed < WikiEditEmbed + def get_title_tag + '[New wiki page]' + end + + def get_fields_color + # 00ffff + 65535 + end + end end \ No newline at end of file diff --git a/lib/redmine_discord/listener.rb b/lib/redmine_discord/listener.rb index 2628dec..60f4abd 100644 --- a/lib/redmine_discord/listener.rb +++ b/lib/redmine_discord/listener.rb @@ -38,7 +38,11 @@ def controller_wiki_edit_after_save(context={}) wiki_page = context[:page] project = wiki_page.project - embed_object = WikiEditEmbed.new context + embed_object = if wiki_page.content.version == 1 + WikiNewEmbed.new context + else + WikiEditEmbed.new context + end @dispatcher.dispatch embed_object, project end