Updated HashtagTimeline to not take in multiple tags
• Updated: - HashtagTimeline to not take in multiple tags
This commit is contained in:
parent
8aeae9c45d
commit
e754c6219b
|
@ -336,11 +336,8 @@ export const expandLinkTimeline = (linkId, { maxId } = {}, done = noop) => {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
export const expandHashtagTimeline = (hashtag, { maxId, tags } = {}, done = noop) => {
|
export const expandHashtagTimeline = (hashtag, { maxId } = {}, done = noop) => {
|
||||||
return expandTimeline(`hashtag:${hashtag}`, `/api/v1/timelines/tag/${hashtag}`, {
|
return expandTimeline(`hashtag:${hashtag}`, `/api/v1/timelines/tag/${hashtag}`, {
|
||||||
max_id: maxId,
|
max_id: maxId,
|
||||||
any: parseTags(tags, 'any'),
|
|
||||||
all: parseTags(tags, 'all'),
|
|
||||||
none: parseTags(tags, 'none'),
|
|
||||||
}, done)
|
}, done)
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,88 +9,31 @@ import StatusList from '../components/status_list'
|
||||||
|
|
||||||
class HashtagTimeline extends React.PureComponent {
|
class HashtagTimeline extends React.PureComponent {
|
||||||
|
|
||||||
title = () => {
|
|
||||||
const title = [this.props.params.id]
|
|
||||||
|
|
||||||
if (this.additionalFor('any')) {
|
|
||||||
title.push(' ',
|
|
||||||
<FormattedMessage
|
|
||||||
key='any'
|
|
||||||
id='hashtag.column_header.tag_mode.any'
|
|
||||||
values={{
|
|
||||||
additional: this.additionalFor('any'),
|
|
||||||
}}
|
|
||||||
defaultMessage='or {additional}'
|
|
||||||
/>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.additionalFor('all')) {
|
|
||||||
title.push(' ',
|
|
||||||
<FormattedMessage
|
|
||||||
key='all'
|
|
||||||
id='hashtag.column_header.tag_mode.all'
|
|
||||||
values={{
|
|
||||||
additional: this.additionalFor('all'),
|
|
||||||
}}
|
|
||||||
defaultMessage='and {additional}'
|
|
||||||
/>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.additionalFor('none')) {
|
|
||||||
title.push(' ',
|
|
||||||
<FormattedMessage
|
|
||||||
key='none'
|
|
||||||
id='hashtag.column_header.tag_mode.none'
|
|
||||||
values={{
|
|
||||||
additional: this.additionalFor('none'),
|
|
||||||
}}
|
|
||||||
defaultMessage='without {additional}'
|
|
||||||
/>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
return title
|
|
||||||
}
|
|
||||||
|
|
||||||
additionalFor = (mode) => {
|
|
||||||
const { tags } = this.props.params
|
|
||||||
|
|
||||||
try {
|
|
||||||
return tags[mode].map(tag => tag.value).join('/')
|
|
||||||
} catch (error) {
|
|
||||||
return ''
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
componentDidMount () {
|
componentDidMount () {
|
||||||
const { dispatch, tagName } = this.props
|
const { dispatch, tagName } = this.props
|
||||||
const { id, tags } = this.props.params
|
const { id } = this.props.params
|
||||||
|
|
||||||
dispatch(expandHashtagTimeline(id, { tags }))
|
dispatch(expandHashtagTimeline(id))
|
||||||
// dispatch(fetchHashtag(tagName))
|
// dispatch(fetchHashtag(tagName))
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillReceiveProps (nextProps) {
|
componentWillReceiveProps (nextProps) {
|
||||||
const { dispatch, params } = this.props
|
const { dispatch, params } = this.props
|
||||||
const { id, tags } = nextProps.params
|
const { id } = nextProps.params
|
||||||
|
|
||||||
if (id !== params.id || !isEqual(tags, params.tags)) {
|
if (id !== params.id) {
|
||||||
this.props.dispatch(clearTimeline(`hashtag:${id}`))
|
this.props.dispatch(clearTimeline(`hashtag:${id}`))
|
||||||
this.props.dispatch(expandHashtagTimeline(id, { tags }))
|
this.props.dispatch(expandHashtagTimeline(id))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
handleLoadMore = (maxId) => {
|
handleLoadMore = (maxId) => {
|
||||||
const { id, tags } = this.props.params
|
const { id } = this.props.params
|
||||||
this.props.dispatch(expandHashtagTimeline(id, { maxId, tags }))
|
this.props.dispatch(expandHashtagTimeline(id, { maxId }))
|
||||||
}
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
const { tag, tagName } = this.props
|
const { tagName } = this.props
|
||||||
|
|
||||||
console.log("tagName:", tag)
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<StatusList
|
<StatusList
|
||||||
|
|
Loading…
Reference in New Issue