diff --git a/src/app/settings.py b/src/app/settings.py index 1cef3c88..0803081d 100644 --- a/src/app/settings.py +++ b/src/app/settings.py @@ -24,7 +24,7 @@ BASE_DIR = Path(__file__).resolve().parent.parent.parent SECRET_KEY = os.getenv("KHOJ_DJANGO_SECRET_KEY") # SECURITY WARNING: don't run with debug turned on in production! -DEBUG = os.getenv("DJANGO_DEBUG", "False") == "True" +DEBUG = os.getenv("KHOJ_DEBUG", "False") == "True" ALLOWED_HOSTS = [".khoj.dev", "localhost", "127.0.0.1", "[::1]", "beta.khoj.dev"] diff --git a/src/database/adapters/__init__.py b/src/database/adapters/__init__.py index 4f71c7aa..70d94df3 100644 --- a/src/database/adapters/__init__.py +++ b/src/database/adapters/__init__.py @@ -134,10 +134,11 @@ async def set_user_subscription( return None -def get_user_subscription_state(user_subscription: Subscription) -> str: +def get_user_subscription_state(email: str) -> str: """Get subscription state of user Valid state transitions: trial -> subscribed <-> unsubscribed OR expired """ + user_subscription = Subscription.objects.filter(user__email=email).first() if not user_subscription: return "trial" elif user_subscription.type == Subscription.Type.TRIAL: @@ -370,8 +371,8 @@ class EntryAdapters: ) @staticmethod - async def user_has_entries(user: KhojUser): - return await Entry.objects.filter(user=user).aexists() + def user_has_entries(user: KhojUser): + return Entry.objects.filter(user=user).exists() @staticmethod async def adelete_entry_by_file(user: KhojUser, file_path: str): @@ -450,5 +451,5 @@ class EntryAdapters: return Entry.objects.filter(user=user).values_list("file_type", flat=True).distinct() @staticmethod - def get_unique_file_source(user: KhojUser): - return Entry.objects.filter(user=user).values_list("file_source", flat=True).distinct() + def get_unique_file_sources(user: KhojUser): + return Entry.objects.filter(user=user).values_list("file_source", flat=True).distinct().all() diff --git a/src/interface/desktop/config.html b/src/interface/desktop/config.html index c63a2a5c..fb39fbb8 100644 --- a/src/interface/desktop/config.html +++ b/src/interface/desktop/config.html @@ -91,10 +91,7 @@