Remove old muting logic
This commit is contained in:
parent
a6ce191cbc
commit
302310a653
5 changed files with 12 additions and 35 deletions
|
@ -12,7 +12,7 @@ const MuteCard = {
|
|||
return this.$store.getters.findUser(this.userId)
|
||||
},
|
||||
muted () {
|
||||
return this.user.mastodonMuted
|
||||
return this.user.muted
|
||||
}
|
||||
},
|
||||
components: {
|
||||
|
|
|
@ -126,18 +126,12 @@ export default {
|
|||
unblockUser () {
|
||||
this.$store.dispatch('unblockUser', this.user.id)
|
||||
},
|
||||
muteUser () { // Mastodon Mute
|
||||
muteUser () {
|
||||
this.$store.dispatch('muteUser', this.user.id)
|
||||
},
|
||||
unmuteUser () { // Mastodon Unmute
|
||||
unmuteUser () {
|
||||
this.$store.dispatch('unmuteUser', this.user.id)
|
||||
},
|
||||
toggleMute () {
|
||||
// TODO: Pleroma mute/unmute, Need to migrate to the Mastodon API
|
||||
const store = this.$store
|
||||
store.commit('setMuted', {user: this.user, muted: !this.user.muted})
|
||||
store.state.api.backendInteractor.setUserMute(this.user)
|
||||
},
|
||||
setProfileView (v) {
|
||||
if (this.switcher) {
|
||||
const store = this.$store
|
||||
|
|
|
@ -110,11 +110,11 @@ export const mutations = {
|
|||
},
|
||||
muteUser (state, id) {
|
||||
const user = state.usersObject[id]
|
||||
set(user, 'mastodonMuted', true)
|
||||
set(user, 'muted', true)
|
||||
},
|
||||
unmuteUser (state, id) {
|
||||
const user = state.usersObject[id]
|
||||
set(user, 'mastodonMuted', false)
|
||||
set(user, 'muted', false)
|
||||
},
|
||||
setUserForStatus (state, status) {
|
||||
status.user = state.usersObject[status.user.id]
|
||||
|
@ -206,9 +206,10 @@ const users = {
|
|||
return Promise.all(promises)
|
||||
})
|
||||
.then((mutedUsers) => {
|
||||
each(mutedUsers, (user) => { user.mastodonMuted = true })
|
||||
each(mutedUsers, (user) => { user.muted = true })
|
||||
store.commit('addNewUsers', mutedUsers)
|
||||
store.commit('saveMutes', map(mutedUsers, 'id'))
|
||||
// TODO: Unset muted property of the rest users
|
||||
})
|
||||
},
|
||||
muteUser (store, id) {
|
||||
|
@ -368,6 +369,11 @@ const users = {
|
|||
// Start getting fresh posts.
|
||||
store.dispatch('startFetching', { timeline: 'friends' })
|
||||
|
||||
// Fetch mutes
|
||||
// TODO: We should not show timeline until fetchMutes is resolved
|
||||
// However, we can get rid of this logic totally if we can know user muted state from user object
|
||||
store.dispatch('fetchMutes')
|
||||
|
||||
// Fetch our friends
|
||||
store.rootState.api.backendInteractor.fetchFriends({ id: user.id })
|
||||
.then((friends) => commit('addNewUsers', friends))
|
||||
|
|
|
@ -26,7 +26,6 @@ const MUTING_URL = '/api/v1/accounts/:id/mute'
|
|||
const UNMUTING_URL = '/api/v1/accounts/:id/unmute'
|
||||
const FOLLOWING_URL = '/api/friendships/create.json'
|
||||
const UNFOLLOWING_URL = '/api/friendships/destroy.json'
|
||||
const QVITTER_USER_PREF_URL = '/api/qvitter/set_profile_pref.json'
|
||||
const REGISTRATION_URL = '/api/account/register.json'
|
||||
const AVATAR_UPDATE_URL = '/api/qvitter/update_avatar.json'
|
||||
const BG_UPDATE_URL = '/api/qvitter/update_background_image.json'
|
||||
|
@ -343,22 +342,6 @@ const fetchStatus = ({id, credentials}) => {
|
|||
.then((data) => parseStatus(data))
|
||||
}
|
||||
|
||||
const setUserMute = ({id, credentials, muted = true}) => {
|
||||
const form = new FormData()
|
||||
|
||||
const muteInteger = muted ? 1 : 0
|
||||
|
||||
form.append('namespace', 'qvitter')
|
||||
form.append('data', muteInteger)
|
||||
form.append('topic', `mute:${id}`)
|
||||
|
||||
return fetch(QVITTER_USER_PREF_URL, {
|
||||
method: 'POST',
|
||||
headers: authHeaders(credentials),
|
||||
body: form
|
||||
})
|
||||
}
|
||||
|
||||
const fetchTimeline = ({timeline, credentials, since = false, until = false, userId = false, tag = false}) => {
|
||||
const timelineUrls = {
|
||||
public: PUBLIC_TIMELINE_URL,
|
||||
|
@ -652,7 +635,6 @@ const apiService = {
|
|||
deleteStatus,
|
||||
uploadMedia,
|
||||
fetchAllFollowing,
|
||||
setUserMute,
|
||||
fetchMutes,
|
||||
muteUser,
|
||||
unmuteUser,
|
||||
|
|
|
@ -62,10 +62,6 @@ const backendInteractorService = (credentials) => {
|
|||
return timelineFetcherService.startFetching({timeline, store, credentials, userId, tag})
|
||||
}
|
||||
|
||||
const setUserMute = ({id, muted = true}) => {
|
||||
return apiService.setUserMute({id, muted, credentials})
|
||||
}
|
||||
|
||||
const fetchMutes = () => apiService.fetchMutes({credentials})
|
||||
const muteUser = (id) => apiService.muteUser({credentials, id})
|
||||
const unmuteUser = (id) => apiService.unmuteUser({credentials, id})
|
||||
|
@ -102,7 +98,6 @@ const backendInteractorService = (credentials) => {
|
|||
fetchAllFollowing,
|
||||
verifyCredentials: apiService.verifyCredentials,
|
||||
startFetching,
|
||||
setUserMute,
|
||||
fetchMutes,
|
||||
muteUser,
|
||||
unmuteUser,
|
||||
|
|
Loading…
Reference in a new issue