#327413 Fix explosions when a user is deleted through the admin portal.

This commit is contained in:
Georgi Prodanov 2017-02-06 18:52:08 +02:00
Родитель 601580e168
Коммит 9fc9038b49
7 изменённых файлов: 26 добавлений и 11 удалений

Просмотреть файл

@ -104,3 +104,7 @@
background-size: cover;
background-position: -5 0;
}
.going-label {
margin-left: 5;
}

Просмотреть файл

@ -62,7 +62,9 @@ export class EventDetailsComponent implements OnInit {
this.event = event;
this._page.actionBar.title = event.Name;
this.isPastEvent = this._eventsService.isPastEvent(this.event);
return this._updateCountsByDate();
if (!this.isPastEvent) {
this._updateCountsByDate();
}
})
.catch(this._onError.bind(this));

Просмотреть файл

@ -70,14 +70,14 @@
<StackLayout class="info-wrapper">
<Label class="info-label" text="Organizer"></Label>
<Label class="info-value" [text]="event.Organizer.DisplayName || event.Organizer.Username"></Label>
<user-display [users]="event.Organizer" [showNames]="true"></user-display>
</StackLayout>
<StackLayout class="info-wrapper no-separator">
<Label class="info-label" text="Registered Participants"></Label>
<StackLayout *ngIf="registeredUsers.length > 0" (tap)="onParticipantsTap()" class="registered-users-wrapper" orientation="horizontal">
<user-display [users]="registeredUsers" [withImages]="3"></user-display>
<Label class="info-value" [text]="(registeredUsers.length === 1 ? 'is' : 'are') + ' going'"></Label>
<Label class="info-value going-label" [text]="(registeredUsers.length === 1 ? 'is' : 'are') + ' going'"></Label>
</StackLayout>
<Label class="info-value" *ngIf="registeredUsers.length === 0" [text]="'No one has registered for this event.'"></Label>

Просмотреть файл

@ -17,6 +17,9 @@ export class EventListComponent implements OnInit {
private _regsService: EventRegistrationsService,
private _usersService: UsersService
) {}
@Input() events: Event[];
@Output() onEventTap: EventEmitter<any> = new EventEmitter<any>();
ngOnInit() {
this._usersService.currentUser()
@ -27,9 +30,6 @@ export class EventListComponent implements OnInit {
});
});
}
@Input() events: Event[];
@Output() onEventTap: EventEmitter<any> = new EventEmitter<any>();
eventTap(event: Event) {
this.onEventTap.emit(event);

Просмотреть файл

@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
import { Data } from '../../node_modules/everlive-sdk/dist/declarations/everlive/types/Data';
import { EverliveProvider } from './everlive-provider.service';
import { EventRegistration } from '../shared/models';
import { EventRegistration, User } from '../shared/models';
@Injectable()
export class EventRegistrationsService {
@ -38,7 +38,11 @@ export class EventRegistrationsService {
query.where().eq('EventId', eventId);
query.expand(this._expandUserExpression);
query.select('User');
return this._data.get(query).then(r => r.result.map(r => r.User));
return this._data.get(query).then(resp => {
let result: User[] = [];
resp.result.forEach(r => r.User && result.push(r.User));
return result;
});
}
getEventDateChoiceCounts(eventId: string) {

Просмотреть файл

@ -109,7 +109,11 @@ export class GroupsService {
let query = this._elProvider.getNewQuery();
query.where({ GroupId: groupId });
query.expand(this._expandUserInMembership);
return this._membershipsData.get(query).then(r => r.result.map(gm => gm.User));
return this._membershipsData.get(query).then(resp => {
let result: User[] = [];
resp.result.forEach(gm => gm.User && result.push(gm.User));
return result;
});
}
isUserAMember(userId: string, groupId: string): Promise<boolean>

Просмотреть файл

@ -1,7 +1,8 @@
<WrapLayout class="list-wrapper">
<StackLayout orientation="horizontal" *ngFor="let user of users; let ind = index">
<photo-picker *ngIf="showImage(ind)" class="user-image" [url]="user.ImageUrl" [type]="'user'" [small]="true" [noImageIcon]="'&#x6c;'"></photo-picker>
<Label *ngIf="showNames" class="user-name" [text]="user.DisplayName || user.Username"></Label>
<photo-picker *ngIf="user && showImage(ind)" class="user-image" [url]="user.ImageUrl" [type]="'user'" [small]="true" [noImageIcon]="'&#x6c;'"></photo-picker>
<Label *ngIf="user && showNames" class="user-name" [text]="user.DisplayName || user.Username"></Label>
<Label *ngIf="!user" text="Unknown User"></Label>
</StackLayout>
<Label class="remaining-users" *ngIf="hasRemainingLabel()" [text]="getRemainingText()"></Label>
</WrapLayout>