Skip to content

Kavita is a fast, feature rich, cross platform reading server. Built with the goal of being a full solution for all your reading needs. Setup your own server and share your reading collection with your friends and family.

Removed showing toasts when series are added to the server since cards will show automatically. Hide events widget unless you're an admin. Changed an API signature to match the data that's being sent back. (#979)

Joseph Milazzo52ab01571b4c
diff --git a/API/Controllers/SeriesController.cs b/API/Controllers/SeriesController.cs
index ad2faeb0f..6787c9142 100644
--- a/API/Controllers/SeriesController.cs
+++ b/API/Controllers/SeriesController.cs
@@ -148,7 +148,7 @@ namespace API.Controllers
}
[HttpGet("chapter")]
- public async Task<ActionResult<VolumeDto>> GetChapter(int chapterId)
+ public async Task<ActionResult<ChapterDto>> GetChapter(int chapterId)
{
return Ok(await _unitOfWork.ChapterRepository.GetChapterDtoAsync(chapterId));
}
diff --git a/UI/Web/src/app/_services/message-hub.service.ts b/UI/Web/src/app/_services/message-hub.service.ts
index 259f2a4c1..bd0994f29 100644
--- a/UI/Web/src/app/_services/message-hub.service.ts
+++ b/UI/Web/src/app/_services/message-hub.service.ts
@@ -143,10 +143,6 @@ export class MessageHubService {
payload: resp.body
});
this.seriesAdded.emit(resp.body);
- // Don't show the toast when user has reader open
- if (this.isAdmin && this.router.url.match(/\d+\/manga|book\/\d+/gi) !== null) {
- this.toastr.info('Series ' + (resp.body as SeriesAddedEvent).seriesName + ' added');
- }
});
this.hubConnection.on(EVENTS.SeriesRemoved, resp => {
diff --git a/UI/Web/src/app/nav-events-toggle/nav-events-toggle.component.html b/UI/Web/src/app/nav-events-toggle/nav-events-toggle.component.html
index 69be1191f..4ff6c8643 100644
--- a/UI/Web/src/app/nav-events-toggle/nav-events-toggle.component.html
+++ b/UI/Web/src/app/nav-events-toggle/nav-events-toggle.component.html
@@ -1,4 +1,4 @@
-<ng-container>
+<ng-container *ngIf="isAdmin">
<button type="button" class="btn btn-icon {{(progressEventsSource.getValue().length > 0 || updateAvailable) ? 'colored' : ''}}"
[ngbPopover]="popContent" title="Activity" placement="bottom" [popoverClass]="'nav-events'">
diff --git a/UI/Web/src/app/nav-events-toggle/nav-events-toggle.component.ts b/UI/Web/src/app/nav-events-toggle/nav-events-toggle.component.ts
index 294f1a9b0..05fa2eda2 100644
--- a/UI/Web/src/app/nav-events-toggle/nav-events-toggle.component.ts
+++ b/UI/Web/src/app/nav-events-toggle/nav-events-toggle.component.ts
@@ -5,6 +5,7 @@ import { takeUntil } from 'rxjs/operators';
import { UpdateNotificationModalComponent } from '../shared/update-notification/update-notification-modal.component';
import { ProgressEvent } from '../_models/events/scan-library-progress-event';
import { User } from '../_models/user';
+import { AccountService } from '../_services/account.service';
import { LibraryService } from '../_services/library.service';
import { EVENTS, Message, MessageHubService } from '../_services/message-hub.service';
@@ -28,6 +29,7 @@ const acceptedEvents = [EVENTS.ScanLibraryProgress, EVENTS.RefreshMetadataProgre
export class NavEventsToggleComponent implements OnInit, OnDestroy {
@Input() user!: User;
+ isAdmin: boolean = false;
private readonly onDestroy = new Subject<void>();
@@ -41,7 +43,7 @@ export class NavEventsToggleComponent implements OnInit, OnDestroy {
updateBody: any;
private updateNotificationModalRef: NgbModalRef | null = null;
- constructor(private messageHub: MessageHubService, private libraryService: LibraryService, private modalService: NgbModal) { }
+ constructor(private messageHub: MessageHubService, private libraryService: LibraryService, private modalService: NgbModal, private accountService: AccountService) { }
ngOnDestroy(): void {
this.onDestroy.next();
@@ -58,6 +60,13 @@ export class NavEventsToggleComponent implements OnInit, OnDestroy {
this.updateBody = event.payload;
}
});
+ this.accountService.currentUser$.pipe(takeUntil(this.onDestroy)).subscribe(user => {
+ if (user) {
+ this.isAdmin = this.accountService.hasAdminRole(user);
+ } else {
+ this.isAdmin = false;
+ }
+ });
}