mirror of
https://github.com/h3poteto/whalebird-desktop
synced 2025-01-27 23:59:49 +01:00
Fix v-slot
This commit is contained in:
parent
5a8fb25119
commit
54c032d3aa
@ -1,205 +0,0 @@
|
||||
import { RootState } from '@/store'
|
||||
import { Entity } from 'megalodon'
|
||||
import { createStore, Store } from 'vuex'
|
||||
import AccountProfile, { AccountProfileState } from '~/src/renderer/store/TimelineSpace/Contents/SideBar/AccountProfile'
|
||||
|
||||
const state = (account: Entity.Account | null): AccountProfileState => {
|
||||
return {
|
||||
loading: false,
|
||||
relationship: null,
|
||||
account: account,
|
||||
identityProofs: []
|
||||
}
|
||||
}
|
||||
|
||||
const initStore = (account: Entity.Account | null) => {
|
||||
return {
|
||||
namespaced: true,
|
||||
state: state(account),
|
||||
actions: AccountProfile.actions,
|
||||
mutations: AccountProfile.mutations,
|
||||
getters: AccountProfile.getters
|
||||
}
|
||||
}
|
||||
|
||||
const sidebarStore = (account: Entity.Account | null) => ({
|
||||
namespaced: true,
|
||||
modules: {
|
||||
AccountProfile: initStore(account)
|
||||
}
|
||||
})
|
||||
|
||||
const contentsStore = (account: Entity.Account | null) => ({
|
||||
namespaced: true,
|
||||
modules: {
|
||||
SideBar: sidebarStore(account)
|
||||
}
|
||||
})
|
||||
|
||||
const timelineStore = (account: Entity.Account | null) => ({
|
||||
namespaced: true,
|
||||
state: {
|
||||
account: {
|
||||
accessToken: 'sampleAccessToken',
|
||||
id: 1,
|
||||
username: 'h3poteto'
|
||||
},
|
||||
server: {
|
||||
sns: 'mastodon',
|
||||
baseURL: 'https://example.com'
|
||||
}
|
||||
},
|
||||
modules: {
|
||||
Contents: contentsStore(account)
|
||||
}
|
||||
})
|
||||
|
||||
describe('AccountProfile', () => {
|
||||
let store: Store<RootState>
|
||||
|
||||
beforeEach(() => {
|
||||
store = createStore({
|
||||
modules: {
|
||||
TimelineSpace: timelineStore(null)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
describe('isOwnProfile', () => {
|
||||
describe('target is a same Mastodon account', () => {
|
||||
const account: Entity.Account = {
|
||||
id: '1',
|
||||
username: 'h3poteto',
|
||||
acct: 'h3poteto@example.com',
|
||||
display_name: 'h3poteto',
|
||||
locked: false,
|
||||
created_at: '2019-10-28T23:11:54',
|
||||
followers_count: 100,
|
||||
following_count: 200,
|
||||
statuses_count: 500,
|
||||
note: '',
|
||||
url: 'https://example.com/@h3poteto',
|
||||
avatar: '',
|
||||
avatar_static: '',
|
||||
header: '',
|
||||
header_static: '',
|
||||
emojis: [],
|
||||
moved: null,
|
||||
fields: [],
|
||||
bot: false
|
||||
}
|
||||
beforeEach(() => {
|
||||
store = createStore({
|
||||
modules: {
|
||||
TimelineSpace: timelineStore(account)
|
||||
}
|
||||
})
|
||||
})
|
||||
it('should be matched', () => {
|
||||
expect(store.getters['TimelineSpace/Contents/SideBar/AccountProfile/isOwnProfile']).toBeTruthy()
|
||||
})
|
||||
})
|
||||
|
||||
describe('target is another Mastodon account', () => {
|
||||
const account: Entity.Account = {
|
||||
id: '1',
|
||||
username: 'h3poteto',
|
||||
acct: 'h3poteto@another.example.com',
|
||||
display_name: 'h3poteto',
|
||||
locked: false,
|
||||
created_at: '2019-10-28T23:11:54',
|
||||
followers_count: 100,
|
||||
following_count: 200,
|
||||
statuses_count: 500,
|
||||
note: '',
|
||||
url: 'https://another.example.com/@h3poteto',
|
||||
avatar: '',
|
||||
avatar_static: '',
|
||||
header: '',
|
||||
header_static: '',
|
||||
emojis: [],
|
||||
moved: null,
|
||||
fields: [],
|
||||
bot: false
|
||||
}
|
||||
beforeEach(() => {
|
||||
store = createStore({
|
||||
modules: {
|
||||
TimelineSpace: timelineStore(account)
|
||||
}
|
||||
})
|
||||
})
|
||||
it('should be matched', () => {
|
||||
expect(store.getters['TimelineSpace/Contents/SideBar/AccountProfile/isOwnProfile']).toBeFalsy()
|
||||
})
|
||||
})
|
||||
|
||||
describe('target is a same Pleroma account', () => {
|
||||
const account: Entity.Account = {
|
||||
id: '1',
|
||||
username: 'h3poteto',
|
||||
acct: 'h3poteto@example.com',
|
||||
display_name: 'h3poteto',
|
||||
locked: false,
|
||||
created_at: '2019-10-28T23:11:54',
|
||||
followers_count: 100,
|
||||
following_count: 200,
|
||||
statuses_count: 500,
|
||||
note: '',
|
||||
url: 'https://example.com/users/h3poteto',
|
||||
avatar: '',
|
||||
avatar_static: '',
|
||||
header: '',
|
||||
header_static: '',
|
||||
emojis: [],
|
||||
moved: null,
|
||||
fields: [],
|
||||
bot: false
|
||||
}
|
||||
beforeEach(() => {
|
||||
store = createStore({
|
||||
modules: {
|
||||
TimelineSpace: timelineStore(account)
|
||||
}
|
||||
})
|
||||
})
|
||||
it('should be matched', () => {
|
||||
expect(store.getters['TimelineSpace/Contents/SideBar/AccountProfile/isOwnProfile']).toBeTruthy()
|
||||
})
|
||||
})
|
||||
|
||||
describe('target is another Pleroma account', () => {
|
||||
const account: Entity.Account = {
|
||||
id: '1',
|
||||
username: 'h3poteto',
|
||||
acct: 'h3poteto@another.example.com',
|
||||
display_name: 'h3poteto',
|
||||
locked: false,
|
||||
created_at: '2019-10-28T23:11:54',
|
||||
followers_count: 100,
|
||||
following_count: 200,
|
||||
statuses_count: 500,
|
||||
note: '',
|
||||
url: 'https://another.example.com/users/h3poteto',
|
||||
avatar: '',
|
||||
avatar_static: '',
|
||||
header: '',
|
||||
header_static: '',
|
||||
emojis: [],
|
||||
moved: null,
|
||||
fields: [],
|
||||
bot: false
|
||||
}
|
||||
beforeEach(() => {
|
||||
store = createStore({
|
||||
modules: {
|
||||
TimelineSpace: timelineStore(account)
|
||||
}
|
||||
})
|
||||
})
|
||||
it('should be matched', () => {
|
||||
expect(store.getters['TimelineSpace/Contents/SideBar/AccountProfile/isOwnProfile']).toBeFalsy()
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
@ -2,7 +2,7 @@
|
||||
<div id="bookmarks">
|
||||
<div></div>
|
||||
<DynamicScroller :items="bookmarks" :min-item-size="60" id="scroller" class="scroller" ref="scroller">
|
||||
<template v-slot="{ item, index, active }">
|
||||
<template #default="{ item, index, active }">
|
||||
<DynamicScrollerItem :item="item" :active="active" :size-dependencies="[item.uri]" :data-index="index" :watchData="true">
|
||||
<toot
|
||||
v-if="account.account && account.server"
|
||||
|
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div id="directmessages">
|
||||
<DynamicScroller :items="timeline" :min-item-size="86" id="scroller" class="scroller" ref="scroller">
|
||||
<template v-slot="{ item, index, active }">
|
||||
<template #default="{ item, index, active }">
|
||||
<DynamicScrollerItem :item="item" :active="active" :size-dependencies="[item.uri]" :data-index="index" :watchData="true">
|
||||
<toot
|
||||
v-if="account.account && account.server"
|
||||
|
@ -2,7 +2,7 @@
|
||||
<div id="favourites">
|
||||
<div></div>
|
||||
<DynamicScroller :items="favourites" :min-item-size="60" id="scroller" class="scroller" ref="scroller">
|
||||
<template v-slot="{ item, index, active }">
|
||||
<template #default="{ item, index, active }">
|
||||
<DynamicScrollerItem :item="item" :active="active" :size-dependencies="[item.uri]" :data-index="index" :watchData="true">
|
||||
<toot
|
||||
v-if="account.account && account.server"
|
||||
|
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div name="tag" class="tag-timeline">
|
||||
<DynamicScroller :items="timeline" :min-item-size="86" id="scroller" class="scroller" ref="scroller">
|
||||
<template v-slot="{ item, index, active }">
|
||||
<template #default="{ item, index, active }">
|
||||
<DynamicScrollerItem :item="item" :active="active" :size-dependencies="[item.uri]" :data-index="index" :watchData="true">
|
||||
<toot
|
||||
v-if="account.account && account.server"
|
||||
|
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div id="home">
|
||||
<DynamicScroller :items="filteredTimeline" :min-item-size="86" id="scroller" class="scroller" ref="scroller">
|
||||
<template v-slot="{ item, index, active }">
|
||||
<template #default="{ item, index, active }">
|
||||
<template v-if="item.id === 'loading-card'">
|
||||
<DynamicScrollerItem :item="item" :active="active" :size-dependencies="[item.id]" :data-index="index" :watchData="true">
|
||||
<StatusLoading :since_id="item.since_id" :max_id="item.max_id" :loading="loadingMore" @load_since="fetchTimelineSince" />
|
||||
|
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div name="list" class="list-timeline">
|
||||
<DynamicScroller :items="timeline" :min-item-size="86" id="scroller" class="scroller" ref="scroller">
|
||||
<template v-slot="{ item, index, active }">
|
||||
<template #default="{ item, index, active }">
|
||||
<DynamicScrollerItem :item="item" :active="active" :size-dependencies="[item.uri]" :data-index="index" :watchData="true">
|
||||
<toot
|
||||
v-if="account.account && account.server"
|
||||
|
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div id="public">
|
||||
<DynamicScroller :items="timeline" :min-item-size="86" id="scroller" class="scroller" ref="scroller">
|
||||
<template v-slot="{ item, index, active }">
|
||||
<template #default="{ item, index, active }">
|
||||
<DynamicScrollerItem :item="item" :active="active" :size-dependencies="[item.uri]" :data-index="index" :watchData="true">
|
||||
<toot
|
||||
v-if="account.account && account.server"
|
||||
|
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<DynamicScroller :items="followers" :min-item-size="53" class="scroller" page-mode>
|
||||
<template v-slot="{ item, index, active }">
|
||||
<template #default="{ item, index, active }">
|
||||
<DynamicScrollerItem :item="item" :active="active" :size-dependencies="[item.item]" :data-index="index" :watchData="true">
|
||||
<User :user="item" :relationship="targetRelationship(item.id)" @follow-account="follow" @unfollow-account="unfollow" />
|
||||
</DynamicScrollerItem>
|
||||
|
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<DynamicScroller :items="following" :min-item-size="53" class="scroller" page-mode>
|
||||
<template v-slot="{ item, index, active }">
|
||||
<template #default="{ item, index, active }">
|
||||
<DynamicScrollerItem :item="item" :active="active" :size-dependencies="[item.item]" :data-index="index" :watchData="true">
|
||||
<User :user="item" :relationship="targetRelationship(item.id)" @follow-account="follow" @unfollow-account="unfollow" />
|
||||
</DynamicScrollerItem>
|
||||
|
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<DynamicScroller :items="statuses" :min-item-size="86">
|
||||
<template v-slot="{ item, index, active }">
|
||||
<template #default="{ item, index, active }">
|
||||
<DynamicScrollerItem :item="item" :active="active" :size-dependencies="[item.uri]" :data-index="index" :watchData="true">
|
||||
<Toot
|
||||
v-if="account && server"
|
||||
|
Loading…
x
Reference in New Issue
Block a user