about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/actions/streaming.js
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2020-01-24 17:28:22 +0100
committerGitHub <noreply@github.com>2020-01-24 17:28:22 +0100
commit0be67df4f0a64367d9e376b06bd3fd2fb9ca8195 (patch)
tree2eaa85c899033aab9bd1b2f9da2d727ce5788e16 /app/javascript/flavours/glitch/actions/streaming.js
parenta8c109baca4d02cc8aed454e231518c1f8ec1844 (diff)
parentbdc1581556b86ba25a385c9309db714eeaba1ca1 (diff)
Merge pull request #1265 from ThibG/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/javascript/flavours/glitch/actions/streaming.js')
-rw-r--r--app/javascript/flavours/glitch/actions/streaming.js11
1 files changed, 10 insertions, 1 deletions
diff --git a/app/javascript/flavours/glitch/actions/streaming.js b/app/javascript/flavours/glitch/actions/streaming.js
index 21379f492..8294fbf36 100644
--- a/app/javascript/flavours/glitch/actions/streaming.js
+++ b/app/javascript/flavours/glitch/actions/streaming.js
@@ -8,6 +8,7 @@ import {
 } from './timelines';
 import { updateNotifications, expandNotifications } from './notifications';
 import { updateConversations } from './conversations';
+import { fetchAnnouncements, updateAnnouncements, updateReaction as updateAnnouncementsReaction } from './announcements';
 import { fetchFilters } from './filters';
 import { getLocale } from 'mastodon/locales';
 
@@ -44,6 +45,12 @@ export function connectTimelineStream (timelineId, path, pollingRefresh = null,
         case 'filters_changed':
           dispatch(fetchFilters());
           break;
+        case 'announcement':
+          dispatch(updateAnnouncements(JSON.parse(data.payload)));
+          break;
+        case 'announcement.reaction':
+          dispatch(updateAnnouncementsReaction(JSON.parse(data.payload)));
+          break;
         }
       },
     };
@@ -51,7 +58,9 @@ export function connectTimelineStream (timelineId, path, pollingRefresh = null,
 }
 
 const refreshHomeTimelineAndNotification = (dispatch, done) => {
-  dispatch(expandHomeTimeline({}, () => dispatch(expandNotifications({}, done))));
+  dispatch(expandHomeTimeline({}, () =>
+    dispatch(expandNotifications({}, () =>
+      dispatch(fetchAnnouncements(done))))));
 };
 
 export const connectUserStream      = () => connectTimelineStream('home', 'user', refreshHomeTimelineAndNotification);