diff options
| author | JP Dillingham <jp@dillingham.me> | 2024-12-17 14:27:41 -0600 |
|---|---|---|
| committer | JP Dillingham <jp@dillingham.me> | 2024-12-17 14:27:41 -0600 |
| commit | 57d560e91247dc27a9b70bed8f4acafcbb9e03b1 (patch) | |
| tree | 87832c31f87088a106c46c2eaee6fc197107799e /src | |
| parent | 20bcd7e388a4dc14f95579f08198e82a1c6ac35c (diff) | |
| download | slskd-57d560e91247dc27a9b70bed8f4acafcbb9e03b1.tar.gz | |
explicitly exclude search responses when broadcasting
Diffstat (limited to 'src')
| -rw-r--r-- | src/slskd/Search/API/Hubs/SearchHub.cs | 29 |
1 files changed, 25 insertions, 4 deletions
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 /// <summary> /// Broadcast an update for a search. /// </summary> + /// <remarks> + /// Responses are removed prior to sending. + /// </remarks> /// <param name="hub">The hub.</param> /// <param name="search">The search to broadcast.</param> /// <returns>The operation context.</returns> public static Task BroadcastUpdateAsync(this IHubContext<SearchHub> hub, Search search) { - return hub.Clients.All.SendAsync(SearchHubMethods.Update, search); + return hub.Clients.All.SendAsync(SearchHubMethods.Update, search with { Responses = null }); } /// <summary> - /// Broadcast the present application options. + /// Broadcast a newly recieved search response. /// </summary> /// <param name="hub">The hub.</param> /// <param name="searchId">The ID of the search associated with the response.</param> @@ -59,14 +62,32 @@ namespace slskd.Search.API return hub.Clients.All.SendAsync(SearchHubMethods.Response, new { searchId, response }); } + /// <summary> + /// Broadcast the creation of a new search. + /// </summary> + /// <remarks> + /// Responses are removed prior to sending. + /// </remarks> + /// <param name="hub">The hub.</param> + /// <param name="search">The search to broadcast.</param> + /// <returns>The operation context.</returns> public static Task BroadcastCreateAsync(this IHubContext<SearchHub> hub, Search search) { - return hub.Clients.All.SendAsync(SearchHubMethods.Create, search); + return hub.Clients.All.SendAsync(SearchHubMethods.Create, search with { Responses = null }); } + /// <summary> + /// Broadcast the deletion of a search. + /// </summary> + /// <remarks> + /// Responses are removed prior to sending. + /// </remarks> + /// <param name="hub">The hub.</param> + /// <param name="search">The search to broadcast.</param> + /// <returns>The operation context.</returns> public static Task BroadcastDeleteAsync(this IHubContext<SearchHub> hub, Search search) { - return hub.Clients.All.SendAsync(SearchHubMethods.Delete, search); + return hub.Clients.All.SendAsync(SearchHubMethods.Delete, search with { Responses = null }); } } |
