Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
auto-tx
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
vamp
auto-tx
Commits
331dcad8
Commit
331dcad8
authored
5 years ago
by
Niko Ehrenfeuchter
Browse files
Options
Downloads
Patches
Plain Diff
Change SendAdminEmail to return a bool
parent
3af8ad75
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ATxService/Email.cs
+7
-7
7 additions, 7 deletions
ATxService/Email.cs
with
7 additions
and
7 deletions
ATxService/Email.cs
+
7
−
7
View file @
331dcad8
...
...
@@ -78,16 +78,17 @@ namespace ATxService
/// </summary>
/// <param name="body">The email text.</param>
/// <param name="subject">Optional subject for the email.</param>
private
void
SendAdminEmail
(
string
body
,
string
subject
=
""
)
{
/// <returns>True in case an email was sent, false otherwise.</returns>
private
bool
SendAdminEmail
(
string
body
,
string
subject
=
""
)
{
if
(
_config
.
SendAdminNotification
==
false
)
return
;
return
false
;
var
delta
=
TimeUtils
.
MinutesSince
(
_status
.
LastAdminNotification
);
if
(
delta
<
_config
.
AdminNotificationDelta
)
{
Log
.
Warn
(
"Suppressed admin email, interval too short ({0} vs. {1}):\n\n{2}\n{3}"
,
TimeUtils
.
MinutesToHuman
(
delta
),
TimeUtils
.
MinutesToHuman
(
_config
.
AdminNotificationDelta
),
subject
,
body
);
return
;
return
false
;
}
if
(
string
.
IsNullOrWhiteSpace
(
subject
))
...
...
@@ -97,7 +98,8 @@ namespace ATxService
Log
.
Debug
(
"Sending an admin notification email."
);
SendEmail
(
_config
.
AdminEmailAdress
,
subject
,
body
);
_status
.
LastAdminNotification
=
DateTime
.
Now
;
Log
.
Debug
(
"{0} sent to AdminEmailAdress."
,
subject
);
return
true
;
}
/// <summary>
...
...
@@ -229,9 +231,7 @@ namespace ATxService
}
_status
.
LastGraceNotification
=
DateTime
.
Now
;
SendAdminEmail
(
report
,
"grace location summary"
);
Log
.
Debug
(
"Notification sent to AdminEmailAdress."
);
return
true
;
return
SendAdminEmail
(
report
,
"grace location summary"
);
}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment