Add hideMutedPosts setting and wire up to post-returning endpoints

This commit is contained in:
taehoon 2019-03-02 08:07:14 -05:00
parent 300259fd97
commit 9857002bf5
8 changed files with 22 additions and 1 deletions

View file

@ -345,7 +345,7 @@ const fetchStatus = ({id, credentials}) => {
.then((data) => parseStatus(data))
}
const fetchTimeline = ({timeline, credentials, since = false, until = false, userId = false, tag = false}) => {
const fetchTimeline = ({timeline, credentials, since = false, until = false, userId = false, tag = false, withMuted = false}) => {
const timelineUrls = {
public: PUBLIC_TIMELINE_URL,
friends: FRIENDS_TIMELINE_URL,
@ -381,6 +381,7 @@ const fetchTimeline = ({timeline, credentials, since = false, until = false, use
}
params.push(['count', 20])
params.push(['with_muted', withMuted])
const queryString = map(params, (param) => `${param[0]}=${param[1]}`).join('&')
url += `?${queryString}`

View file

@ -19,6 +19,9 @@ const fetchAndUpdate = ({store, credentials, timeline = 'friends', older = false
const args = { timeline, credentials }
const rootState = store.rootState || store.state
const timelineData = rootState.statuses.timelines[camelCase(timeline)]
const hideMutedPosts = typeof rootState.config.hideMutedPosts === 'undefined'
? rootState.instance.hideMutedPosts
: rootState.config.hideMutedPosts
if (older) {
args['until'] = until || timelineData.minId
@ -28,6 +31,7 @@ const fetchAndUpdate = ({store, credentials, timeline = 'friends', older = false
args['userId'] = userId
args['tag'] = tag
args['withMuted'] = !hideMutedPosts
const numStatusesBeforeFetch = timelineData.statuses.length