refs #1065 Fix comparison between login user and target account
This commit is contained in:
parent
cf646069a2
commit
5a25ed42e9
@ -8,14 +8,14 @@
|
||||
aria-label="account profile">
|
||||
<div class="header-background" v-bind:style="{ backgroundImage: 'url(' + account.header + ')' }">
|
||||
<div class="header">
|
||||
<div class="follow-follower" v-if="relationship !== null && relationship !== '' && account.username!==user.username">
|
||||
<div class="follow-follower" v-if="relationship !== null && relationship !== '' && !isOwnProfile">
|
||||
<div class="follower-status">
|
||||
<el-tag class="status" size="small" v-if="relationship.followed_by">{{ $t('side_bar.account_profile.follows_you') }}</el-tag>
|
||||
<el-tag class="status" size="medium" v-else>{{ $t('side_bar.account_profile.doesnt_follow_you') }}</el-tag>
|
||||
</div>
|
||||
</div>
|
||||
<div class="user-info">
|
||||
<div class="more" v-if="relationship !== null && relationship !== '' && account.username!==user.username">
|
||||
<div class="more" v-if="relationship !== null && relationship !== '' && !isOwnProfile">
|
||||
<popper trigger="click" :options="{placement: 'bottom'}" ref="popper">
|
||||
<div class="popper">
|
||||
<ul class="menu-list">
|
||||
@ -48,7 +48,7 @@
|
||||
<div class="icon" role="presentation">
|
||||
<FailoverImg :src="account.avatar" :alt="`Avatar of ${account.username}`" />
|
||||
</div>
|
||||
<div class="follow-status" v-if="relationship !== null && relationship !== '' && account.username!==user.username">
|
||||
<div class="follow-status" v-if="relationship !== null && relationship !== '' && !isOwnProfile">
|
||||
<div v-if="relationship.following" class="unfollow" @click="unfollow(account)" :title="$t('side_bar.account_profile.unfollow')">
|
||||
<icon name="user-times" scale="1.5"></icon>
|
||||
</div>
|
||||
@ -107,7 +107,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapState } from 'vuex'
|
||||
import { mapState, mapGetters } from 'vuex'
|
||||
import { shell } from 'electron'
|
||||
import { findLink } from '~/src/renderer/utils/tootParser'
|
||||
import emojify from '~/src/renderer/utils/emojify'
|
||||
@ -131,7 +131,6 @@ export default {
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
user: state => state.TimelineSpace.account,
|
||||
theme: (state) => {
|
||||
return {
|
||||
'--theme-mask-color': state.App.theme.wrapper_mask_color,
|
||||
@ -146,7 +145,8 @@ export default {
|
||||
loading: state => state.loading,
|
||||
muting: state => state.relationship && state.relationship.muting,
|
||||
blocking: state => state.relationship && state.relationship.blocking
|
||||
})
|
||||
}),
|
||||
...mapGetters('TimelineSpace/Contents/SideBar/AccountProfile', ['isOwnProfile'])
|
||||
},
|
||||
watch: {
|
||||
account: function () {
|
||||
|
@ -2,7 +2,7 @@ import Mastodon, { Account, Relationship, Response } from 'megalodon'
|
||||
import Timeline, { TimelineState } from './AccountProfile/Timeline'
|
||||
import Follows, { FollowsState } from './AccountProfile/Follows'
|
||||
import Followers, { FollowersState } from './AccountProfile/Followers'
|
||||
import { Module, MutationTree, ActionTree } from 'vuex'
|
||||
import { Module, MutationTree, ActionTree, GetterTree } from 'vuex'
|
||||
import { RootState } from '@/store'
|
||||
|
||||
export type AccountProfileState = {
|
||||
@ -165,6 +165,21 @@ const actions: ActionTree<AccountProfileState, RootState> = {
|
||||
}
|
||||
}
|
||||
|
||||
const getters: GetterTree<AccountProfileState, RootState> = {
|
||||
isOwnProfile: (state, _getters, rootState) => {
|
||||
if (!state.account) {
|
||||
return false
|
||||
}
|
||||
const own = rootState.TimelineSpace.account
|
||||
// For Mastodon
|
||||
if (`${own.baseURL}/@${own.username}` === state.account.url) {
|
||||
return true
|
||||
}
|
||||
// For Pleroma
|
||||
return `${own.baseURL}/users/${own.username}` === state.account.url
|
||||
}
|
||||
}
|
||||
|
||||
const AccountProfile: Module<AccountProfileState, RootState> = {
|
||||
namespaced: true,
|
||||
modules: {
|
||||
@ -174,7 +189,8 @@ const AccountProfile: Module<AccountProfileState, RootState> = {
|
||||
},
|
||||
state: state,
|
||||
mutations: mutations,
|
||||
actions: actions
|
||||
actions: actions,
|
||||
getters: getters
|
||||
}
|
||||
|
||||
class AccountNotFound extends Error {}
|
||||
|
Loading…
x
Reference in New Issue
Block a user