Adding rss links. Fixes #548

This commit is contained in:
Dessalines 2022-01-20 10:49:57 -05:00
parent cd338b081b
commit 59deb9dd06
4 changed files with 45 additions and 39 deletions

View file

@ -354,6 +354,10 @@ export class Community extends Component<any, State> {
}
selects() {
let communityRss = communityRSSUrl(
this.state.communityRes.community_view.community.actor_id,
this.state.sort
);
return (
<div class="mb-3">
<span class="mr-3">
@ -365,16 +369,10 @@ export class Community extends Component<any, State> {
<span class="mr-2">
<SortSelect sort={this.state.sort} onChange={this.handleSortChange} />
</span>
<a
href={communityRSSUrl(
this.state.communityRes.community_view.community.actor_id,
this.state.sort
)}
title="RSS"
rel="noopener"
>
<a href={communityRss} title="RSS" rel="noopener">
<Icon icon="rss" classes="text-muted small" />
</a>
<link rel="alternate" type="application/atom+xml" href={communityRss} />
</div>
);
}

View file

@ -669,6 +669,12 @@ export class Home extends Component<any, HomeState> {
}
selects() {
let allRss = `/feeds/all.xml?sort=${this.state.sort}`;
let localRss = `/feeds/local.xml?sort=${this.state.sort}`;
let frontRss = UserService.Instance.myUserInfo
? `/feeds/front/${UserService.Instance.auth}.xml?sort=${this.state.sort}`
: "";
return (
<div className="mb-3">
<span class="mr-3">
@ -688,32 +694,33 @@ export class Home extends Component<any, HomeState> {
<SortSelect sort={this.state.sort} onChange={this.handleSortChange} />
</span>
{this.state.listingType == ListingType.All && (
<a
href={`/feeds/all.xml?sort=${this.state.sort}`}
rel="noopener"
title="RSS"
>
<Icon icon="rss" classes="text-muted small" />
</a>
<>
<a href={allRss} rel="noopener" title="RSS">
<Icon icon="rss" classes="text-muted small" />
</a>
<link rel="alternate" type="application/atom+xml" href={allRss} />
</>
)}
{this.state.listingType == ListingType.Local && (
<a
href={`/feeds/local.xml?sort=${this.state.sort}`}
rel="noopener"
title="RSS"
>
<Icon icon="rss" classes="text-muted small" />
</a>
<>
<a href={localRss} rel="noopener" title="RSS">
<Icon icon="rss" classes="text-muted small" />
</a>
<link rel="alternate" type="application/atom+xml" href={localRss} />
</>
)}
{UserService.Instance.myUserInfo &&
this.state.listingType == ListingType.Subscribed && (
<a
href={`/feeds/front/${UserService.Instance.auth}.xml?sort=${this.state.sort}`}
title="RSS"
rel="noopener"
>
<Icon icon="rss" classes="text-muted small" />
</a>
<>
<a href={frontRss} title="RSS" rel="noopener">
<Icon icon="rss" classes="text-muted small" />
</a>
<link
rel="alternate"
type="application/atom+xml"
href={frontRss}
/>
</>
)}
</div>
);

View file

@ -140,6 +140,7 @@ export class Inbox extends Component<any, InboxState> {
}
render() {
let inboxRss = `/feeds/inbox/${UserService.Instance.auth}.xml`;
return (
<div class="container">
{this.state.loading ? (
@ -156,13 +157,14 @@ export class Inbox extends Component<any, InboxState> {
<h5 class="mb-2">
{i18n.t("inbox")}
<small>
<a
href={`/feeds/inbox/${UserService.Instance.auth}.xml`}
title="RSS"
rel="noopener"
>
<a href={inboxRss} title="RSS" rel="noopener">
<Icon icon="rss" classes="ml-2 text-muted small" />
</a>
<link
rel="alternate"
type="application/atom+xml"
href={inboxRss}
/>
</small>
</h5>
{this.state.replies.length +

View file

@ -335,6 +335,8 @@ export class Profile extends Component<any, ProfileState> {
}
selects() {
let profileRss = `/feeds/u/${this.state.userName}.xml?sort=${this.state.sort}`;
return (
<div className="mb-2">
<span class="mr-3">{this.viewRadios()}</span>
@ -344,13 +346,10 @@ export class Profile extends Component<any, ProfileState> {
hideHot
hideMostComments
/>
<a
href={`/feeds/u/${this.state.userName}.xml?sort=${this.state.sort}`}
rel="noopener"
title="RSS"
>
<a href={profileRss} rel="noopener" title="RSS">
<Icon icon="rss" classes="text-muted small mx-2" />
</a>
<link rel="alternate" type="application/atom+xml" href={profileRss} />
</div>
);
}