parsav  Diff

Differences From Artifact [99b348e685]:

To Artifact [745afb2f25]:


13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
..
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
	
	if notes.ct == 0 then
		co:complain(200,'no news is good news',"you don't have any notices to review")
		return
	end
	defer notes:free()

	var pg: lib.str.acc pg:init(512) defer pg:free()
	var pflink: lib.str.acc pflink:init(64)
	var body: lib.str.acc body:init(256)
	var latest: lib.store.timepoint = 0
	for i=0,notes.ct do
		if notes(i).when > latest then latest = notes(i).when end
		var who = co.srv:actor_fetch_uid(notes(i).who) defer who:free()
		if not who then lib.bail('schema integrity violation: nonexistent actor referenced in notification, this is almost certainly an SQL error or bug in the backend implementation') end
		pflink:cue(lib.str.sz(who(0).xid) + 4)
		if who(0).origin == 0 then pflink:lpush('/')
................................................................................
				n.kind = P'reply'
				n.act = P'replied to your post'
				notweet = false
			end
		else goto skip end
		do var idbuf: int8[lib.math.shorthand.maxlen]
			var idlen = lib.math.shorthand.gen(notes(i).what, idbuf)
			var b = lib.smackdown.html(pstr {ptr=what(0).body,ct=0},true) defer b:free()
			body:lpush(' <a class="quote" href="/post/'):push(&idbuf[0],idlen):lpush('">'):ppush(b):lpush('</a>')
		end
		if not notweet then
			var reply = co.srv:post_fetch(notes(i).reply)
				lib.render.tweet(co,reply.ptr,&body)
			reply:free()
		end
................................................................................
		n.ref = pstr {ptr = body.buf, ct = body.sz}

		n:append(&pg)
		::skip:: n.nym:free()
		         pflink:reset()
				 body:reset()
	end
	pflink:free()
	pg:lpush('<form method="post"><button name="act" value="clear">clear all notices</button></form>')
	co:livepage([lib.srv.convo.page] {
		title = P'notices', class = P'notices';
		body = pstr {ptr = pg.buf, ct = pg.sz};
		cache = false;
	}, latest)
end

return render_notices







|
|
|







 







|







 







|









13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
..
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
	
	if notes.ct == 0 then
		co:complain(200,'no news is good news',"you don't have any notices to review")
		return
	end
	defer notes:free()

	var pg = co:stra(512) -- defer pg:free()
	var pflink = co:stra(64)
	var body = co:stra(256)
	var latest: lib.store.timepoint = 0
	for i=0,notes.ct do
		if notes(i).when > latest then latest = notes(i).when end
		var who = co.srv:actor_fetch_uid(notes(i).who) defer who:free()
		if not who then lib.bail('schema integrity violation: nonexistent actor referenced in notification, this is almost certainly an SQL error or bug in the backend implementation') end
		pflink:cue(lib.str.sz(who(0).xid) + 4)
		if who(0).origin == 0 then pflink:lpush('/')
................................................................................
				n.kind = P'reply'
				n.act = P'replied to your post'
				notweet = false
			end
		else goto skip end
		do var idbuf: int8[lib.math.shorthand.maxlen]
			var idlen = lib.math.shorthand.gen(notes(i).what, idbuf)
			var b = lib.smackdown.html(&co.srv.pool, pstr {ptr=what(0).body,ct=0},true) --defer b:free()
			body:lpush(' <a class="quote" href="/post/'):push(&idbuf[0],idlen):lpush('">'):ppush(b):lpush('</a>')
		end
		if not notweet then
			var reply = co.srv:post_fetch(notes(i).reply)
				lib.render.tweet(co,reply.ptr,&body)
			reply:free()
		end
................................................................................
		n.ref = pstr {ptr = body.buf, ct = body.sz}

		n:append(&pg)
		::skip:: n.nym:free()
		         pflink:reset()
				 body:reset()
	end
	--pflink:free()
	pg:lpush('<form method="post"><button name="act" value="clear">clear all notices</button></form>')
	co:livepage([lib.srv.convo.page] {
		title = P'notices', class = P'notices';
		body = pstr {ptr = pg.buf, ct = pg.sz};
		cache = false;
	}, latest)
end

return render_notices