Ver código fonte

refac: temporary enforced behaviour

Timothy Jaeryang Baek 3 meses atrás
pai
commit
eac2f36f4f

+ 1 - 1
src/lib/components/chat/Chat.svelte

@@ -708,7 +708,7 @@
 	//////////////////////////
 
 	const initNewChat = async () => {
-		if ($user?.permissions?.chat?.temporary_enforced) {
+		if ($user?.role !== 'admin' && $user?.permissions?.chat?.temporary_enforced) {
 			await temporaryChatEnabled.set(true);
 		}
 

+ 1 - 1
src/lib/components/layout/Sidebar.svelte

@@ -491,7 +491,7 @@
 				on:click={async () => {
 					selectedChatId = null;
 
-					if ($user?.permissions?.chat?.temporary_enforced) {
+					if ($user?.role !== 'admin' && $user?.permissions?.chat?.temporary_enforced) {
 						await temporaryChatEnabled.set(true);
 					} else {
 						await temporaryChatEnabled.set(false);

+ 2 - 2
src/routes/(app)/+layout.svelte

@@ -199,7 +199,7 @@
 					event.preventDefault();
 					console.log('temporaryChat');
 
-					if ($user?.permissions?.chat?.temporary_enforced) {
+					if ($user?.role !== 'admin' && $user?.permissions?.chat?.temporary_enforced) {
 						temporaryChatEnabled.set(true);
 					} else {
 						temporaryChatEnabled.set(!$temporaryChatEnabled);
@@ -222,7 +222,7 @@
 					temporaryChatEnabled.set(true);
 				}
 
-				if ($user?.permissions?.chat?.temporary_enforced) {
+				if ($user?.role !== 'admin' && $user?.permissions?.chat?.temporary_enforced) {
 					temporaryChatEnabled.set(true);
 				}
 			}