1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
|
/- sur=nostrill, nsur=nostr, comms=nostrill-comms,
post=trill-post, gate=trill-gate, feed=trill-feed
/+ appjs=json-nostrill,
lib=nostrill,
trill-feed,
trill=trill-post,
njs=json-nostr,
postlib=trill-post,
sr=sortug
|_ [=state:sur =bowl:gall]
+$ card card:agent:gall
++ debug-own-feed
=/ postlist (tap:orm:feed feed.state)
=/ lol
|- ?~ postlist ~
~& >> poast=+.i.postlist
$(postlist t.postlist)
~
:: state
++ add-to-feed |= p=post:post
=. feed.state (put:orm:feed feed.state id.p p)
state
++ headsup-poke
|= [poke=post-poke:ui:sur p=post:post] ^- engagement:comms
?- -.poke
%add !!
%del !!
%quote [%quote id.poke p]
:: TODO del-reply
%reply [%reply id.poke p]
%rp [%rp id.poke id.p]
%reaction [%reaction id.poke reaction.poke]
==
++ handle-post |= poke=post-poke:ui:sur
^- (quip card _state)
~& handle-post-ui=poke
=/ profile (~(get by profiles.state) [%urbit our.bowl])
=/ pubkey pub.i.keys.state
=/ crds ~(. cards:lib bowl)
:: TODO UI notifications [%hark ]
?- -.poke
%del =. feed.state =< + (del:orm:feed feed.state id.poke)
:: TODO cascade children
=/ p *post:post
=/ p p(id id.poke, host host.poke)
=/ pw [p (some pubkey) ~ ~ profile]
=/ jfact=fact:ui:sur [%post %del pw]
=/ ui-card (update-ui:cards:lib jfact)
:_ state
?: .=(our.bowl host.p)
=/ =fact:comms [%post %del id.poke]
=/ fact-card (update-followers:cards:lib fact)
:~ ui-card
fact-card
==
::
:~ ui-card
==
%add
=/ sp (build-sp:trill our.bowl our.bowl content.poke ~ ~)
=/ p=post:post
(build-post:trill now.bowl pubkey sp)
=. state (add-to-feed p)
=/ pw [p (some pubkey) ~ ~ profile]
=/ jfact=fact:ui:sur [%post %add pw]
=/ ui-card (update-ui:cards:lib jfact)
:_ state
=/ =fact:comms [%post %add p]
=/ fact-card (update-followers:cards:lib fact)
:~ ui-card
fact-card
==
%quote
=/ sp (build-sp:trill our.bowl our.bowl content.poke ~ ~)
=/ quote [%ref %trill host.poke /(crip (scow:sr %ud id.poke))]
=. contents.sp (snoc contents.sp quote)
=/ p=post:post
(build-post:trill now.bowl pubkey sp)
=. state (add-to-feed p)
=/ pw [p (some pubkey) ~ ~ profile]
=/ jfact=fact:ui:sur [%post %add pw]
=/ ui-card (update-ui:cards:lib jfact)
=/ eng-poke [%eng (headsup-poke poke p)]
=/ eng-card (poke-host:crds host.p eng-poke)
:_ state
?: .=(our.bowl host.poke)
=/ =fact:comms [%post %add p]
=/ fact-card (update-followers:cards:lib fact)
:~ ui-card
fact-card
eng-card
==
::
:~ ui-card
eng-card
==
%reply
=/ sp (build-sp:trill host.poke our.bowl content.poke `id.poke `thread.poke)
=/ p=post:post
(build-post:trill now.bowl pubkey sp)
=. state (add-to-feed p)
=/ pw [p (some pubkey) ~ ~ profile]
=/ jfact=fact:ui:sur [%post %add pw]
=/ ui-card (update-ui:cards:lib jfact)
=/ eng-poke [%eng (headsup-poke poke p)]
=/ eng-card (poke-host:crds host.p eng-poke)
:_ state
?: .=(our.bowl host.poke)
=/ =fact:comms [%post %add p]
=/ fact-card (update-followers:cards:lib fact)
:~ ui-card
fact-card
eng-card
==
::
:~ ui-card
eng-card
==
%rp
=/ quote [%ref %trill host.poke /(crip (scow:sr %ud id.poke))]
=/ sp (build-sp:trill host.poke our.bowl '' ~ ~)
=. contents.sp ~[quote]
=/ p=post:post
(build-post:trill now.bowl pubkey sp)
=. state (add-to-feed p)
=/ pw [p (some pubkey) ~ ~ profile]
=/ jfact=fact:ui:sur [%post %add pw]
=/ ui-card (update-ui:cards:lib jfact)
=/ eng-poke [%eng (headsup-poke poke p)]
=/ eng-card (poke-host:crds host.p eng-poke)
:_ state
?: .=(our.bowl host.poke)
=/ =fact:comms [%post %add p]
=/ fact-card (update-followers:cards:lib fact)
:~ ui-card
fact-card
eng-card
==
::
:~ ui-card
eng-card
==
%reaction
?: .=(host.poke our.bowl)
=/ p (got:orm:feed feed.state id.poke)
=. reacts.engagement.p %+ ~(put by reacts.engagement.p)
our.bowl [reaction.poke *signature:post]
=. state (add-to-feed p)
=/ pw [p (some pubkey) ~ ~ profile]
=/ jfact=fact:ui:sur [%post %add pw]
=/ ui-card (update-ui:cards:lib jfact)
=/ eng-poke [%eng (headsup-poke poke p)]
=/ eng-card (poke-host:crds host.poke eng-poke)
:_ state
=/ =fact:comms [%post %add p]
=/ fact-card (update-followers:cards:lib fact)
:~ ui-card
fact-card
eng-card
==
::
=/ up (get:orm:feed following2.state id.poke)
?~ up
=/ eng-poke [%eng (headsup-poke poke *post:post)]
=/ eng-card (poke-host:crds host.poke eng-poke)
:_ state :~(eng-card)
::
=/ p u.up
=. reacts.engagement.p %+ ~(put by reacts.engagement.p)
our.bowl [reaction.poke *signature:post]
=. state (add-to-feed p)
=/ pw [p (some pubkey) ~ ~ profile]
=/ jfact=fact:ui:sur [%post %add pw]
=/ ui-card (update-ui:cards:lib jfact)
=/ eng-poke [%eng (headsup-poke poke p)]
=/ eng-card (poke-host:crds host.p eng-poke)
:_ state
=/ =fact:comms [%post %add p]
:~ ui-card
eng-card
==
==
++ handle-post-fact |= pf=post-fact:comms
^- (quip card _state)
~& handle-post-fact=pf
=/ =user:sur [%urbit src.bowl]
=/ fed (~(get by following.state) user)
?~ fed ~& "emmm not following ya" `state
=/ nf=feed:feed
?: ?=(%del -.pf)
=< + (del:orm:feed u.fed id.pf)
::mmm people aren't supposed to update if its not their own feeds
:: =/ =user:nsur [%urbit host.p.pdf]
(put:orm:feed u.fed id.p.pf p.pf)
=. following.state (~(put by following.state) user nf)
=. following2.state
?: ?=(%del -.pf)
=< + (del:orm:feed following2.state id.pf)
(insert-to-global:trill-feed nf p.pf)
:: TODO update the ui with the changes
:_ state
=/ profile (~(get by profiles.state) user)
=/ pubkey 0 :: TODO
=/ jfact=fact:ui:sur
?: ?=(%del -.pf)
=/ p *post:post
=/ p p(host src.bowl, id id.pf)
=/ pw [p ~ ~ ~ profile]
[%post %del pw]
=/ pw [p.pf ~ ~ ~ profile]
[%post %add pw]
=/ ui-card (update-ui:cards:lib jfact)
:~ ui-card
==
--
|