Fix logged out bug for most recent organizations

This commit is contained in:
cuom1999 2022-10-17 19:32:13 -05:00
parent 30f1c105cb
commit 8f15e327b8

View file

@ -127,7 +127,6 @@ class OrganizationMixin(OrganizationBase):
context["logo_override_image"] = self.organization.logo_override_image
if "organizations" in context:
context.pop("organizations")
OrganizationProfile.add_organization(self.request.profile, self.organization)
return context
def dispatch(self, request, *args, **kwargs):
@ -152,6 +151,11 @@ class OrganizationMixin(OrganizationBase):
return HttpResponsePermanentRedirect(
request.get_full_path().replace(kwargs["slug"], self.organization.slug)
)
if self.request.user.is_authenticated:
OrganizationProfile.add_organization(
self.request.profile, self.organization
)
return super(OrganizationMixin, self).dispatch(request, *args, **kwargs)