1
0
mirror of https://github.com/h3poteto/whalebird-desktop synced 2025-01-27 07:46:15 +01:00

refs #4257 Check followRequests in SideMenu

This commit is contained in:
AkiraFukushima 2023-06-03 16:43:59 +09:00
parent c756e2e232
commit c32560c05c
No known key found for this signature in database
GPG Key ID: B6E51BAC4DE1A957
2 changed files with 9 additions and 9 deletions

View File

@ -89,7 +89,7 @@
</template>
</el-menu-item>
<el-menu-item
v-if="unreadFollowRequests"
v-if="followRequests.length > 0"
:index="`/${id}/follow-requests`"
role="menuitem"
:title="$t('side_menu.follow_requests')"
@ -271,6 +271,7 @@ export default defineComponent({
const lists = ref<Array<Entity.List>>([])
const tags = ref<Array<LocalTag>>([])
const followRequests = ref<Array<Entity.FollowRequest | Entity.Account>>([])
const enabledTimelines = reactive({
home: true,
notification: true,
@ -292,7 +293,6 @@ export default defineComponent({
const unreadLocalTimeline = computed(() => store.state.TimelineSpace.SideMenu.unreadLocalTimeline)
const unreadDirectMessagesTimeline = computed(() => store.state.TimelineSpace.SideMenu.unreadDirectMessagesTimeline)
const unreadPublicTimeline = computed(() => store.state.TimelineSpace.SideMenu.unreadPublicTimeline)
const unreadFollowRequests = computed(() => store.state.TimelineSpace.SideMenu.unreadFollowRequests)
const collapse = computed(() => store.state.TimelineSpace.SideMenu.collapse)
const themeColor = computed(() => store.state.App.theme.side_menu_color)
const hideGlobalHeader = computed(() => store.state.GlobalHeader.hide)
@ -307,11 +307,17 @@ export default defineComponent({
account.server = s
const client = generator(s.sns, s.baseURL, a.accessToken, userAgent.value)
await fetchFollowRequests(client)
await fetchLists(client)
await fetchTags(a)
await confirmTimelines(client)
})
const fetchFollowRequests = async (client: MegalodonInterface) => {
const res = await client.getFollowRequests()
followRequests.value = res.data
}
const fetchLists = async (client: MegalodonInterface) => {
const res = await client.getLists()
lists.value = res.data
@ -391,7 +397,7 @@ export default defineComponent({
unreadLocalTimeline,
unreadDirectMessagesTimeline,
unreadPublicTimeline,
unreadFollowRequests,
followRequests,
lists,
tags,
collapse,

View File

@ -10,7 +10,6 @@ export type SideMenuState = {
unreadLocalTimeline: boolean
unreadDirectMessagesTimeline: boolean
unreadPublicTimeline: boolean
unreadFollowRequests: boolean
collapse: boolean
}
@ -20,7 +19,6 @@ const state = (): SideMenuState => ({
unreadLocalTimeline: false,
unreadDirectMessagesTimeline: false,
unreadPublicTimeline: false,
unreadFollowRequests: false,
collapse: false
})
@ -30,7 +28,6 @@ export const MUTATION_TYPES = {
CHANGE_UNREAD_LOCAL_TIMELINE: 'changeUnreadLocalTimeline',
CHANGE_UNREAD_DIRECT_MESSAGES_TIMELINE: 'changeUnreadDirectMessagesTimeline',
CHANGE_UNREAD_PUBLIC_TIMELINE: 'changeUnreadPublicTimeline',
CHANGE_UNREAD_FOLLOW_REQUESTS: 'changeUnreadFollowRequests',
CHANGE_COLLAPSE: 'changeCollapse'
}
@ -50,9 +47,6 @@ const mutations: MutationTree<SideMenuState> = {
[MUTATION_TYPES.CHANGE_UNREAD_PUBLIC_TIMELINE]: (state, value: boolean) => {
state.unreadPublicTimeline = value
},
[MUTATION_TYPES.CHANGE_UNREAD_FOLLOW_REQUESTS]: (state, value: boolean) => {
state.unreadFollowRequests = value
},
[MUTATION_TYPES.CHANGE_COLLAPSE]: (state, collapse: boolean) => {
state.collapse = collapse
}