Skip to content

Commit

Permalink
Merge branch 'main' into global-search
Browse files Browse the repository at this point in the history
  • Loading branch information
Bastian Rihm authored and Bastian Rihm committed May 2, 2023
2 parents dea15b8 + d595307 commit f8773d0
Show file tree
Hide file tree
Showing 158 changed files with 2,630 additions and 868 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Start dev setup
run: make run-dev ARGS="-d"
- name: Wait for dev setup
uses: iFaxity/wait-on-action@v1
uses: iFaxity/wait-on-action@v1.1.0
with:
resource: https://localhost:8000
timeout: 300000
Expand All @@ -50,7 +50,7 @@ jobs:
build-and-check-dev-image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: create docker dev image
run: make build-dev
Expand All @@ -67,7 +67,7 @@ jobs:
build-and-test-prod-image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Build prod image
run: make build-prod
11 changes: 8 additions & 3 deletions .github/workflows/set-project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,13 @@ jobs:
name: 'Set project'
runs-on: ubuntu-latest
steps:
- name: Set project
uses: actions/[email protected]
- uses: tibdex/github-app-token@v1
id: generate-token
with:
app_id: ${{ secrets.AUTOMATION_APP_ID }}
private_key: ${{ secrets.AUTOMATION_APP_PRIVATE_KEY }}

- uses: actions/[email protected]
with:
project-url: https://github.com/orgs/OpenSlides/projects/2
github-token: ${{ secrets.ISSUE_AND_PR_PAT }}
github-token: ${{ steps.generate-token.outputs.token }}
6 changes: 6 additions & 0 deletions client/cli/get-available-languages.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/**
* Helper script to print a comma-separated list of all available translations.
*/
import { availableTranslations } from 'src/app/domain/definitions/languages';

