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
This commit is contained in:
Bofh 2020-12-31 13:58:51 +01:00
parent e88cb59b31
commit 229908e0f3
5 changed files with 26 additions and 15 deletions

View File

@ -74,7 +74,7 @@ export default {
goBack: 'Go back', goBack: 'Go back',
back: 'Back', back: 'Back',
profile: 'Profile', profile: 'Profile',
federatedTimeline: 'Federated timeline', federatedTimeline: 'Meet people',
localTimeline: 'Local timeline', localTimeline: 'Local timeline',
// community page // community page
chat: 'Chat', chat: 'Chat',
@ -91,7 +91,7 @@ export default {
bookmarksNotLoggedIn: 'Your bookmarks will appear here when logged in.', bookmarksNotLoggedIn: 'Your bookmarks will appear here when logged in.',
directMessagesNotLoggedIn: 'Your chat will appear here when logged in.', directMessagesNotLoggedIn: 'Your chat will appear here when logged in.',
favoritesNotLoggedIn: 'Your favorites 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.', localTimelineNotLoggedIn: 'Your local timeline will appear here when logged in.',
searchNotLoggedIn: 'You can search once logged in to an instance.', searchNotLoggedIn: 'You can search once logged in to an instance.',
communityNotLoggedIn: 'Community options appear here when logged in.', communityNotLoggedIn: 'Community options appear here when logged in.',
@ -133,7 +133,7 @@ export default {
<li><kbd>g</kbd> + <kbd>h</kbd> to go home</li> <li><kbd>g</kbd> + <kbd>h</kbd> to go home</li>
<li><kbd>g</kbd> + <kbd>n</kbd> to go to notifications</li> <li><kbd>g</kbd> + <kbd>n</kbd> to go to notifications</li>
<li><kbd>g</kbd> + <kbd>l</kbd> to go to the local timeline</li> <li><kbd>g</kbd> + <kbd>l</kbd> to go to the local timeline</li>
<li><kbd>g</kbd> + <kbd>t</kbd> to go to the federated timeline</li> <li><kbd>g</kbd> + <kbd>t</kbd> to go to the meet people page</li>
<li><kbd>g</kbd> + <kbd>c</kbd> to go to the community page</li> <li><kbd>g</kbd> + <kbd>c</kbd> to go to the community page</li>
<li><kbd>g</kbd> + <kbd>d</kbd> to go to the chat page</li> <li><kbd>g</kbd> + <kbd>d</kbd> to go to the chat page</li>
<li><kbd>h</kbd> or <kbd>?</kbd> to toggle the help dialog</li> <li><kbd>h</kbd> or <kbd>?</kbd> to toggle the help dialog</li>

View File

@ -116,6 +116,9 @@ export function addStatusOrNotification (instanceName, timelineName, newStatusOr
export function addStatusesOrNotifications (instanceName, timelineName, newStatusesOrNotifications) { export function addStatusesOrNotifications (instanceName, timelineName, newStatusesOrNotifications) {
console.log('addStatusesOrNotifications', Date.now()) console.log('addStatusesOrNotifications', Date.now())
if (timelineName === 'federated') {
newStatusesOrNotifications = window.fediloveFunctions.filterItemsForFedilove(newStatusesOrNotifications);
}
let freshUpdates = store.getForTimeline(instanceName, timelineName, 'freshUpdates') || [] let freshUpdates = store.getForTimeline(instanceName, timelineName, 'freshUpdates') || []
freshUpdates = concat(freshUpdates, newStatusesOrNotifications) freshUpdates = concat(freshUpdates, newStatusesOrNotifications)
freshUpdates = uniqBy(freshUpdates, _ => _.id) freshUpdates = uniqBy(freshUpdates, _ => _.id)

View File

@ -18,7 +18,7 @@ function getTimelineUrlPath (timeline) {
switch (timeline) { switch (timeline) {
case 'local': case 'local':
case 'federated': case 'federated':
return 'timelines/public' return 'timelines/tag/fedilove'
case 'home': case 'home':
return 'timelines/home' return 'timelines/home'
case 'notifications': case 'notifications':
@ -82,6 +82,10 @@ export async function getTimeline (instanceName, accessToken, timeline, maxId, s
params.exclude_types = ['follow', 'favourite', 'reblog', 'poll'] params.exclude_types = ['follow', 'favourite', 'reblog', 'poll']
} }
if (timeline === 'federated') {
params.limit = 50;
}
url += '?' + paramsString(params) url += '?' + paramsString(params)
console.log('fetching url', url) console.log('fetching url', url)
@ -92,15 +96,7 @@ export async function getTimeline (instanceName, accessToken, timeline, maxId, s
} }
if (timeline === 'direct' || timeline === 'federated') { if (timeline === 'direct' || timeline === 'federated') {
let newItems = []; items = window.fediloveFunctions.filterItemsForFedilove(items);
for (var item of items) {
if (item.account === undefined)
continue;
if (item.account.display_name.toLowerCase().includes('#fedilove')) {
newItems.push(item);
}
}
items = newItems;
} }
return { items, headers } return { items, headers }

View File

@ -1,7 +1,7 @@
{#if $isUserLoggedIn} {#if $isUserLoggedIn}
<TimelinePage timeline="federated"> <TimelinePage timeline="federated">
{#if $pinnedPage !== '/federated'} {#if $pinnedPage !== '/federated'}
<DynamicPageBanner title="{intl.federatedTimeline}" icon="#fa-globe"/> <DynamicPageBanner title="{intl.federatedTimeline}" icon="#fa-users"/>
{/if} {/if}
</TimelinePage> </TimelinePage>
{:else} {:else}

View File

@ -124,7 +124,19 @@ var fediloveApi = {
return JSON.parse(localStorage.store_currentInstance); 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 = { var fediloveData = {
chatAvatarCache: undefined, chatAvatarCache: undefined,
gotEmojifyTextFunction: false, gotEmojifyTextFunction: false,