Skip to content

Commit fd61a05

Browse files
authored
feat: dispaly quote notifications (#3435)
1 parent 83d1f5c commit fd61a05

File tree

6 files changed

+36
-4
lines changed

6 files changed

+36
-4
lines changed

app/components/notification/NotificationCard.vue

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ const supportedNotificationTypes: NotificationType[] = [
2525
'update',
2626
'status',
2727
'annual_report',
28+
// @ts-expect-error masto.js type does not include this new type yet (ref. https://github.com/neet/masto.js/pull/1357)
29+
'quote',
2830
]
2931
3032
// well-known emoji reactions types Elk does not support yet
@@ -130,7 +132,15 @@ const timeAgo = useTimeAgo(() => notification.createdAt, timeAgoOptions)
130132
</template>
131133
</StatusCard>
132134
</template>
133-
<template v-else-if="notification.type === 'mention' || notification.type === 'poll' || notification.type === 'status'">
135+
<template
136+
v-else-if="
137+
notification.type === 'mention'
138+
|| notification.type === 'poll'
139+
|| notification.type === 'status'
140+
// @ts-expect-error masto.js type does not include this new type yet (ref. https://github.com/neet/masto.js/pull/1357)
141+
|| notification.type === 'quote'
142+
"
143+
>
134144
<StatusCard :status="notification.status!" />
135145
</template>
136146
<template v-else-if="notification.type === 'annual_report'">

app/components/notification/NotificationPaginator.vue

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,14 @@ const virtualScroller = false // TODO: fix flickering issue with virtual scroll
1313
1414
const groupCapacity = Number.MAX_VALUE // No limit
1515
16-
const includeNotificationTypes: mastodon.v1.NotificationType[] = ['update', 'mention', 'poll', 'status']
16+
const includeNotificationTypes: mastodon.v1.NotificationType[] = [
17+
'update',
18+
'mention',
19+
'poll',
20+
'status',
21+
// @ts-expect-error masto.js type does not include this new type yet (ref. https://github.com/neet/masto.js/pull/1357)
22+
'quote',
23+
]
1724
1825
let id = 0
1926

app/constants/index.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,19 @@ export const STORAGE_KEY_BOTTOM_NAV_BUTTONS = 'elk-bottom-nav-buttons'
2727

2828
export const HANDLED_MASTO_URLS = /^(https?:\/\/)?([\w\-]+\.)+\w+\/(@[@\w\-.]+)(\/objects)?(\/\d+)?$/
2929

30-
export const NOTIFICATION_FILTER_TYPES: mastodon.v1.NotificationType[] = ['status', 'reblog', 'follow', 'follow_request', 'favourite', 'poll', 'update', 'admin.sign_up', 'admin.report']
30+
export const NOTIFICATION_FILTER_TYPES: mastodon.v1.NotificationType[] = [
31+
'status',
32+
'reblog',
33+
// @ts-expect-error masto.js type does not include this new type yet (ref. https://github.com/neet/masto.js/pull/1357)
34+
'quote',
35+
'follow',
36+
'follow_request',
37+
'favourite',
38+
'poll',
39+
'update',
40+
'admin.sign_up',
41+
'admin.report',
42+
]
3143

3244
export const THEME_COLORS = {
3345
defaultTheme: '#cc7d24',

app/pages/notifications.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ const filterIconMap: Record<mastodon.v1.NotificationType, string> = {
4040
'mention': 'i-ri:at-line',
4141
'status': 'i-ri:account-pin-circle-line',
4242
'reblog': 'i-ri:repeat-fill',
43+
// @ts-expect-error masto.js type does not include this new type yet (ref. https://github.com/neet/masto.js/pull/1357)
44+
'quote': 'i-ri:double-quotes-l',
4345
'follow': 'i-ri:user-follow-line',
4446
'follow_request': 'i-ri:user-shared-line',
4547
'favourite': 'i-ri:heart-3-line',

locales/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -676,6 +676,7 @@
676676
"notifications_mention": "Mentions",
677677
"notifications_more_tooltip": "Filter notifications by type",
678678
"notifications_poll": "Poll",
679+
"notifications_quote": "Quote",
679680
"notifications_reblog": "Boost",
680681
"notifications_status": "Status",
681682
"notifications_update": "Update",

service-worker/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// I just copy/paste any entry from masto api and convert it to snake case, reusing types not including camel case props
44
import type { mastodon } from 'masto'
55

6-
export type NotificationType = 'mention' | 'status' | 'reblog' | 'follow' | 'follow_request' | 'favourite' | 'poll' | 'update' | 'admin.sign_up' | 'admin.report'
6+
export type NotificationType = 'mention' | 'status' | 'reblog' | 'follow' | 'follow_request' | 'favourite' | 'poll' | 'update' | 'admin.sign_up' | 'admin.report' | 'quote'
77

88
export interface PushPayload {
99
access_token: string

0 commit comments

Comments
 (0)