Fix federated community link on search page.

This commit is contained in:
Dessalines 2020-04-28 11:53:05 -04:00
parent 59bba148ff
commit 36d0e34668

View file

@ -22,8 +22,6 @@ import {
fetchLimit, fetchLimit,
routeSearchTypeToEnum, routeSearchTypeToEnum,
routeSortTypeToEnum, routeSortTypeToEnum,
pictshareAvatarThumbnail,
showAvatars,
toast, toast,
createCommentLikeRes, createCommentLikeRes,
createPostLikeFindRes, createPostLikeFindRes,
@ -31,6 +29,7 @@ import {
} from '../utils'; } from '../utils';
import { PostListing } from './post-listing'; import { PostListing } from './post-listing';
import { UserListing } from './user-listing'; import { UserListing } from './user-listing';
import { CommunityLink } from './community-link';
import { SortSelect } from './sort-select'; import { SortSelect } from './sort-select';
import { CommentNodes } from './comment-nodes'; import { CommentNodes } from './comment-nodes';
import { i18n } from '../i18next'; import { i18n } from '../i18next';
@ -253,16 +252,7 @@ export class Search extends Component<any, SearchState> {
/> />
)} )}
{i.type_ == 'communities' && ( {i.type_ == 'communities' && (
<div> <div>{this.communityListing(i.data as Community)}</div>
<span>
<Link to={`/c/${(i.data as Community).name}`}>{`/c/${
(i.data as Community).name
}`}</Link>
</span>
<span>{` - ${(i.data as Community).title} - ${
(i.data as Community).number_of_subscribers
} subscribers`}</span>
</div>
)} )}
{i.type_ == 'users' && ( {i.type_ == 'users' && (
<div> <div>
@ -316,20 +306,28 @@ export class Search extends Component<any, SearchState> {
<> <>
{this.state.searchResponse.communities.map(community => ( {this.state.searchResponse.communities.map(community => (
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">{this.communityListing(community)}</div>
<span>
<Link
to={`/c/${community.name}`}
>{`/c/${community.name}`}</Link>
</span>
<span>{` - ${community.title} - ${community.number_of_subscribers} subscribers`}</span>
</div>
</div> </div>
))} ))}
</> </>
); );
} }
communityListing(community: Community) {
return (
<>
<span>
<CommunityLink community={community} />
</span>
<span>{` - ${community.title} -
${i18n.t('number_of_subscribers', {
count: community.number_of_subscribers,
})}
`}</span>
</>
);
}
users() { users() {
return ( return (
<> <>