Skip to content

Commit

Permalink
fix missing roles in abook
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias committed Jan 10, 2024
1 parent a755a96 commit 123be3a
Show file tree
Hide file tree
Showing 3 changed files with 134 additions and 6 deletions.
20 changes: 18 additions & 2 deletions assets/l10n/intl_de.arb
Original file line number Diff line number Diff line change
Expand Up @@ -2509,12 +2509,20 @@
"@contactsInfoTeacher": {},
"contactsInfoStudent": "Schüler:in in",
"@contactsInfoStudent": {},
"contactsInfoAdmin": "Admin in",
"contactsInfoAdmin": "Organisationsadmin in",
"@contactsInfoAdmin": {},
"contactsInfoParent": "Sorgeberechtigte:r in",
"@contactsInfoParent": {},
"contactsInfoGroup": "Gruppe in",
"@contactsInfoGroup": {},
"contactsInfoSocialWork": "Schulsozialarbeit in",
"@contactsInfoSocialWork": {},
"contactsInfoOffice": "Sekretariat in",
"@contactsInfoOffice": {},
"contactsInfoPrincipal": "Schulleitung in",
"@contactsInfoPrincipal": {},
"contactsInfoElternbeirat": "Elternbeirat in",
"@contactsInfoElternbeirat": {},
"userNotInMessenger": "noch nicht im Schulchat",
"@userNotInMessenger": {},
"inviteErrorHappened": "Ein Fehler trat während der Einladung auf",
Expand All @@ -2538,8 +2546,16 @@
"@abookTitleSCGroups": {},
"abookTitleParents": "Sorgeberechtigte",
"@abookTitleParents": {},
"abookTitleAdmins": "Administratoren",
"abookTitleAdmins": "Organisationsadmins",
"@abookTitleAdmins": {},
"abookTitleOffice": "Sekretariat",
"@abookTitleOffice": {},
"abookTitleSocialWork": "Schulsozialarbeit",
"@abookTitleSocialWork": {},
"abookTitleElternbeirat": "Elternbeirat",
"@abookTitleElternbeirat": {},
"abookTitlePrincipal": "Schulleitung",
"@abookTitlePrincipal": {},
"inviteTitleMessage": "{uniqUsersLength} Nutzer:innen und {uniqGroupsLength} Gruppen (insgesamt: {selectionLength}) in den Raum {name} einladen",
"@inviteTitleMessage": {
"type": "text",
Expand Down
16 changes: 16 additions & 0 deletions assets/l10n/intl_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -2485,6 +2485,14 @@
"@contactsInfoParent": {},
"contactsInfoGroup": "Group in",
"@contactsInfoGroup": {},
"contactsInfoSocialWork": "Social Work in",
"@contactsInfoSocialWork": {},
"contactsInfoOffice": "Office in",
"@contactsInfoOffice": {},
"contactsInfoPrincipal": "Principal in",
"@contactsInfoPrincipal": {},
"contactsInfoElternbeirat": "Parents association in",
"@contactsInfoElternbeirat": {},
"searchContacts": "Search people or groups",
"@searchContacts": {},
"contactsInvited": "Contacts have been invited",
Expand Down Expand Up @@ -2516,6 +2524,14 @@
"@abookTitleParents": {},
"abookTitleAdmins": "Administrators",
"@abookTitleAdmins": {},
"abookTitleOffice": "Office",
"@abookTitleOffice": {},
"abookTitleSocialWork": "Social Work",
"@abookTitleSocialWork": {},
"abookTitleElternbeirat": "Parents association",
"@abookTitleElternbeirat": {},
"abookTitlePrincipal": "Principal",
"@abookTitlePrincipal": {},
"inviteTitleMessage": "You are about to invite {uniqUsersLength} users and {uniqGroupsLength} groups (total: {selectionLength}) to room {name}",
"@inviteTitleMessage": {
"type": "text",
Expand Down
104 changes: 100 additions & 4 deletions lib/pages/addressbook/addressbook.dart
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,6 @@ class AddressbookController extends State<AddressbookPage> {
if (filteredSchool.isNotEmpty && filteredSchool != school) continue;

final schoolName = abookJson[school]['name'];
//final schoolName = await Matrix.of(context).client.request(RequestType.GET, '/../idm/school/${school}');
final abookSchool = ABookEntry(
title: schoolName,
children: [],
Expand Down Expand Up @@ -325,6 +324,31 @@ class AddressbookController extends State<AddressbookPage> {
category: true,
orgName: school,
);
final abookOffice = ABookEntry(
title: L10n.of(context)!.abookTitleOffice,
children: [],
category: true,
orgName: school,
);
final abookSocialWork = ABookEntry(
title: L10n.of(context)!.abookTitleSocialWork,
children: [],
category: true,
orgName: school,
);
final abookElternbeirat = ABookEntry(
title: L10n.of(context)!.abookTitleElternbeirat,
children: [],
category: true,
orgName: school,
);
final abookPrincipal = ABookEntry(
title: L10n.of(context)!.abookTitlePrincipal,
children: [],
category: true,
orgName: school,
);

allUsers[school] = [];
if (abookJson[school]['teachers'] != null &&
abookJson[school]['teachers'].isNotEmpty) {
Expand Down Expand Up @@ -435,10 +459,10 @@ class AddressbookController extends State<AddressbookPage> {
allUsers[school]!.add(entry);
});
}
if (abookJson[school]['admins'] != null &&
abookJson[school]['admins'].isNotEmpty) {
if (abookJson[school]['Organisationsadmin'] != null &&
abookJson[school]['Organisationsadmin'].isNotEmpty) {
abookSchool.children.add(abookAdmins);
abookJson[school]['admins'].forEach((admin) {
abookJson[school]['Organisationsadmin'].forEach((admin) {
final entry = ABookEntry(
title: admin,
info: '${L10n.of(context)!.contactsInfoAdmin} $schoolName',
Expand All @@ -453,6 +477,78 @@ class AddressbookController extends State<AddressbookPage> {
allUsers[school]!.add(entry);
});
}
if (abookJson[school]['Schulleitung'] != null &&
abookJson[school]['Schulleitung'].isNotEmpty) {
abookSchool.children.add(abookPrincipal);
abookJson[school]['Schulleitung'].forEach((user) {
final entry = ABookEntry(
title: user,
info: '${L10n.of(context)!.contactsInfoPrincipal} $schoolName',
orgName: school,
longName: abookJson['users'][user].first,
kind: 'Schulleitung', //TODO
active: abookJson['users'][user].last == 'active',
);
abookPrincipal.children.add(
entry,
);
allUsers[school]!.add(entry);
});
}
if (abookJson[school]['Sekretariat'] != null &&
abookJson[school]['Sekretariat'].isNotEmpty) {
abookSchool.children.add(abookOffice);
abookJson[school]['Sekretariat'].forEach((user) {
final entry = ABookEntry(
title: user,
info: '${L10n.of(context)!.contactsInfoOffice} $schoolName',
orgName: school,
longName: abookJson['users'][user].first,
kind: 'Sekretariat', //TODO
active: abookJson['users'][user].last == 'active',
);
abookOffice.children.add(
entry,
);
allUsers[school]!.add(entry);
});
}
if (abookJson[school]['SocialWork'] != null &&
abookJson[school]['SocialWork'].isNotEmpty) {
abookSchool.children.add(abookSocialWork);
abookJson[school]['SocialWork'].forEach((user) {
final entry = ABookEntry(
title: user,
info: '${L10n.of(context)!.contactsInfoSocialWork} $schoolName',
orgName: school,
longName: abookJson['users'][user].first,
kind: 'Schulsozialarbeit', //TODO
active: abookJson['users'][user].last == 'active',
);
abookSocialWork.children.add(
entry,
);
allUsers[school]!.add(entry);
});
}
if (abookJson[school]['Elternbeirat'] != null &&
abookJson[school]['Elternbeirat'].isNotEmpty) {
abookSchool.children.add(abookElternbeirat);
abookJson[school]['Elternbeirat'].forEach((user) {
final entry = ABookEntry(
title: user,
info: '${L10n.of(context)!.contactsInfoElternbeirat} $schoolName',
orgName: school,
longName: abookJson['users'][user].first,
kind: 'Elternbeirat', //TODO
active: abookJson['users'][user].last == 'active',
);
abookElternbeirat.children.add(
entry,
);
allUsers[school]!.add(entry);
});
}
abookEntries.add(abookSchool);
}
}
Expand Down

0 comments on commit 123be3a

Please sign in to comment.