Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide empty space if three dot menu is not shown #3590

Merged
merged 6 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -150,14 +150,21 @@ <h2>{{ 'Participants' | translate }}</h2>
</div>

<!-- Menu -->
<div *osScrollingTableCell="'menu'; row as user; config: { width: 40 }" class="cell-slot fill">
<div
*osScrollingTableCell="
'menu';
row as user;
config: { width: 40 };
isHidden: !canSeeItemMenu() && viewport.isMobileSubject
"
class="cell-slot"
>
<button
mat-icon-button
[disabled]="isMultiSelect"
[matMenuTriggerFor]="singleItemMenu"
(click)="$event.stopPropagation()"
[matMenuTriggerData]="{ user: user }"
*ngIf="canSeeSingleItemMenu(user) || (viewport.isMobileSubject | async)"
>
<mat-icon>more_vert</mat-icon>
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,7 @@ export class ParticipantListComponent extends BaseMeetingListViewComponent<ViewU
public canChangePassword(user: ViewUser): boolean {
const userOML = user?.organization_management_level;
const sufficientOML = userOML ? this.operator.hasOrganizationPermissions(userOML as OML) : true;
return (
!user?.saml_id &&
this.userService.isAllowed(`changePassword`, user.id === this.operator.user.id) &&
sufficientOML
);
return !user?.saml_id && this.userService.isAllowed(`changePassword`, false) && sufficientOML;
}

public isUserPresent(user: ViewUser): boolean {
Expand Down Expand Up @@ -458,8 +454,8 @@ export class ParticipantListComponent extends BaseMeetingListViewComponent<ViewU
await this.repo.removeUsersFromMeeting([user]);
}

public canSeeSingleItemMenu(user: ViewUser): boolean {
return this.operator.hasPerms(Permission.userCanUpdate) || this.canChangePassword(user);
public canSeeItemMenu(): boolean {
return this.operator.hasPerms(Permission.userCanUpdate);
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { TemplatePortal } from '@angular/cdk/portal';
import { Directive, Input, OnInit, TemplateRef, ViewContainerRef } from '@angular/core';
import { Directive, Input, OnDestroy, OnInit, TemplateRef, ViewContainerRef } from '@angular/core';
import { Observable, Subscription } from 'rxjs';

import { ScrollingTableManageService } from '../services';
import { ScrollingTableCellDefConfig } from './scrolling-table-cell-config';
Expand All @@ -9,7 +10,7 @@ import { ScrollingTableCellPosition } from './scrolling-table-cell-position';
@Directive({
selector: `[osScrollingTableCell]`
})
export class ScrollingTableCellDirective implements OnInit, ScrollingTableCellDefinition {
export class ScrollingTableCellDirective implements OnInit, OnDestroy, ScrollingTableCellDefinition {
@Input()
public set osScrollingTableCell(property: string) {
this._property = property;
Expand All @@ -22,8 +23,18 @@ export class ScrollingTableCellDirective implements OnInit, ScrollingTableCellDe
}

@Input()
public set osScrollingTableCellIsHidden(isHidden: boolean) {
this._isHidden = isHidden;
public set osScrollingTableCellIsHidden(isHidden: boolean | Observable<boolean>) {
if (this.isHiddenSubscription) {
this.isHiddenSubscription.unsubscribe();
}
if (typeof isHidden == `boolean`) {
this.isHiddenSubscription = null;
this._isHidden = isHidden;
} else {
isHidden.subscribe(isMobileView => {
this._isHidden = !isMobileView;
});
bastianjoel marked this conversation as resolved.
Show resolved Hide resolved
}
}

@Input()
Expand Down Expand Up @@ -81,6 +92,7 @@ export class ScrollingTableCellDirective implements OnInit, ScrollingTableCellDe
private _property = ``;
private _labelString = ``;
private _isDefault = false;
private isHiddenSubscription: Subscription | null = null;

public constructor(
public readonly template: TemplateRef<any>,
Expand All @@ -96,6 +108,12 @@ export class ScrollingTableCellDirective implements OnInit, ScrollingTableCellDe
}
}

public ngOnDestroy(): void {
if (this.isHiddenSubscription) {
this.isHiddenSubscription.unsubscribe();
}
}

private render(): void {
const { width, minWidth, maxWidth } = this._config;
if (width) {
Expand Down
Loading