diff --git a/app/soapbox/__fixtures__/pleroma-notification-move.json b/app/soapbox/__fixtures__/pleroma-notification-move.json new file mode 100644 index 000000000..d7a763457 --- /dev/null +++ b/app/soapbox/__fixtures__/pleroma-notification-move.json @@ -0,0 +1,119 @@ +{ + "account": { + "acct": "alex@fedibird.com", + "avatar": "https://gleasonator.com/images/avi.png", + "avatar_static": "https://gleasonator.com/images/avi.png", + "bot": false, + "created_at": "2022-01-24T21:25:37.000Z", + "display_name": "alex@fedibird.com", + "emojis": [], + "fields": [], + "followers_count": 2, + "following_count": 1, + "fqn": "alex@fedibird.com", + "header": "https://gleasonator.com/images/banner.png", + "header_static": "https://gleasonator.com/images/banner.png", + "id": "AFmHQ18XZ7Lco68MW8", + "last_status_at": "2022-03-16T22:07:53", + "locked": false, + "note": "

", + "pleroma": { + "accepts_chat_messages": null, + "also_known_as": [], + "ap_id": "https://fedibird.com/users/alex", + "background_image": null, + "birthday": "1993-07-03", + "deactivated": false, + "favicon": "https://gleasonator.com/proxy/HzfsidHss3CuA7aM2zxXN-tAjF8/aHR0cHM6Ly9mZWRpYmlyZC5jb20vZmF2aWNvbi5pY28/favicon.ico", + "hide_favorites": true, + "hide_followers": false, + "hide_followers_count": false, + "hide_follows": false, + "hide_follows_count": false, + "is_admin": false, + "is_confirmed": true, + "is_moderator": false, + "is_suggested": false, + "location": "Texas, USA", + "relationship": {}, + "skip_thread_containment": false, + "tags": [] + }, + "source": { + "fields": [], + "note": "", + "pleroma": { + "actor_type": "Person", + "discoverable": false + }, + "sensitive": false + }, + "statuses_count": 5, + "url": "https://fedibird.com/@alex", + "username": "alex" + }, + "created_at": "2022-03-17T00:08:48.000Z", + "id": "406814", + "pleroma": { + "is_muted": false, + "is_seen": true + }, + "target": { + "acct": "benis911", + "avatar": "https://gleasonator.com/images/avi.png", + "avatar_static": "https://gleasonator.com/images/avi.png", + "bot": false, + "created_at": "2021-03-26T20:42:11.000Z", + "display_name": "benis911", + "emojis": [], + "fields": [], + "followers_count": 0, + "following_count": 0, + "fqn": "benis911@gleasonator.com", + "header": "https://media.gleasonator.com/fc595bbbcf5aabefecd1c2adfe5b7f5457db59847992881668653a0338ba25bd.jpg", + "header_static": "https://media.gleasonator.com/fc595bbbcf5aabefecd1c2adfe5b7f5457db59847992881668653a0338ba25bd.jpg", + "id": "A5c5LK7EJTFR0u26Pg", + "last_status_at": "2022-03-16T22:01:57", + "locked": false, + "note": "hello world 2", + "pleroma": { + "accepts_chat_messages": true, + "also_known_as": [ + "https://gleasonator.com/users/alex", + "https://poa.st/users/alex", + "https://fedibird.com/users/alex" + ], + "ap_id": "https://gleasonator.com/users/benis911", + "background_image": null, + "birthday": "2000-01-25", + "deactivated": false, + "favicon": "https://gleasonator.com/favicon.png", + "hide_favorites": true, + "hide_followers": true, + "hide_followers_count": true, + "hide_follows": true, + "hide_follows_count": true, + "is_admin": false, + "is_confirmed": true, + "is_moderator": false, + "is_suggested": false, + "location": null, + "relationship": {}, + "skip_thread_containment": false, + "tags": [] + }, + "source": { + "fields": [], + "note": "hello world 2", + "pleroma": { + "actor_type": "Person", + "discoverable": false + }, + "sensitive": false + }, + "statuses_count": 172, + "url": "https://gleasonator.com/users/benis911", + "username": "benis911" + }, + "type": "move" +} diff --git a/app/soapbox/reducers/__tests__/notifications-test.js b/app/soapbox/reducers/__tests__/notifications-test.js index 630aa61e3..aa5b7cd62 100644 --- a/app/soapbox/reducers/__tests__/notifications-test.js +++ b/app/soapbox/reducers/__tests__/notifications-test.js @@ -93,6 +93,22 @@ describe('notifications reducer', () => { expect(result.items.size).toEqual(1); expect(result.items.get('4').id).toEqual('4'); }); + + it('imports move notification', () => { + const action = { + type: NOTIFICATIONS_EXPAND_SUCCESS, + notifications: [ + require('soapbox/__fixtures__/pleroma-notification-move.json'), + ], + next: null, + skipLoading: true, + }; + + const result = reducer(undefined, action).items.get('406814'); + + expect(result.account).toEqual('AFmHQ18XZ7Lco68MW8'); + expect(result.target).toEqual('A5c5LK7EJTFR0u26Pg'); + }); }); describe('NOTIFICATIONS_EXPAND_REQUEST', () => { diff --git a/app/soapbox/reducers/notifications.js b/app/soapbox/reducers/notifications.js index 02ffa58e9..fad2563c3 100644 --- a/app/soapbox/reducers/notifications.js +++ b/app/soapbox/reducers/notifications.js @@ -56,6 +56,7 @@ const comparator = (a, b) => { const minifyNotification = notification => { return notification.mergeWith((o, n) => n || o, { account: notification.getIn(['account', 'id']), + target: notification.getIn(['target', 'id']), status: notification.getIn(['status', 'id']), }); };