|
53 | 53 | 'stream_id': int,
|
54 | 54 | 'stream_ids': List[int], # NOTE: replaces 'stream_id' in ZFL 35 for peer*
|
55 | 55 | 'value': bool,
|
56 |
| - 'message_ids': List[int] # Present when subject of msg(s) is updated |
| 56 | + 'message_ids': List[int], # Present when subject of msg(s) is updated, |
| 57 | + 'subscriptions': List[Dict[str, Any]] |
57 | 58 | }, total=False) # Each Event will only have a subset of these
|
58 | 59 |
|
59 | 60 | EditPropagateMode = Literal['change_one', 'change_all', 'change_later']
|
@@ -785,6 +786,21 @@ def get_stream_by_id(streams: List[StreamData], stream_id: int
|
785 | 786 | sort_streams(self.pinned_streams)
|
786 | 787 | self.controller.view.left_panel.update_stream_view()
|
787 | 788 | self.controller.update_screen()
|
| 789 | + elif event['op'] == 'add': |
| 790 | + def make_reduced_stream_data(stream: Any) -> StreamData: |
| 791 | + # stream_id has been changed to id. |
| 792 | + return StreamData({'name': stream['name'], |
| 793 | + 'id': stream['stream_id'], |
| 794 | + 'color': stream['color'], |
| 795 | + 'invite_only': stream['invite_only'], |
| 796 | + 'description': stream['description']}) |
| 797 | + |
| 798 | + subscription = event['subscriptions'][0] |
| 799 | + stream_data = make_reduced_stream_data(subscription) |
| 800 | + self.stream_dict[subscription['stream_id']] = stream_data |
| 801 | + self.pinned_streams.append(stream_data) |
| 802 | + self.controller.update_screen() |
| 803 | + |
788 | 804 | elif event['op'] in ('peer_add', 'peer_remove'):
|
789 | 805 | # NOTE: ZFL 35 commit was not atomic with API change
|
790 | 806 | # (ZFL >=35 can use new plural style)
|
|
0 commit comments