From 229908e0f301186d9fb2da5dccb148410d3b660c Mon Sep 17 00:00:00 2001 From: Bastard Operator Date: Thu, 31 Dec 2020 13:58:51 +0100 Subject: [PATCH] Federated timeline was replaced by #fedilove hashtag timeline For better and faster infrastructure and application, we needed to change the timeline full of giberish on federated to something a lot more limited. In every post someone writes using FediLove, a #fedilove hashtag will be included at the end to make sure their posts appear on this timeline, and be able to interact with people --- src/intl/en-US.js | 6 +++--- src/routes/_actions/addStatusOrNotification.js | 3 +++ src/routes/_api/timelines.js | 16 ++++++---------- src/routes/_pages/federated.html | 2 +- static/fedilove-no-react.js | 14 +++++++++++++- 5 files changed, 26 insertions(+), 15 deletions(-) diff --git a/src/intl/en-US.js b/src/intl/en-US.js index aa277e15..d1537661 100644 --- a/src/intl/en-US.js +++ b/src/intl/en-US.js @@ -74,7 +74,7 @@ export default { goBack: 'Go back', back: 'Back', profile: 'Profile', - federatedTimeline: 'Federated timeline', + federatedTimeline: 'Meet people', localTimeline: 'Local timeline', // community page chat: 'Chat', @@ -91,7 +91,7 @@ export default { bookmarksNotLoggedIn: 'Your bookmarks will appear here when logged in.', directMessagesNotLoggedIn: 'Your chat will appear here when logged in.', favoritesNotLoggedIn: 'Your favorites will appear here when logged in.', - federatedTimelineNotLoggedIn: 'Your federated timeline will appear here when logged in.', + federatedTimelineNotLoggedIn: 'A list of people to meet will appear here when logged in.', localTimelineNotLoggedIn: 'Your local timeline will appear here when logged in.', searchNotLoggedIn: 'You can search once logged in to an instance.', communityNotLoggedIn: 'Community options appear here when logged in.', @@ -133,7 +133,7 @@ export default {
  • g + h to go home
  • g + n to go to notifications
  • g + l to go to the local timeline
  • -
  • g + t to go to the federated timeline
  • +
  • g + t to go to the meet people page
  • g + c to go to the community page
  • g + d to go to the chat page
  • h or ? to toggle the help dialog
  • diff --git a/src/routes/_actions/addStatusOrNotification.js b/src/routes/_actions/addStatusOrNotification.js index 731cf116..df297432 100644 --- a/src/routes/_actions/addStatusOrNotification.js +++ b/src/routes/_actions/addStatusOrNotification.js @@ -116,6 +116,9 @@ export function addStatusOrNotification (instanceName, timelineName, newStatusOr export function addStatusesOrNotifications (instanceName, timelineName, newStatusesOrNotifications) { console.log('addStatusesOrNotifications', Date.now()) + if (timelineName === 'federated') { + newStatusesOrNotifications = window.fediloveFunctions.filterItemsForFedilove(newStatusesOrNotifications); + } let freshUpdates = store.getForTimeline(instanceName, timelineName, 'freshUpdates') || [] freshUpdates = concat(freshUpdates, newStatusesOrNotifications) freshUpdates = uniqBy(freshUpdates, _ => _.id) diff --git a/src/routes/_api/timelines.js b/src/routes/_api/timelines.js index c1a0e1bb..9f7e7a10 100644 --- a/src/routes/_api/timelines.js +++ b/src/routes/_api/timelines.js @@ -18,7 +18,7 @@ function getTimelineUrlPath (timeline) { switch (timeline) { case 'local': case 'federated': - return 'timelines/public' + return 'timelines/tag/fedilove' case 'home': return 'timelines/home' case 'notifications': @@ -82,6 +82,10 @@ export async function getTimeline (instanceName, accessToken, timeline, maxId, s params.exclude_types = ['follow', 'favourite', 'reblog', 'poll'] } + if (timeline === 'federated') { + params.limit = 50; + } + url += '?' + paramsString(params) console.log('fetching url', url) @@ -92,15 +96,7 @@ export async function getTimeline (instanceName, accessToken, timeline, maxId, s } if (timeline === 'direct' || timeline === 'federated') { - let newItems = []; - for (var item of items) { - if (item.account === undefined) - continue; - if (item.account.display_name.toLowerCase().includes('#fedilove')) { - newItems.push(item); - } - } - items = newItems; + items = window.fediloveFunctions.filterItemsForFedilove(items); } return { items, headers } diff --git a/src/routes/_pages/federated.html b/src/routes/_pages/federated.html index 0ea5c986..7bc8fc85 100644 --- a/src/routes/_pages/federated.html +++ b/src/routes/_pages/federated.html @@ -1,7 +1,7 @@ {#if $isUserLoggedIn} {#if $pinnedPage !== '/federated'} - + {/if} {:else} diff --git a/static/fedilove-no-react.js b/static/fedilove-no-react.js index e5b0a78a..40067a96 100644 --- a/static/fedilove-no-react.js +++ b/static/fedilove-no-react.js @@ -124,7 +124,19 @@ var fediloveApi = { return JSON.parse(localStorage.store_currentInstance); } }; -var fediloveFunctions = {}; +var fediloveFunctions = { + filterItemsForFedilove: function(items) { + let newItems = []; + for (var item of items) { + if (item.account === undefined) + continue; + if (item.account.display_name.toLowerCase().includes('#fedilove')) { + newItems.push(item); + } + } + return newItems; + } +}; var fediloveData = { chatAvatarCache: undefined, gotEmojifyTextFunction: false,