Skip to content

Commit

Permalink
Merge branch 'master' of github.com:Piratenpartei/keycloak-ekklesia
Browse files Browse the repository at this point in the history
  • Loading branch information
kaenganxt committed Dec 23, 2023
2 parents 263fa03 + 2543606 commit 8e6625a
Show file tree
Hide file tree
Showing 10 changed files with 2,285 additions and 1,896 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,13 @@ jobs:
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
java-version: '17'
distribution: 'temurin'
cache: maven
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
- name: Build with Maven
run: mvn -B package
- name: set lower case owner name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[
"snowpack/assets/babel-plugin.js",
{
"webModulesUrl": "../common/keycloak/web_modules",
"webModulesUrl": "../account/keycloak.v2/web_modules",
"moduleResolution": "node"
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ declare const baseUrl: string;

type ConfigResolve = (config: RequestInit) => void;

export interface HttpResponse<T = {}> extends Response {
export interface HttpResponse<T = unknown> extends Response {
data?: T;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@
"modulePath": "/content/account-page/AccountPage.js",
"componentName": "AccountPage"
},
{
"id": "ekklesia-sync-state",
"icon": "pf-icon-catalog",
"path": "ekklesia-sync-state",
"label": "ekklesia-sync-state",
"descriptionLabel": "ekklesia-sync-intro",
"modulePath": "/content/ekklesia-sync-page/EkklesiaSyncPage.js",
"componentName": "EkklesiaSyncPage"
},
{
"id": "security",
"icon": "pf-icon-security",
Expand Down Expand Up @@ -65,14 +74,5 @@
"descriptionLabel": "ekklesia-beo-short",
"modulePath": "/content/ekklesia-beo-settings/EkklesiaBeoSettings.js",
"componentName": "EkklesiaBeoSettings"
},
{
"id": "ekklesia-sync-state",
"icon": "pf-icon-catalog",
"path": "ekklesia-sync-state",
"label": "ekklesia-sync-state",
"descriptionLabel": "ekklesia-sync-intro",
"modulePath": "/content/ekklesia-sync-page/EkklesiaSyncPage.js",
"componentName": "EkklesiaSyncPage"
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -37,24 +37,24 @@ export class EkklesiaBeoSettings extends React.Component {

fetchPersonalInfo() {
this.context!.doGet<FormFields>("/")
.then((response: HttpResponse<FormFields>) => {
this.setState(this.DEFAULT_STATE);
const formFields = response.data;
if (!formFields!.attributes) {
formFields!.attributes = { notify_matrix_ids: [] };
}
if (!formFields!.attributes.notify_matrix_ids) {
formFields!.attributes.notify_matrix_ids = [];
}
let enable_email = formFields!.attributes.notify_enable_email;
if (typeof enable_email !== "object" || enable_email.length != 1) {
formFields!.attributes.notify_enable_email = true;
} else {
formFields!.attributes.notify_enable_email = enable_email[0] === "true";
}

this.setState({...{ formFields: formFields }});
});
.then((response: HttpResponse<FormFields>) => {
this.setState(this.DEFAULT_STATE);
const formFields = response.data;
if (!formFields!.attributes) {
formFields!.attributes = { notify_matrix_ids: [] };
}
if (!formFields!.attributes.notify_matrix_ids) {
formFields!.attributes.notify_matrix_ids = [];
}
let enable_email = formFields!.attributes.notify_enable_email;
if (typeof enable_email !== "object" || enable_email.length != 1) {
formFields!.attributes.notify_enable_email = true;
} else {
formFields!.attributes.notify_enable_email = enable_email[0] === "true";
}

this.setState({...{ formFields: formFields }});
});
}

private handleChange = (value: string, event: React.FormEvent<HTMLInputElement>) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { ContentPage } from "../ContentPage";
import { Msg } from "../../widgets/Msg";
import { ContentAlert } from "../ContentAlert";
import { AccountServiceContext } from '../../account-service/AccountServiceContext';
import { HttpResponse } from '../../account-service/account.service';

interface SyncPageProps {}

Expand Down Expand Up @@ -58,11 +59,12 @@ export class EkklesiaSyncPage extends React.Component {
}

private fetchPersonalInfo(): void {
this.context!.doGet("/").then((response: any) => {
this.context!.doGet<FormFields>("/")
.then((response: HttpResponse<FormFields>) => {
this.setState(this.DEFAULT_STATE);
let formData = response.data as FormFields;
if (!formData.attributes) {
formData.attributes = this.DEFAULT_ATTRIBUTES;
let formData = response.data;
if (!formData!.attributes) {
formData!.attributes = this.DEFAULT_ATTRIBUTES;
}
this.setState({ ...{formFields: formData} });
});
Expand All @@ -88,7 +90,7 @@ export class EkklesiaSyncPage extends React.Component {
let vals = this.state.formFields.attributes!;

let dateVal = Date.parse(vals.ekklesia_last_sync!);
let options = {year: 'numeric', month: 'numeric', day: 'numeric', hour: 'numeric', minute: 'numeric'};
let options = {year: 'numeric', month: 'numeric', day: 'numeric', hour: 'numeric', minute: 'numeric'} as const;
let date = isNaN(dateVal) ? "-" : new Intl.DateTimeFormat("default", options).format(dateVal);

let eligible = vals.ekklesia_eligible == "true" ? Msg.localize("ekklesia-yes") : Msg.localize("ekklesia-no");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ export class KeycloakService {
if (this.keycloakAuth.token) {
this.keycloakAuth
.updateToken(5)
.success(() => {
.then(() => {
resolve(this.keycloakAuth.token as string);
})
.error(() => {
.catch(() => {
reject('Failed to refresh token');
});
} else {
Expand Down
Loading

0 comments on commit 8e6625a

Please sign in to comment.