Merge branch 'fix-move' into 'develop'
Fix move notification crashing Notifications page Closes #861 See merge request soapbox-pub/soapbox-fe!1103
This commit is contained in:
commit
05b6d2124a
3 changed files with 136 additions and 0 deletions
119
app/soapbox/__fixtures__/pleroma-notification-move.json
Normal file
119
app/soapbox/__fixtures__/pleroma-notification-move.json
Normal file
|
@ -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": "<p></p>",
|
||||||
|
"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"
|
||||||
|
}
|
|
@ -93,6 +93,22 @@ describe('notifications reducer', () => {
|
||||||
expect(result.items.size).toEqual(1);
|
expect(result.items.size).toEqual(1);
|
||||||
expect(result.items.get('4').id).toEqual('4');
|
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', () => {
|
describe('NOTIFICATIONS_EXPAND_REQUEST', () => {
|
||||||
|
|
|
@ -56,6 +56,7 @@ const comparator = (a, b) => {
|
||||||
const minifyNotification = notification => {
|
const minifyNotification = notification => {
|
||||||
return notification.mergeWith((o, n) => n || o, {
|
return notification.mergeWith((o, n) => n || o, {
|
||||||
account: notification.getIn(['account', 'id']),
|
account: notification.getIn(['account', 'id']),
|
||||||
|
target: notification.getIn(['target', 'id']),
|
||||||
status: notification.getIn(['status', 'id']),
|
status: notification.getIn(['status', 'id']),
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue