crspeller / mattermost-plugin-channel-notes

A Mattermost plugin that extends channel functionality with notes.
Apache License 2.0
27 stars 5 forks source link

Move fetching logic to websocket listener #5

Closed agarciamontoro closed 2 years ago

agarciamontoro commented 2 years ago

This fixes the error found by @dipak-demansol in #4. The channel header icon contained the logic for fetching the notes for each channel, so when we use the App Bar icon (which prevents the channel header icon from being mounted) that logic is never executed.

To solve this, I added a listener for the CHANNEL_VIEWED websocket event, so that when the user switches channel, the notes for that channel are fetched.

With this change, the old logic of the channel header icon changing its colour whenever the current channel has notes still works, and the bug found in #4 when the App Bar icon is shown is solved.

agarciamontoro commented 2 years ago

@crspeller, we can merge this one and then I'll test again in #4 so we can merge the App Bar icon.