Differences From
Artifact [2f7668c3df]:
222 222 return
223 223 else goto badop end
224 224 end
225 225 else goto badurl end
226 226 end
227 227
228 228 if meth == method.post then
229 - var replytext = co:ppostv('post')
230 - var acl = co:ppostv('acl')
231 - var subj = co:ppostv('subject')
232 - if not acl then acl = lib.str.plit 'all' end
233 - if not replytext then goto badop end
234 -
235 - var reply = lib.store.post {
236 - author = co.who.id, parent = pid;
237 - subject = subj.ptr, acl = acl.ptr, body = replytext.ptr;
238 - }
229 + var act = co:ppostv('act')
230 + if act:cmp(lib.str.plit 'like') and not co.srv:post_liked_uid(co.who.id,pid) then
231 + co.srv:post_like(co.who.id, pid, false)
232 + post.ptr.likes = post.ptr.likes + 1
233 + elseif act:cmp(lib.str.plit 'dislike') and co.srv:post_liked_uid(co.who.id,pid) then
234 + co.srv:post_like(co.who.id, pid, true)
235 + post.ptr.likes = post.ptr.likes - 1
236 + elseif act:cmp(lib.str.plit 'rt') then
237 + co.srv:post_retweet(co.who.id, pid, false)
238 + post.ptr.rts = post.ptr.rts + 1
239 + elseif act:cmp(lib.str.plit 'post') then
240 + var replytext = co:ppostv('post')
241 + var acl = co:ppostv('acl')
242 + var subj = co:ppostv('subject')
243 + if not acl then acl = lib.str.plit 'all' end
244 + if not replytext then goto badop end
245 +
246 + var reply = lib.store.post {
247 + author = co.who.id, parent = pid;
248 + subject = subj.ptr, acl = acl.ptr, body = replytext.ptr;
249 + }
239 250
240 - reply:publish(co.srv)
251 + reply:publish(co.srv)
252 + else goto badop end
241 253 end
242 254
243 255 lib.render.tweet_page(co, path, post.ptr)
244 256 do return end
245 257
246 258 ::badurl:: do co:complain(404, 'invalid URL', 'this URL does not reference extant content or functionality') return end
247 259 ::badop :: do co:complain(405, 'invalid operation', 'the operation you have attempted on this post is not meaningful') return end
................................................................................
257 269 path(1):cmp(lib.str.lit 'emoji')
258 270 ) then goto nopriv
259 271
260 272 elseif not co.who.rights.powers.rebrand() and (
261 273 path(1):cmp(lib.str.lit 'brand')
262 274 ) then goto nopriv
263 275
264 - elseif not co.who.rights.powers.acct() and (
276 + elseif not co.who.rights.powers.account() and (
265 277 path(1):cmp(lib.str.lit 'profile') or
266 278 path(1):cmp(lib.str.lit 'acct')
267 279 ) then goto nopriv
268 280
269 281 elseif not co.who.rights.powers:affect_users() and (
270 282 path(1):cmp(lib.str.lit 'users')
271 283 ) then goto nopriv end