console.log(Object.keys(availableTranslations).join(`,`));
8 changes: 5 additions & 3 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@
"cleanup": "npm run prettify-write && npm run lint-write",
"prettify-check": "prettier --list-different \"src/{app,environments}/**/*{.js,.json,.css,.scss}\" cli/*{.ts,.json} \"tests/**/*.ts\"",
"prettify-write": "prettier --list-different --write \"src/{app,environments}/**/*{.js,.json,.css,.scss}\" cli/*{.ts,.json} \"tests/**/*.ts\"",
"generate-defaults": "ts-node -s -r tsconfig-paths/register cli/generate-settings-defaults.ts && prettier --write src/app/domain/definitions/meeting-settings-defaults.ts",
"generate-permissions": "ts-node -s -r tsconfig-paths/register cli/generate-permissions.ts && prettier --write src/app/domain/definitions/permission*.ts",
"generate-models": "ts-node -s -r tsconfig-paths/register cli/generate-models.ts && ng lint --fix --lint-file-patterns=src/app/domain/models/**/*.ts"
"ts": "ts-node -s -r tsconfig-paths/register",
"generate-defaults": "npm run ts -- cli/generate-settings-defaults.ts && prettier --write src/app/domain/definitions/meeting-settings-defaults.ts",
"generate-permissions": "npm run ts -- cli/generate-permissions.ts && prettier --write src/app/domain/definitions/permission*.ts",
"generate-models": "npm run ts -- cli/generate-models.ts && ng lint --fix --lint-file-patterns=src/app/domain/models/**/*.ts",
"get-available-languages": "npm run ts -- cli/get-available-languages.ts"
},
"dependencies": {
"@angular/animations": "^14.3.0",
Expand Down
8 changes: 8 additions & 0 deletions client/src/app/domain/definitions/languages.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export const availableTranslations = {
en: `English`,
de: `Deutsch`,
cs: `Čeština`,
it: `Italiano`,
es: `Español`,
ru: `русский`
};
3 changes: 3 additions & 0 deletions client/src/app/domain/models/meetings/meeting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export class Settings {
// in the committee-list-view is finished.
public is_template!: boolean; // Unique within a committee
public enable_anonymous!: boolean;
public language!: boolean;

// Jitsi/Livestream settings
public jitsi_domain!: string;
Expand Down Expand Up @@ -288,6 +289,7 @@ export class Meeting extends BaseModel<Meeting> {
`start_time`,
`end_time`,
`imported_at`,
`language`,
`jitsi_domain`,
`jitsi_room_name`,
`jitsi_room_password`,
Expand Down Expand Up @@ -414,6 +416,7 @@ export class Meeting extends BaseModel<Meeting> {
`poll_default_100_percent_base`,
`poll_default_group_ids`,
`poll_default_backend`,
`topic_poll_default_group_ids`,
`projector_ids`,
`all_projection_ids`,
`projector_message_ids`,
Expand Down
2 changes: 2 additions & 0 deletions client/src/app/domain/models/organizations/organization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export class OrganizationSetting {
public enable_chat!: boolean;
public limit_of_meetings!: number;
public limit_of_users!: number;
public default_language!: string;

public users_email_sender!: string; // default: OpenSlides
public users_email_subject!: string; // default: OpenSlides access data
Expand Down Expand Up @@ -59,6 +60,7 @@ export class Organization extends BaseModel<Organization> {
`enable_chat`,
`limit_of_meetings`,
`limit_of_users`,
`default_language`,
`committee_ids`,
`active_meeting_ids`,
`archived_meeting_ids`,
Expand Down
3 changes: 0 additions & 3 deletions client/src/app/domain/models/poll/poll-constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ export enum PollClassType {
}

export enum PollColor {
yes = `#4caf50`,
no = `#cc6c5b`,
abstain = `#a6a6a6`,
votesvalid = `#e2e2e2`,
votesinvalid = `#e2e2e2`,
votescast = `#e2e2e2`
Expand Down
13 changes: 12 additions & 1 deletion client/src/app/domain/models/theme/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ export interface ThemeOptionalValues {
warn_a700?: HtmlColor;
}

export interface ThemeGeneralColors {
headbar: HtmlColor;
yes: HtmlColor;
no: HtmlColor;
abstain: HtmlColor;
}

// export class ThemeRequiredValues {
// // Required
// public name!: string;
Expand Down Expand Up @@ -158,9 +165,13 @@ export class Theme extends BaseModel {
`warn_a200`,
`warn_a400`,
`warn_a700`,
`headbar`,
`yes`,
`no`,
`abstain`,
`theme_for_organization_id`,
`organization_id`
];
}

export interface Theme extends ThemeRequiredValues, ThemeOptionalValues {}
export interface Theme extends ThemeRequiredValues, ThemeOptionalValues, Partial<ThemeGeneralColors> {}
1 change: 1 addition & 0 deletions client/src/app/domain/models/topics/topic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export class Topic extends BaseModel<Topic> {
`agenda_item_id`,
`list_of_speakers_id`,
`tag_ids`,
`poll_ids`,
`meeting_id`
];
}
Expand Down
2 changes: 1 addition & 1 deletion client/src/app/domain/models/users/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { BaseDecimalModel } from '../base/base-decimal-model';
export type UserSortProperty = 'first_name' | 'last_name' | 'number';

/**
* Iterable pre selection of genders (sexes)
* Iterable pre selection of genders
*/
export const GENDERS = [_(`female`), _(`male`), _(`diverse`)];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ export class PdfDocumentService {
*/
public createTitle(title: string): object {
return {
text: this.translate.instant(title),
text: title,
style: `title`
};
}
Expand Down
6 changes: 4 additions & 2 deletions client/src/app/gateways/notify.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,7 @@ export class NotifyService extends BaseICCGatewayService<ChannelIdResponse | Not
const notify: NotifyRequest<T> = {
name: data.name,
message: data.message,
channel_id: this.channelId,
to_meeting: this.activeMeetingIdService.meetingId!
channel_id: this.channelId
};
if (data.toAll === true) {
notify.to_all = true;
Expand All @@ -207,6 +206,9 @@ export class NotifyService extends BaseICCGatewayService<ChannelIdResponse | Not
if (data.channels) {
notify.to_channels = data.channels;
}
if (!(data.channels || data.toAll == true || data.users)) {
notify.to_meeting = this.activeMeetingIdService.meetingId!;
}
return notify;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class GroupRepositoryService extends BaseMeetingRelatedRepository<ViewGro
public getNameForIds(...ids: number[]): string {
return this.getSortedViewModelList()
.filter(group => ids.includes(group.id))
.map(group => this.translate.instant(group.getTitle()))
.map(group => group.getTitle())
.join(`, `);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ export class MeetingRepositoryService extends BaseRepository<ViewMeeting, Meetin
`default_meeting_for_committee_id`,
`jitsi_domain`,
`jitsi_room_name`,
`jitsi_room_password`
`jitsi_room_password`,
`language`
];
const groupFields: TypedFieldset<Meeting> = [`admin_group_id`, `default_group_id`];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ import { MotionCategoryAction } from './motion-category.action';
export class MotionCategoryRepositoryService extends BaseMeetingRelatedRepository<ViewMotionCategory, MotionCategory> {
constructor(repositoryServiceCollector: RepositoryMeetingServiceCollectorService) {
super(repositoryServiceCollector, MotionCategory);

this.setSortFunction((a, b) => a.weight - b.weight);
}

public create(...categories: Partial<MotionCategory>[]): Promise<Identifiable[]> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,9 @@ export class MotionRepositoryService extends BaseAgendaItemAndListOfSpeakersCont
}

private getUpdatePayload(update: any, viewMotion: Motion & { workflow_id: Id }): any {
const ownMotion = this.getViewModel(viewMotion.id);
const updatePayload = Object.keys(update).mapToObject(key => {
if (JSON.stringify(update[key]) !== JSON.stringify(viewMotion[key as keyof Motion & { workflow_id: Id }])) {
if (JSON.stringify(update[key]) !== JSON.stringify(ownMotion[key as keyof Motion & { workflow_id: Id }])) {
return { [key]: update[key] };
}
return {};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ export class OrganizationRepositoryService extends BaseRepository<ViewOrganizati
`users_email_body`,
`users_email_replyto`,
`users_email_sender`,
`users_email_subject`
`users_email_subject`,
`default_language`
);
return {
...super.getFieldsets(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,13 @@ export class UserRepositoryService extends BaseRepository<ViewUser, User> {
{ templateField: `structure_level_$` },
{ templateField: `number_$` },
{ templateField: `comment_$` },
{ templateField: `group_$_ids` }
{ templateField: `group_$_ids` },
`is_present_in_meeting_ids`
]);

const participantListFields: TypedFieldset<User> = participantListFieldsMinimal
.concat(filterableListFields)
.concat([`is_present_in_meeting_ids`]);
.concat([`default_password`]);

const detailFields: TypedFieldset<User> = [
`default_password`,
Expand Down
1 change: 1 addition & 0 deletions client/src/app/infrastructure/utils/dom-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export function replaceHtmlEntities(html: string): string {
html = html.replace(/&gt;/g, `<GT></GT>`);
html = html.replace(/&lt;/g, `<LT></LT>`);
html = html.replace(/&nbsp;/g, ` `);
html = html.replace(/&ndash;/g, `-`);

const textarea = document.createElement(`textarea`);
textarea.innerHTML = html;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { DomSanitizer } from '@angular/platform-browser';
import { LangChangeEvent, TranslateService } from '@ngx-translate/core';
import { locale } from 'moment';
import { first, firstValueFrom, tap } from 'rxjs';
import { availableTranslations } from 'src/app/domain/definitions/languages';
import { StorageService } from 'src/app/gateways/storage.service';
import { overloadJsFunctions } from 'src/app/infrastructure/utils/overload-js-functions';
import { Deferred } from 'src/app/infrastructure/utils/promises';
Expand Down Expand Up @@ -42,7 +43,7 @@ export class OpenSlidesMainComponent implements OnInit {

private loadTranslation(): void {
// manually add the supported languages
this.translate.addLangs([`en`, `de`, `cs`, `it`, `es`, `ru`]);
this.translate.addLangs(Object.keys(availableTranslations));
// this language will be used as a fallback when a translation isn't found in the current language
this.translate.setDefaultLang(`en`);
// get the browsers default language
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,18 +91,9 @@

<mat-menu #languageMenu="matMenu">
<ng-template matMenuContent>
<ng-container *ngTemplateOutlet="languageButton; context: { $implicit: 'en' }"></ng-container>
<ng-container *ngTemplateOutlet="languageButton; context: { $implicit: 'de' }"></ng-container>
<ng-container *ngTemplateOutlet="languageButton; context: { $implicit: 'it' }"></ng-container>
<ng-container *ngTemplateOutlet="languageButton; context: { $implicit: 'es' }"></ng-container>
<ng-container *ngTemplateOutlet="languageButton; context: { $implicit: 'ru' }"></ng-container>
<ng-container *ngTemplateOutlet="languageButton; context: { $implicit: 'cs' }"></ng-container>
<button *ngFor="let lang of translations | keyvalue" mat-menu-item (click)="selectLanguage(lang.key)">
<mat-icon>{{ getCurrentLanguageName() === lang.value ? 'check' : '' }}</mat-icon>
<span>{{ lang.value }}</span>
</button>
</ng-template>
</mat-menu>

<ng-template #languageButton let-language>
<button mat-menu-item (click)="selectLanguage(language)">
<mat-icon>{{ getCurrentLanguageName() === getLanguageName(language) ? 'check' : '' }}</mat-icon>
<span>{{ getLanguageName(language) }}</span>
</button>
</ng-template>
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Router } from '@angular/router';
import { TranslateService } from '@ngx-translate/core';
import { Observable, Subscription } from 'rxjs';
import { Id } from 'src/app/domain/definitions/key-types';
import { availableTranslations } from 'src/app/domain/definitions/languages';
import { getOmlVerboseName } from 'src/app/domain/definitions/organization-permission';
import { largeDialogSettings } from 'src/app/infrastructure/utils/dialog-settings';
import { ActiveMeetingIdService } from 'src/app/site/pages/meetings/services/active-meeting-id.service';
Expand All @@ -24,6 +25,8 @@ import { AccountDialogComponent } from '../account-dialog/account-dialog.compone
styleUrls: [`./account-button.component.scss`]
})
export class AccountButtonComponent extends BaseUiComponent implements OnInit {
public readonly translations = availableTranslations;

@ViewChild(`languageTrigger`, { read: MatMenuTrigger })
public set languageTrigger(trigger: MatMenuTrigger | undefined) {
this._languageTrigger = trigger;
Expand Down Expand Up @@ -100,20 +103,7 @@ export class AccountButtonComponent extends BaseUiComponent implements OnInit {
* language should be used.
*/
public getLanguageName(abbreviation: string): string {
if (abbreviation === `en`) {
return `English`;
} else if (abbreviation === `de`) {
return `Deutsch`;
} else if (abbreviation === `cs`) {
return `Čeština`;
} else if (abbreviation === `it`) {
return `Italiano`;
} else if (abbreviation === `es`) {
return `Español`;
} else if (abbreviation === `ru`) {
return `русский`;
}
return `No language`;
return availableTranslations[abbreviation] || `No language`;
}

public selectLanguage(abbreviation: string): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ <h2>{{ 'My meetings' | translate }}</h2>
class="flex-vertical-center"
*ngFor="let group of getGroupsForMeeting(meeting); let last = last"
>
{{ group.name | translate }}
{{ group.name }}
<span *ngIf="!last">,&nbsp;</span>
</span>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<mat-toolbar class="global-headbar background-primary-darkest">
<mat-toolbar class="global-headbar background-headbar">
<div class="one-line display-name">
<span>{{ displayName }}</span>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
}

.global-headbar {
height: 28px;
line-height: 28px;
height: var(--global-headbar-height);
line-height: var(--global-headbar-height);
display: flex;
flex-direction: row;
padding-left: 26px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
>
<div class="header-name" *ngIf="observables.meeting || observables.organization" [@fadeIn]>
<!-- Meeting's name -->
<h1 *ngIf="observables.meeting">{{ observables.meeting.name | translate }}</h1>
<h1 *ngIf="observables.meeting">{{ observables.meeting.name }}</h1>
<!-- Organization's name -->
<h1 *ngIf="observables.organization && !observables.meeting">
{{ observables.organization.name | translate }}
{{ observables.organization.name }}
</h1>
</div>
</ng-container>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import { ActiveMeetingIdService } from 'src/app/site/pages/meetings/services/act
import { SequentialNumberMappingService } from 'src/app/site/pages/meetings/services/sequential-number-mapping.service';

const ROUTE_SUBSCRIPTION_NAME = `routeSubscription`;
const SEQUENTIAL_NUMBER_SUBSCRIPTION_NAME = `sequentialNumberSubscription`;

@Component({
selector: `os-detail-view`,
Expand Down
Loading

0 comments on commit f8773d0

Please sign in to comment.