about summary refs log tree commit diff
path: root/app/javascript/mastodon/actions
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2021-05-07 14:33:57 +0200
committerGitHub <noreply@github.com>2021-05-07 14:33:57 +0200
commit0ad240cb6b8662e31dfae6279cbee07a4c75b231 (patch)
treea0a95773093d562103ca121d8ea90366a1f5d291 /app/javascript/mastodon/actions
parent74081433d0078784b7c2139f6caaa812740632b2 (diff)
Change home timeline to reload after follow recommendations in web UI (#16160)
Diffstat (limited to 'app/javascript/mastodon/actions')
-rw-r--r--app/javascript/mastodon/actions/timelines.js16
1 files changed, 15 insertions, 1 deletions
diff --git a/app/javascript/mastodon/actions/timelines.js b/app/javascript/mastodon/actions/timelines.js
index de1725acf..31ae09e4a 100644
--- a/app/javascript/mastodon/actions/timelines.js
+++ b/app/javascript/mastodon/actions/timelines.js
@@ -18,17 +18,26 @@ export const TIMELINE_LOAD_PENDING = 'TIMELINE_LOAD_PENDING';
 export const TIMELINE_DISCONNECT   = 'TIMELINE_DISCONNECT';
 export const TIMELINE_CONNECT      = 'TIMELINE_CONNECT';
 
+export const TIMELINE_MARK_AS_PARTIAL = 'TIMELINE_MARK_AS_PARTIAL';
+
 export const loadPending = timeline => ({
   type: TIMELINE_LOAD_PENDING,
   timeline,
 });
 
 export function updateTimeline(timeline, status, accept) {
-  return dispatch => {
+  return (dispatch, getState) => {
     if (typeof accept === 'function' && !accept(status)) {
       return;
     }
 
+    if (getState().getIn(['timelines', timeline, 'isPartial'])) {
+      // Prevent new items from being added to a partial timeline,
+      // since it will be reloaded anyway
+
+      return;
+    }
+
     dispatch(importFetchedStatus(status));
 
     dispatch({
@@ -183,3 +192,8 @@ export const disconnectTimeline = timeline => ({
   timeline,
   usePendingItems: preferPendingItems,
 });
+
+export const markAsPartial = timeline => ({
+  type: TIMELINE_MARK_AS_PARTIAL,
+  timeline,
+});