mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-02-16 07:11:15 +03:00
Test fix Pixelfed home timeline not showing reblogs
This commit is contained in:
parent
ed712d15f1
commit
d16221e296
3 changed files with 28 additions and 6 deletions
|
@ -41,6 +41,7 @@ import states, { statusKey } from '../utils/states';
|
|||
import statusPeek from '../utils/status-peek';
|
||||
import store from '../utils/store';
|
||||
import { getCurrentAccountID, getCurrentAccountNS } from '../utils/store-utils';
|
||||
import supports from '../utils/supports';
|
||||
import { assignFollowedTags } from '../utils/timeline-utils';
|
||||
import useTitle from '../utils/useTitle';
|
||||
|
||||
|
@ -116,6 +117,8 @@ function Catchup() {
|
|||
}, []);
|
||||
const isSelf = (accountID) => accountID === currentAccount;
|
||||
|
||||
const supportsPixelfed = supports('@pixelfed/home-include-reblogs');
|
||||
|
||||
async function fetchHome({ maxCreatedAt }) {
|
||||
const maxCreatedAtDate = maxCreatedAt ? new Date(maxCreatedAt) : null;
|
||||
console.debug('fetchHome', maxCreatedAtDate);
|
||||
|
@ -123,6 +126,13 @@ function Catchup() {
|
|||
const homeIterator = masto.v1.timelines.home.list({ limit: 40 });
|
||||
mainloop: while (true) {
|
||||
try {
|
||||
if (supportsPixelfed && homeIterator.nextParams) {
|
||||
if (typeof homeIterator.nextParams === 'string') {
|
||||
homeIterator.nextParams += '&include_reblogs=true';
|
||||
} else {
|
||||
homeIterator.nextParams.include_reblogs = true;
|
||||
}
|
||||
}
|
||||
const results = await homeIterator.next();
|
||||
const { value } = results;
|
||||
if (value?.length) {
|
||||
|
|
|
@ -6,6 +6,7 @@ import { api } from '../utils/api';
|
|||
import { filteredItems } from '../utils/filters';
|
||||
import states from '../utils/states';
|
||||
import { getStatus, saveStatus } from '../utils/states';
|
||||
import supports from '../utils/supports';
|
||||
import {
|
||||
assignFollowedTags,
|
||||
clearFollowedTagsState,
|
||||
|
@ -23,11 +24,19 @@ function Following({ title, path, id, ...props }) {
|
|||
const latestItem = useRef();
|
||||
|
||||
console.debug('RENDER Following', title, id);
|
||||
const supportsPixelfed = supports('@pixelfed/home-include-reblogs');
|
||||
|
||||
async function fetchHome(firstLoad) {
|
||||
if (firstLoad || !homeIterator.current) {
|
||||
homeIterator.current = masto.v1.timelines.home.list({ limit: LIMIT });
|
||||
}
|
||||
if (supportsPixelfed && homeIterator.current?.nextParams) {
|
||||
if (typeof homeIterator.current.nextParams === 'string') {
|
||||
homeIterator.current.nextParams += '&include_reblogs=true';
|
||||
} else {
|
||||
homeIterator.current.nextParams.include_reblogs = true;
|
||||
}
|
||||
}
|
||||
const results = await homeIterator.current.next();
|
||||
let { value } = results;
|
||||
if (value?.length) {
|
||||
|
@ -63,12 +72,14 @@ function Following({ title, path, id, ...props }) {
|
|||
|
||||
async function checkForUpdates() {
|
||||
try {
|
||||
const results = await masto.v1.timelines.home
|
||||
.list({
|
||||
limit: 5,
|
||||
since_id: latestItem.current,
|
||||
})
|
||||
.next();
|
||||
const opts = {
|
||||
limit: 5,
|
||||
since_id: latestItem.current,
|
||||
};
|
||||
if (supports('@pixelfed/home-include-reblogs')) {
|
||||
opts.include_reblogs = true;
|
||||
}
|
||||
const results = await masto.v1.timelines.home.list(opts).next();
|
||||
let { value } = results;
|
||||
console.log('checkForUpdates', latestItem.current, value);
|
||||
const valueContainsLatestItem = value[0]?.id === latestItem.current; // since_id might not be supported
|
||||
|
|
|
@ -18,6 +18,7 @@ const platformFeatures = {
|
|||
'@mastodon/profile-edit': notContainPixelfed,
|
||||
'@mastodon/profile-private-note': notContainPixelfed,
|
||||
'@pixelfed/trending': containPixelfed,
|
||||
'@pixelfed/home-include-reblogs': containPixelfed,
|
||||
};
|
||||
const supportsCache = {};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue