MOBILE-4203 timezone: Convert 99 to a readable timezone
parent
d2e34e3d87
commit
36232f04a1
|
@ -79,7 +79,7 @@
|
||||||
<p>{{ user.country }}</p>
|
<p>{{ user.country }}</p>
|
||||||
</ion-label>
|
</ion-label>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
<ion-item class="ion-text-wrap" *ngIf="user.timezone">
|
<ion-item class="ion-text-wrap" *ngIf="displayTimezone && user.timezone">
|
||||||
<ion-label>
|
<ion-label>
|
||||||
<p class="item-heading">{{ 'core.timezone' | translate}}</p>
|
<p class="item-heading">{{ 'core.timezone' | translate}}</p>
|
||||||
<p>{{ user.timezone }}</p>
|
<p>{{ user.timezone }}</p>
|
||||||
|
|
|
@ -21,7 +21,13 @@ import { CoreDomUtils } from '@services/utils/dom';
|
||||||
import { CoreTextUtils } from '@services/utils/text';
|
import { CoreTextUtils } from '@services/utils/text';
|
||||||
import { CoreUtils } from '@services/utils/utils';
|
import { CoreUtils } from '@services/utils/utils';
|
||||||
import { CoreEventObserver, CoreEvents } from '@singletons/events';
|
import { CoreEventObserver, CoreEvents } from '@singletons/events';
|
||||||
import { CoreUser, CoreUserProfile, USER_PROFILE_PICTURE_UPDATED, USER_PROFILE_REFRESHED } from '@features/user/services/user';
|
import {
|
||||||
|
CoreUser,
|
||||||
|
CoreUserProfile,
|
||||||
|
USER_PROFILE_PICTURE_UPDATED,
|
||||||
|
USER_PROFILE_REFRESHED,
|
||||||
|
USER_PROFILE_SERVER_TIMEZONE,
|
||||||
|
} from '@features/user/services/user';
|
||||||
import { CoreUserHelper } from '@features/user/services/user-helper';
|
import { CoreUserHelper } from '@features/user/services/user-helper';
|
||||||
import { CoreNavigator } from '@services/navigator';
|
import { CoreNavigator } from '@services/navigator';
|
||||||
import { CoreIonLoadingElement } from '@classes/ion-loading';
|
import { CoreIonLoadingElement } from '@classes/ion-loading';
|
||||||
|
@ -50,6 +56,7 @@ export class CoreUserAboutPage implements OnInit, OnDestroy {
|
||||||
encodedAddress?: SafeUrl;
|
encodedAddress?: SafeUrl;
|
||||||
canChangeProfilePicture = false;
|
canChangeProfilePicture = false;
|
||||||
interests?: string[];
|
interests?: string[];
|
||||||
|
displayTimezone = false;
|
||||||
|
|
||||||
protected userId!: number;
|
protected userId!: number;
|
||||||
protected site!: CoreSite;
|
protected site!: CoreSite;
|
||||||
|
@ -120,6 +127,12 @@ export class CoreUserAboutPage implements OnInit, OnDestroy {
|
||||||
|
|
||||||
this.user.address = CoreUserHelper.formatAddress('', user.city, user.country);
|
this.user.address = CoreUserHelper.formatAddress('', user.city, user.country);
|
||||||
|
|
||||||
|
const serverTimezone = CoreSites.getCurrentSite()?.getStoredConfig('timezone');
|
||||||
|
this.displayTimezone = !!serverTimezone;
|
||||||
|
if (this.displayTimezone && this.user.timezone === USER_PROFILE_SERVER_TIMEZONE) {
|
||||||
|
this.user.timezone = serverTimezone;
|
||||||
|
}
|
||||||
|
|
||||||
await this.checkUserImageUpdated();
|
await this.checkUserImageUpdated();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
CoreDomUtils.showErrorModalDefault(error, 'core.user.errorloaduser', true);
|
CoreDomUtils.showErrorModalDefault(error, 'core.user.errorloaduser', true);
|
||||||
|
|
|
@ -54,6 +54,11 @@ export const USER_PROFILE_REFRESHED = 'CoreUserProfileRefreshed';
|
||||||
*/
|
*/
|
||||||
export const USER_PROFILE_PICTURE_UPDATED = 'CoreUserProfilePictureUpdated';
|
export const USER_PROFILE_PICTURE_UPDATED = 'CoreUserProfilePictureUpdated';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Value set in timezone when using the server's timezone.
|
||||||
|
*/
|
||||||
|
export const USER_PROFILE_SERVER_TIMEZONE = '99';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Service to provide user functionalities.
|
* Service to provide user functionalities.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -3,8 +3,8 @@ Feature: Test basic usage of user features
|
||||||
|
|
||||||
Background:
|
Background:
|
||||||
Given the following "users" exist:
|
Given the following "users" exist:
|
||||||
| username | firstname | lastname |
|
| username | firstname | lastname | timezone |
|
||||||
| student1 | Student | Student |
|
| student1 | Student | Student | 99 |
|
||||||
|
|
||||||
Scenario: Complete missing fields
|
Scenario: Complete missing fields
|
||||||
Given the following "custom profile fields" exist:
|
Given the following "custom profile fields" exist:
|
||||||
|
@ -59,3 +59,36 @@ Feature: Test basic usage of user features
|
||||||
Then I should find "student1@example.com" in the app
|
Then I should find "student1@example.com" in the app
|
||||||
And I should find "Student Student" in the app
|
And I should find "Student Student" in the app
|
||||||
And the UI should match the snapshot
|
And the UI should match the snapshot
|
||||||
|
|
||||||
|
@lms_from4.2
|
||||||
|
Scenario: View timezone in profile
|
||||||
|
Given the following config values are set as admin:
|
||||||
|
| timezone | Europe/Madrid |
|
||||||
|
| forcetimezone | 99 |
|
||||||
|
And the following "users" exist:
|
||||||
|
| username | firstname | lastname | timezone |
|
||||||
|
| student2 | John | Smith | Asia/Shanghai |
|
||||||
|
And the following "courses" exist:
|
||||||
|
| fullname | shortname |
|
||||||
|
| Course 1 | C1 |
|
||||||
|
And the following "course enrolments" exist:
|
||||||
|
| user | course | role |
|
||||||
|
| student1 | C1 | student |
|
||||||
|
| student2 | C1 | student |
|
||||||
|
# @todo MDL-77468 This capability override is needed until the issue is integrated.
|
||||||
|
And the following "permission overrides" exist:
|
||||||
|
| capability | permission | role | contextlevel | reference |
|
||||||
|
| moodle/user:viewalldetails | Allow | student | Course | C1 |
|
||||||
|
And I entered the course "Course 1" as "student1" in the app
|
||||||
|
When I press "Participants" in the app
|
||||||
|
And I press "Student Student" in the app
|
||||||
|
And I press "Details" in the app
|
||||||
|
Then I should find "Europe/Madrid" in the app
|
||||||
|
And I should not find "Asia/Shanghai" in the app
|
||||||
|
|
||||||
|
When I press the back button in the app
|
||||||
|
And I press the back button in the app
|
||||||
|
And I press "John Smith" in the app
|
||||||
|
And I press "Details" in the app
|
||||||
|
Then I should find "Asia/Shanghai" in the app
|
||||||
|
And I should not find "Europe/Madrid" in the app
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 19 KiB |
Loading…
Reference in New Issue