add back mute prediction, add getter for relationships

This commit is contained in:
Shpuld Shpuldson 2020-04-24 18:53:17 +03:00
parent f6fce92cf7
commit af9492977a
9 changed files with 21 additions and 8 deletions

View file

@ -12,7 +12,7 @@ const BlockCard = {
return this.$store.getters.findUser(this.userId)
},
relationship () {
return this.$store.state.users.relationships[this.userId] || {}
return this.$store.getters.relationship(this.userId)
},
blocked () {
return this.relationship.blocking

View file

@ -20,7 +20,7 @@ const FollowCard = {
return this.$store.state.users.currentUser
},
relationship () {
return this.$store.state.users.relationships[this.user.id]
return this.$store.getters.relationship(this.user.id)
}
}
}

View file

@ -12,7 +12,7 @@ const MuteCard = {
return this.$store.getters.findUser(this.userId)
},
relationship () {
return this.$store.state.users.relationships[this.userId]
return this.$store.getters.relationship(this.userId)
},
muted () {
return this.relationship.muting

View file

@ -56,7 +56,7 @@ const Notification = {
return this.generateUserProfileLink(this.targetUser)
},
needMute () {
return (this.$store.state.users.relationships[this.user.id] || {}).muting
return this.$store.getters.relationship(this.user.id).muting
}
}
}

View file

@ -119,7 +119,7 @@ const Status = {
return hits
},
muted () {
const relationship = this.$store.state.users.relationships[this.status.user.id] || {}
const relationship = this.$store.getters.relationship(this.userId)
return !this.unmuted && (
(!(this.inProfile && this.status.user.id === this.profileUserId) && relationship.muting) ||
(!this.inConversation && this.status.thread_muted) ||

View file

@ -25,7 +25,7 @@ export default {
return this.$store.getters.findUser(this.userId)
},
relationship () {
return this.$store.state.users.relationships[this.userId] || {}
return this.$store.getters.relationship(this.userId)
},
classes () {
return [{

View file

@ -351,13 +351,13 @@ const UserSettings = {
},
filterUnblockedUsers (userIds) {
return reject(userIds, (userId) => {
const relationship = this.$store.state.users.relationships[userId] || {}
const relationship = this.$store.getters.relationship(this.userId)
return relationship.blocking || userId === this.$store.state.users.currentUser.id
})
},
filterUnMutedUsers (userIds) {
return reject(userIds, (userId) => {
const relationship = this.$store.state.users.relationships[userId] || {}
const relationship = this.$store.getters.relationship(this.userId)
return relationship.muting || userId === this.$store.state.users.currentUser.id
})
},