More Polish (#2320)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
Joe Milazzo 2023-10-17 11:05:14 -05:00 committed by GitHub
parent cd3a15fa3b
commit 5f11973696
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
34 changed files with 337 additions and 161 deletions

View file

@ -124,7 +124,7 @@ public class StreamService : IStreamService
var stream = user?.DashboardStreams.FirstOrDefault(d => d.Id == dto.Id);
if (stream == null)
throw new KavitaException(await _localizationService.Translate(userId, "dashboard-stream-doesnt-exist"));
if (stream.Order == dto.ToPosition) return ;
if (stream.Order == dto.ToPosition) return;
var list = user!.DashboardStreams.ToList();
ReorderItems(list, stream.Id, dto.ToPosition);
@ -132,6 +132,7 @@ public class StreamService : IStreamService
_unitOfWork.UserRepository.Update(user);
await _unitOfWork.CommitAsync();
if (!stream.Visible) return;
await _eventHub.SendMessageToAsync(MessageFactory.DashboardUpdate, MessageFactory.DashboardUpdateEvent(user.Id),
user.Id);
}
@ -264,9 +265,10 @@ public class StreamService : IStreamService
var list = user!.SideNavStreams.ToList();
ReorderItems(list, stream.Id, dto.ToPosition);
user.SideNavStreams = list;
_unitOfWork.UserRepository.Update(user);
await _unitOfWork.CommitAsync();
if (!stream.Visible) return;
await _eventHub.SendMessageToAsync(MessageFactory.SideNavUpdate, MessageFactory.SideNavUpdateEvent(userId),
userId);
}