You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
res, err:=r.db.ExecContext(ctx, `UPDATE email_queue SET status = $1, last_error = NULL, sent_at = NOW() WHERE id = $2`, SentStatus, id)
77
+
res, err:=r.db.ExecContext(ctx, `UPDATE email_queue SET status = $1, last_error = NULL, sent_at = NOW() WHERE id = $2 AND status = $3`, SentStatus, id, ProcessingStatus)
78
78
79
79
iferr!=nil {
80
80
returnfmt.Errorf("%s: failed to mark email queue item %d as sent: %w", repo, id, err)
res, err:=r.db.ExecContext(ctx, `UPDATE email_queue SET status = $1, attempts = (attempts + 1), last_error = $2 WHERE id = $3`, FailedStatus, errMsg, id)
90
+
res, err:=r.db.ExecContext(ctx, `UPDATE email_queue SET status = $1, attempts = (attempts + 1), last_error = $2 WHERE id = $3 AND status = $4`, FailedStatus, errMsg, id, ProcessingStatus)
91
91
92
92
iferr!=nil {
93
93
returnfmt.Errorf("%s: failed to mark email queue item %d as failed: %w", repo, id, err)
res, err:=r.db.ExecContext(ctx, `UPDATE email_queue SET status = $1, attempts = (attempts + 1), last_error = $2 WHERE id = $3`, PendingStatus, errMsg, id)
103
+
res, err:=r.db.ExecContext(ctx, `UPDATE email_queue SET status = $1, attempts = (attempts + 1), last_error = $2 WHERE id = $3 AND status = $4`, PendingStatus, errMsg, id, ProcessingStatus)
104
104
105
105
iferr!=nil {
106
106
returnfmt.Errorf("%s: failed to mark email queue item %d as pending for retry: %w", repo, id, err)
body=fmt.Sprintf("Good news!\nYour %s has been approved by the ELN Community moderation team.\n\nIt is now available on the platform and can be shared with the community.", item)
81
+
link="\n\nYou can view it here: https://eln.community"
80
82
caseStatusRejected:
81
83
body=fmt.Sprintf("Your %s has been reviewed by the ELN Community moderation team and was not approved for publication.\n\nIf you think this is a mistake or need more information, please contact the ELN Community team at contact@deltablot.email.", item)
84
+
link=""
82
85
}
83
86
84
-
fullBody:=fmt.Sprintf("Hello,\n\n%s\n\nYou can view it here: https://eln.community\n\nThank you for contributing to open science.", body)
85
-
returnbuildEmailBody(fullBody)
87
+
returnbuildEmailBody(fmt.Sprintf("Hello,\n\n%s%s\n\nThank you for contributing to open science.", body, link))
0 commit comments