mirror of
https://github.com/glitch-soc/mastodon.git
synced 2025-12-23 15:29:07 +00:00
[Glitch] Change onboarding prompt to follow suggestions carousel in web UI
Port 9cdc60ecc6 to glitch-soc
Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
@@ -22,6 +22,10 @@ export const TIMELINE_DISCONNECT = 'TIMELINE_DISCONNECT';
|
||||
export const TIMELINE_CONNECT = 'TIMELINE_CONNECT';
|
||||
|
||||
export const TIMELINE_MARK_AS_PARTIAL = 'TIMELINE_MARK_AS_PARTIAL';
|
||||
export const TIMELINE_INSERT = 'TIMELINE_INSERT';
|
||||
|
||||
export const TIMELINE_SUGGESTIONS = 'inline-follow-suggestions';
|
||||
export const TIMELINE_GAP = null;
|
||||
|
||||
export const loadPending = timeline => ({
|
||||
type: TIMELINE_LOAD_PENDING,
|
||||
@@ -123,9 +127,19 @@ export function expandTimeline(timelineId, path, params = {}, done = noOp) {
|
||||
|
||||
api(getState).get(path, { params }).then(response => {
|
||||
const next = getLinks(response).refs.find(link => link.rel === 'next');
|
||||
|
||||
dispatch(importFetchedStatuses(response.data));
|
||||
dispatch(expandTimelineSuccess(timelineId, response.data, next ? next.uri : null, response.status === 206, isLoadingRecent, isLoadingMore, isLoadingRecent && preferPendingItems));
|
||||
|
||||
if (timelineId === 'home' && !isLoadingMore && !isLoadingRecent) {
|
||||
const now = new Date();
|
||||
const fittingIndex = response.data.findIndex(status => now - (new Date(status.created_at)) > 4 * 3600 * 1000);
|
||||
|
||||
if (fittingIndex !== -1) {
|
||||
dispatch(insertIntoTimeline(timelineId, TIMELINE_SUGGESTIONS, Math.max(1, fittingIndex)));
|
||||
}
|
||||
}
|
||||
|
||||
if (timelineId === 'home') {
|
||||
dispatch(submitMarkers());
|
||||
}
|
||||
@@ -233,3 +247,10 @@ export const markAsPartial = timeline => ({
|
||||
type: TIMELINE_MARK_AS_PARTIAL,
|
||||
timeline,
|
||||
});
|
||||
|
||||
export const insertIntoTimeline = (timeline, key, index) => ({
|
||||
type: TIMELINE_INSERT,
|
||||
timeline,
|
||||
index,
|
||||
key,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user