Skip to content

Commit

Permalink
Merge pull request #3741 from alfonso-salces/MOBILE-4242
Browse files Browse the repository at this point in the history
MOBILE-4242 profile: Add groups to participants profile
  • Loading branch information
crazyserver authored Jul 17, 2023
2 parents 4199aed + e4081e6 commit 3549dbb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/core/features/user/pages/profile/profile.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ <h2>{{ user.fullname }}</h2>
<strong>{{ 'core.user.roles' | translate}}</strong>{{'core.labelsep' | translate}}
{{ rolesFormatted }}
</p>
<p *ngIf="userGroups">
<strong>{{ 'core.group' | translate}}</strong>{{'core.labelsep' | translate}}
{{ userGroups }}
</p>
<p *ngIf="user.lastaccess !== undefined">
<strong>{{ 'core.lastaccess' | translate }}: </strong>
<span *ngIf="user.lastaccess">{{ user.lastaccess | coreTimeAgo }}</span>
Expand Down
6 changes: 6 additions & 0 deletions src/core/features/user/pages/profile/profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export class CoreUserProfilePage implements OnInit, OnDestroy {
protected subscription?: Subscription;
protected logView: (user: CoreUserProfile) => void;

userGroups?: string;
userLoaded = false;
isLoadingHandlers = false;
user?: CoreUserProfile;
Expand Down Expand Up @@ -133,6 +134,11 @@ export class CoreUserProfilePage implements OnInit, OnDestroy {

try {
await this.fetchUser();

if (this.courseId && this.user && 'groups' in this.user) {
const separator = Translate.instant('core.listsep');
this.userGroups = this.user.groups?.map(group => group.name).join(separator + ' ');
}
} finally {
this.userLoaded = true;
}
Expand Down

0 comments on commit 3549dbb

Please sign in to comment.