Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

500er auf Prod #472

Open
larsUE opened this issue Nov 21, 2024 · 5 comments
Open

500er auf Prod #472

larsUE opened this issue Nov 21, 2024 · 5 comments
Assignees
Labels
hotfix to be removed after proper fix

Comments

@larsUE
Copy link
Collaborator

larsUE commented Nov 21, 2024

Auf diesen beiden Komponenten kriegen wir einen 500er:
https://mitwirken.stadt-zuerich.ch/admin/assemblies/anmeldung/components/550/manage/
https://mitwirken.stadt-zuerich.ch/admin/assemblies/anmeldung/components/551/manage/

Allenfalls hat das einen Zusammenhang mit den Access Links.

@larsUE larsUE converted this from a draft issue Nov 21, 2024
@Kagemaru
Copy link
Member

@larsUE Aus der Fehlermeldung vermute ich, dass es mit decidim_awesome oder der OpenPoke Decidim Version zusammenhängt. Dies ist aber nur eine vage Vermutung.

Wie soll ich damit umgehen? Soll ich mehr Zeit investieren?

ActionView::Template::Error

undefined local variable or method `current_assembly' for #<ActionView::Base:0x000000808c8108>
Did you mean?  current_user


NameError

undefined local variable or method `current_assembly' for #<ActionView::Base:0x000000808c8108>
Did you mean?  current_user

    decidim (2536f0df31be) decidim-assemblies/lib/decidim/assemblies/admin_engine.rb in block (2 levels) in <class:AdminEngine> at line 207
    decidim (2536f0df31be) decidim-core/lib/decidim/menu.rb in instance_exec at line 20
    decidim (2536f0df31be) decidim-core/lib/decidim/menu.rb in block in build_for at line 20
    decidim (2536f0df31be) decidim-core/lib/decidim/menu.rb in each at line 19
    decidim (2536f0df31be) decidim-core/lib/decidim/menu.rb in build_for at line 19
    … decidim_awesome (161e41933910) app/presenters/decidim/decidim_awesome/menu_presenter_override.rb in evaluated_menu at line 15

@nicolefreypuzzle
Copy link
Collaborator

Weitere Zeit investieren für genauere Analyse @Kagemaru

@Kagemaru
Copy link
Member

Es scheint ein Problem mit den share tokens zu sein, da beim hinzufügen dieses Menu Items, current_assembly nicht verfügbar ist:

          menu.add_item :assembly_share_tokens,
                        I18n.t("menu.share_tokens", scope: "decidim.admin"),
                        decidim_admin_assemblies.assembly_share_tokens_path(current_assembly),
                        active: is_active_link?(decidim_admin_assemblies.assembly_share_tokens_path(current_participatory_space)),
                        if: allowed_to?(:read, :share_tokens, current_participatory_space: current_participatory_space)

Es gibt einen ekligen Hack um dies zu umgehen:

class Object
  def current_assembly
    @current_assembly ||= begin
      model = organization_assemblies if defined?(organization_assemblies)
      model ||= Decidim::Assembly

      model.find_by!(
        slug: params[:assembly_slug] || params[:slug]
      )
    end
  end
end

Dies setzt current_assembly quasi als globale Methode. Falls wir uns für einen Fix auf unserer Seite entscheiden, würde ich dies noch mit anderen Mitarbeitern besprechen, da ich momentan keinen besseren Weg sehe.

@Kagemaru Kagemaru moved this from Ready to In Progress in Basisplattform Mitwirken Umsetzung 2023/24 Dec 17, 2024
@Kagemaru Kagemaru moved this from In Progress to Review in Basisplattform Mitwirken Umsetzung 2023/24 Dec 17, 2024
@larsUE
Copy link
Collaborator Author

larsUE commented Jan 6, 2025

Translation for @microstudi and @paarals:

We are experiencing a 500 server error on the following pages:
Auf diesen beiden Komponenten kriegen wir einen 500er:
https://mitwirken.stadt-zuerich.ch/admin/assemblies/anmeldung/components/550/manage/
https://mitwirken.stadt-zuerich.ch/admin/assemblies/anmeldung/components/551/manage/

The error is as follows:

ActionView::Template::Error

undefined local variable or method `current_assembly' for #<ActionView::Base:0x000000808c8108>
Did you mean?  current_user


NameError

undefined local variable or method `current_assembly' for #<ActionView::Base:0x000000808c8108>
Did you mean?  current_user

    decidim (2536f0df31be) decidim-assemblies/lib/decidim/assemblies/admin_engine.rb in block (2 levels) in <class:AdminEngine> at line 207
    decidim (2536f0df31be) decidim-core/lib/decidim/menu.rb in instance_exec at line 20
    decidim (2536f0df31be) decidim-core/lib/decidim/menu.rb in block in build_for at line 20
    decidim (2536f0df31be) decidim-core/lib/decidim/menu.rb in each at line 19
    decidim (2536f0df31be) decidim-core/lib/decidim/menu.rb in build_for at line 19
    … decidim_awesome (161e41933910) app/presenters/decidim/decidim_awesome/menu_presenter_override.rb in evaluated_menu at line 15

This problem occurs due to the share tokens, because when this menu item is added, current_assembly isn't available any more.

          menu.add_item :assembly_share_tokens,
                        I18n.t("menu.share_tokens", scope: "decidim.admin"),
                        decidim_admin_assemblies.assembly_share_tokens_path(current_assembly),
                        active: is_active_link?(decidim_admin_assemblies.assembly_share_tokens_path(current_participatory_space)),
                        if: allowed_to?(:read, :share_tokens, current_participatory_space: current_participatory_space)

There would be a very hacky solution to this, which sets current_assembly as the global method. But maybe you have a better idea?

class Object
  def current_assembly
    @current_assembly ||= begin
      model = organization_assemblies if defined?(organization_assemblies)
      model ||= Decidim::Assembly

      model.find_by!(
        slug: params[:assembly_slug] || params[:slug]
      )
    end
  end
end

@larsUE
Copy link
Collaborator Author

larsUE commented Jan 7, 2025

@Kagemaru Please implement hacky solution until we have a better solution.

@larsUE larsUE added the hotfix to be removed after proper fix label Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotfix to be removed after proper fix
Projects
Development

No branches or pull requests

3 participants