Skip to content

Commit 65c7f85

Browse files
lbwexleramcclain
authored andcommitted
Misc email service fixes
1 parent 968a543 commit 65c7f85

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## 21.0-SNAPSHOT - unreleased
44

5+
### ⚙️ Technical
6+
7+
* Remove obsolete, non-functioning GSP support from EmailService.
8+
59
## 20.2.0 - 2024-06-26
610

711
### ⚙️ Technical

grails-app/services/io/xh/hoist/email/EmailService.groovy

+4-10
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import io.xh.hoist.util.Utils
2121
class EmailService extends BaseService {
2222

2323
def configService
24-
def groovyPageRenderer
2524

2625
private Date lastSentDate = null
2726
private Long emailsSent = 0
@@ -40,12 +39,10 @@ class EmailService extends BaseService {
4039
* logIdentifier {String} - optional, string to append to log message, defaults to subject
4140
* throwError {Boolean} - option to throw on error or to suppress and log, defaults to false
4241
*
43-
* To determine email body, either "text" OR "html" OR ("view" AND "model") must be included in args:
42+
* To determine email body, either "text" OR "html" must be included in args:
4443
*
4544
* text {String} - plain text message
4645
* html {String} - html message
47-
* view - gsp file path
48-
* model - model to be applied to the view
4946
*
5047
* To attach file(s) to the email, include:
5148
*
@@ -83,8 +80,8 @@ class EmailService extends BaseService {
8380
env = Utils.appEnvironment.displayName.toUpperCase(),
8481
envString = Utils.isProduction ? '' : " [$env]",
8582
subj = args.subject + envString,
86-
isAsync = args.containsKey('async') ? args.async : false,
87-
isMultipart = args.containsKey('attachments') ,
83+
isAsync = args.async as boolean,
84+
isMultipart = args.attachments as boolean,
8885
attachments = []
8986

9087
if (isMultipart) {
@@ -118,10 +115,7 @@ class EmailService extends BaseService {
118115
} else if (args.containsKey('text')) {
119116
text args.text as String
120117
} else {
121-
html groovyPageRenderer.render(
122-
view: args.view,
123-
model: args.model
124-
)
118+
throw new RuntimeException("Must provide 'html' or 'text' for email.")
125119
}
126120

127121
attachments.each { Map f ->

0 commit comments

Comments
 (0)