mirror of
https://github.com/dolphin-emu/redmine_webhook.git
synced 2026-01-31 01:15:19 +01:00
move icon_url to author
This commit is contained in:
@@ -26,6 +26,7 @@ Post Data Example
|
||||
"payload": {
|
||||
"issue": {
|
||||
"author": {
|
||||
"icon_url": "http://www.gravatar.com/avatar/example",
|
||||
"identity_url": null,
|
||||
"lastname": "user",
|
||||
"firstname": "test",
|
||||
@@ -69,8 +70,7 @@ Post Data Example
|
||||
}
|
||||
},
|
||||
"action": "opened",
|
||||
"url": "https://example.com",
|
||||
"icon_url": "http://www.gravatar.com/avatar/example"
|
||||
"url": "https://example.com"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,11 +78,11 @@ Post Data Example
|
||||
|
||||
{
|
||||
"payload": {
|
||||
"icon_url": "http://www.gravatar.com/avatar/example",
|
||||
"url": "https://example.com",
|
||||
"journal": {
|
||||
"details": [],
|
||||
"author": {
|
||||
"icon_url": "http://www.gravatar.com/avatar/example",
|
||||
"identity_url": null,
|
||||
"lastname": "user",
|
||||
"firstname": "test",
|
||||
@@ -97,6 +97,7 @@ Post Data Example
|
||||
},
|
||||
"issue": {
|
||||
"author": {
|
||||
"icon_url": "http://www.gravatar.com/avatar/example",
|
||||
"identity_url": null,
|
||||
"lastname": "user",
|
||||
"firstname": "test",
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
class RedmineWebhook::AuthorWrapper
|
||||
include GravatarHelper::PublicMethods
|
||||
include ERB::Util
|
||||
|
||||
def initialize(author)
|
||||
@author = author
|
||||
end
|
||||
@@ -11,6 +14,15 @@ class RedmineWebhook::AuthorWrapper
|
||||
:firstname => @author.firstname,
|
||||
:lastname => @author.lastname,
|
||||
:identity_url => @author.identity_url,
|
||||
:icon_url => icon_url
|
||||
}
|
||||
end
|
||||
|
||||
def icon_url
|
||||
if @author.mail.blank?
|
||||
icon_url = nil
|
||||
else
|
||||
icon_url = gravatar_url(@author.mail)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
class RedmineWebhook::WebhookListener < Redmine::Hook::Listener
|
||||
include GravatarHelper::PublicMethods
|
||||
include ERB::Util
|
||||
|
||||
def controller_issues_new_after_save(context = {})
|
||||
issue = context[:issue]
|
||||
@@ -27,8 +25,7 @@ class RedmineWebhook::WebhookListener < Redmine::Hook::Listener
|
||||
:payload => {
|
||||
:action => 'opened',
|
||||
:issue => RedmineWebhook::IssueWrapper.new(issue).to_hash,
|
||||
:url => controller.issue_url(issue),
|
||||
:icon_url => gravatar_url(issue.author.mail)
|
||||
:url => controller.issue_url(issue)
|
||||
}
|
||||
}.to_json
|
||||
end
|
||||
@@ -39,8 +36,7 @@ class RedmineWebhook::WebhookListener < Redmine::Hook::Listener
|
||||
:action => 'updated',
|
||||
:issue => RedmineWebhook::IssueWrapper.new(issue).to_hash,
|
||||
:journal => RedmineWebhook::JournalWrapper.new(journal).to_hash,
|
||||
:url => controller.issue_url(issue),
|
||||
:icon_url => gravatar_url(issue.author.mail)
|
||||
:url => controller.issue_url(issue)
|
||||
}
|
||||
}.to_json
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user