parsav  Diff

Differences From Artifact [ac2cb76c4f]:

To Artifact [b916bb0a63]:


   109    109   	edited		bigint,
   110    110   	parent		bigint,
   111    111   	convoheaduri text,
   112    112   	chgcount	integer,
   113    113   -- ephemeral
   114    114   	accent		smallint,
   115    115   	rtdby		bigint, -- note that these must be 0 if the record
   116         -	rtid		bigint, -- in question does not represent an RT!
          116  +	rtdat		bigint, -- in question does not represent an RT!
          117  +	rtid		bigint, -- (this one too)
   117    118   	n_likes		integer,
   118    119   	n_rts		integer,
   119    120   	isreply		bool -- true if parent in (table posts); saves us a bunch of queries
   120    121   );
   121    122   
   122    123   create or replace function
   123         -pg_temp.parsavpg_translate_post(parsav_posts,bigint,bigint)
          124  +pg_temp.parsavpg_translate_post(parsav_posts,bigint,bigint,bigint)
   124    125   returns pg_temp.parsavpg_intern_post as $$
   125    126   	select a.origin is null,
   126    127   		($1).id,     ($1).author,
   127    128   		($1).subject,($1).acl,         ($1).body,
   128    129   		($1).posted, ($1).discovered,  ($1).edited,
   129    130   		($1).parent, ($1).convoheaduri,($1).chgcount,
   130    131   		coalesce(c.value, -1)::smallint,
   131         -		$2 as rtdby, $3 as rtid,
          132  +		$2 as rtdby, $3 as rtdat, $4 as rtid,
   132    133   		re.likes, re.rts,
   133    134   		($1).parent in (select id from parsav_posts)
   134    135   	from parsav_actors as a 
   135    136   		left join parsav_actor_conf_ints as c
   136    137   		          on c.key = 'ui-accent' and
   137    138   		             c.uid = a.id
   138    139   		left join pg_temp.parsavpg_post_react_counts as re
................................................................................
   158    159   			inner join parsav_posts as p on a.subject = p.id
   159    160   		where a.kind = 'rt'
   160    161   	),
   161    162   
   162    163   	content as (select * from posts union select * from rts)
   163    164   
   164    165   	select pg_temp.parsavpg_translate_post(cn.orig,
   165         -			coalesce(cn.promoter,0), coalesce(cn.promotion,0)
          166  +			coalesce(cn.promoter,0),
          167  +			coalesce(cn.promotime,0),
          168  +			coalesce(cn.promotion,0)
   166    169   		) as post,
   167    170   		cn.promotime::bigint as tltime,
   168    171   		coalesce(cn.promoter, (cn.orig).author) as promoter
   169    172   	from content as cn
   170    173   	order by cn.promotime desc
   171    174   );
   172    175