Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/components/status/StatusActionsMore.vue
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ function showFavoritedAndBoostedBy() {

<CommonDropdownItem
is="button"
v-if="currentUser && (status.account.id === currentUser.account.id || status.mentions.some(m => m.id === currentUser!.account.id))"
v-if="currentUser && (status.account.id === currentUser.account.id || status.mentions.some((m: mastodon.v1.StatusMention) => m.id === currentUser!.account.id))"
:text="status.muted ? $t('menu.unmute_conversation') : $t('menu.mute_conversation')"
:icon="status.muted ? 'i-ri:eye-line' : 'i-ri:eye-off-line'"
:command="command"
Expand Down
3 changes: 3 additions & 0 deletions app/components/status/StatusDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ useHydratedHead({
{{ status.application?.name }}
</div>
</div>
<div border="t base" py-2>
<StatusEmojiReaction v-if="actions" :status="status" details :command="command" />
</div>
<div border="t base" py-2>
<StatusActions v-if="actions" :status="status" details :command="command" />
</div>
Expand Down
34 changes: 34 additions & 0 deletions app/components/status/StatusEmojiReaction.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<script setup lang="ts">
import type { mastodon } from 'masto'
import { getEmojiAttributes } from '~~/config/emojis'

const props = defineProps<{
status: mastodon.v1.Status
details?: boolean
}>()

const { status } = useStatusActions(props)
function isCustomEmoji(emoji: mastodon.v1.EmojiReaction) {
return !!emoji.staticUrl
}
</script>

<template>
<div flex flex-wrap gap-1 class="status-actions">
<button
v-for="(emoji, i) in status.emojiReactions ?? []"
:key="i"
flex gap-1 p="block-1 inline-2" text-secondary btn-base rounded-1
:class="emoji.me ? 'b-1 b-primary bg-primary-fade' : 'b b-white bg-gray-1 hover:bg-gray-1 hover:b-gray'"
>
<picture v-if="isCustomEmoji(emoji)" class="custom-emoji" :alt="`:${emoji.name}:`" :data-emoji-id="emoji.name">
<source :srcset="emoji.staticUrl" media="(prefers-reduced-motion: reduce)">
<img :src="emoji.url" :alt="`:${emoji.name}:`" title="" style="">
</picture>
<picture v-else class="custom-emoji" :alt="`:${emoji.name}:`" :data-emoji-id="emoji.name">
<img v-bind="getEmojiAttributes(emoji.name)">
</picture>
<CommonLocalizedNumber :keypath="emoji.count.toString()" :count="emoji.count" />
</button>
</div>
</template>
2 changes: 1 addition & 1 deletion app/components/timeline/TimelineHome.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function reorderAndFilter(items: mastodon.v1.Status[]) {

let followedTags: mastodon.v1.Tag[] | undefined
if (currentUser.value !== undefined) {
followedTags = (await useMasto().client.value.v1.followedTags.list({ limit: 0 }))
followedTags = await useMasto().client.value.v1.followedTags.list({ limit: 200 })
}
</script>

Expand Down
2 changes: 1 addition & 1 deletion app/components/timeline/TimelineNotifications.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const options = { limit: 30, types: filter ? [filter] : [] }

// Default limit is 20 notifications, and servers are normally caped to 30
const paginator = useMastoClient().v1.notifications.list(options)
const stream = useStreaming(client => client.user.notification.subscribe())
const stream = useStreaming(client => client.user.subscribe())

lastAccessedNotificationRoute.value = route.path.replace(/\/notifications\/?/, '')

Expand Down
2 changes: 1 addition & 1 deletion app/components/timeline/TimelinePublic.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function reorderAndFilter(items: mastodon.v1.Status[]) {

let followedTags: mastodon.v1.Tag[] | undefined
if (currentUser.value !== undefined) {
followedTags = (await useMasto().client.value.v1.followedTags.list({ limit: 0 }))
followedTags = (await useMasto().client.value.v1.followedTags.list({ limit: 200 }))
}
</script>

Expand Down
2 changes: 1 addition & 1 deletion app/components/timeline/TimelinePublicLocal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function reorderAndFilter(items: mastodon.v1.Status[]) {

let followedTags: mastodon.v1.Tag[] | undefined
if (currentUser.value !== undefined) {
followedTags = (await useMasto().client.value.v1.followedTags.list({ limit: 0 }))
followedTags = (await useMasto().client.value.v1.followedTags.list({ limit: 200 }))
}
</script>

Expand Down
2 changes: 1 addition & 1 deletion app/composables/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export async function fetchAccountByHandle(acct: string): Promise<mastodon.v1.Ac
}
else {
const userAcctDomain = userAcct.includes('@') ? userAcct : `${userAcct}@${domain}`
account = (await client.v1.search.fetch({ q: `@${userAcctDomain}`, type: 'accounts' })).accounts[0]
account = (await client.v2.search.list({ q: `@${userAcctDomain}`, type: 'accounts' })).accounts[0]
}

if (account.acct && !account.acct.includes('@') && domain)
Expand Down
2 changes: 1 addition & 1 deletion app/composables/masto/notification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export function useNotifications() {
const paginator = client.value.v1.notifications.list({ limit: 30 })

do {
const result = await paginator.next()
const result = await paginator.values().next()
if (!result.done && result.value.length) {
for (const notification of result.value) {
if (notification.id === position.notifications.lastReadId)
Expand Down
4 changes: 2 additions & 2 deletions app/composables/masto/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export function useSearch(query: MaybeRefOrGetter<string>, options: UseSearchOpt
...resolveUnref(options),
resolve: !!currentUser.value,
})
const nextResults = await paginator.next()
const nextResults = await paginator.values().next()

done.value = !!nextResults.done
if (!nextResults.done)
Expand All @@ -91,7 +91,7 @@ export function useSearch(query: MaybeRefOrGetter<string>, options: UseSearchOpt
return

loading.value = true
const nextResults = await paginator.next()
const nextResults = await paginator.values().next()
loading.value = false

done.value = !!nextResults.done
Expand Down
2 changes: 1 addition & 1 deletion app/composables/masto/status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export function useStatusActions(props: StatusActionsProps) {
'reblogged',
() => client.value.v1.statuses.$select(status.value.id)[status.value.reblogged ? 'unreblog' : 'reblog']().then((res) => {
if (status.value.reblogged)
// returns the original status
// returns the original status
return res.reblog!
return res
}),
Expand Down
2 changes: 1 addition & 1 deletion app/composables/paginator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export function usePaginator<T, P, U = T>(
// called `next` method will mutate the internal state of the variable,
// and we need its initial state after HMR
// so clone it
const paginator = _paginator.clone()
const paginator = _paginator.values()

const state = ref<PaginatorState>(isHydrated.value ? 'idle' : 'loading')
const items = ref<U[]>([])
Expand Down
4 changes: 2 additions & 2 deletions app/composables/tiptap/suggestion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const TiptapMentionSuggestion: Partial<SuggestionOptions> = import.meta.s
return []

const paginator = useMastoClient().v2.search.list({ q: query, type: 'accounts', limit: 25, resolve: true })
return (await paginator.next()).value?.accounts ?? []
return (await paginator.values().next()).value?.accounts ?? []
},
render: createSuggestionRenderer(TiptapMentionList),
}
Expand All @@ -47,7 +47,7 @@ export const TiptapHashtagSuggestion: Partial<SuggestionOptions> = {
resolve: false,
excludeUnreviewed: true,
})
return (await paginator.next()).value?.hashtags ?? []
return (await paginator.values().next()).value?.hashtags ?? []
},
render: createSuggestionRenderer(TiptapHashtagList),
}
Expand Down
2 changes: 1 addition & 1 deletion app/middleware/1.permalink.global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default defineNuxtRouteMiddleware(async (to, from) => {

// If we're logged in, search for the local id the account or status corresponds to
const paginator = masto.client.value.v2.search.list({ q: `https:/${to.fullPath}`, resolve: true, limit: 1 })
const { accounts, statuses } = (await paginator.next()).value ?? { accounts: [], statuses: [] }
const { accounts, statuses } = (await paginator.values().next()).value ?? { accounts: [], statuses: [] }

if (statuses[0])
return getStatusRoute(statuses[0])
Expand Down
2 changes: 1 addition & 1 deletion app/pages/[[server]]/tags/[tag].vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ onReactivated(() => {

let followedTags: mastodon.v1.Tag[] | undefined
if (currentUser.value !== undefined) {
followedTags = (await useMasto().client.value.v1.followedTags.list({ limit: 0 }))
followedTags = (await useMasto().client.value.v1.followedTags.list({ limit: 200 }))
}
</script>

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
"iso-639-1": "^3.0.0",
"js-yaml": "^4.1.0",
"lru-cache": "^11.0.0",
"masto": "^6.10.4",
"masto": "^7.1.0",
"mocked-exports": "^0.1.1",
"node-emoji": "^2.1.3",
"node-mock-http": "^1.0.0",
Expand Down
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions shared/types/global.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import 'masto'

declare module 'masto/mastodon/entities/v1/index.js' {
// support fedibird non-mastodon emoji reaction
interface EmojiReaction {
name: string
count: number
accountIds: string[]
me: boolean
url?: string
staticUrl?: string
domain?: string | null
width?: number
height?: number
}

interface Status {
emojiReactionsCount?: number
emojiReactions?: EmojiReaction[]
}
}