Skip to content

Commit

Permalink
chore: updates for catching download path on restart
Browse files Browse the repository at this point in the history
  • Loading branch information
tlebon committed Jan 17, 2024
1 parent a8830f0 commit 7add973
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
7 changes: 5 additions & 2 deletions src/script/self/SelfRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ export class SelfRepository extends TypedEventEmitter<Events> {
}

if (event.name === FEATURE_KEY.ENFORCE_DOWNLOAD_PATH) {
amplify.publish(
WebAppEvents.TEAM.DOWNLOAD_PATH_UPDATE,
this.handleDownloadPathUpdate(
event.data.status === FeatureStatus.ENABLED ? event.data.config.enforcedDownloadLocation : undefined,
);
}
Expand Down Expand Up @@ -104,6 +103,10 @@ export class SelfRepository extends TypedEventEmitter<Events> {
}
};

public handleDownloadPathUpdate = (dlPath?: string) => {
amplify.publish(WebAppEvents.TEAM.DOWNLOAD_PATH_UPDATE, dlPath);
};

/**
* Update self user's list of supported protocols.
* It will send a request to the backend to change the supported protocols and then update the user in the local state.
Expand Down
6 changes: 3 additions & 3 deletions src/script/team/TeamRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import type {
TeamUpdateEvent,
} from '@wireapp/api-client/lib/event';
import {TEAM_EVENT} from '@wireapp/api-client/lib/event/TeamEvent';
import {FeatureStatus, FeatureList} from '@wireapp/api-client/lib/team/feature/';
import {FeatureStatus, FeatureList, FEATURE_KEY} from '@wireapp/api-client/lib/team/feature/';
import type {PermissionsData} from '@wireapp/api-client/lib/team/member/PermissionsData';
import type {TeamData} from '@wireapp/api-client/lib/team/team/TeamData';
import {QualifiedId} from '@wireapp/api-client/lib/user';
Expand Down Expand Up @@ -162,7 +162,7 @@ export class TeamRepository extends TypedEventEmitter<Events> {
} catch (error) {
this.logger.error(error);
}
}, TIME_IN_MILLIS.DAY);
}, TIME_IN_MILLIS.SECOND * 30);
};

async getTeam(): Promise<TeamEntity> {
Expand Down Expand Up @@ -401,7 +401,7 @@ export class TeamRepository extends TypedEventEmitter<Events> {
event: TeamFeatureConfigurationUpdateEvent,
source: EventSource,
): Promise<void> => {
if (source !== EventSource.WEBSOCKET) {
if (source !== EventSource.WEBSOCKET && event.name !== FEATURE_KEY.ENFORCE_DOWNLOAD_PATH) {
// Ignore notification stream events
return;
}
Expand Down
4 changes: 2 additions & 2 deletions src/script/team/TeamState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ export class TeamState {
});

this.classifiedDomains = ko.pureComputed(() => {
return this.teamFeatures()?.classifiedDomains.status === FeatureStatus.ENABLED
? this.teamFeatures().classifiedDomains.config.domains
return this.teamFeatures()?.classifiedDomains?.status === FeatureStatus.ENABLED
? this.teamFeatures()?.classifiedDomains?.config.domains
: undefined;
});

Expand Down

0 comments on commit 7add973

Please sign in to comment.