Fixes for CI failures
parent
514b57b0af
commit
7968ca0d3c
|
|
@ -141,7 +141,7 @@ class ActivitiesApi {
|
|||
/// * [ReactionLevel] level:
|
||||
///
|
||||
/// * [int] take:
|
||||
/// Maximum number of activities to return
|
||||
/// Approximate maximum number of activities to return. The response may exceed this value to include all activities sharing the oldest returned timestamp, preserving pagination boundaries.
|
||||
///
|
||||
/// * [ReactionType] type:
|
||||
///
|
||||
|
|
@ -210,7 +210,7 @@ class ActivitiesApi {
|
|||
/// * [ReactionLevel] level:
|
||||
///
|
||||
/// * [int] take:
|
||||
/// Maximum number of activities to return
|
||||
/// Approximate maximum number of activities to return. The response may exceed this value to include all activities sharing the oldest returned timestamp, preserving pagination boundaries.
|
||||
///
|
||||
/// * [ReactionType] type:
|
||||
///
|
||||
|
|
|
|||
|
|
@ -33,9 +33,6 @@
|
|||
"required": false,
|
||||
"in": "query",
|
||||
"description": "Return activities created before this date (for pagination)",
|
||||
"x-nestjs_zod-parent-metadata": {
|
||||
"description": "Activity search"
|
||||
},
|
||||
"schema": {
|
||||
"format": "date-time",
|
||||
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
|
||||
|
|
@ -56,9 +53,6 @@
|
|||
"required": false,
|
||||
"in": "query",
|
||||
"description": "Approximate maximum number of activities to return. The response may exceed this value to include all activities sharing the oldest returned timestamp, preserving pagination boundaries.",
|
||||
"x-nestjs_zod-parent-metadata": {
|
||||
"description": "Activity search"
|
||||
},
|
||||
"schema": {
|
||||
"minimum": 1,
|
||||
"maximum": 1000,
|
||||
|
|
|
|||
|
|
@ -151,9 +151,7 @@ describe(ActivityService.name, () => {
|
|||
|
||||
await sut.getAll(AuthFactory.create(), { albumId, take: 2, before });
|
||||
|
||||
expect(mocks.activity.search).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ albumId, take: 2, before }),
|
||||
);
|
||||
expect(mocks.activity.search).toHaveBeenCalledWith(expect.objectContaining({ albumId, take: 2, before }));
|
||||
});
|
||||
|
||||
it('should query boundary with at parameter', async () => {
|
||||
|
|
@ -162,15 +160,11 @@ describe(ActivityService.name, () => {
|
|||
const a1 = ActivityFactory.create({ albumId, createdAt: boundaryTime });
|
||||
|
||||
mocks.access.album.checkOwnerAccess.mockResolvedValue(new Set([albumId]));
|
||||
mocks.activity.search
|
||||
.mockResolvedValueOnce([a1])
|
||||
.mockResolvedValueOnce([a1]);
|
||||
mocks.activity.search.mockResolvedValueOnce([a1]).mockResolvedValueOnce([a1]);
|
||||
|
||||
await sut.getAll(AuthFactory.create(), { albumId, take: 2 });
|
||||
|
||||
expect(mocks.activity.search).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ at: boundaryTime }),
|
||||
);
|
||||
expect(mocks.activity.search).toHaveBeenCalledWith(expect.objectContaining({ at: boundaryTime }));
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -68,9 +68,9 @@
|
|||
hour12: false,
|
||||
};
|
||||
|
||||
const handleDeleteReaction = async (reaction: ActivityResponseDto, index: number) => {
|
||||
const handleDeleteReaction = async (reaction: ActivityResponseDto) => {
|
||||
try {
|
||||
await activityManager.deleteActivity(reaction, index);
|
||||
await activityManager.deleteActivity(reaction);
|
||||
|
||||
const deleteMessages: Record<ReactionType, string> = {
|
||||
[ReactionType.Comment]: $t('comment_deleted'),
|
||||
|
|
@ -119,7 +119,9 @@
|
|||
});
|
||||
|
||||
const loadMoreAndPreserveScroll = async () => {
|
||||
if (!scrollContainer) return;
|
||||
if (!scrollContainer) {
|
||||
return;
|
||||
}
|
||||
const prevScrollHeight = scrollContainer.scrollHeight;
|
||||
const prevScrollTop = scrollContainer.scrollTop;
|
||||
await activityManager.loadMore();
|
||||
|
|
@ -130,7 +132,9 @@
|
|||
};
|
||||
|
||||
const onScrollContainer = () => {
|
||||
if (isAdjustingScroll || !scrollContainer || activityManager.isLoadingMore || !activityManager.hasMore) return;
|
||||
if (isAdjustingScroll || !scrollContainer || activityManager.isLoadingMore || !activityManager.hasMore) {
|
||||
return;
|
||||
}
|
||||
if (scrollContainer.scrollTop < 200) {
|
||||
void loadMoreAndPreserveScroll();
|
||||
}
|
||||
|
|
@ -142,9 +146,11 @@
|
|||
void activityManager.activities.length;
|
||||
void activityManager.isLoadingMore;
|
||||
|
||||
if (!scrollContainer || !activityManager.hasMore || activityManager.isLoadingMore) return;
|
||||
if (!scrollContainer || !activityManager.hasMore || activityManager.isLoadingMore) {
|
||||
return;
|
||||
}
|
||||
// After rendering, check if there's no scrollable overflow
|
||||
tick().then(() => {
|
||||
void tick().then(() => {
|
||||
if (scrollContainer && scrollContainer.scrollHeight <= scrollContainer.clientHeight) {
|
||||
void loadMoreAndPreserveScroll();
|
||||
}
|
||||
|
|
@ -215,7 +221,7 @@
|
|||
activeColor="bg-red-200"
|
||||
icon={mdiDeleteOutline}
|
||||
text={$t('remove')}
|
||||
onClick={() => handleDeleteReaction(reaction, index)}
|
||||
onClick={() => handleDeleteReaction(reaction)}
|
||||
/>
|
||||
</ButtonContextMenu>
|
||||
</div>
|
||||
|
|
@ -265,7 +271,7 @@
|
|||
activeColor="bg-red-200"
|
||||
icon={mdiDeleteOutline}
|
||||
text={$t('remove')}
|
||||
onClick={() => handleDeleteReaction(reaction, index)}
|
||||
onClick={() => handleDeleteReaction(reaction)}
|
||||
/>
|
||||
</ButtonContextMenu>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -27,7 +27,9 @@ function waitForServerVersion(): Promise<{ major: number; minor: number; patch:
|
|||
return new Promise((resolve) => {
|
||||
let settled = false;
|
||||
const finish = (version: { major: number; minor: number; patch: number } | undefined) => {
|
||||
if (settled) return;
|
||||
if (settled) {
|
||||
return;
|
||||
}
|
||||
settled = true;
|
||||
try {
|
||||
clearTimeout(timer);
|
||||
|
|
@ -148,7 +150,7 @@ class ActivityManager {
|
|||
return activity;
|
||||
}
|
||||
|
||||
async deleteActivity(activity: ActivityResponseDto, index?: number) {
|
||||
async deleteActivity(activity: ActivityResponseDto) {
|
||||
if (!this.#albumId) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue