Move logic from views/shared/wikis/404.html.haml to helpers/wiki_helper.rb (wiki_404_messages)

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

The following discussion from !179545 (merged) should be addressed:

  • @eugielimpin started a discussion:

    suggestion (non-blocking): Ideally we do this in the backend (helper) to make testing easier.

      def wiki_404_messages
        messages = {
          title: s_("Wiki404|This page doesn't exist")
          body: s_('Wiki404|Use the sidebar to find a different page.'),
          button_text: nil,
          button_link: nil
        }
    
        # need to check presence of @error here too?
        if current_user.can?(:create_wiki, @wiki.container)
          messages.merge({
            body: _("Wiki404|Would you like to create it?"),
            button_text: s_('WikiEmpty|Create this page…'),
            button_link: wiki_page_path(@wiki, params[:id], view: 'create')
          })
        end
      end
    
    = render Pajamas::EmptyStateComponent.new(svg_path: 'illustrations/empty-state/empty-wiki-md.svg',
      title: messages[:title],
      primary_button_text: messages[:button_text],
      primary_button_link: messages[:button_link],
      empty_state_options: { data: { testid: 'wiki-404' } }) do |c|
    
      - c.with_description do
        = messages[:body]
Edited by 🤖 GitLab Bot 🤖