From 9f5e976f83e8e1c6ece239745dcb43835a4788c1 Mon Sep 17 00:00:00 2001
From: Alfonso Salces
Date: Fri, 23 Jun 2023 10:18:23 +0200
Subject: [PATCH] MOBILE-4267 about: Add idnumber, department and institution
---
scripts/langindex.json | 3 ++
src/core/features/user/lang.json | 3 ++
src/core/features/user/pages/about/about.html | 32 +++++++++++++------
src/core/features/user/pages/about/about.ts | 11 ++-----
4 files changed, 30 insertions(+), 19 deletions(-)
diff --git a/scripts/langindex.json b/scripts/langindex.json
index 959e74ac0..fc50d343f 100644
--- a/scripts/langindex.json
+++ b/scripts/langindex.json
@@ -2492,6 +2492,7 @@
"core.user.completeyourprofile": "local_moodlemobileapp",
"core.user.contact": "local_moodlemobileapp",
"core.user.country": "moodle",
+ "core.user.department": "moodle",
"core.user.description": "moodle",
"core.user.details": "report_security",
"core.user.detailsnotavailable": "local_moodlemobileapp",
@@ -2500,6 +2501,8 @@
"core.user.emailagain": "moodle",
"core.user.errorloaduser": "local_moodlemobileapp",
"core.user.firstname": "moodle",
+ "core.user.idnumber": "moodle",
+ "core.user.institution": "moodle",
"core.user.interests": "moodle",
"core.user.lastcourseaccess": "moodle",
"core.user.lastname": "moodle",
diff --git a/src/core/features/user/lang.json b/src/core/features/user/lang.json
index 5cb9ff365..f6a34ee91 100644
--- a/src/core/features/user/lang.json
+++ b/src/core/features/user/lang.json
@@ -9,6 +9,7 @@
"completeyourprofile": "Complete your profile",
"contact": "Contact",
"country": "Country",
+ "department": "Department",
"description": "Description",
"details": "Details",
"detailsnotavailable": "The details of this user are not available to you.",
@@ -17,6 +18,8 @@
"emailagain": "Email (again)",
"errorloaduser": "Error loading user.",
"firstname": "First name",
+ "idnumber": "ID number",
+ "institution": "Institution",
"interests": "Interests",
"lastcourseaccess": "Last access to course",
"lastname": "Last name",
diff --git a/src/core/features/user/pages/about/about.html b/src/core/features/user/pages/about/about.html
index 6c6d35285..38fd5d14a 100644
--- a/src/core/features/user/pages/about/about.html
+++ b/src/core/features/user/pages/about/about.html
@@ -59,21 +59,13 @@
-
-
- {{ 'core.user.address' | translate}}
-
- {{ formattedAddress }}
-
-
-
-
+
{{ 'core.user.city' | translate}}
{{ user.city }}
-
+
{{ 'core.user.country' | translate}}
{{ user.country }}
@@ -85,6 +77,26 @@
{{ user.timezone }}
+
+
+
+ {{ 'core.user.idnumber' | translate }}
+ {{ user.idnumber }}
+
+
+
+
+ {{ 'core.user.institution' | translate }}
+ {{ user.institution }}
+
+
+
+
+ {{ 'core.user.department' | translate }}
+ {{ user.department }}
+
+
+
diff --git a/src/core/features/user/pages/about/about.ts b/src/core/features/user/pages/about/about.ts
index c3f600e04..64671bccc 100644
--- a/src/core/features/user/pages/about/about.ts
+++ b/src/core/features/user/pages/about/about.ts
@@ -13,12 +13,10 @@
// limitations under the License.
import { Component, OnDestroy, OnInit } from '@angular/core';
-import { SafeUrl } from '@angular/platform-browser';
import { IonRefresher } from '@ionic/angular';
import { CoreSites } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom';
-import { CoreTextUtils } from '@services/utils/text';
import { CoreUtils } from '@services/utils/utils';
import { CoreEventObserver, CoreEvents } from '@singletons/events';
import {
@@ -52,11 +50,10 @@ export class CoreUserAboutPage implements OnInit, OnDestroy {
hasDetails = false;
user?: CoreUserProfile;
title?: string;
- formattedAddress?: string;
- encodedAddress?: SafeUrl;
canChangeProfilePicture = false;
interests?: string[];
displayTimezone = false;
+ canShowDepartment = false;
protected userId!: number;
protected site!: CoreSite;
@@ -88,6 +85,7 @@ export class CoreUserAboutPage implements OnInit, OnDestroy {
async ngOnInit(): Promise {
this.userId = CoreNavigator.getRouteNumberParam('userId') || 0;
this.courseId = CoreNavigator.getRouteNumberParam('courseId') || 0;
+ this.canShowDepartment = this.userId != this.site.getUserId();
// Allow to change the profile image only in the app profile page.
this.canChangeProfilePicture =
@@ -110,11 +108,6 @@ export class CoreUserAboutPage implements OnInit, OnDestroy {
try {
const user = await CoreUser.getProfile(this.userId, this.courseId);
- if (user.address) {
- this.formattedAddress = CoreUserHelper.formatAddress(user.address, user.city, user.country);
- this.encodedAddress = CoreTextUtils.buildAddressURL(this.formattedAddress);
- }
-
this.interests = user.interests ?
user.interests.split(',').map(interest => interest.trim()) :
undefined;