diff --git a/__mocks__/@rocket.chat/sdk.js b/__mocks__/@rocket.chat/sdk.js new file mode 100644 index 000000000..b469d9125 --- /dev/null +++ b/__mocks__/@rocket.chat/sdk.js @@ -0,0 +1,2 @@ +export class Rocketchat {} +export const settings = {}; diff --git a/__tests__/__snapshots__/Storyshots.test.js.snap b/__tests__/__snapshots__/Storyshots.test.js.snap index 792cd66d0..2fa6d1061 100644 --- a/__tests__/__snapshots__/Storyshots.test.js.snap +++ b/__tests__/__snapshots__/Storyshots.test.js.snap @@ -3751,7 +3751,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -4013,7 +4013,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -4275,7 +4275,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -4515,7 +4515,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -4945,7 +4945,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -5324,7 +5324,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -5582,7 +5582,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -5862,7 +5862,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -6124,7 +6124,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -6396,7 +6396,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -6729,7 +6729,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -7199,7 +7199,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -7584,7 +7584,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -8025,7 +8025,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://pbs.twimg.com/profile_images/1016397063649660929/14EIApTi_400x400.jpg", } @@ -8287,7 +8287,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -8549,7 +8549,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -8977,7 +8977,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -9244,7 +9244,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -9511,7 +9511,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -9906,7 +9906,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -10173,7 +10173,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -10472,7 +10472,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -10793,7 +10793,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -11055,7 +11055,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -11659,7 +11659,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -12707,7 +12707,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/rocket.cat?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -12947,7 +12947,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -13187,7 +13187,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/rocket.cat?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -13427,7 +13427,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -13689,7 +13689,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/rocket.cat?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -13991,7 +13991,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -14371,7 +14371,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/rocket.cat?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -14656,7 +14656,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -14918,7 +14918,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -15235,7 +15235,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -15606,7 +15606,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -15920,7 +15920,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -16187,7 +16187,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -17299,7 +17299,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -17660,7 +17660,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -18075,7 +18075,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -18410,7 +18410,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -18811,7 +18811,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -19146,7 +19146,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -19569,7 +19569,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -19801,7 +19801,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -20033,7 +20033,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -20265,7 +20265,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -20497,7 +20497,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -20729,7 +20729,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -20961,7 +20961,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -21125,7 +21125,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -21465,7 +21465,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -21614,7 +21614,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -21763,7 +21763,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -22015,7 +22015,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -22164,7 +22164,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -22313,7 +22313,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -22462,7 +22462,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -22626,7 +22626,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -22960,7 +22960,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -23296,7 +23296,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -23632,7 +23632,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -23990,7 +23990,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -24369,7 +24369,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -24864,7 +24864,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -25497,7 +25497,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -26213,7 +26213,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -26558,7 +26558,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -26803,7 +26803,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -27313,7 +27313,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -27581,7 +27581,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -27848,7 +27848,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -28017,7 +28017,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -28186,7 +28186,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -28355,7 +28355,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -28524,7 +28524,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -28693,7 +28693,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -28862,7 +28862,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -29031,7 +29031,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -29200,7 +29200,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -29369,7 +29369,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -29538,7 +29538,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -29707,7 +29707,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -29876,7 +29876,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -30045,7 +30045,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -30214,7 +30214,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -30383,7 +30383,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -30645,7 +30645,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -31225,7 +31225,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -31670,7 +31670,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -32127,7 +32127,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -32376,7 +32376,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -32745,7 +32745,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } @@ -33039,7 +33039,7 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } diff --git a/app/lib/methods/getUsersPresence.js b/app/lib/methods/getUsersPresence.js index 2d8fe5926..91c82ff47 100644 --- a/app/lib/methods/getUsersPresence.js +++ b/app/lib/methods/getUsersPresence.js @@ -3,12 +3,13 @@ import semver from 'semver'; import reduxStore from '../createStore'; import { setActiveUsers } from '../../actions/activeUsers'; +import { setUser } from '../../actions/login'; export function subscribeUsersPresence() { const serverVersion = reduxStore.getState().server.version; // if server is lower than 1.1.0 - if (serverVersion && semver.lt(semver.coerce(serverVersion), '1.1.0')) { + if (serverVersion && semver.lt(serverVersion, '1.1.0')) { if (this.activeUsersSubTimeout) { clearTimeout(this.activeUsersSubTimeout); this.activeUsersSubTimeout = false; @@ -25,35 +26,43 @@ let ids = []; export default async function getUsersPresence() { const serverVersion = reduxStore.getState().server.version; + const { user: loggedUser } = reduxStore.getState().login; // if server is greather than or equal 1.1.0 - if (serverVersion && !semver.lt(semver.coerce(serverVersion), '1.1.0')) { + if (serverVersion && semver.gte(serverVersion, '1.1.0')) { let params = {}; // if server is greather than or equal 3.0.0 - if (serverVersion && !semver.lt(semver.coerce(serverVersion), '3.0.0')) { + if (serverVersion && semver.gte(serverVersion, '3.0.0')) { // if not have any id if (!ids.length) { return; } // Request userPresence on demand params = { ids: ids.join(',') }; - ids = []; } - // RC 1.1.0 - const result = await this.sdk.get('users.presence', params); - if (result.success) { - const activeUsers = result.users.reduce((ret, item) => { - ret[item._id] = { - status: item.status, - statusText: item.statusText - }; - return ret; - }, {}); - InteractionManager.runAfterInteractions(() => { - reduxStore.dispatch(setActiveUsers(activeUsers)); - }); + try { + // RC 1.1.0 + const result = await this.sdk.get('users.presence', params); + if (result.success) { + const activeUsers = result.users.reduce((ret, item) => { + const { _id, status, statusText } = item; + + if (loggedUser && loggedUser.id === _id) { + reduxStore.dispatch(setUser({ status, statusText })); + } + + ret[_id] = { status, statusText }; + return ret; + }, {}); + InteractionManager.runAfterInteractions(() => { + reduxStore.dispatch(setActiveUsers(activeUsers)); + }); + ids = []; + } + } catch { + // do nothing } } } diff --git a/app/lib/methods/subscriptions/room.js b/app/lib/methods/subscriptions/room.js index e00bb1124..507c36b09 100644 --- a/app/lib/methods/subscriptions/room.js +++ b/app/lib/methods/subscriptions/room.js @@ -51,11 +51,11 @@ export default class RoomSubscription { // do nothing } } + reduxStore.dispatch(clearUserTyping()); this.removeListener(this.connectedListener); this.removeListener(this.disconnectedListener); this.removeListener(this.notifyRoomListener); this.removeListener(this.messageReceivedListener); - reduxStore.dispatch(clearUserTyping()); if (this.timer) { clearTimeout(this.timer); } @@ -73,6 +73,7 @@ export default class RoomSubscription { }; handleConnection = () => { + reduxStore.dispatch(clearUserTyping()); RocketChat.loadMissedMessages({ rid: this.rid }).catch(e => console.log(e)); }; diff --git a/app/lib/rocketchat.js b/app/lib/rocketchat.js index cc176ea03..e7247c2ce 100644 --- a/app/lib/rocketchat.js +++ b/app/lib/rocketchat.js @@ -63,13 +63,12 @@ const RocketChat = { TOKEN_KEY, callJitsi, async subscribeRooms() { - if (this.roomsSub) { - this.roomsSub.stop(); - } - try { - this.roomsSub = await subscribeRooms.call(this); - } catch (e) { - log(e); + if (!this.roomsSub) { + try { + this.roomsSub = await subscribeRooms.call(this); + } catch (e) { + log(e); + } } }, canOpenRoom, @@ -189,6 +188,7 @@ const RocketChat = { if (this.roomsSub) { this.roomsSub.stop(); + this.roomsSub = null; } if (this.sdk) { @@ -206,7 +206,7 @@ const RocketChat = { this.sdk = new RocketchatClient({ host: server, protocol: 'ddp', useSsl }); this.getSettings(); - this.sdk.connect() + const sdkConnect = () => this.sdk.connect() .then(() => { if (user && user.token) { reduxStore.dispatch(loginRequest({ resume: user.token }, logoutOnError)); @@ -217,10 +217,12 @@ const RocketChat = { // when `connect` raises an error, we try again in 10 seconds this.connectTimeout = setTimeout(() => { - this.connect({ server, user }); + sdkConnect(); }, 10000); }); + sdkConnect(); + this.connectedListener = this.sdk.onStreamData('connected', () => { reduxStore.dispatch(connectSuccess()); }); @@ -410,6 +412,7 @@ const RocketChat = { async logout({ server }) { if (this.roomsSub) { this.roomsSub.stop(); + this.roomsSub = null; } if (this.activeUsersSubTimeout) { diff --git a/app/presentation/RoomItem/index.js b/app/presentation/RoomItem/index.js index a284ca956..a28bacdcb 100644 --- a/app/presentation/RoomItem/index.js +++ b/app/presentation/RoomItem/index.js @@ -27,6 +27,7 @@ const attrs = [ 'isRead', 'favorite', 'status', + 'connected', 'theme' ]; @@ -40,13 +41,13 @@ const arePropsEqual = (oldProps, newProps) => { }; const RoomItem = React.memo(({ - onPress, width, favorite, toggleFav, isRead, rid, toggleRead, hideChannel, testID, unread, userMentions, name, _updatedAt, alert, type, avatarSize, baseUrl, userId, username, token, id, prid, showLastMessage, hideUnreadStatus, lastMessage, status, avatar, useRealName, getUserPresence, isGroupChat, theme + onPress, width, favorite, toggleFav, isRead, rid, toggleRead, hideChannel, testID, unread, userMentions, name, _updatedAt, alert, type, avatarSize, baseUrl, userId, username, token, id, prid, showLastMessage, hideUnreadStatus, lastMessage, status, avatar, useRealName, getUserPresence, isGroupChat, connected, theme }) => { useEffect(() => { - if (type === 'd') { + if (connected && type === 'd' && id) { getUserPresence(id); } - }, []); + }, [connected]); const date = formatDate(_updatedAt); @@ -197,6 +198,7 @@ RoomItem.propTypes = { hideUnreadStatus: PropTypes.bool, useRealName: PropTypes.bool, getUserPresence: PropTypes.func, + connected: PropTypes.bool, isGroupChat: PropTypes.bool, theme: PropTypes.string }; @@ -208,6 +210,7 @@ RoomItem.defaultProps = { }; const mapStateToProps = (state, ownProps) => ({ + connected: state.meteor.connected, status: state.meteor.connected && ownProps.type === 'd' ? state.activeUsers[ownProps.id] && state.activeUsers[ownProps.id].status diff --git a/app/sagas/login.js b/app/sagas/login.js index 1eb504722..80d158ddc 100644 --- a/app/sagas/login.js +++ b/app/sagas/login.js @@ -73,7 +73,7 @@ const registerPushToken = function* registerPushToken() { const fetchUsersPresence = function* fetchUserPresence() { yield RocketChat.getUsersPresence(); - yield RocketChat.subscribeUsersPresence(); + RocketChat.subscribeUsersPresence(); }; const handleLoginSuccess = function* handleLoginSuccess({ user }) { @@ -81,6 +81,8 @@ const handleLoginSuccess = function* handleLoginSuccess({ user }) { const adding = yield select(state => state.server.adding); yield RNUserDefaults.set(RocketChat.TOKEN_KEY, user.token); + RocketChat.getUserPresence(user.id); + const server = yield select(getServer); yield put(roomsRequest()); yield fork(fetchPermissions); diff --git a/app/sagas/selectServer.js b/app/sagas/selectServer.js index 23a716bc6..ee2cfc7dd 100644 --- a/app/sagas/selectServer.js +++ b/app/sagas/selectServer.js @@ -38,7 +38,10 @@ const getServerInfo = function* getServerInfo({ server, raiseError = true }) { return; } - const validVersion = semver.coerce(serverInfo.version); + let serverVersion = semver.valid(serverInfo.version); + if (!serverVersion) { + ({ version: serverVersion } = semver.coerce(serverInfo.version)); + } const serversDB = database.servers; const serversCollection = serversDB.collections.get('servers'); @@ -46,12 +49,12 @@ const getServerInfo = function* getServerInfo({ server, raiseError = true }) { try { const serverRecord = await serversCollection.find(server); await serverRecord.update((record) => { - record.version = validVersion; + record.version = serverVersion; }); } catch (e) { await serversCollection.create((record) => { record._raw = sanitizedRaw({ id: server }, serversCollection.schema); - record.version = validVersion; + record.version = serverVersion; }); } }); diff --git a/app/views/RoomView/Header/index.js b/app/views/RoomView/Header/index.js index 7e91d3afe..5d3dc2592 100644 --- a/app/views/RoomView/Header/index.js +++ b/app/views/RoomView/Header/index.js @@ -101,8 +101,10 @@ const mapStateToProps = (state, ownProps) => { if (type === 'd') { const user = getUserSelector(state); if (user.id) { - if (state.activeUsers[roomUserId]) { + if (state.activeUsers[roomUserId] && state.meteor.connected) { ({ status, statusText } = state.activeUsers[roomUserId]); + } else { + status = 'offline'; } } } diff --git a/app/views/RoomView/index.js b/app/views/RoomView/index.js index 47566d4a9..82c91f696 100644 --- a/app/views/RoomView/index.js +++ b/app/views/RoomView/index.js @@ -222,10 +222,13 @@ class RoomView extends React.Component { if (this.tmid) { navigation.setParams({ toggleFollowThread: this.toggleFollowThread, goRoomActionsView: this.goRoomActionsView }); } - if (isAuthenticated && this.rid) { - this.init(); - } else if (this.rid) { - EventEmitter.addEventListener('connected', this.handleConnected); + if (this.rid) { + this.sub.subscribe(); + if (isAuthenticated) { + this.init(); + } else { + EventEmitter.addEventListener('connected', this.handleConnected); + } } if (isIOS && this.rid) { this.updateUnreadCount(); @@ -361,7 +364,6 @@ class RoomView extends React.Component { this.setLastOpen(null); } RocketChat.readMessages(room.rid, newLastOpen, true).catch(e => console.log(e)); - this.sub.subscribe(); } } diff --git a/app/views/RoomsListView/index.js b/app/views/RoomsListView/index.js index d8b6e4728..61f41d43c 100644 --- a/app/views/RoomsListView/index.js +++ b/app/views/RoomsListView/index.js @@ -174,6 +174,7 @@ class RoomsListView extends React.Component { roomsRequest: PropTypes.func, closeServerDropdown: PropTypes.func, useRealName: PropTypes.bool, + connected: PropTypes.bool, split: PropTypes.bool }; @@ -302,6 +303,7 @@ class RoomsListView extends React.Component { showFavorites, showUnread, appState, + connected, roomsRequest } = this.props; @@ -317,6 +319,7 @@ class RoomsListView extends React.Component { } else if ( appState === 'foreground' && appState !== prevProps.appState + && connected ) { roomsRequest(); } @@ -894,6 +897,7 @@ class RoomsListView extends React.Component { const mapStateToProps = state => ({ user: getUserSelector(state), server: state.server.server, + connected: state.server.connected, searchText: state.rooms.searchText, loadingServer: state.server.loading, showServerDropdown: state.rooms.showServerDropdown, diff --git a/package.json b/package.json index 5894e508b..c2f701807 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "@react-native-community/cameraroll": "^1.3.0", "@react-native-community/datetimepicker": "^2.1.0", "@react-native-community/slider": "2.0.5", - "@rocket.chat/sdk": "1.0.0-alpha.41", + "@rocket.chat/sdk": "djorkaeffalexandre/Rocket.Chat.js.SDK#test.fix-ddp", "@rocket.chat/ui-kit": "^0.2.0-alpha.25", "base-64": "^0.1.0", "bugsnag-react-native": "2.23.2", @@ -70,7 +70,7 @@ "react-native-keyboard-tracking-view": "^5.6.1", "react-native-keycommands": "2.0.3", "react-native-localize": "1.3.1", - "react-native-mime-types": "^2.2.1", + "react-native-mime-types": "2.2.1", "react-native-modal": "11.5.3", "react-native-modalize": "^1.3.6", "react-native-navigation-bar-color": "^1.0.0", diff --git a/patches/@rocket.chat+sdk+1.0.0-alpha.41.patch b/patches/@rocket.chat+sdk+1.0.0-alpha.41.patch deleted file mode 100644 index 9dfff7688..000000000 --- a/patches/@rocket.chat+sdk+1.0.0-alpha.41.patch +++ /dev/null @@ -1,63 +0,0 @@ -diff --git a/node_modules/@rocket.chat/sdk/lib/api/api.js b/node_modules/@rocket.chat/sdk/lib/api/api.js -index 5b7dc21..49f1af5 100644 ---- a/node_modules/@rocket.chat/sdk/lib/api/api.js -+++ b/node_modules/@rocket.chat/sdk/lib/api/api.js -@@ -62,6 +62,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); - var log_1 = require("../log"); - var message_1 = require("../message"); - var tiny_events_1 = require("tiny-events"); -+var settings = require("../settings"); - var Client = /** @class */ (function () { - function Client(_a) { - var _b = _a.host, host = _b === void 0 ? 'http://localhost:3000' : _b; -@@ -70,7 +71,7 @@ var Client = /** @class */ (function () { - } - Object.defineProperty(Client.prototype, "headers", { - get: function () { -- return __assign({ 'Content-Type': 'application/json' }, this._headers); -+ return __assign({ 'Content-Type': 'application/json', ...settings.customHeaders }, this._headers); - }, - set: function (obj) { - this._headers = obj; -diff --git a/node_modules/@rocket.chat/sdk/lib/drivers/ddp.js b/node_modules/@rocket.chat/sdk/lib/drivers/ddp.js -index e3510c7..e3216cc 100644 ---- a/node_modules/@rocket.chat/sdk/lib/drivers/ddp.js -+++ b/node_modules/@rocket.chat/sdk/lib/drivers/ddp.js -@@ -110,6 +110,7 @@ tiny_events_1.EventEmitter.prototype.removeAllListeners = function (event) { - var interfaces_1 = require("../../interfaces"); - var util_1 = require("../util"); - var js_sha256_1 = require("js-sha256"); -+var settings = require("../settings"); - /** Websocket handler class, manages connections and subscriptions by DDP */ - var Socket = /** @class */ (function (_super) { - __extends(Socket, _super); -@@ -145,7 +146,7 @@ var Socket = /** @class */ (function (_super) { - return !_this.alive() && _this.reopen(); - }, ms); - try { -- connection = new universal_websocket_client_1.default(this.host); -+ connection = new universal_websocket_client_1.default(this.host, null, { headers: settings.customHeaders }); - connection.onerror = reject; - } - catch (err) { -diff --git a/node_modules/@rocket.chat/sdk/lib/settings.d.ts b/node_modules/@rocket.chat/sdk/lib/settings.d.ts -index 99eb828..8c99307 100644 ---- a/node_modules/@rocket.chat/sdk/lib/settings.d.ts -+++ b/node_modules/@rocket.chat/sdk/lib/settings.d.ts -@@ -17,3 +17,4 @@ export declare let dmCacheMaxAge: number; - export declare let token: string; - export declare let rid: string; - export declare let department: string; -+export declare let customHeaders: object; -diff --git a/node_modules/@rocket.chat/sdk/lib/settings.js b/node_modules/@rocket.chat/sdk/lib/settings.js -index 822c286..ce8f805 100644 ---- a/node_modules/@rocket.chat/sdk/lib/settings.js -+++ b/node_modules/@rocket.chat/sdk/lib/settings.js -@@ -29,4 +29,6 @@ exports.dmCacheMaxAge = 1000 * parseInt(process.env.DM_ROOM_CACHE_MAX_AGE || '10 - exports.token = process.env.LIVECHAT_TOKEN || ''; - exports.rid = process.env.LIVECHAT_ROOM || ''; - exports.department = process.env.LIVECHAT_DEPARTMENT || ''; -+// Headers settings -+exports.customHeaders = {}; - //# sourceMappingURL=settings.js.map -\ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 504d7f655..9688e69b8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1915,10 +1915,9 @@ resolved "https://registry.yarnpkg.com/@redux-saga/types/-/types-1.1.0.tgz#0e81ce56b4883b4b2a3001ebe1ab298b84237204" integrity sha512-afmTuJrylUU/0OtqzaRkbyYFFNgCF73Bvel/sw90pvGrWIZ+vyoIJqA6eMSoA6+nb443kTmulmBtC9NerXboNg== -"@rocket.chat/sdk@1.0.0-alpha.41": - version "1.0.0-alpha.41" - resolved "https://registry.yarnpkg.com/@rocket.chat/sdk/-/sdk-1.0.0-alpha.41.tgz#8fcae2885786bec56a56b6d9a8cccaa365b77364" - integrity sha512-jQ+/exEQMOv+bwH+yzPTC0oJGIKj/AlMc95IvWAn/vHDLjjS3aGzpIpZhBwsMOBVvb/5N8rnq6kEleCkEJk28g== +"@rocket.chat/sdk@djorkaeffalexandre/Rocket.Chat.js.SDK#test.fix-ddp": + version "1.0.0-dj.15" + resolved "https://codeload.github.com/djorkaeffalexandre/Rocket.Chat.js.SDK/tar.gz/216de62f7e52dd4a9f73d7989d6943ced550a92a" dependencies: js-sha256 "^0.9.0" lru-cache "^4.1.1" @@ -9965,7 +9964,7 @@ react-native-localize@1.3.1: resolved "https://registry.yarnpkg.com/react-native-localize/-/react-native-localize-1.3.1.tgz#d0b7046acd4214ac2bcb61102317374351400c76" integrity sha512-Y3LzTHyrgsIsDYvjWSRguARBKjiLaahcbJg663ZqP1Tcpan4LYn/f3iusM+Oh6qYvClnlo9AlBkLdCZbWwe7Tw== -react-native-mime-types@^2.2.1: +react-native-mime-types@2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/react-native-mime-types/-/react-native-mime-types-2.2.1.tgz#a9760e9916e4e7df03512c60516668f23543f2c0" integrity sha512-2H0jjW5l2driXiiKx9PZsJDCFgS8LeMaVLVZPy3iRkBrNcstpQosEr6+YJfihLbW3WvFtmS2qcyFKB7mYw/iJg==