Differences From
Artifact [d7574b82d8]:
7 7 local terra
8 8 push_promo_header(co: &lib.srv.convo, acc: &lib.str.acc, rter: &lib.store.actor, rid: uint64)
9 9 acc:lpush('<div class="lede"><div class="promo"><img src="'):push(rter.avatar,0):lpush('"><a href="/')
10 10 if rter.origin ~= 0 then acc:lpush('@') end
11 11 acc:push(rter.xid,0):lpush('" class="username">')
12 12 lib.render.nym(rter, 0, acc, true)
13 13 acc:lpush('</a> retweeted</div>')
14 - if co.who.id == rter.id then
14 + if co.aid ~= 0 and co.who.id == rter.id then
15 15 acc:lpush('<a href="/post/'):shpush(rid):lpush('/del" class="del">✖</a>')
16 16 end
17 17 end
18 18
19 19 local terra
20 20 render_tweet(co: &lib.srv.convo, p: &lib.store.post, acc: &lib.str.acc)
21 21 var author: &lib.store.actor = nil
................................................................................
35 35 end
36 36
37 37 ::foundauth::
38 38 var avistr: lib.str.acc if author.origin == 0 then
39 39 avistr:compose('/avi/',author.handle)
40 40 end
41 41 var timestr: int8[26] lib.osclock.ctime_r(&p.posted, ×tr[0])
42 + for i=0,26 do if timestr[i] == @'\n' then timestr[i] = 0 break end end -- 🙄
42 43
43 44 var bhtml = lib.smackdown.html([lib.mem.ptr(int8)] {ptr=p.body,ct=0})
44 45 defer bhtml:free()
45 46
46 47 var idbuf: int8[lib.math.shorthand.maxlen]
47 48 var idlen = lib.math.shorthand.gen(p.id, idbuf)
48 49 var permalink: lib.str.acc permalink:compose('/post/',{idbuf,idlen})
................................................................................
57 58 permalink = permalink:finalize();
58 59 attr = pstr{'',0};
59 60 stats = pstr{'',0};
60 61 }
61 62 if p.rts + p.likes > 0 then
62 63 var s: lib.str.acc s:init(128)
63 64 s:lpush('<div class="stats">')
64 - if p.rts > 0 then s:lpush('<div class="rt">' ):ipush(p.rts ):lpush('</div>') end
65 - if p.likes > 0 then s:lpush('<div class="like">'):ipush(p.likes):lpush('</div>') end
65 + if p.rts > 0 then s:lpush('<div class="rt">' ):dpush(p.rts ):lpush('</div>') end
66 + if p.likes > 0 then s:lpush('<div class="like">'):dpush(p.likes):lpush('</div>') end
66 67 s:lpush('</div>')
67 68 tpl.stats = s:finalize()
68 69 end
69 70
70 - var attrbuf: int8[48]
71 + var attrbuf: int8[64]
71 72 var attrcur = &attrbuf[0]
72 73 if p.accent ~= -1 and p.accent ~= co.ui_hue then
73 74 var hdecbuf: int8[21]
74 75 var hdec = lib.math.decstr(p.accent, &hdecbuf[20])
75 76 attrcur = lib.str.cpy(attrcur,' style="--hue:')
76 77 attrcur = lib.str.cpy(attrcur, hdec)
77 78 -- var len = &hdecbuf[20] - hdec
78 79 attrcur = lib.str.cpy(attrcur, '"')
79 80 end
80 - if p.author == co.who.id then attrcur = lib.str.cpy(attrcur, ' data-own') end
81 + if co.aid ~= 0 and p.author == co.who.id then attrcur = lib.str.cpy(attrcur, ' data-own') end
82 + if retweeter ~= nil then attrcur = lib.str.cpy(attrcur, ' data-rt') end
81 83
82 84 if attrcur ~= &attrbuf[0] then tpl.attr = &attrbuf[0] end
83 85
84 86 defer tpl.permalink:free()
85 87 if acc ~= nil then
86 88 if retweeter ~= nil then push_promo_header(co, acc, retweeter, p.rtact) end
87 89 tpl:append(acc)