From 6aa3f8bc29cb1ed3a1b165cbf526079a751c8c71 Mon Sep 17 00:00:00 2001 From: David Svantesson Date: Fri, 25 Oct 2019 16:46:37 +0200 Subject: Mail assignee when issue/pull request is assigned (#8546) * Send email to assigned user * Only send mail if enabled * Mail also when assigned through API * Need to refactor functions from models to issue service * Refer to issue index rather than ID * Disable email notifications completly at initalization if global disable * Check of user enbled mail shall be in mail notification function only * Initialize notifications from routers init function. * Use the assigned comment when sending assigned mail * Refactor so that assignees always added as separate step when new issue/pr. * Check error from AddAssignees * Check if user can be assiged to issue or pull request * Missing return * Refactor of CanBeAssigned check. CanBeAssigned shall have same check as UI. * Clarify function names (toggle rather than update/change), and clean up. * Fix review comments. * Flash error if assignees was not added when creating issue/pr * Generate error if assignee users doesn't exist --- routers/init.go | 2 ++ 1 file changed, 2 insertions(+) (limited to 'routers/init.go') diff --git a/routers/init.go b/routers/init.go index e4e880dbbb..bdd978d717 100644 --- a/routers/init.go +++ b/routers/init.go @@ -18,6 +18,7 @@ import ( "code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/markup" "code.gitea.io/gitea/modules/markup/external" + "code.gitea.io/gitea/modules/notification" "code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/ssh" "code.gitea.io/gitea/modules/task" @@ -44,6 +45,7 @@ func NewServices() { setting.NewServices() mailer.NewContext() _ = cache.NewContext() + notification.NewContext() } // In case of problems connecting to DB, retry connection. Eg, PGSQL in Docker Container on Synology -- cgit v1.2.3