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

View file

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

View file

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

View file

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