If beyond 12 hours, allow last catch up's end timing

This commit is contained in:
Lim Chee Aun 2024-03-31 20:34:01 +08:00
parent 5e56ba9fb9
commit e35e02593a

View file

@ -191,6 +191,7 @@ function Catchup() {
const [posts, setPosts] = useState([]);
const catchupRangeRef = useRef();
const catchupLastRef = useRef();
const NS = useMemo(() => getCurrentAccountNS(), []);
const handleCatchupClick = useCallback(async ({ duration } = {}) => {
const now = Date.now();
@ -925,7 +926,15 @@ function Catchup() {
type="button"
onClick={() => {
if (range < RANGES[RANGES.length - 1].value) {
const duration = range * 60 * 60 * 1000;
let duration;
if (
range === RANGES[RANGES.length - 1].value &&
catchupLastRef.current?.checked
) {
duration = Date.now() - lastCatchupEndAt;
} else {
duration = range * 60 * 60 * 1000;
}
handleCatchupClick({ duration });
} else {
handleCatchupClick();
@ -935,11 +944,25 @@ function Catchup() {
Catch up
</button>
</div>
{lastCatchupRange && range > lastCatchupRange && (
{lastCatchupRange && range > lastCatchupRange ? (
<p class="catchup-info">
<Icon icon="info" /> Overlaps with your last catch-up
</p>
)}
) : range === RANGES[RANGES.length - 1].value &&
lastCatchupEndAt ? (
<p class="catchup-info">
<label>
<input
type="checkbox"
switch
checked
ref={catchupLastRef}
/>{' '}
Until the last catch-up (
{dtf.format(new Date(lastCatchupEndAt))})
</label>
</p>
) : null}
<p class="insignificant">
<small>
Note: your instance might only show a maximum of 800 posts in