-
+
@@ -29,8 +29,8 @@
-
-
+
+
{{siteUrl}}
diff --git a/src/core/features/login/pages/reconnect/reconnect.ts b/src/core/features/login/pages/reconnect/reconnect.ts
index 65d696c93..ffb74ffa2 100644
--- a/src/core/features/login/pages/reconnect/reconnect.ts
+++ b/src/core/features/login/pages/reconnect/reconnect.ts
@@ -17,7 +17,7 @@ import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { CoreApp } from '@services/app';
import { CoreNetwork } from '@services/network';
-import { CoreSites, CoreSitesReadingStrategy } from '@services/sites';
+import { CoreSiteBasicInfo, CoreSites, CoreSitesReadingStrategy } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreUtils } from '@services/utils/utils';
import { CoreLoginHelper } from '@features/login/services/login-helper';
@@ -47,9 +47,6 @@ export class CoreLoginReconnectPage implements OnInit, OnDestroy {
credForm: FormGroup;
siteUrl!: string;
username!: string;
- userFullName!: string;
- userAvatar?: string;
- siteName!: string;
logoUrl?: string;
identityProviders?: CoreSiteIdentityProvider[];
showForgottenPassword = true;
@@ -58,6 +55,7 @@ export class CoreLoginReconnectPage implements OnInit, OnDestroy {
isOAuth = false;
isLoggedOut: boolean;
siteId!: string;
+ siteInfo?: CoreSiteBasicInfo;
showScanQR = false;
showLoading = true;
reconnectAttempts = 0;
@@ -104,20 +102,30 @@ export class CoreLoginReconnectPage implements OnInit, OnDestroy {
throw new CoreError('Invalid site');
}
+ this.siteUrl = site.getURL();
+
+ this.siteInfo = {
+ id: this.siteId,
+ siteUrl: this.siteUrl,
+ siteUrlWithoutProtocol: this.siteUrl.replace(/^https?:\/\//, '').toLowerCase(),
+ fullname: site.infos.fullname,
+ firstname: site.infos.firstname,
+ lastname: site.infos.lastname,
+ siteName: await site.getSiteName(),
+ userpictureurl: site.infos.userpictureurl,
+ loggedOut: true, // Not used.
+ };
+
this.username = site.infos.username;
- this.userFullName = site.infos.fullname;
- this.userAvatar = site.infos.userpictureurl;
- this.siteUrl = site.infos.siteurl;
- this.siteName = await site.getSiteName();
this.supportConfig = new CoreUserAuthenticatedSupportConfig(site);
// If login was OAuth we should only reach this page if the OAuth method ID has changed.
this.isOAuth = site.isOAuth();
- const sites = await CoreLoginHelper.getAvailableSites();
+ const availableSites = await CoreLoginHelper.getAvailableSites();
// Show logo instead of avatar if it's a fixed site.
- this.showUserAvatar = !!this.userAvatar && !sites.length;
+ this.showUserAvatar = !availableSites.length;
this.checkSiteConfig(site);
@@ -130,7 +138,7 @@ export class CoreLoginReconnectPage implements OnInit, OnDestroy {
}
/**
- * Component destroyed.
+ * @inheritdoc
*/
ngOnDestroy(): void {
this.viewLeft = true;
@@ -191,10 +199,6 @@ export class CoreLoginReconnectPage implements OnInit, OnDestroy {
await CoreSites.checkApplication(this.siteConfig);
- // Check logoURL if user avatar is not set.
- if (this.userAvatar?.startsWith(this.siteUrl + '/theme/image.php')) {
- this.showUserAvatar = false;
- }
this.logoUrl = CoreLoginHelper.getLogoUrl(this.siteConfig);
}
diff --git a/src/core/features/login/pages/sites/sites.html b/src/core/features/login/pages/sites/sites.html
index cb5d2afd3..438d20b27 100644
--- a/src/core/features/login/pages/sites/sites.html
+++ b/src/core/features/login/pages/sites/sites.html
@@ -33,12 +33,10 @@
-
-
-
+
+
- {{site.fullName}}
+ {{site.fullname}}
{{site.badge}}
diff --git a/src/core/features/settings/pages/space-usage/space-usage.html b/src/core/features/settings/pages/space-usage/space-usage.html
index 0f5040f75..bf28e9aa7 100644
--- a/src/core/features/settings/pages/space-usage/space-usage.html
+++ b/src/core/features/settings/pages/space-usage/space-usage.html
@@ -69,12 +69,10 @@
-
-
-
+
+
- {{site.fullName}}
+ {{site.fullname}}
{{ site.spaceUsage | coreBytesToSize }}
-
-
-
+
+
- {{site.fullName}}
+ {{site.fullname}}
{{ 'core.settings.logintosync' | translate }}
diff --git a/src/core/features/settings/pages/synchronization/synchronization.ts b/src/core/features/settings/pages/synchronization/synchronization.ts
index a5c25a507..dd80abad3 100644
--- a/src/core/features/settings/pages/synchronization/synchronization.ts
+++ b/src/core/features/settings/pages/synchronization/synchronization.ts
@@ -84,7 +84,7 @@ export class CoreSettingsSynchronizationPage implements OnInit, OnDestroy {
if (siteInfo) {
siteEntry.siteUrl = siteInfo.siteurl;
- siteEntry.fullName = siteInfo.fullname;
+ siteEntry.fullname = siteInfo.fullname;
}
});
diff --git a/src/core/features/sharedfiles/pages/choose-site/choose-site.html b/src/core/features/sharedfiles/pages/choose-site/choose-site.html
index f931b9365..6091f5b76 100644
--- a/src/core/features/sharedfiles/pages/choose-site/choose-site.html
+++ b/src/core/features/sharedfiles/pages/choose-site/choose-site.html
@@ -18,12 +18,10 @@
-
-
-
+
+
- {{site.fullName}}
+ {{site.fullname}}
diff --git a/src/core/features/tag/components/feed/core-tag-feed.html b/src/core/features/tag/components/feed/core-tag-feed.html
index 17b3de5ca..1223943fe 100644
--- a/src/core/features/tag/components/feed/core-tag-feed.html
+++ b/src/core/features/tag/components/feed/core-tag-feed.html
@@ -1,8 +1,7 @@
-
-
-
+
+
diff --git a/src/core/features/user/services/user-helper.ts b/src/core/features/user/services/user-helper.ts
index 015c9c8b2..1d45a65b4 100644
--- a/src/core/features/user/services/user-helper.ts
+++ b/src/core/features/user/services/user-helper.ts
@@ -17,7 +17,7 @@ import { CoreNavigator } from '@services/navigator';
import { CoreSites } from '@services/sites';
import { makeSingleton, Translate } from '@singletons';
-import { CoreUserRole } from './user';
+import { CoreUserProfile, CoreUserRole } from './user';
/**
* Service that provides some features regarding users information.
@@ -83,6 +83,21 @@ export class CoreUserHelperProvider {
await CoreNavigator.navigate('/user/completeprofile', { params: { siteId }, reset: true });
}
+ /**
+ * Get the user initials.
+ *
+ * @param user User object.
+ * @returns Promise resolved with the user data.
+ */
+ getUserInitials(user: Partial): string {
+ if (!user.firstname && !user.lastname) {
+ // @TODO: Use local info or check WS to get initials from.
+ return '';
+ }
+
+ return (user.firstname?.charAt(0) || '') + (user.lastname?.charAt(0) || '');
+ }
+
}
export const CoreUserHelper = makeSingleton(CoreUserHelperProvider);
diff --git a/src/core/features/user/services/user.ts b/src/core/features/user/services/user.ts
index 7484e800b..4e80ccf32 100644
--- a/src/core/features/user/services/user.ts
+++ b/src/core/features/user/services/user.ts
@@ -27,6 +27,8 @@ import { CoreStatusWithWarningsWSResponse, CoreWSExternalWarning } from '@servic
import { CoreError } from '@classes/errors/error';
import { USERS_TABLE_NAME, CoreUserDBRecord } from './database/user';
import { CorePushNotifications } from '@features/pushnotifications/services/pushnotifications';
+import { CoreUserHelper } from './user-helper';
+import { CoreUrl } from '@singletons/url';
const ROOT_CACHE_KEY = 'mmUser:';
@@ -673,6 +675,14 @@ export class CoreUserProvider {
return;
}
+ // Do not prefetch when initials are set and image is default.
+ if ('firstname' in entry || 'lastname' in entry) {
+ const initials = CoreUserHelper.getUserInitials(entry);
+ if (initials && imageUrl && CoreUrl.parse(imageUrl)?.path === '/theme/image.php') {
+ return;
+ }
+ }
+
treated[imageUrl] = true;
try {
diff --git a/src/core/services/sites.ts b/src/core/services/sites.ts
index 816c2eb81..f2e7b64bc 100644
--- a/src/core/services/sites.ts
+++ b/src/core/services/sites.ts
@@ -1260,9 +1260,11 @@ export class CoreSitesProvider {
id: site.id,
siteUrl: site.siteUrl,
siteUrlWithoutProtocol: site.siteUrl.replace(/^https?:\/\//, '').toLowerCase(),
- fullName: siteInfo?.fullname,
+ fullname: siteInfo?.fullname,
+ firstname: siteInfo?.firstname,
+ lastname: siteInfo?.lastname,
siteName: siteInfo?.sitename,
- avatar: siteInfo?.userpictureurl,
+ userpictureurl: siteInfo?.userpictureurl,
siteHomeId: siteInfo?.siteid || 1,
loggedOut: !!site.loggedOut,
};
@@ -1300,8 +1302,8 @@ export class CoreSitesProvider {
}
// Finally use fullname.
- textA = a.fullName?.toLowerCase().trim() || '';
- textB = b.fullName?.toLowerCase().trim() || '';
+ textA = a.fullname?.toLowerCase().trim() || '';
+ textB = b.fullname?.toLowerCase().trim() || '';
return textA.localeCompare(textB);
});
@@ -2016,9 +2018,11 @@ export type CoreSiteBasicInfo = {
id: string; // Site ID.
siteUrl: string; // Site URL.
siteUrlWithoutProtocol: string; // Site URL without protocol.
- fullName?: string; // User's full name.
+ fullname?: string; // User's full name.
+ firstname?: string; // User's first name.
+ lastname?: string; // User's last name.
+ userpictureurl?: string; // User avatar.
siteName?: string; // Site's name.
- avatar?: string; // User's avatar.
badge?: number; // Badge to display in the site.
siteHomeId?: number; // Site home ID.
loggedOut: boolean; // If Site is logged out.
diff --git a/src/theme/theme.light.scss b/src/theme/theme.light.scss
index 1302c3a55..fa09f202c 100644
--- a/src/theme/theme.light.scss
+++ b/src/theme/theme.light.scss
@@ -330,6 +330,7 @@ html {
--core-large-avatar-size: 90px;
--core-avatar-size: var(--a11y-min-target-size);
+ --core-avatar-radius: 50%;
--core-courseimage-on-course-size: 72px;
--core-courseimage-radius: var(--medium-radius);
diff --git a/upgrade.txt b/upgrade.txt
index bf8043196..922dadc2e 100644
--- a/upgrade.txt
+++ b/upgrade.txt
@@ -1,6 +1,10 @@
This files describes API changes in the Moodle Mobile app,
information provided here is intended especially for developers.
+=== 4.3.0 ===
+
+ - CoreSiteBasicInfo fullName attribute has changed to fullname and avatar to userpictureurl to match user fields.
+
=== 4.2.0 ===
- CoreIconComponent has been removed after deprecation period: Use CoreFaIconDirective instead.