[mastodon-client] fix poll notifications

This commit is contained in:
Laura Hausmann 2023-07-09 21:27:09 +02:00
parent b841ed5be8
commit d1c9c7cc31
No known key found for this signature in database
GPG Key ID: D044E84C5BE01605
5 changed files with 17 additions and 13 deletions

View File

@ -396,8 +396,8 @@ namespace MisskeyAPI {
return MisskeyNotificationType.Reaction return MisskeyNotificationType.Reaction
case NotificationType.Reblog: case NotificationType.Reblog:
return MisskeyNotificationType.Renote return MisskeyNotificationType.Renote
case NotificationType.PollVote: case NotificationType.Poll:
return MisskeyNotificationType.PollVote return MisskeyNotificationType.PollEnded
case NotificationType.FollowRequest: case NotificationType.FollowRequest:
return MisskeyNotificationType.ReceiveFollowRequest return MisskeyNotificationType.ReceiveFollowRequest
default: default:
@ -417,8 +417,8 @@ namespace MisskeyAPI {
return NotificationType.Reblog return NotificationType.Reblog
case MisskeyNotificationType.Reaction: case MisskeyNotificationType.Reaction:
return NotificationType.EmojiReaction return NotificationType.EmojiReaction
case MisskeyNotificationType.PollVote: case MisskeyNotificationType.PollEnded:
return NotificationType.PollVote return NotificationType.Poll
case MisskeyNotificationType.ReceiveFollowRequest: case MisskeyNotificationType.ReceiveFollowRequest:
return NotificationType.FollowRequest return NotificationType.FollowRequest
case MisskeyNotificationType.FollowRequestAccepted: case MisskeyNotificationType.FollowRequestAccepted:
@ -458,6 +458,11 @@ namespace MisskeyAPI {
notification = Object.assign(notification, { notification = Object.assign(notification, {
status: this.note(n.note, host) status: this.note(n.note, host)
}) })
if (notification.type === NotificationType.Poll) {
notification = Object.assign(notification, {
account: this.note(n.note, host).account
})
}
} }
if (n.reaction) { if (n.reaction) {
notification = Object.assign(notification, { notification = Object.assign(notification, {

View File

@ -7,7 +7,7 @@ namespace MisskeyNotificationType {
export const Renote: MisskeyEntity.NotificationType = 'renote' export const Renote: MisskeyEntity.NotificationType = 'renote'
export const Quote: MisskeyEntity.NotificationType = 'quote' export const Quote: MisskeyEntity.NotificationType = 'quote'
export const Reaction: MisskeyEntity.NotificationType = 'favourite' export const Reaction: MisskeyEntity.NotificationType = 'favourite'
export const PollVote: MisskeyEntity.NotificationType = 'pollVote' export const PollEnded: MisskeyEntity.NotificationType = 'pollEnded'
export const ReceiveFollowRequest: MisskeyEntity.NotificationType = 'receiveFollowRequest' export const ReceiveFollowRequest: MisskeyEntity.NotificationType = 'receiveFollowRequest'
export const FollowRequestAccepted: MisskeyEntity.NotificationType = 'followRequestAccepted' export const FollowRequestAccepted: MisskeyEntity.NotificationType = 'followRequestAccepted'
export const GroupInvited: MisskeyEntity.NotificationType = 'groupInvited' export const GroupInvited: MisskeyEntity.NotificationType = 'groupInvited'

View File

@ -8,8 +8,7 @@ namespace NotificationType {
export const EmojiReaction: Entity.NotificationType = 'emoji_reaction' export const EmojiReaction: Entity.NotificationType = 'emoji_reaction'
export const FollowRequest: Entity.NotificationType = 'follow_request' export const FollowRequest: Entity.NotificationType = 'follow_request'
export const Status: Entity.NotificationType = 'status' export const Status: Entity.NotificationType = 'status'
export const PollVote: Entity.NotificationType = 'poll_vote' export const Poll: Entity.NotificationType = 'poll'
export const PollExpired: Entity.NotificationType = 'poll_expired'
} }
export default NotificationType export default NotificationType

View File

@ -93,7 +93,7 @@ const pollVote: MisskeyEntity.Notification = {
createdAt: '2021-02-01T01:49:29', createdAt: '2021-02-01T01:49:29',
userId: user.id, userId: user.id,
user: user, user: user,
type: MisskeyNotificationType.PollVote, type: MisskeyNotificationType.PollEnded,
note: note note: note
} }
@ -168,7 +168,7 @@ describe('getNotifications', () => {
}, },
{ {
event: pollVote, event: pollVote,
expected: MegalodonNotificationType.PollVote, expected: MegalodonNotificationType.Poll,
title: 'pollVote' title: 'pollVote'
}, },
{ {

View File

@ -42,8 +42,8 @@ describe('api_client', () => {
dist: MisskeyNotificationType.Renote dist: MisskeyNotificationType.Renote
}, },
{ {
src: MegalodonNotificationType.PollVote, src: MegalodonNotificationType.Poll,
dist: MisskeyNotificationType.PollVote dist: MisskeyNotificationType.PollEnded
}, },
{ {
src: MegalodonNotificationType.FollowRequest, src: MegalodonNotificationType.FollowRequest,
@ -83,8 +83,8 @@ describe('api_client', () => {
dist: MegalodonNotificationType.EmojiReaction dist: MegalodonNotificationType.EmojiReaction
}, },
{ {
src: MisskeyNotificationType.PollVote, src: MisskeyNotificationType.PollEnded,
dist: MegalodonNotificationType.PollVote dist: MegalodonNotificationType.Poll
}, },
{ {
src: MisskeyNotificationType.ReceiveFollowRequest, src: MisskeyNotificationType.ReceiveFollowRequest,