[backend] Switch params methods to IEnumerable<T>

This commit is contained in:
Laura Hausmann 2024-09-20 20:41:15 +02:00
parent b49be2f904
commit 6c76b2b2c5
No known key found for this signature in database
GPG key ID: D044E84C5BE01605
4 changed files with 5 additions and 5 deletions

View file

@ -31,7 +31,7 @@ public class ActivityDeliverService(
// @formatter:on // @formatter:on
} }
public async Task DeliverToAsync(ASActivity activity, User actor, params User[] recipients) public async Task DeliverToAsync(ASActivity activity, User actor, params IEnumerable<User> recipients)
{ {
logger.LogDebug("Queuing deliver-to-recipients jobs for activity {id}", activity.Id); logger.LogDebug("Queuing deliver-to-recipients jobs for activity {id}", activity.Id);
if (activity.Actor == null) throw new Exception("Actor must not be null"); if (activity.Actor == null) throw new Exception("Actor must not be null");

View file

@ -93,7 +93,7 @@ public class BackgroundTaskQueue(int parallelism)
else else
{ {
var storageSvc = scope.GetRequiredService<ObjectStorageService>(); var storageSvc = scope.GetRequiredService<ObjectStorageService>();
await storageSvc.RemoveFilesAsync(paths.Where(p => p != null).Select(p => p!).ToArray()); await storageSvc.RemoveFilesAsync(paths.Where(p => p != null).Select(p => p!));
} }
} }
@ -152,7 +152,7 @@ public class BackgroundTaskQueue(int parallelism)
var rendered = await noteRenderer.RenderAsync(note); var rendered = await noteRenderer.RenderAsync(note);
var activity = ActivityPub.ActivityRenderer.RenderUpdate(rendered, actor); var activity = ActivityPub.ActivityRenderer.RenderUpdate(rendered, actor);
await deliverSvc.DeliverToAsync(activity, note.User, voters.ToArray()); await deliverSvc.DeliverToAsync(activity, note.User, voters);
} }
} }

View file

@ -710,7 +710,7 @@ public class NoteService(
// @formatter:on // @formatter:on
if (note.Visibility == Note.NoteVisibility.Specified) if (note.Visibility == Note.NoteVisibility.Specified)
await deliverSvc.DeliverToAsync(activity, note.User, recipients.ToArray()); await deliverSvc.DeliverToAsync(activity, note.User, recipients);
else else
await deliverSvc.DeliverToFollowersAsync(activity, note.User, recipients); await deliverSvc.DeliverToFollowersAsync(activity, note.User, recipients);
} }

View file

@ -120,7 +120,7 @@ public class ObjectStorageService(IOptions<Config.StorageSection> config, HttpCl
} }
} }
public async Task RemoveFilesAsync(params string[] filenames) public async Task RemoveFilesAsync(params IEnumerable<string> filenames)
{ {
if (_bucket == null) if (_bucket == null)
throw new Exception("Refusing to remove file from object storage with invalid configuration"); throw new Exception("Refusing to remove file from object storage with invalid configuration");