Issues gitea 2.0

This commit is contained in:
knuthtimo-lab 2026-01-15 21:35:49 +01:00
parent 09e7ce59a9
commit 447027db2b
4 changed files with 18 additions and 14 deletions

View File

@ -31,10 +31,11 @@
<a routerLink="/details-user/{{ listingUser.id }}" <a routerLink="/details-user/{{ listingUser.id }}"
class="text-primary-600 dark:text-primary-500 hover:underline">{{ listingUser.firstname }} {{ class="text-primary-600 dark:text-primary-500 hover:underline">{{ listingUser.firstname }} {{
listingUser.lastname }}</a> listingUser.lastname }}</a>
<img *ngIf="listing.imageName" <div class="relative w-[100px] h-[30px] mr-5 lg:mb-0" *ngIf="listing.imageName">
ngSrc="{{ env.imageBaseUrl }}/pictures/logo/{{ listing.imageName }}.avif?_ts={{ ts }}" <img ngSrc="{{ env.imageBaseUrl }}/pictures/logo/{{ listing.imageName }}.avif?_ts={{ ts }}" fill
class="mr-5 lg:mb-0" style="max-height: 30px; max-width: 100px" width="100" height="30" class="object-contain"
alt="Business logo for {{ listingUser.firstname }} {{ listingUser.lastname }}" /> alt="Business logo for {{ listingUser.firstname }} {{ listingUser.lastname }}" />
</div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -32,10 +32,11 @@
<a [routerLink]="['/details-user', detail.user.id]" <a [routerLink]="['/details-user', detail.user.id]"
class="text-primary-600 dark:text-primary-500 hover:underline"> {{ detail.user.firstname }} {{ class="text-primary-600 dark:text-primary-500 hover:underline"> {{ detail.user.firstname }} {{
detail.user.lastname }} </a> detail.user.lastname }} </a>
<img *ngIf="detail.user.hasCompanyLogo" <div class="relative w-[100px] h-[30px] mr-5 lg:mb-0" *ngIf="detail.user.hasCompanyLogo">
[ngSrc]="detail.imageBaseUrl + '/pictures/logo/' + detail.imagePath + '.avif?_ts=' + detail.ts" <img [ngSrc]="detail.imageBaseUrl + '/pictures/logo/' + detail.imagePath + '.avif?_ts=' + detail.ts"
class="mr-5 lg:mb-0" style="max-height: 30px; max-width: 100px" width="100" height="30" fill class="object-contain"
alt="Company logo for {{ detail.user.firstname }} {{ detail.user.lastname }}" /> alt="Company logo for {{ detail.user.firstname }} {{ detail.user.lastname }}" />
</div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -35,8 +35,10 @@
</p> </p>
</div> </div>
@if(user.hasCompanyLogo){ @if(user.hasCompanyLogo){
<img ngSrc="{{ env.imageBaseUrl }}/pictures/logo/{{ emailToDirName(user.email) }}.avif?_ts={{ ts }}" <div class="relative w-14 h-14">
class="w-14 h-14 object-contain" width="56" height="56" alt="Company logo of {{ user.companyName }}" /> <img ngSrc="{{ env.imageBaseUrl }}/pictures/logo/{{ emailToDirName(user.email) }}.avif?_ts={{ ts }}" fill
class="object-contain" alt="Company logo of {{ user.companyName }}" />
</div>
} }
<!-- <img src="https://placehold.co/45x60" class="w-11 h-14" /> --> <!-- <img src="https://placehold.co/45x60" class="w-11 h-14" /> -->
</div> </div>

View File

@ -183,11 +183,8 @@ export class AuthService {
return Promise.resolve(); return Promise.resolve();
} }
isAdmin(): Observable<boolean> { isAdmin(): Observable<boolean> {
return this.getUserRole().pipe( return this.userRole$.pipe(
map(role => role === 'admin'), map(role => role === 'admin'),
// take(1) ist optional - es beendet die Subscription, nachdem ein Wert geliefert wurde
// Nützlich, wenn du die Methode in einem Template mit dem async pipe verwendest
take(1),
); );
} }
// Get current user's role from the server with caching // Get current user's role from the server with caching
@ -196,6 +193,9 @@ export class AuthService {
// Cache zurücksetzen, wenn die Caching-Zeit abgelaufen ist oder kein Cache existiert // Cache zurücksetzen, wenn die Caching-Zeit abgelaufen ist oder kein Cache existiert
if (!this.cachedUserRole$ || now - this.lastCacheTime > this.cacheDuration) { if (!this.cachedUserRole$ || now - this.lastCacheTime > this.cacheDuration) {
if (!this.getLocalStorageItem('authToken')) {
return of(null);
}
this.lastCacheTime = now; this.lastCacheTime = now;
let headers = new HttpHeaders().set('X-Hide-Loading', 'true').set('Accept-Language', 'en-US'); let headers = new HttpHeaders().set('X-Hide-Loading', 'true').set('Accept-Language', 'en-US');
this.cachedUserRole$ = this.http.get<{ role: UserRole | null }>(`${environment.apiBaseUrl}/bizmatch/auth/me/role`, { headers }).pipe( this.cachedUserRole$ = this.http.get<{ role: UserRole | null }>(`${environment.apiBaseUrl}/bizmatch/auth/me/role`, { headers }).pipe(