mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-03-12 00:48:50 +01:00
Fix disabled follow button
This commit is contained in:
parent
e102a9f925
commit
ad831fae35
1 changed files with 35 additions and 35 deletions
|
@ -583,43 +583,43 @@ function RelatedActions({ info, instance, authenticated, standalone }) {
|
||||||
accountInfoStates.familiarFollowers =
|
accountInfoStates.familiarFollowers =
|
||||||
followers[0].accounts.slice(0, FAMILIAR_FOLLOWERS_LIMIT);
|
followers[0].accounts.slice(0, FAMILIAR_FOLLOWERS_LIMIT);
|
||||||
|
|
||||||
if (standalone) return;
|
if (!standalone) {
|
||||||
|
const { value: statuses } = await fetchStatuses;
|
||||||
|
console.log('fetched statuses', statuses);
|
||||||
|
const stats = {
|
||||||
|
total: statuses.length,
|
||||||
|
originals: 0,
|
||||||
|
replies: 0,
|
||||||
|
boosts: 0,
|
||||||
|
};
|
||||||
|
// Categories statuses by type
|
||||||
|
// - Original posts (not replies to others)
|
||||||
|
// - Threads (self-replies + 1st original post)
|
||||||
|
// - Boosts (reblogs)
|
||||||
|
// - Replies (not-self replies)
|
||||||
|
statuses.forEach((status) => {
|
||||||
|
if (status.reblog) {
|
||||||
|
stats.boosts++;
|
||||||
|
} else if (
|
||||||
|
status.inReplyToAccountId !== currentID &&
|
||||||
|
!!status.inReplyToId
|
||||||
|
) {
|
||||||
|
stats.replies++;
|
||||||
|
} else {
|
||||||
|
stats.originals++;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
const { value: statuses } = await fetchStatuses;
|
// Count days since last post
|
||||||
console.log('fetched statuses', statuses);
|
stats.daysSinceLastPost = Math.ceil(
|
||||||
const stats = {
|
(Date.now() -
|
||||||
total: statuses.length,
|
new Date(statuses[statuses.length - 1].createdAt)) /
|
||||||
originals: 0,
|
86400000,
|
||||||
replies: 0,
|
);
|
||||||
boosts: 0,
|
|
||||||
};
|
|
||||||
// Categories statuses by type
|
|
||||||
// - Original posts (not replies to others)
|
|
||||||
// - Threads (self-replies + 1st original post)
|
|
||||||
// - Boosts (reblogs)
|
|
||||||
// - Replies (not-self replies)
|
|
||||||
statuses.forEach((status) => {
|
|
||||||
if (status.reblog) {
|
|
||||||
stats.boosts++;
|
|
||||||
} else if (
|
|
||||||
status.inReplyToAccountId !== currentID &&
|
|
||||||
!!status.inReplyToId
|
|
||||||
) {
|
|
||||||
stats.replies++;
|
|
||||||
} else {
|
|
||||||
stats.originals++;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Count days since last post
|
console.log('posting stats', stats);
|
||||||
stats.daysSinceLastPost = Math.ceil(
|
setPostingStats(stats);
|
||||||
(Date.now() -
|
}
|
||||||
new Date(statuses[statuses.length - 1].createdAt)) /
|
|
||||||
86400000,
|
|
||||||
);
|
|
||||||
|
|
||||||
console.log('posting stats', stats);
|
|
||||||
setPostingStats(stats);
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue