Skip to content

Commit

Permalink
separate embed for new wiki page
Browse files Browse the repository at this point in the history
  • Loading branch information
kory33 committed Nov 26, 2017
1 parent c28ed28 commit aee9754
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
11 changes: 11 additions & 0 deletions lib/redmine_discord/embed_objects/wiki_embeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 5 additions & 1 deletion lib/redmine_discord/listener.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit aee9754

Please sign in to comment.