diff --git a/front/src/Components/Menu/SettingsSubMenu.svelte b/front/src/Components/Menu/SettingsSubMenu.svelte index 93d3eaa9..1db14036 100644 --- a/front/src/Components/Menu/SettingsSubMenu.svelte +++ b/front/src/Components/Menu/SettingsSubMenu.svelte @@ -8,6 +8,7 @@ let fullscreen: boolean = localUserStore.getFullscreen(); let notification: boolean = localUserStore.getNotification() === "granted"; let forceCowebsiteTrigger: boolean = localUserStore.getForceCowebsiteTrigger(); + let ignoreFollowRequests: boolean = localUserStore.getIgnoreFollowRequests(); let valueGame: number = localUserStore.getGameQualityValue(); let valueVideo: number = localUserStore.getVideoQualityValue(); let previewValueGame = valueGame; @@ -59,6 +60,10 @@ localUserStore.setForceCowebsiteTrigger(forceCowebsiteTrigger); } + function changeIgnoreFollowRequests() { + localUserStore.setIgnoreFollowRequests(ignoreFollowRequests); + } + function closeMenu() { menuVisiblilityStore.set(false); } @@ -123,6 +128,15 @@ /> Always ask before opening websites and Jitsi Meet rooms + diff --git a/front/src/Connexion/LocalUserStore.ts b/front/src/Connexion/LocalUserStore.ts index 30755034..4dce6924 100644 --- a/front/src/Connexion/LocalUserStore.ts +++ b/front/src/Connexion/LocalUserStore.ts @@ -14,6 +14,7 @@ const audioPlayerMuteKey = "audioMute"; const helpCameraSettingsShown = "helpCameraSettingsShown"; const fullscreenKey = "fullscreen"; const forceCowebsiteTriggerKey = "forceCowebsiteTrigger"; +const ignoreFollowRequests = "ignoreFollowRequests"; const lastRoomUrl = "lastRoomUrl"; const authToken = "authToken"; const state = "state"; @@ -128,6 +129,13 @@ class LocalUserStore { return localStorage.getItem(forceCowebsiteTriggerKey) === "true"; } + setIgnoreFollowRequests(value: boolean): void { + localStorage.setItem(ignoreFollowRequests, value.toString()); + } + getIgnoreFollowRequests(): boolean { + return localStorage.getItem(ignoreFollowRequests) === "true"; + } + setLastRoomUrl(roomUrl: string): void { localStorage.setItem(lastRoomUrl, roomUrl.toString()); if ("caches" in window) { diff --git a/front/src/Connexion/RoomConnection.ts b/front/src/Connexion/RoomConnection.ts index f8d385d4..f4cbc251 100644 --- a/front/src/Connexion/RoomConnection.ts +++ b/front/src/Connexion/RoomConnection.ts @@ -63,6 +63,7 @@ import { emoteEventStream } from "./EmoteEventStream"; import { get } from "svelte/store"; import { warningContainerStore } from "../Stores/MenuStore"; import { followStateStore, followRoleStore, followUsersStore, followRoles, followStates } from "../Stores/FollowStore"; +import { localUserStore } from "./LocalUserStore"; const manualPingDelay = 20000; @@ -264,17 +265,16 @@ export class RoomConnection implements RoomConnection { //todo: implement a way to notify the user the room was refreshed. } else if (message.hasFollowrequestmessage()) { const requestMessage = message.getFollowrequestmessage() as FollowRequestMessage; - console.log("Got follow request from " + requestMessage.getLeader()); - followStateStore.set(followStates.requesting); - followRoleStore.set(followRoles.follower); - followUsersStore.set([requestMessage.getLeader()]); + if (!localUserStore.getIgnoreFollowRequests()) { + followStateStore.set(followStates.requesting); + followRoleStore.set(followRoles.follower); + followUsersStore.set([requestMessage.getLeader()]); + } } else if (message.hasFollowconfirmationmessage()) { const responseMessage = message.getFollowconfirmationmessage() as FollowConfirmationMessage; - console.log("Got follow response from " + responseMessage.getFollower()); followUsersStore.set([...get(followUsersStore), responseMessage.getFollower()]); } else if (message.hasFollowabortmessage()) { const abortMessage = message.getFollowabortmessage() as FollowAbortMessage; - console.log("Got follow abort message"); if (get(followRoleStore) === followRoles.follower) { followStateStore.set(followStates.off); followRoleStore.set(followRoles.leader);