mirror of
https://github.com/tloncorp/landscape.git
synced 2024-12-01 10:55:45 +03:00
Merge pull request #13 from tloncorp/ns/send-emails-with-notification-count
Send emails with notification count
This commit is contained in:
commit
38625f3baf
@ -6,7 +6,7 @@
|
||||
+$ versioned-state
|
||||
$% state-0
|
||||
==
|
||||
+$ state-0 [%0 mailchimp-api-key=cord hosting-api-key=cord recipients=(set ship)]
|
||||
+$ state-0 [%0 tlon-api-key=tape mailchimp-api-key=tape recipients=(set ship)]
|
||||
--
|
||||
::
|
||||
=| state-0
|
||||
@ -22,8 +22,11 @@
|
||||
|= [=mark =vase]
|
||||
^- (quip card _this)
|
||||
?+ mark (on-poke:def mark vase)
|
||||
%set-api-key
|
||||
`this(mailchimp-api-key !<(cord vase))
|
||||
%set-tlon-api-key
|
||||
`this(tlon-api-key !<(tape vase))
|
||||
::
|
||||
%set-mailchimp-api-key
|
||||
`this(mailchimp-api-key !<(tape vase))
|
||||
::
|
||||
%bark-add-recipient
|
||||
=+ !<(=ship vase)
|
||||
@ -49,10 +52,13 @@
|
||||
=/ result !<((unit [requested=time =carpet:hark]) vase)
|
||||
?~ result
|
||||
`this(recipients (~(del in recipients) src.bowl))
|
||||
~& >>> carpet.u.result
|
||||
:: TODO create thread that calls the "get email address" thread (to be written)
|
||||
:: and the "send email" thread and call it here
|
||||
`this
|
||||
:_ this
|
||||
:~ :* %pass /mail-hosted-users/(scot %p src.bowl)/(scot %da requested.u.result)
|
||||
%arvo %k %fard
|
||||
%bark %mail-hosted-user %noun
|
||||
!>(`[tlon-api-key mailchimp-api-key src.bowl carpet.u.result])
|
||||
==
|
||||
==
|
||||
==
|
||||
++ on-watch on-watch:def
|
||||
++ on-agent on-agent:def
|
||||
|
59
desk/ted/mail-hosted-user.hoon
Normal file
59
desk/ted/mail-hosted-user.hoon
Normal file
@ -0,0 +1,59 @@
|
||||
/- spider, hark
|
||||
/+ *strandio
|
||||
=, strand=strand:spider
|
||||
=, dejs:format
|
||||
|^ ted
|
||||
++ template-vars
|
||||
|= [=ship =carpet:hark]
|
||||
^- (map cord cord)
|
||||
%- malt
|
||||
:~ ['name' (scot %p ship)]
|
||||
['notifications' (crip (a-co:co ~(wyt by yarns.carpet)))]
|
||||
==
|
||||
++ ted
|
||||
^- thread:spider
|
||||
|= arg=vase
|
||||
=/ m (strand ,vase)
|
||||
^- form:m
|
||||
=/ arg-mold
|
||||
$: tlon-api-key=tape
|
||||
mailchimp-api-key=tape
|
||||
=ship
|
||||
=carpet:hark
|
||||
==
|
||||
=/ args !<((unit arg-mold) arg)
|
||||
?~ args !!
|
||||
;< ~ bind:m
|
||||
%- send-raw-card
|
||||
:* %pass /check-email/(scot %p ship.u.args)
|
||||
%arvo %k %fard
|
||||
%bark %hosting-email %noun
|
||||
!>(`[tlon-api-key.u.args ship.u.args])
|
||||
==
|
||||
;< [mire=wire mine=sign-arvo] bind:m take-sign-arvo
|
||||
?> ?=([%check-email @ *] mire)
|
||||
?> =(i.t.mire (scot %p ship.u.args))
|
||||
?> ?=([%khan %arow %.y %noun *] mine)
|
||||
::
|
||||
=/ [%khan %arow %.y %noun vs=vase] mine
|
||||
=+ !<((unit cord) vs)
|
||||
?~ - !!
|
||||
=/ email u.-
|
||||
;< ~ bind:m
|
||||
%- send-raw-card
|
||||
:* %pass /send-mailchimp-email/(scot %p ship.u.args)
|
||||
%arvo %k %fard
|
||||
%bark %mailchimp-send-template %noun
|
||||
!>(`[mailchimp-api-key.u.args (trip email) "landscape-weekly-digest" (template-vars ship.u.args carpet.u.args)])
|
||||
==
|
||||
;< [wimp=wire simp=sign-arvo] bind:m take-sign-arvo
|
||||
?> ?=([%send-mailchimp-email @ *] wimp)
|
||||
?> =(i.t.wimp (scot %p ship.u.args))
|
||||
?> ?=([%khan %arow %.y %noun *] simp)
|
||||
::
|
||||
=/ [%khan %arow %.y %noun vs=vase] simp
|
||||
=+ !<((unit cord) vs)
|
||||
?~ - !!
|
||||
%- pure:m
|
||||
!> u.-
|
||||
--
|
@ -65,5 +65,5 @@
|
||||
?~ full-file.rep !!
|
||||
=/ body=cord q.data.u.full-file.rep
|
||||
%- pure:m
|
||||
!> [body ~]
|
||||
!> `body
|
||||
--
|
||||
|
Loading…
Reference in New Issue
Block a user