From 20bcd7e388a4dc14f95579f08198e82a1c6ac35c Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Tue, 17 Dec 2024 14:27:19 -0600 Subject: exclude responses when fetching to delete --- src/slskd/Search/API/Controllers/SearchesController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/slskd/Search/API') diff --git a/src/slskd/Search/API/Controllers/SearchesController.cs b/src/slskd/Search/API/Controllers/SearchesController.cs index 56c5f533..d6d96bbe 100644 --- a/src/slskd/Search/API/Controllers/SearchesController.cs +++ b/src/slskd/Search/API/Controllers/SearchesController.cs @@ -210,7 +210,7 @@ namespace slskd.Search.API return Forbid(); } - var search = await Searches.FindAsync(search => search.Id == id, includeResponses: true); + var search = await Searches.FindAsync(search => search.Id == id, includeResponses: false); if (search == default) { -- cgit v1.2.3 From 57d560e91247dc27a9b70bed8f4acafcbb9e03b1 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Tue, 17 Dec 2024 14:27:41 -0600 Subject: explicitly exclude search responses when broadcasting --- src/slskd/Search/API/Hubs/SearchHub.cs | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) (limited to 'src/slskd/Search/API') diff --git a/src/slskd/Search/API/Hubs/SearchHub.cs b/src/slskd/Search/API/Hubs/SearchHub.cs index b1fbf725..b4d2b6f0 100644 --- a/src/slskd/Search/API/Hubs/SearchHub.cs +++ b/src/slskd/Search/API/Hubs/SearchHub.cs @@ -39,16 +39,19 @@ namespace slskd.Search.API /// /// Broadcast an update for a search. /// + /// + /// Responses are removed prior to sending. + /// /// The hub. /// The search to broadcast. /// The operation context. public static Task BroadcastUpdateAsync(this IHubContext hub, Search search) { - return hub.Clients.All.SendAsync(SearchHubMethods.Update, search); + return hub.Clients.All.SendAsync(SearchHubMethods.Update, search with { Responses = null }); } /// - /// Broadcast the present application options. + /// Broadcast a newly recieved search response. /// /// The hub. /// The ID of the search associated with the response. @@ -59,14 +62,32 @@ namespace slskd.Search.API return hub.Clients.All.SendAsync(SearchHubMethods.Response, new { searchId, response }); } + /// + /// Broadcast the creation of a new search. + /// + /// + /// Responses are removed prior to sending. + /// + /// The hub. + /// The search to broadcast. + /// The operation context. public static Task BroadcastCreateAsync(this IHubContext hub, Search search) { - return hub.Clients.All.SendAsync(SearchHubMethods.Create, search); + return hub.Clients.All.SendAsync(SearchHubMethods.Create, search with { Responses = null }); } + /// + /// Broadcast the deletion of a search. + /// + /// + /// Responses are removed prior to sending. + /// + /// The hub. + /// The search to broadcast. + /// The operation context. public static Task BroadcastDeleteAsync(this IHubContext hub, Search search) { - return hub.Clients.All.SendAsync(SearchHubMethods.Delete, search); + return hub.Clients.All.SendAsync(SearchHubMethods.Delete, search with { Responses = null }); } } -- cgit v1.2.3 From a1ddaccf2fa3e6c86ee3f89d2b62dd210b72f9e6 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Tue, 17 Dec 2024 16:03:17 -0600 Subject: typo --- src/slskd/Search/API/Hubs/SearchHub.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/slskd/Search/API') diff --git a/src/slskd/Search/API/Hubs/SearchHub.cs b/src/slskd/Search/API/Hubs/SearchHub.cs index b4d2b6f0..e1cfb4b5 100644 --- a/src/slskd/Search/API/Hubs/SearchHub.cs +++ b/src/slskd/Search/API/Hubs/SearchHub.cs @@ -51,7 +51,7 @@ namespace slskd.Search.API } /// - /// Broadcast a newly recieved search response. + /// Broadcast a newly received search response. /// /// The hub. /// The ID of the search associated with the response. -- cgit v1.2.3