Commit 81a029d9 authored by Sam Bingner's avatar Sam Bingner Committed by Arturo Herrero

Add changelog and use Array.wrap

parent ae70ff27
......@@ -56,7 +56,7 @@ class DiscordService < ChatNotificationService
client.execute do |builder|
builder.add_embed do |embed|
embed.author = Discordrb::Webhooks::EmbedAuthor.new(name: message.user_name, icon_url: message.user_avatar)
embed.description = (message.pretext + "\n" + wrap_array(message.attachments).join("\n")).gsub(ATTACHMENT_REGEX, " \\k<entry> - \\k<name>\n")
embed.description = (message.pretext + "\n" + Array.wrap(message.attachments).join("\n")).gsub(ATTACHMENT_REGEX, " \\k<entry> - \\k<name>\n")
end
end
end
......@@ -64,12 +64,4 @@ class DiscordService < ChatNotificationService
def custom_data(data)
super(data).merge(markdown: true)
end
def wrap_array(object)
case(object)
when nil then []
when object.respond_to?(:to_a) then object.to_a
else [object]
end
end
end
---
title: sbingner Update discord notifications to be a single embed and include log
messages
merge_request: 26978
author: Sam Bingner
type: fixed
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment