mirror of
https://github.com/urbit/shrub.git
synced 2025-01-01 17:16:47 +03:00
link fe: always render up-to-date comment counts
This commit is contained in:
parent
ab21f67ba6
commit
4222ebbfb3
File diff suppressed because one or more lines are too long
@ -94,7 +94,9 @@ export class LinkDetail extends Component {
|
||||
hostname = hostname[4];
|
||||
}
|
||||
|
||||
let commentCount = data.commentCount || 0;
|
||||
const commentCount = props.comments
|
||||
? props.comments.totalItems
|
||||
: data.commentCount || 0;
|
||||
|
||||
let comments = commentCount + " comment" + ((commentCount === 1) ? "" : "s");
|
||||
|
||||
|
@ -44,9 +44,13 @@ export class Links extends Component {
|
||||
let LinkList = Object.keys(links)
|
||||
.map((link) => {
|
||||
let linksObj = props.links[linkPage];
|
||||
let { title, url, timestamp, ship, commentCount } = linksObj[link];
|
||||
let { title, url, timestamp, ship } = linksObj[link];
|
||||
let members = {};
|
||||
|
||||
const commentCount = props.comments[url]
|
||||
? props.comments[url].totalItems
|
||||
: linksObj[link].commentCount || 0;
|
||||
|
||||
if (!props.members[ship]) {
|
||||
members[ship] = {'nickname': '', 'avatar': 'TODO', 'color': '0x0'};
|
||||
} else {
|
||||
|
@ -71,6 +71,10 @@ export class Root extends Component {
|
||||
? links[groupPath]
|
||||
: {};
|
||||
|
||||
let channelComments = !!comments[groupPath]
|
||||
? comments[groupPath]
|
||||
: {};
|
||||
|
||||
return (
|
||||
<Skeleton
|
||||
spinner={state.spinner}
|
||||
@ -85,6 +89,7 @@ export class Root extends Component {
|
||||
{...props}
|
||||
members={groupMembers}
|
||||
links={channelLinks}
|
||||
comments={channelComments}
|
||||
page={page}
|
||||
path={groupPath}
|
||||
popout={popout}
|
||||
|
Loading…
Reference in New Issue
Block a user