Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions apps/custom_email/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,5 @@ def get_brand_logo_light(self, instance):
return get_theme_logo_url(instance, "light")

def get_brand_name(self, instance):
organization = getattr(instance, "organization", None)
setting = (
getattr(organization, "organization_settings", None)
if organization
else None
)
setting = getattr(instance, "organization_setting", None)
return getattr(setting, "brand_name", "") or ""
10 changes: 3 additions & 7 deletions apps/custom_email/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@
def get_theme_logo_url(instance, theme_key):
host = settings.HOST.rstrip("/")
default_logo = "logo_white.png" if theme_key == ThemeType.DARK else "logo_black.png"
organization = getattr(instance, "organization", None)
if not organization:
return f"{host}/static/images/branding/{default_logo}"

setting = getattr(organization, "organization_settings", None)
setting = getattr(instance, "organization_setting", None)
if not setting:
return f"{host}/static/images/branding/{default_logo}"

Expand Down Expand Up @@ -80,10 +76,10 @@ def get_default_organization_emails():
]


def create_default_organization_email(organization):
def create_default_organization_email(organization_setting):
return OrganizationEmail.objects.bulk_create(
[
OrganizationEmail(organization=organization, **email_data)
OrganizationEmail(organization_setting=organization_setting, **email_data)
for email_data in get_default_organization_emails()
]
)
Expand Down
4 changes: 2 additions & 2 deletions apps/custom_page/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ def get_default_pages():
]


def create_default_pages(organization):
def create_default_pages(organization_setting):
default_pages = get_default_pages()
list_data = [
CustomPage(
organization=organization,
organization_setting=organization_setting,
page_type=page.get("page_type"),
title=page.get("title"),
subtitle=page.get("subtitle"),
Expand Down
1 change: 1 addition & 0 deletions apps/organization_setting/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,4 @@ def create_default_organization_setting(organization: Organization):
),
]
)
return setting
6 changes: 3 additions & 3 deletions bootstrap_service/management/commands/init_organization.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ def _create_organization_with_roles(self, org_id, org_name, org_slug, result):

organization_policies = create_default_policies(organization)

create_default_pages(organization)
create_default_organization_email(organization)
create_default_organization_setting(organization)
organization_setting = create_default_organization_setting(organization)
create_default_pages(organization_setting)
create_default_organization_email(organization_setting)
create_default_organization_monitoring(organization)
create_default_subscription(organization)
self.stdout.write(self.style.SUCCESS("Created default policies"))
Expand Down
Loading