parsav  user-page.t at [26937ca853]

File render/user-page.t artifact b87f9f8b97 part of check-in 26937ca853


-- vim: ft=terra
local terra 
render_userpage(
	co          : &lib.srv.convo,
	actor       : &lib.store.actor,
	relationship: &lib.store.relationship
): {}
	var ti: lib.str.t
	if co.aid ~= 0 and co.who.id == actor.id then
		ti = 'my profile'
	else
		ti = co:qstr('profile :: ', actor.handle)
	end

	var acc: lib.str.acc acc:pool(&co.srv.pool, 1024)
	var pftxt = lib.render.profile(co,actor,relationship) --defer pftxt:free()
	acc:ppush(pftxt)

	var stoptime = lib.osclock.time(nil)
	var posts = co.srv:post_enum_author_uid(actor.id, lib.store.range {
		mode = 1; -- T->I
		from_time = stoptime;
		to_idx = 64;
	})

	acc:lpush('<div id="feed" data-live="10">')
	var newest: lib.store.timepoint = 0
	for i = 0, posts.sz do
		lib.render.tweet(co, posts(i).ptr, &acc)
		var t = lib.math.biggest(lib.math.biggest(posts(i).ptr.posted, posts(i).ptr.discovered),posts(i).ptr.edited)
		if t > newest then newest = t end
		posts(i):free()
	end
	posts:free()
	acc:lpush('</div>')

	var bdf = acc:finalize()
	co:livepage([lib.srv.convo.page] {
		title = ti; body = bdf;
		class = 'profile';
		cache = false;
	}, newest)

	--tiptr:free()
	--bdf:free()
end

return render_userpage