Differences From
Artifact [57b2f599e2]:
12 12 terra http.actor_profile(co: &lib.srv.convo, actor: &lib.store.actor, meth: method.t)
13 13 var rel: lib.store.relationship
14 14 if co.aid ~= 0 then
15 15 rel = co.srv:actor_rel_calc(co.who.id, actor.id)
16 16 if meth == method.post then
17 17 var act = co:ppostv('act')
18 18 if rel.recip.block() then
19 - if act:cmp( 'follow') or act:cmp( 'subscribe') then
19 + if act:cmp('follow') or act:cmp('subscribe') then
20 20 co:complain(403,'blocked','you cannot follow a user you are blocked by') return
21 21 end
22 22 end
23 - if act:cmp( 'block') and not rel.rel.block() then
24 - (rel.rel.block << true) ; (rel.recip.follow << false)
23 + if act:cmp('block') and not rel.rel.block() then
24 + rel.rel.block = true rel.recip.follow = false
25 25 co.srv:actor_rel_create([lib.store.relation.idvmap.block], co.who.id, actor.id)
26 26 co.srv:actor_rel_destroy([lib.store.relation.idvmap.follow], actor.id, co.who.id)
27 - else
27 + elseif not act:cmp('report') then
28 28 [(function()
29 29 local tests = quote co:complain(400,'bad request','the action you have attempted on this user is not meaningful') return end
30 30 for i,v in ipairs(lib.store.relation.members) do
31 31 tests = quote
32 - if [v ~= 'block'] and act:cmp(([v])) and not rel.rel.[v]() then -- rely on dead code elimination :/
33 - (rel.rel.[v] << true)
32 + if [v ~= 'block'] and act:cmp(lib.str.plit([v])) and not rel.rel.[v]() then -- rely on dead code elimination :/
33 + rel.rel.[v] = true
34 34 co.srv:actor_rel_create([lib.store.relation.idvmap[v]], co.who.id, actor.id)
35 - elseif act:cmp((['un'..v])) and rel.rel.[v]() then
36 - (rel.rel.[v] << false)
35 + elseif act:cmp(lib.str.plit(['un'..v])) and rel.rel.[v]() then
36 + rel.rel.[v] = false
37 37 co.srv:actor_rel_destroy([lib.store.relation.idvmap[v]], co.who.id, actor.id)
38 38 else [tests] end
39 39 end
40 40 end
41 41 return tests
42 42 end)()]
43 43 end