Skip to content

Commit

Permalink
update user follow to filter by team (#662)
Browse files Browse the repository at this point in the history
  • Loading branch information
sei-aschlackman authored May 23, 2024
1 parent fc64edf commit 94d195a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,14 @@ export class UserFollowPageComponent implements OnInit, OnDestroy {
ngOnInit() {
const userId = this.routerQuery.getParams('userId');
const viewId = this.routerQuery.getParams('viewId');
const teamId = this.routerQuery.getQueryParams('teamId');

this.signalrRService.startConnection().then(() => {
this.signalrRService.joinUser(userId, viewId).then((vmUser: VmUser) => {
this.vmUser = vmUser;
});
this.signalrRService
.joinUser(userId, viewId, teamId)
.then((vmUser: VmUser) => {
this.vmUser = vmUser;
});
});

this.userQuery
Expand Down
15 changes: 10 additions & 5 deletions src/app/services/signalr/signalr.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { ComnAuthService } from '@cmusei/crucible-common';
import * as signalR from '@microsoft/signalr';
import { BehaviorSubject, Observable } from 'rxjs';
import { BASE_PATH, VmUser } from '../../generated/vm-api';
import { UserQuery } from '../../state/user/user.query';
import { UserService } from '../../state/user/user.service';
import { VsphereService } from '../../state/vsphere/vsphere.service';

Expand All @@ -22,6 +21,7 @@ export class SignalRService {

private userId: string;
private viewId: string;
private teamId: string;
private vmId: string;
private activeVmId: string;

Expand Down Expand Up @@ -76,8 +76,8 @@ export class SignalRService {
}

private joinGroups() {
if (this.userId && this.viewId) {
this.joinUser(this.userId, this.viewId);
if (this.userId && this.viewId && this.teamId) {
this.joinUser(this.userId, this.viewId, this.teamId);
}

if (this.activeVmId) {
Expand All @@ -89,13 +89,18 @@ export class SignalRService {
}
}

public joinUser(userId: string, viewId: string): Promise<VmUser> {
public joinUser(
userId: string,
viewId: string,
teamId: string,
): Promise<VmUser> {
this.userId = userId;
this.viewId = viewId;
this.teamId = teamId;

return this.startConnection().then(() => {
return this.hubConnection
.invoke('JoinUser', userId, viewId)
.invoke('JoinUser', userId, viewId, teamId)
.then((vmUser: VmUser) => {
const user = { id: vmUser.userId, name: vmUser.username };
this.userService.add(user);
Expand Down

0 comments on commit 94d195a

Please sign in to comment.