Skip to content

Commit 2304d3e

Browse files
committed
Add subject
1 parent 13d361c commit 2304d3e

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

nimletter.nimble

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Package
22

3-
version = "0.4.1"
3+
version = "0.4.2"
44
author = "ThomasTJdev"
55
description = "Newsletter"
66
license = "AGPL v3"

src/routes/routes_mail.nim

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ proc(request: Request) =
168168
contentEditor = @"contentEditor"
169169
editorType = (if @"editorType" in ["html", "emailbuilder"]: @"editorType" else: "html")
170170
skipContent = (@"skipContent" == "true")
171+
subject = @"subject"
171172

172173
if not mailID.isValidInt():
173174
resp Http400, "Invalid UUID"
@@ -189,7 +190,8 @@ proc(request: Request) =
189190
"contentHTML",
190191
"contentEditor",
191192
"editorType",
192-
"send_once"
193+
"send_once",
194+
"subject"
193195
],
194196
where = [
195197
"id = ?"
@@ -202,6 +204,7 @@ proc(request: Request) =
202204
contentEditor,
203205
editorType,
204206
sendOnce,
207+
subject,
205208
mailID
206209
) > 0
207210

src/scheduling/schedule_mail.nim

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ proc createPendingEmail*(
4848
triggerType: string = "delay",
4949
scheduledFor: DateTime = now().utc,
5050
status: string = "pending",
51+
manualSubject: string = "",
5152
) =
5253

5354
let scheduledFor = (
@@ -82,6 +83,9 @@ proc createPendingEmail*(
8283
if scheduledFor != "NULL":
8384
data.add("scheduled_for")
8485
args.add(scheduledFor)
86+
if manualSubject != "":
87+
data.add("manual_subject")
88+
args.add(manualSubject)
8589

8690
pg.withConnection conn:
8791
exec(conn, sqlInsert(
@@ -104,7 +108,8 @@ proc createPendingEmailFromFlowstep*(userID, listID, flowID: string, stepNumber:
104108
"mail_id",
105109
"step_number",
106110
"trigger_type",
107-
"delay_minutes"
111+
"delay_minutes",
112+
"subject"
108113
],
109114
where = [
110115
"flow_id = ?",
@@ -124,7 +129,8 @@ proc createPendingEmailFromFlowstep*(userID, listID, flowID: string, stepNumber:
124129
mailID = flowStep[1],
125130
triggerType = flowStep[3],
126131
scheduledFor = (now().utc + parseInt(flowStep[4]).minutes),
127-
status = "pending"
132+
status = "pending",
133+
manualSubject = flowStep[5]
128134
)
129135

130136

0 commit comments

Comments
 (0)