Fix implicit profiles being created when opening a reader
- Fix default profiles not being marked as such when creating an account - Mention that no implicit profiles are created for pdfs
This commit is contained in:
parent
a67e15bbb3
commit
643c499f16
5 changed files with 20 additions and 14 deletions
|
|
@ -154,7 +154,7 @@ public class AccountController : BaseApiController
|
|||
AddDefaultStreamsToUser(user);
|
||||
|
||||
// Assign default reading profile
|
||||
AddDefaultReadingProfileToUser(user);
|
||||
await AddDefaultReadingProfileToUser(user);
|
||||
|
||||
var token = await _userManager.GenerateEmailConfirmationTokenAsync(user);
|
||||
if (string.IsNullOrEmpty(token)) return BadRequest(await _localizationService.Get("en", "confirm-token-gen"));
|
||||
|
|
@ -673,7 +673,7 @@ public class AccountController : BaseApiController
|
|||
AddDefaultStreamsToUser(user);
|
||||
|
||||
// Assign default reading profile
|
||||
AddDefaultReadingProfileToUser(user);
|
||||
await AddDefaultReadingProfileToUser(user);
|
||||
|
||||
// Assign Roles
|
||||
var roles = dto.Roles;
|
||||
|
|
@ -785,17 +785,15 @@ public class AccountController : BaseApiController
|
|||
}
|
||||
}
|
||||
|
||||
private void AddDefaultReadingProfileToUser(AppUser user)
|
||||
private async Task AddDefaultReadingProfileToUser(AppUser user)
|
||||
{
|
||||
var profile = new AppUserReadingProfileBuilder(user.Id)
|
||||
.WithName("Default Profile")
|
||||
.Build();
|
||||
_unitOfWork.AppUserReadingProfileRepository.Attach(profile);
|
||||
_unitOfWork.AppUserReadingProfileRepository.Add(profile);
|
||||
await _unitOfWork.CommitAsync();
|
||||
|
||||
user.UserPreferences.ReadingProfiles.Add(profile);
|
||||
// TODO: This doesn't save, but I've had to revert it having the full entity or everything would start failing
|
||||
// in tests because of foreign key constrains. This HAS to be resolved as the code does expect there to always be a
|
||||
// default profile
|
||||
user.UserPreferences.DefaultReadingProfileId = profile.Id;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -128,6 +128,7 @@ public class ReadingProfileService(IUnitOfWork unitOfWork, ILocalizationService
|
|||
var newProfile = new AppUserReadingProfileBuilder(user.Id).Build();
|
||||
UpdateReaderProfileFields(newProfile, dto);
|
||||
unitOfWork.AppUserReadingProfileRepository.Add(newProfile);
|
||||
user.UserPreferences.ReadingProfiles.Add(newProfile);
|
||||
|
||||
await unitOfWork.CommitAsync();
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import {
|
|||
Output
|
||||
} from '@angular/core';
|
||||
import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';
|
||||
import { take } from 'rxjs';
|
||||
import {skip, take} from 'rxjs';
|
||||
import { BookPageLayoutMode } from 'src/app/_models/readers/book-page-layout-mode';
|
||||
import { BookTheme } from 'src/app/_models/preferences/book-theme';
|
||||
import { ReadingDirection } from 'src/app/_models/preferences/reading-direction';
|
||||
|
|
@ -210,7 +210,7 @@ export class ReaderSettingsComponent implements OnInit {
|
|||
|
||||
this.setupSettings();
|
||||
|
||||
this.setTheme(this.readingProfile.bookReaderThemeName || this.themeService.defaultBookTheme);
|
||||
this.setTheme(this.readingProfile.bookReaderThemeName || this.themeService.defaultBookTheme, false);
|
||||
this.cdRef.markForCheck();
|
||||
|
||||
// Emit first time so book reader gets the setting
|
||||
|
|
@ -288,6 +288,7 @@ export class ReaderSettingsComponent implements OnInit {
|
|||
this.settingsForm.valueChanges.pipe(
|
||||
debounceTime(300),
|
||||
distinctUntilChanged(),
|
||||
skip(1), // Skip the initial creation of the form, we do not want an implicit profile of this snapshot
|
||||
takeUntilDestroyed(this.destroyRef),
|
||||
tap(_ => this.updateImplicit())
|
||||
).subscribe();
|
||||
|
|
@ -346,13 +347,16 @@ export class ReaderSettingsComponent implements OnInit {
|
|||
};
|
||||
}
|
||||
|
||||
setTheme(themeName: string) {
|
||||
setTheme(themeName: string, update: boolean = true) {
|
||||
const theme = this.themes.find(t => t.name === themeName);
|
||||
this.activeTheme = theme;
|
||||
this.cdRef.markForCheck();
|
||||
this.colorThemeUpdate.emit(theme);
|
||||
|
||||
if (update) {
|
||||
this.updateImplicit();
|
||||
}
|
||||
}
|
||||
|
||||
toggleReadingDirection() {
|
||||
if (this.readingDirectionModel === ReadingDirection.LeftToRight) {
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import {
|
|||
merge,
|
||||
Observable,
|
||||
ReplaySubject,
|
||||
skip,
|
||||
Subject,
|
||||
take,
|
||||
tap
|
||||
|
|
@ -616,11 +617,11 @@ export class MangaReaderComponent implements OnInit, AfterViewInit, OnDestroy {
|
|||
|
||||
this.init();
|
||||
|
||||
// TODO: Fix this, it's going off way too often
|
||||
// Update implicit reading profile while changing settings
|
||||
this.generalSettingsForm.valueChanges.pipe(
|
||||
debounceTime(300),
|
||||
distinctUntilChanged(),
|
||||
skip(1), // Skip the initial creation of the form, we do not want an implicit profile of this snapshot
|
||||
takeUntilDestroyed(this.destroyRef),
|
||||
map(_ => this.packReadingProfile()),
|
||||
distinctUntilChanged(),
|
||||
|
|
@ -821,7 +822,9 @@ export class MangaReaderComponent implements OnInit, AfterViewInit, OnDestroy {
|
|||
|
||||
disableDoubleRendererIfScreenTooSmall() {
|
||||
if (window.innerWidth > window.innerHeight) {
|
||||
if (this.generalSettingsForm.get('layoutMode')?.disabled) {
|
||||
this.generalSettingsForm.get('layoutMode')?.enable();
|
||||
}
|
||||
this.cdRef.markForCheck();
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2803,7 +2803,7 @@
|
|||
|
||||
"manage-reading-profiles": {
|
||||
"description": "Not all your series may be read in the same way, set up distinct reading profiles per library or series to make getting back in your series as seamless as possible.",
|
||||
"extra-tip": "Assign reading profiles via the action menu on series and libraries, or in bulk. When changing settings in a reader, a hidden profile is created that remembers your choices for that series. This profile is removed when you assign or update one of your own reading profiles to the series.",
|
||||
"extra-tip": "Assign reading profiles via the action menu on series and libraries, or in bulk. When changing settings in a reader, a hidden profile is created that remembers your choices for that series (not for pdfs). This profile is removed when you assign or update one of your own reading profiles to the series.",
|
||||
"profiles-title": "Your reading profiles",
|
||||
"default-profile": "Default",
|
||||
"add": "{{common.add}}",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue