mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
Fix #1506
This commit is contained in:
parent
160552734d
commit
a053181334
@ -59,7 +59,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapGetters, mapMutations } from 'vuex'
|
import { mapGetters, mapMutations } from 'vuex'
|
||||||
import HcUser from '~/components/User'
|
import HcUser from '~/components/User/User'
|
||||||
import ContentMenu from '~/components/ContentMenu'
|
import ContentMenu from '~/components/ContentMenu'
|
||||||
import ContentViewer from '~/components/Editor/ContentViewer'
|
import ContentViewer from '~/components/Editor/ContentViewer'
|
||||||
import HcEditCommentForm from '~/components/EditCommentForm/EditCommentForm'
|
import HcEditCommentForm from '~/components/EditCommentForm/EditCommentForm'
|
||||||
|
|||||||
@ -79,7 +79,7 @@ import locales from '~/locales'
|
|||||||
import PostMutations from '~/graphql/PostMutations.js'
|
import PostMutations from '~/graphql/PostMutations.js'
|
||||||
import HcCategoriesSelect from '~/components/CategoriesSelect/CategoriesSelect'
|
import HcCategoriesSelect from '~/components/CategoriesSelect/CategoriesSelect'
|
||||||
import HcTeaserImage from '~/components/TeaserImage/TeaserImage'
|
import HcTeaserImage from '~/components/TeaserImage/TeaserImage'
|
||||||
import HcUser from '~/components/User'
|
import HcUser from '~/components/User/User'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
|
|||||||
@ -69,7 +69,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import HcUser from '~/components/User'
|
import HcUser from '~/components/User/User'
|
||||||
import ContentMenu from '~/components/ContentMenu'
|
import ContentMenu from '~/components/ContentMenu'
|
||||||
import HcCategory from '~/components/Category'
|
import HcCategory from '~/components/Category'
|
||||||
import HcRibbon from '~/components/Ribbon'
|
import HcRibbon from '~/components/Ribbon'
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { mount, createLocalVue, RouterLinkStub } from '@vue/test-utils'
|
import { mount, createLocalVue, RouterLinkStub } from '@vue/test-utils'
|
||||||
import User from './index'
|
import User from './User.vue'
|
||||||
import Vuex from 'vuex'
|
import Vuex from 'vuex'
|
||||||
import VTooltip from 'v-tooltip'
|
import VTooltip from 'v-tooltip'
|
||||||
import Filters from '~/plugins/vue-filters'
|
import Filters from '~/plugins/vue-filters'
|
||||||
@ -67,6 +67,30 @@ describe('User', () => {
|
|||||||
expect(wrapper.text()).toMatch('Tilda Swinton')
|
expect(wrapper.text()).toMatch('Tilda Swinton')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe('user is deleted', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
propsData.user.deleted = true
|
||||||
|
})
|
||||||
|
|
||||||
|
it('renders anonymous user', () => {
|
||||||
|
const wrapper = Wrapper()
|
||||||
|
expect(wrapper.text()).not.toMatch('Tilda Swinton')
|
||||||
|
expect(mocks.$t).toHaveBeenCalledWith('profile.userAnonym')
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('even if the current user is a moderator', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
getters['auth/isModerator'] = () => true
|
||||||
|
})
|
||||||
|
|
||||||
|
it('renders anonymous user', () => {
|
||||||
|
const wrapper = Wrapper()
|
||||||
|
expect(wrapper.text()).not.toMatch('Tilda Swinton')
|
||||||
|
expect(mocks.$t).toHaveBeenCalledWith('profile.userAnonym')
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
describe('user is disabled', () => {
|
describe('user is disabled', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
propsData.user.disabled = true
|
propsData.user.disabled = true
|
||||||
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div v-if="!user || ((user.disabled || user.deleted) && !isModerator)">
|
<div v-if="displayAnonymous">
|
||||||
<div
|
<div
|
||||||
style="display: inline-block; float: left; margin-right: 4px; height: 100%; vertical-align: middle;"
|
style="display: inline-block; float: left; margin-right: 4px; height: 100%; vertical-align: middle;"
|
||||||
>
|
>
|
||||||
@ -125,6 +125,10 @@ export default {
|
|||||||
itsMe() {
|
itsMe() {
|
||||||
return this.user.slug === this.$store.getters['auth/user'].slug
|
return this.user.slug === this.$store.getters['auth/user'].slug
|
||||||
},
|
},
|
||||||
|
displayAnonymous() {
|
||||||
|
const { user, isModerator } = this
|
||||||
|
return !user || (user.deleted) || (user.disabled && !isModerator)
|
||||||
|
},
|
||||||
userLink() {
|
userLink() {
|
||||||
const { id, slug } = this.user
|
const { id, slug } = this.user
|
||||||
if (!(id && slug)) return ''
|
if (!(id && slug)) return ''
|
||||||
@ -33,7 +33,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import HcUser from '~/components/User'
|
import HcUser from '~/components/User/User'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Notification',
|
name: 'Notification',
|
||||||
|
|||||||
@ -79,7 +79,7 @@ import ContentViewer from '~/components/Editor/ContentViewer'
|
|||||||
import HcCategory from '~/components/Category'
|
import HcCategory from '~/components/Category'
|
||||||
import HcTag from '~/components/Tag'
|
import HcTag from '~/components/Tag'
|
||||||
import ContentMenu from '~/components/ContentMenu'
|
import ContentMenu from '~/components/ContentMenu'
|
||||||
import HcUser from '~/components/User'
|
import HcUser from '~/components/User/User'
|
||||||
import HcShoutButton from '~/components/ShoutButton.vue'
|
import HcShoutButton from '~/components/ShoutButton.vue'
|
||||||
import HcCommentForm from '~/components/CommentForm/CommentForm'
|
import HcCommentForm from '~/components/CommentForm/CommentForm'
|
||||||
import HcCommentList from '~/components/CommentList/CommentList'
|
import HcCommentList from '~/components/CommentList/CommentList'
|
||||||
|
|||||||
@ -258,7 +258,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import uniqBy from 'lodash/uniqBy'
|
import uniqBy from 'lodash/uniqBy'
|
||||||
import User from '~/components/User'
|
import User from '~/components/User/User'
|
||||||
import HcPostCard from '~/components/PostCard'
|
import HcPostCard from '~/components/PostCard'
|
||||||
import HcFollowButton from '~/components/FollowButton.vue'
|
import HcFollowButton from '~/components/FollowButton.vue'
|
||||||
import HcCountTo from '~/components/CountTo.vue'
|
import HcCountTo from '~/components/CountTo.vue'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user