Fix post modal rules not linking properly
This commit is contained in:
parent
296202b69f
commit
0f5e9e7fca
1 changed files with 6 additions and 5 deletions
|
|
@ -3,6 +3,7 @@ import { connect } from 'react-redux';
|
||||||
import Cookies from 'js-cookie';
|
import Cookies from 'js-cookie';
|
||||||
|
|
||||||
import { unSelectPost, markPostRead } from '../actions/posts.js';
|
import { unSelectPost, markPostRead } from '../actions/posts.js';
|
||||||
|
import { CATEGORY_TYPE, RULE_TYPE, FEED, SUBREDDIT } from '../constants.js';
|
||||||
import { formatDatetime } from '../../../utils.js';
|
import { formatDatetime } from '../../../utils.js';
|
||||||
|
|
||||||
class PostModal extends React.Component {
|
class PostModal extends React.Component {
|
||||||
|
|
@ -43,6 +44,10 @@ class PostModal extends React.Component {
|
||||||
const post = this.props.post;
|
const post = this.props.post;
|
||||||
const publicationDate = formatDatetime(post.publicationDate);
|
const publicationDate = formatDatetime(post.publicationDate);
|
||||||
const titleClassName = post.read ? 'post__title post__title--read' : 'post__title';
|
const titleClassName = post.read ? 'post__title post__title--read' : 'post__title';
|
||||||
|
const ruleUrl =
|
||||||
|
this.props.rule.type === FEED
|
||||||
|
? `/collection/rules/${this.props.rule.id}/`
|
||||||
|
: `/collection/rules/subreddits/${this.props.rule.id}/`;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="modal post-modal">
|
<div className="modal post-modal">
|
||||||
|
|
@ -70,11 +75,7 @@ class PostModal extends React.Component {
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
<span className="badge post__rule" title={this.props.rule.name}>
|
<span className="badge post__rule" title={this.props.rule.name}>
|
||||||
<a
|
<a href={ruleUrl} target="_blank" rel="noopener noreferrer">
|
||||||
href={`/collection/rules/${this.props.rule.id}/`}
|
|
||||||
target="_blank"
|
|
||||||
rel="noopener noreferrer"
|
|
||||||
>
|
|
||||||
{this.props.rule.name}
|
{this.props.rule.name}
|
||||||
</a>
|
</a>
|
||||||
</span>
|
</span>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue