-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add notification helpers #136
Conversation
R/utils.R
Outdated
checkmate::assert_flag(html) | ||
checkmate::assert_flag(inline) | ||
checkmate::assert_from(host_name, min.chars = 1) | ||
checkmate::assert_character(attached_files) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These two lines should be wrapped into if, to allow for using def arg with NULL, i.e.
if (!is.null(attached_files)) {
checkmate::assert_character(attached_files)
checkmate::assert_file_exists(attached_files)
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done in 708cae4.
R/duplicates.R
Outdated
qs::qsave(att_l, att_f) | ||
m_to <- get_env_var("EMAIL_RECIPIENT") | ||
stopifnot(nchar(m_to) > 0) | ||
send_email(body = msg, to = m_to, from = from, attached_files = att_f) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
arg from
is not definied
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed in 1c494b0.
R/duplicates.R
Outdated
if ("slack" %in% by) { | ||
s_to <- get_env_var("EMAIL_SLACK_NOTIFICATION") | ||
stopifnot(nchar(s_to) > 0) | ||
send_email(body = msg, to = s_to, from = from) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
arg from
is not definied
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed in 1c494b0.
Co-authored-by: Bartek <[email protected]>
Co-authored-by: Bartek <[email protected]>
Co-authored-by: Bartek <[email protected]>
Co-authored-by: Bartek <[email protected]>
Co-authored-by: Bartek <[email protected]>
Co-authored-by: Bartek <[email protected]>
Co-authored-by: Bartek <[email protected]>
Co-authored-by: Bartek <[email protected]>
R/duplicates.R
Outdated
m_sbj <- "[gDR] Error - unexpected duplicates found" | ||
|
||
if ("email" %in% by) { | ||
att_l <- list(c(dup_dt = dup_dt, metadata)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it intentional to create one-element list instead of list(dup_dt = dup_dt, metadata = metadata)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Usually it will be a list with multiple elements because metadata usually will be a non-empty list.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Fixed.
Co-authored-by: Bartek <[email protected]>
Co-authored-by: Bartek <[email protected]>
Co-authored-by: Bartek <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, add tests.
R/duplicates.R
Outdated
s_to <- get_env_var("EMAIL_SLACK_NOTIFICATION") | ||
stopifnot(nchar(s_to) > 0) | ||
send_email(body = msg, subject = m_sbj, to = s_to) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a.a.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved to GC
See https://code.roche.com/gdr/gdrviz/-/merge_requests/149.