Polish Round 2 (#2845)

This commit is contained in:
Joe Milazzo 2024-04-11 17:01:34 -05:00 committed by GitHub
parent c47fec4648
commit 5195f08c2f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 63 additions and 22 deletions

View file

@ -108,7 +108,7 @@ public class DeviceService : IDeviceService
public async Task<bool> SendTo(IReadOnlyList<int> chapterIds, int deviceId)
{
var settings = await _unitOfWork.SettingsRepository.GetSettingsDtoAsync();
if (!settings.IsEmailSetup())
if (!settings.IsEmailSetupForSendToDevice())
throw new KavitaException("send-to-kavita-email");
var device = await _unitOfWork.DeviceRepository.GetDeviceById(deviceId);
@ -123,9 +123,16 @@ public class DeviceService : IDeviceService
throw new KavitaException("send-to-size-limit");
device.UpdateLastUsed();
_unitOfWork.DeviceRepository.Update(device);
await _unitOfWork.CommitAsync();
try
{
device.UpdateLastUsed();
_unitOfWork.DeviceRepository.Update(device);
await _unitOfWork.CommitAsync();
}
catch (Exception ex)
{
_logger.LogError(ex, "There was an issue updating device last used time");
}
var success = await _emailService.SendFilesToEmail(new SendToDto()
{