parsav  Diff

Differences From Artifact [900216dd8b]:

To Artifact [5c434424ea]:


    34     34   		sz = 0, run = 0
    35     35   	}
    36     36   	var fetchmode = lib.store.range {
    37     37   		mode = 1; -- T->I
    38     38   		from_time = stoptime;
    39     39   		to_idx = 64;
    40     40   	}
           41  +	var circ: lib.mem.ptr(lib.store.circle) = nil
    41     42   	if mode == modes.follow or mode == modes.mutual then
    42     43   		posts = co.srv:timeline_actor_fetch_uid(co.who.id,fetchmode)
    43     44   	elseif mode == [modes['local']] then
    44     45   		posts = co.srv:timeline_instance_fetch(fetchmode)
    45     46   	elseif mode == modes.fedi then
    46         -	elseif mode == modes.circle then
           47  +	elseif mode == modes.circle and spec:ref() then
           48  +		var cid, ok = lib.math.shorthand.parse(spec.ptr,spec.ct)
           49  +		if ok then
           50  +			circ = co.srv:circle_search(&co.srv.pool,co.who.id,cid)
           51  +			if circ.ct == 1 then
           52  +				posts = co.srv:timeline_circle_fetch(cid,fetchmode)
           53  +			end
           54  +		end
    47     55   	end
    48     56   
    49     57   	var acc = co:stra(1024)
    50         -	var modelabels = arrayof(pstr, 'followed', 'mutuals', 'local instance', 'fediverse', 'circle')
           58  +	var modelabels = arrayof(pstr, '<u>f</u>ollowed', 'm<u>u</u>tuals', '<u>l</u>ocal instance', 'fedi<u>v</u>erse', 'ci<u>r</u>cle')
           59  +	var keybinds = arrayof(pstr, 'f', 'u', 'l', 'v', 'r')
    51     60   	var modelinks = arrayof(pstr, [modes.members])
    52         -	acc:lpush('<div style="text-align: right"><em>showing ')
           61  +	acc:lpush('<div class="kind-picker">showing ')
    53     62   	for i=0, [modelabels.type.N] do
    54     63   		if co.aid ~= 0 or not requires_login(i) then
    55     64   			if i > 0 then acc:lpush(' ยท ') end
    56         -			if i == mode and not (mode == modes.circle and spec:ref()) then
           65  +			if i == mode and not circ then
    57     66   				acc:lpush('<strong>'):ppush(modelabels[i]):lpush('</strong>')
    58     67   			else
    59         -				acc:lpush('<a href="/tl/'):ppush(modelinks[i]):lpush('">'):ppush(modelabels[i]):lpush('</a>')
           68  +				acc:lpush('<a href="/tl/'):ppush(modelinks[i]):lpush('" accesskey="'):ppush(keybinds[i]):lpush('">')
           69  +				if i == mode and circ:ref() then
           70  +					acc:lpush'<strong>':ppush(modelabels[i]):lpush'</strong> (':ppush(circ().name):lpush(')')
           71  +				else
           72  +					acc:ppush(modelabels[i])
           73  +				end
           74  +				acc:lpush('</a>')
    60     75   			end
    61     76   		end
    62     77   	end
    63         -	acc:lpush('</em></div>')
           78  +	acc:lpush('</div>')
    64     79   	var newest: lib.store.timepoint = 0
    65     80   	if mode == modes.circle and not spec then
    66     81   		var circles = co.srv:circle_search(&co.srv.pool, co.who.id, 0)
    67     82   		acc:lpush '<menu class="circles">'
    68     83   		for i:intptr = 0, circles.ct do
    69         -			acc:lpush '<li><a href="/tl/circle/'
           84  +			acc:lpush '<a href="/tl/circle/'
    70     85   			   :shpush(circles(i).cid)
    71         -			   :lpush '">'
           86  +			if i <= 10 then
           87  +				acc:lpush '" accesskey="':ipush((i+1) % 10)
           88  +			end
           89  +			acc:lpush '">'
    72     90   			   :ppush(circles(i).name)
    73         -			   :lpush '</a></li>'
           91  +			   :lpush '</a>'
    74     92   		end
    75     93   		-- TODO list circles
    76     94   		acc:lpush '</menu>'
    77     95   	else
    78     96   		acc:lpush('<div id="tl" data-live="10">')
    79     97   		for i = 0, posts.sz do
    80     98   			var author = co:uid2actor(posts(i).ptr.author)
    81     99   			if mode == modes.mutual and posts(i).ptr.author ~= co.who.id then
    82    100   				if not author.relationship.recip.follow() then goto skip end
    83    101   			end
    84    102   			if author.relationship.rel.mute() or 
    85    103   			   author.relationship.rel.avoid() or 
    86    104   			   author.relationship.recip.exclude() then goto skip end
          105  +			if posts(i).ptr.rtdby ~= 0 then
          106  +				var rter = co:uid2actor(posts(i).ptr.rtdby)
          107  +				if rter.relationship.rel.mute()
          108  +				or rter.relationship.rel.attenuate()
          109  +				or rter.relationship.rel.avoid()
          110  +				or rter.relationship.recip.exclude() then goto skip end
          111  +			end
    87    112   			lib.render.tweet(co, posts(i).ptr, &acc)
    88    113   			var t = lib.math.biggest(lib.math.biggest(posts(i).ptr.posted, posts(i).ptr.discovered),posts(i).ptr.edited)
    89    114   			if t > newest then newest = t end
    90    115   			::skip:: posts(i):free()
    91    116   		end
    92    117   		if posts.run > 0 then posts:free() end
    93    118   		acc:lpush('</div>')