Merge pull request #310 from cheeaun/main

Update from main
This commit is contained in:
Chee Aun 2023-11-07 14:59:48 +08:00 committed by GitHub
commit 84b6368253
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 12 deletions

View file

@ -265,7 +265,8 @@ function Timeline({
(visible) => {
if (visible) {
const timeDiff = Date.now() - lastHiddenTime.current;
if (!lastHiddenTime.current || timeDiff > 1000 * 60) {
if (!lastHiddenTime.current || timeDiff > 1000 * 3) {
// 3 seconds
loadOrCheckUpdates({
disableIdleCheck: true,
});
@ -461,6 +462,7 @@ function TimelineItem({
view,
}) {
const { id: statusID, reblog, items, type, _pinned } = status;
if (_pinned) useItemID = false;
const actualStatusID = reblog?.id || statusID;
const url = instance
? `/${instance}/s/${actualStatusID}`
@ -496,11 +498,12 @@ function TimelineItem({
<li key={`timeline-${statusID}`} class="timeline-item-carousel">
<StatusCarousel title={title} class={`${type}-carousel`}>
{items.map((item) => {
const { id: statusID, reblog } = item;
const { id: statusID, reblog, _pinned } = item;
const actualStatusID = reblog?.id || statusID;
const url = instance
? `/${instance}/s/${actualStatusID}`
: `/s/${actualStatusID}`;
if (_pinned) useItemID = false;
return (
<li key={statusID}>
<Link class="status-carousel-link timeline-item-alt" to={url}>

View file

@ -152,16 +152,19 @@ function AccountStatuses() {
const results = [];
if (firstLoad) {
const { value: pinnedStatuses } = await masto.v1.accounts
const { value } = await masto.v1.accounts
.$select(id)
.statuses.list({
pinned: true,
})
.next();
if (pinnedStatuses?.length && !tagged && !media) {
pinnedStatuses.forEach((status) => {
if (value?.length && !tagged && !media) {
const pinnedStatuses = value.map((status) => {
saveStatus(status, instance);
status._pinned = true;
return {
...status,
_pinned: true,
};
});
if (pinnedStatuses.length >= 3) {
const pinnedStatusesIds = pinnedStatuses.map((status) => status.id);

View file

@ -130,6 +130,7 @@ function Notifications({ columnMode }) {
}
const loadNotifications = (firstLoad) => {
setShowNew(false);
setUIState('loading');
(async () => {
try {
@ -192,19 +193,14 @@ function Notifications({ columnMode }) {
scrollTop: scrollableRef.current?.scrollTop,
inBackground: inBackground(),
disableIdleCheck,
notificationsShowNew: snapStates.notificationsShowNew,
});
if (
snapStates.settings.autoRefresh &&
scrollableRef.current?.scrollTop < 16 &&
(disableIdleCheck || window.__IDLE__) &&
!inBackground() &&
snapStates.notificationsShowNew
!inBackground()
) {
setShowNew(false);
loadNotifications(true);
} else {
setShowNew(snapStates.notificationsShowNew);
}
},
[snapStates.notificationsShowNew, snapStates.settings.autoRefresh, uiState],
@ -228,6 +224,7 @@ function Notifications({ columnMode }) {
if (v) {
loadUpdates();
}
setShowNew(v);
});
}
return () => {