Apply corrections identified by SonarQube (#8457)
This commit is contained in:
parent
99cb83a9df
commit
964c60d086
73 changed files with 211 additions and 232 deletions
|
@ -418,10 +418,7 @@ export class OwnBeaconStore extends AsyncStoreWithClient<OwnBeaconStoreState> {
|
|||
this.stopPollingLocation();
|
||||
|
||||
try {
|
||||
this.clearPositionWatch = await watchPosition(
|
||||
this.onWatchedPosition,
|
||||
this.onGeolocationError,
|
||||
);
|
||||
this.clearPositionWatch = watchPosition(this.onWatchedPosition, this.onGeolocationError);
|
||||
} catch (error) {
|
||||
this.onGeolocationError(error?.message);
|
||||
// don't set locationInterval if geolocation failed to setup
|
||||
|
|
|
@ -49,8 +49,8 @@ export class RoomEchoChamber extends GenericEchoChamber<RoomEchoContext, CachedR
|
|||
|
||||
private onAccountData = (event: MatrixEvent) => {
|
||||
if (event.getType() === EventType.PushRules) {
|
||||
const currentVolume = this.properties.get(CachedRoomKey.NotificationVolume) as RoomNotifState;
|
||||
const newVolume = getRoomNotifsState(this.context.room.roomId) as RoomNotifState;
|
||||
const currentVolume = this.properties.get(CachedRoomKey.NotificationVolume);
|
||||
const newVolume = getRoomNotifsState(this.context.room.roomId);
|
||||
if (currentVolume !== newVolume) {
|
||||
this.updateNotificationVolume();
|
||||
}
|
||||
|
|
|
@ -141,7 +141,6 @@ export default class RightPanelStore extends ReadyWatchingStore {
|
|||
const hist = this.byRoom[rId]?.history ?? [];
|
||||
hist[hist.length - 1].state = cardState;
|
||||
this.emitAndUpdateSettings();
|
||||
return;
|
||||
} else if (targetPhase !== this.currentCard?.phase) {
|
||||
// Set right panel and erase history.
|
||||
this.show();
|
||||
|
|
|
@ -732,7 +732,7 @@ export class SpaceStoreClass extends AsyncStoreWithClient<IState> {
|
|||
const newPath = new Set(parentPath).add(spaceId);
|
||||
|
||||
childSpaces.forEach(childSpace => {
|
||||
traverseSpace(childSpace.roomId, newPath) ?? [];
|
||||
traverseSpace(childSpace.roomId, newPath);
|
||||
});
|
||||
hiddenChildren.get(spaceId)?.forEach(roomId => {
|
||||
roomIds.add(roomId);
|
||||
|
@ -1076,7 +1076,7 @@ export class SpaceStoreClass extends AsyncStoreWithClient<IState> {
|
|||
});
|
||||
|
||||
const enabledMetaSpaces = SettingsStore.getValue("Spaces.enabledMetaSpaces");
|
||||
this._enabledMetaSpaces = metaSpaceOrder.filter(k => enabledMetaSpaces[k]) as MetaSpace[];
|
||||
this._enabledMetaSpaces = metaSpaceOrder.filter(k => enabledMetaSpaces[k]);
|
||||
|
||||
this._allRoomsInHome = SettingsStore.getValue("Spaces.allRoomsInHome");
|
||||
this.sendUserProperties();
|
||||
|
@ -1169,8 +1169,7 @@ export class SpaceStoreClass extends AsyncStoreWithClient<IState> {
|
|||
}
|
||||
|
||||
case Action.SettingUpdated: {
|
||||
const settingUpdatedPayload = payload as SettingUpdatedPayload;
|
||||
switch (settingUpdatedPayload.settingName) {
|
||||
switch (payload.settingName) {
|
||||
case "Spaces.allRoomsInHome": {
|
||||
const newValue = SettingsStore.getValue("Spaces.allRoomsInHome");
|
||||
if (this.allRoomsInHome !== newValue) {
|
||||
|
@ -1186,7 +1185,7 @@ export class SpaceStoreClass extends AsyncStoreWithClient<IState> {
|
|||
|
||||
case "Spaces.enabledMetaSpaces": {
|
||||
const newValue = SettingsStore.getValue("Spaces.enabledMetaSpaces");
|
||||
const enabledMetaSpaces = metaSpaceOrder.filter(k => newValue[k]) as MetaSpace[];
|
||||
const enabledMetaSpaces = metaSpaceOrder.filter(k => newValue[k]);
|
||||
if (arrayHasDiff(this._enabledMetaSpaces, enabledMetaSpaces)) {
|
||||
const hadPeopleOrHomeEnabled = this.enabledMetaSpaces.some(s => {
|
||||
return s === MetaSpace.Home || s === MetaSpace.People;
|
||||
|
@ -1217,9 +1216,9 @@ export class SpaceStoreClass extends AsyncStoreWithClient<IState> {
|
|||
|
||||
case "Spaces.showPeopleInSpace":
|
||||
// getSpaceFilteredUserIds will return the appropriate value
|
||||
this.emit(settingUpdatedPayload.roomId);
|
||||
this.emit(payload.roomId);
|
||||
if (!this.enabledMetaSpaces.some(s => s === MetaSpace.Home || s === MetaSpace.People)) {
|
||||
this.updateNotificationStates([settingUpdatedPayload.roomId]);
|
||||
this.updateNotificationStates([payload.roomId]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue