Skip to content

Commit

Permalink
Adding rss links. Fixes #548 (#549)
Browse files Browse the repository at this point in the history
  • Loading branch information
dessalines authored Jan 25, 2022
1 parent cd338b0 commit 1d085de
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 39 deletions.
14 changes: 6 additions & 8 deletions src/shared/components/community/community.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand All @@ -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>
);
}
Expand Down
49 changes: 28 additions & 21 deletions src/shared/components/home/home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand All @@ -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>
);
Expand Down
12 changes: 7 additions & 5 deletions src/shared/components/person/inbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 ? (
Expand All @@ -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 +
Expand Down
9 changes: 4 additions & 5 deletions src/shared/components/person/profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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>
);
}
Expand Down

0 comments on commit 1d085de

Please sign in to comment.