{"action":"created","comment":{"url":"https://api.github.com/repos/opf/openproject/pulls/comments/25736898","id":25736898,"diff_hunk":"@@ -0,0 +1,57 @@\n+#-- encoding: UTF-8\n+#-- copyright\n+# OpenProject is a project management system.\n+# Copyright (C) 2012-2015 the OpenProject Foundation (OPF)\n+#\n+# This program is free software; you can redistribute it and/or\n+# modify it under the terms of the GNU General Public License version 3.\n+#\n+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:\n+# Copyright (C) 2006-2013 Jean-Philippe Lang\n+# Copyright (C) 2010-2013 the ChiliProject Team\n+#\n+# This program is free software; you can redistribute it and/or\n+# modify it under the terms of the GNU General Public License\n+# as published by the Free Software Foundation; either version 2\n+# of the License, or (at your option) any later version.\n+#\n+# This program is distributed in the hope that it will be useful,\n+# but WITHOUT ANY WARRANTY; without even the implied warranty of\n+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n+# GNU General Public License for more details.\n+#\n+# You should have received a copy of the GNU General Public License\n+# along with this program; if not, write to the Free Software\n+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.\n+#\n+# See doc/COPYRIGHT.rdoc for more details.\n+#++\n+\n+class DeliverWorkPackageCreatedJob\n+  def initialize(user_id, work_package_id)\n+    @user_id         = user_id\n+    @work_package_id = work_package_id\n+  end\n+\n+  def perform\n+    notification_mail.deliver\n+  end\n+\n+  def error(_job, e)\n+    Rails.logger.error \"notification of #{user.mail} failed (work package created): #{e}\"\n+  end\n+\n+  private\n+\n+  def notification_mail\n+    @notification_mail ||= UserMailer.work_package_added(user, work_package)\n+  end\n+\n+  def user\n+    @user ||= Principal.find(@user_id)","path":"app/workers/deliver_work_package_created_job.rb","position":51,"original_position":51,"commit_id":"21553ea918294bd4f69889dfa97640465cc5b006","original_commit_id":"21553ea918294bd4f69889dfa97640465cc5b006","user":{"login":"linki","id":36162,"avatar_url":"https://avatars.githubusercontent.com/u/36162?v=3","gravatar_id":"","url":"https://api.github.com/users/linki","html_url":"https://github.com/linki","followers_url":"https://api.github.com/users/linki/followers","following_url":"https://api.github.com/users/linki/following{/other_user}","gists_url":"https://api.github.com/users/linki/gists{/gist_id}","starred_url":"https://api.github.com/users/linki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/linki/subscriptions","organizations_url":"https://api.github.com/users/linki/orgs","repos_url":"https://api.github.com/users/linki/repos","events_url":"https://api.github.com/users/linki/events{/privacy}","received_events_url":"https://api.github.com/users/linki/received_events","type":"User","site_admin":false},"body":"a problem i often encoutered during `openproject-demo.org` times was that this failed because the user couldn't be found. delayed job will then reschedule the job and keep it in the queue for a very long time. i think it would be safe to just drop the mail entirely in that case, because it's quite unlikely that this will record will magically be found, right? so, a `find_by_id` in combination with a `if user` somewhere might be useful. same goes for the wp below.","created_at":"2015-03-03T23:02:03Z","updated_at":"2015-03-03T23:02:03Z","html_url":"https://github.com/opf/openproject/pull/2619#discussion_r25736898","pull_request_url":"https://api.github.com/repos/opf/openproject/pulls/2619","_links":{"self":{"href":"https://api.github.com/repos/opf/openproject/pulls/comments/25736898"},"html":{"href":"https://github.com/opf/openproject/pull/2619#discussion_r25736898"},"pull_request":{"href":"https://api.github.com/repos/opf/openproject/pulls/2619"}}},"pull_request":{"url":"https://api.github.com/repos/opf/openproject/pulls/2619","id":29992133,"html_url":"https://github.com/opf/openproject/pull/2619","diff_url":"https://github.com/opf/openproject/pull/2619.diff","patch_url":"https://github.com/opf/openproject/pull/2619.patch","issue_url":"https://api.github.com/repos/opf/openproject/issues/2619","number":2619,"state":"open","locked":false,"title":"avoid 500 upon mail failure when creating issues","user":{"login":"machisuji","id":158871,"avatar_url":"https://avatars.githubusercontent.com/u/158871?v=3","gravatar_id":"","url":"https://api.github.com/users/machisuji","html_url":"https://github.com/machisuji","followers_url":"https://api.github.com/users/machisuji/followers","following_url":"https://api.github.com/users/machisuji/following{/other_user}","gists_url":"https://api.github.com/users/machisuji/gists{/gist_id}","starred_url":"https://api.github.com/users/machisuji/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/machisuji/subscriptions","organizations_url":"https://api.github.com/users/machisuji/orgs","repos_url":"https://api.github.com/users/machisuji/repos","events_url":"https://api.github.com/users/machisuji/events{/privacy}","received_events_url":"https://api.github.com/users/machisuji/received_events","type":"User","site_admin":false},"body":"also log the errors with specific tag so they can be found\r\n\r\nWP [#18882](https://community.openproject.org/work_packages/18882)","created_at":"2015-02-25T14:45:01Z","updated_at":"2015-03-03T23:02:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"11db2044cd773dee03e2684345d1a2be993b81be","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/opf/openproject/pulls/2619/commits","review_comments_url":"https://api.github.com/repos/opf/openproject/pulls/2619/comments","review_comment_url":"https://api.github.com/repos/opf/openproject/pulls/comments{/number}","comments_url":"https://api.github.com/repos/opf/openproject/issues/2619/comments","statuses_url":"https://api.github.com/repos/opf/openproject/statuses/21553ea918294bd4f69889dfa97640465cc5b006","head":{"label":"opf:feature/silent_mail_failure","ref":"feature/silent_mail_failure","sha":"21553ea918294bd4f69889dfa97640465cc5b006","user":{"login":"opf","id":1756674,"avatar_url":"https://avatars.githubusercontent.com/u/1756674?v=3","gravatar_id":"","url":"https://api.github.com/users/opf","html_url":"https://github.com/opf","followers_url":"https://api.github.com/users/opf/followers","following_url":"https://api.github.com/users/opf/following{/other_user}","gists_url":"https://api.github.com/users/opf/gists{/gist_id}","starred_url":"https://api.github.com/users/opf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/opf/subscriptions","organizations_url":"https://api.github.com/users/opf/orgs","repos_url":"https://api.github.com/users/opf/repos","events_url":"https://api.github.com/users/opf/events{/privacy}","received_events_url":"https://api.github.com/users/opf/received_events","type":"Organization","site_admin":false},"repo":{"id":6899875,"name":"openproject","full_name":"opf/openproject","owner":{"login":"opf","id":1756674,"avatar_url":"https://avatars.githubusercontent.com/u/1756674?v=3","gravatar_id":"","url":"https://api.github.com/users/opf","html_url":"https://github.com/opf","followers_url":"https://api.github.com/users/opf/followers","following_url":"https://api.github.com/users/opf/following{/other_user}","gists_url":"https://api.github.com/users/opf/gists{/gist_id}","starred_url":"https://api.github.com/users/opf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/opf/subscriptions","organizations_url":"https://api.github.com/users/opf/orgs","repos_url":"https://api.github.com/users/opf/repos","events_url":"https://api.github.com/users/opf/events{/privacy}","received_events_url":"https://api.github.com/users/opf/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/opf/openproject","description":"OpenProject is a web-based project management system built on Ruby on Rails","fork":false,"url":"https://api.github.com/repos/opf/openproject","forks_url":"https://api.github.com/repos/opf/openproject/forks","keys_url":"https://api.github.com/repos/opf/openproject/keys{/key_id}","collaborators_url":"https://api.github.com/repos/opf/openproject/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/opf/openproject/teams","hooks_url":"https://api.github.com/repos/opf/openproject/hooks","issue_events_url":"https://api.github.com/repos/opf/openproject/issues/events{/number}","events_url":"https://api.github.com/repos/opf/openproject/events","assignees_url":"https://api.github.com/repos/opf/openproject/assignees{/user}","branches_url":"https://api.github.com/repos/opf/openproject/branches{/branch}","tags_url":"https://api.github.com/repos/opf/openproject/tags","blobs_url":"https://api.github.com/repos/opf/openproject/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/opf/openproject/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/opf/openproject/git/refs{/sha}","trees_url":"https://api.github.com/repos/opf/openproject/git/trees{/sha}","statuses_url":"https://api.github.com/repos/opf/openproject/statuses/{sha}","languages_url":"https://api.github.com/repos/opf/openproject/languages","stargazers_url":"https://api.github.com/repos/opf/openproject/stargazers","contributors_url":"https://api.github.com/repos/opf/openproject/contributors","subscribers_url":"https://api.github.com/repos/opf/openproject/subscribers","subscription_url":"https://api.github.com/repos/opf/openproject/subscription","commits_url":"https://api.github.com/repos/opf/openproject/commits{/sha}","git_commits_url":"https://api.github.com/repos/opf/openproject/git/commits{/sha}","comments_url":"https://api.github.com/repos/opf/openproject/comments{/number}","issue_comment_url":"https://api.github.com/repos/opf/openproject/issues/comments{/number}","contents_url":"https://api.github.com/repos/opf/openproject/contents/{+path}","compare_url":"https://api.github.com/repos/opf/openproject/compare/{base}...{head}","merges_url":"https://api.github.com/repos/opf/openproject/merges","archive_url":"https://api.github.com/repos/opf/openproject/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/opf/openproject/downloads","issues_url":"https://api.github.com/repos/opf/openproject/issues{/number}","pulls_url":"https://api.github.com/repos/opf/openproject/pulls{/number}","milestones_url":"https://api.github.com/repos/opf/openproject/milestones{/number}","notifications_url":"https://api.github.com/repos/opf/openproject/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/opf/openproject/labels{/name}","releases_url":"https://api.github.com/repos/opf/openproject/releases{/id}","created_at":"2012-11-28T09:59:11Z","updated_at":"2015-03-03T16:16:53Z","pushed_at":"2015-03-03T16:50:16Z","git_url":"git://github.com/opf/openproject.git","ssh_url":"git@github.com:opf/openproject.git","clone_url":"https://github.com/opf/openproject.git","svn_url":"https://github.com/opf/openproject","homepage":"https://www.openproject.org","size":186312,"stargazers_count":529,"watchers_count":529,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":235,"mirror_url":null,"open_issues_count":49,"forks":235,"open_issues":49,"watchers":529,"default_branch":"dev"}},"base":{"label":"opf:dev","ref":"dev","sha":"c58adebccbcbae06443c05ae5338c780c0bbcd10","user":{"login":"opf","id":1756674,"avatar_url":"https://avatars.githubusercontent.com/u/1756674?v=3","gravatar_id":"","url":"https://api.github.com/users/opf","html_url":"https://github.com/opf","followers_url":"https://api.github.com/users/opf/followers","following_url":"https://api.github.com/users/opf/following{/other_user}","gists_url":"https://api.github.com/users/opf/gists{/gist_id}","starred_url":"https://api.github.com/users/opf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/opf/subscriptions","organizations_url":"https://api.github.com/users/opf/orgs","repos_url":"https://api.github.com/users/opf/repos","events_url":"https://api.github.com/users/opf/events{/privacy}","received_events_url":"https://api.github.com/users/opf/received_events","type":"Organization","site_admin":false},"repo":{"id":6899875,"name":"openproject","full_name":"opf/openproject","owner":{"login":"opf","id":1756674,"avatar_url":"https://avatars.githubusercontent.com/u/1756674?v=3","gravatar_id":"","url":"https://api.github.com/users/opf","html_url":"https://github.com/opf","followers_url":"https://api.github.com/users/opf/followers","following_url":"https://api.github.com/users/opf/following{/other_user}","gists_url":"https://api.github.com/users/opf/gists{/gist_id}","starred_url":"https://api.github.com/users/opf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/opf/subscriptions","organizations_url":"https://api.github.com/users/opf/orgs","repos_url":"https://api.github.com/users/opf/repos","events_url":"https://api.github.com/users/opf/events{/privacy}","received_events_url":"https://api.github.com/users/opf/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/opf/openproject","description":"OpenProject is a web-based project management system built on Ruby on Rails","fork":false,"url":"https://api.github.com/repos/opf/openproject","forks_url":"https://api.github.com/repos/opf/openproject/forks","keys_url":"https://api.github.com/repos/opf/openproject/keys{/key_id}","collaborators_url":"https://api.github.com/repos/opf/openproject/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/opf/openproject/teams","hooks_url":"https://api.github.com/repos/opf/openproject/hooks","issue_events_url":"https://api.github.com/repos/opf/openproject/issues/events{/number}","events_url":"https://api.github.com/repos/opf/openproject/events","assignees_url":"https://api.github.com/repos/opf/openproject/assignees{/user}","branches_url":"https://api.github.com/repos/opf/openproject/branches{/branch}","tags_url":"https://api.github.com/repos/opf/openproject/tags","blobs_url":"https://api.github.com/repos/opf/openproject/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/opf/openproject/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/opf/openproject/git/refs{/sha}","trees_url":"https://api.github.com/repos/opf/openproject/git/trees{/sha}","statuses_url":"https://api.github.com/repos/opf/openproject/statuses/{sha}","languages_url":"https://api.github.com/repos/opf/openproject/languages","stargazers_url":"https://api.github.com/repos/opf/openproject/stargazers","contributors_url":"https://api.github.com/repos/opf/openproject/contributors","subscribers_url":"https://api.github.com/repos/opf/openproject/subscribers","subscription_url":"https://api.github.com/repos/opf/openproject/subscription","commits_url":"https://api.github.com/repos/opf/openproject/commits{/sha}","git_commits_url":"https://api.github.com/repos/opf/openproject/git/commits{/sha}","comments_url":"https://api.github.com/repos/opf/openproject/comments{/number}","issue_comment_url":"https://api.github.com/repos/opf/openproject/issues/comments{/number}","contents_url":"https://api.github.com/repos/opf/openproject/contents/{+path}","compare_url":"https://api.github.com/repos/opf/openproject/compare/{base}...{head}","merges_url":"https://api.github.com/repos/opf/openproject/merges","archive_url":"https://api.github.com/repos/opf/openproject/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/opf/openproject/downloads","issues_url":"https://api.github.com/repos/opf/openproject/issues{/number}","pulls_url":"https://api.github.com/repos/opf/openproject/pulls{/number}","milestones_url":"https://api.github.com/repos/opf/openproject/milestones{/number}","notifications_url":"https://api.github.com/repos/opf/openproject/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/opf/openproject/labels{/name}","releases_url":"https://api.github.com/repos/opf/openproject/releases{/id}","created_at":"2012-11-28T09:59:11Z","updated_at":"2015-03-03T16:16:53Z","pushed_at":"2015-03-03T16:50:16Z","git_url":"git://github.com/opf/openproject.git","ssh_url":"git@github.com:opf/openproject.git","clone_url":"https://github.com/opf/openproject.git","svn_url":"https://github.com/opf/openproject","homepage":"https://www.openproject.org","size":186312,"stargazers_count":529,"watchers_count":529,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":235,"mirror_url":null,"open_issues_count":49,"forks":235,"open_issues":49,"watchers":529,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/opf/openproject/pulls/2619"},"html":{"href":"https://github.com/opf/openproject/pull/2619"},"issue":{"href":"https://api.github.com/repos/opf/openproject/issues/2619"},"comments":{"href":"https://api.github.com/repos/opf/openproject/issues/2619/comments"},"review_comments":{"href":"https://api.github.com/repos/opf/openproject/pulls/2619/comments"},"review_comment":{"href":"https://api.github.com/repos/opf/openproject/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/opf/openproject/pulls/2619/commits"},"statuses":{"href":"https://api.github.com/repos/opf/openproject/statuses/21553ea918294bd4f69889dfa97640465cc5b006"}}}}