Skip to content

Commit 47f2341

Browse files
authored
Merge pull request #9165 from Couchers-org/na/web/excludeattending
Do frontend of exclude attending and remove dashboardNews
2 parents aa0eaec + 3a50c32 commit 47f2341

8 files changed

Lines changed: 38 additions & 45 deletions

File tree

app/web/features/communities/events/DiscoverEventsList.test.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,22 @@ describe("DiscoverEventsList", () => {
8989
expect(screen.getByRole("link", { name: "create" })).toBeInTheDocument();
9090
});
9191

92+
it("Excludes events the user is already attending or organizing", async () => {
93+
mockEventSearch.mockResolvedValue({
94+
eventsList: [],
95+
totalItems: 0,
96+
nextPageToken: "",
97+
});
98+
99+
render(<DiscoverEventsList />, { wrapper });
100+
101+
await waitFor(() => {
102+
expect(mockEventSearch).toHaveBeenCalledWith(
103+
expect.objectContaining({ excludeAttending: true }),
104+
);
105+
});
106+
});
107+
92108
it("Renders error message when there is an error", async () => {
93109
mockEventSearch.mockRejectedValue(new Error("Error occurred"));
94110

app/web/features/communities/events/DiscoverEventsList.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ const DiscoverEventsList = () => {
9797
isMyCommunities,
9898
isOnlineOnly,
9999
searchLocation: locationResult,
100+
excludeAttending: true,
100101
});
101102

102103
const hasEvents = data && data.eventsList && data.eventsList.length > 0;

app/web/features/communities/events/hooks.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ export function useEventSearch({
134134
isMyCommunities,
135135
isOnlineOnly,
136136
searchLocation,
137+
excludeAttending,
137138
}: {
138139
pageNumber: number;
139140
pageSize: number;
@@ -143,6 +144,7 @@ export function useEventSearch({
143144
searchLocation?: GeocodeResult | "";
144145
attending?: boolean;
145146
organizing?: boolean;
147+
excludeAttending?: boolean;
146148
}) {
147149
return useQuery<EventSearchRes.AsObject, RpcError>({
148150
queryKey: [
@@ -152,6 +154,7 @@ export function useEventSearch({
152154
pageNumber,
153155
pastEvents,
154156
searchLocation,
157+
excludeAttending,
155158
],
156159
queryFn: () =>
157160
service.search.EventSearch({
@@ -161,6 +164,7 @@ export function useEventSearch({
161164
isMyCommunities,
162165
isOnlineOnly,
163166
searchLocation,
167+
excludeAttending,
164168
}),
165169
});
166170
}

app/web/features/dashboard/CommunityEvents.test.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ describe("Community events", () => {
106106
pageSize: 3,
107107
myCommunities: true,
108108
myCommunitiesExcludeGlobal: true,
109+
excludeAttending: true,
109110
});
110111
});
111112
});

app/web/features/dashboard/CommunityEvents.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ export default function CommunityEvents() {
5454
pageSize: 3,
5555
myCommunities: true,
5656
myCommunitiesExcludeGlobal: true,
57+
excludeAttending: true,
5758
}),
5859
getNextPageParam: (lastPage) =>
5960
lastPage.nextPageToken ? lastPage.nextPageToken : undefined,

app/web/features/dashboard/Dashboard.tsx

Lines changed: 1 addition & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1-
import { Alert, Box, Grid, Typography } from "@mui/material";
1+
import { Box, Grid } from "@mui/material";
22
import Divider from "components/Divider";
33
import HtmlMeta from "components/HtmlMeta";
44
import PageContainer from "components/PageContainer";
55
import PageTitle from "components/PageTitle";
6-
import StyledLink from "components/StyledLink";
76
import { useTranslation } from "i18n";
87
import { DASHBOARD, GLOBAL } from "i18n/namespaces";
98
import { theme } from "theme";
109

11-
import dashboardNews from "../../dashboardNews.json";
1210
import CommunitiesSection from "./CommunitiesSection";
1311
import CommunityEvents from "./CommunityEvents";
1412
import DashboardMyPublicTrips from "./DashboardMyPublicTrips";
@@ -46,46 +44,6 @@ export default function Dashboard() {
4644

4745
<PageTitle>{t("dashboard:welcome")}</PageTitle>
4846

49-
<Alert
50-
severity="info"
51-
sx={{
52-
marginBottom: theme.spacing(2),
53-
[theme.breakpoints.down("sm")]: { py: 0.75 },
54-
}}
55-
>
56-
<Typography
57-
variant="body1"
58-
sx={{
59-
[theme.breakpoints.down("sm")]: { fontSize: "0.8125rem" },
60-
}}
61-
>
62-
New blog post:{" "}
63-
<StyledLink href={dashboardNews["2026-05-25"].link}>
64-
{dashboardNews["2026-05-25"].title}
65-
</StyledLink>
66-
</Typography>
67-
</Alert>
68-
69-
<Alert
70-
severity="info"
71-
sx={{
72-
marginBottom: theme.spacing(2),
73-
[theme.breakpoints.down("sm")]: { py: 0.75 },
74-
}}
75-
>
76-
<Typography
77-
variant="body1"
78-
sx={{
79-
[theme.breakpoints.down("sm")]: { fontSize: "0.8125rem" },
80-
}}
81-
>
82-
New blog post:{" "}
83-
<StyledLink href={dashboardNews["2026-05-15"].link}>
84-
{dashboardNews["2026-05-15"].title}
85-
</StyledLink>
86-
</Typography>
87-
</Alert>
88-
8947
<ReminderCarousel />
9048

9149
<Divider spacing={3} />

app/web/service/events.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,7 @@ export async function listAllEvents({
259259
}
260260

261261
export interface ListMyEventsInput {
262+
excludeAttending?: boolean;
262263
myCommunities?: boolean;
263264
myCommunitiesExcludeGlobal?: boolean;
264265
pageNumber?: number;
@@ -269,6 +270,7 @@ export interface ListMyEventsInput {
269270
}
270271

271272
export async function listMyEvents({
273+
excludeAttending,
272274
myCommunities,
273275
myCommunitiesExcludeGlobal,
274276
pageNumber,
@@ -278,8 +280,13 @@ export async function listMyEvents({
278280
showCancelled,
279281
}: ListMyEventsInput) {
280282
const req = new ListMyEventsReq();
281-
req.setAttending(true);
282-
req.setOrganizing(true);
283+
284+
if (excludeAttending) {
285+
req.setExcludeAttending(true);
286+
} else {
287+
req.setAttending(true);
288+
req.setOrganizing(true);
289+
}
283290

284291
if (myCommunities !== undefined) {
285292
req.setMyCommunities(myCommunities);

app/web/service/search.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ export async function EventSearch({
187187
searchLocation,
188188
attending,
189189
organizing,
190+
excludeAttending,
190191
}: {
191192
pageNumber: number;
192193
pageSize: number;
@@ -196,6 +197,7 @@ export async function EventSearch({
196197
searchLocation?: GeocodeResult | "";
197198
attending?: boolean;
198199
organizing?: boolean;
200+
excludeAttending?: boolean;
199201
}): Promise<EventSearchRes.AsObject> {
200202
const req = new EventSearchReq();
201203
req.setPageSize(pageSize);
@@ -232,6 +234,9 @@ export async function EventSearch({
232234
if (organizing !== undefined) {
233235
req.setOrganizing(organizing);
234236
}
237+
if (excludeAttending !== undefined) {
238+
req.setExcludeAttending(excludeAttending);
239+
}
235240

236241
const res = await client.search.eventSearch(req);
237242
return res.toObject();

0 commit comments

Comments
 (0)