#2147 [mailman3] Disable search in hyperkitty
Merged 6 months ago by zlopez. Opened 6 months ago by zlopez.
fedora-infra/ zlopez/ansible mailman_update  into  main

@@ -0,0 +1,249 @@ 

+ {% load i18n %}

+ {% load compress %}

+ {% load static %}

+ {% load hk_generic %}

+ <!DOCTYPE HTML>

+ <html>

+     <head>

+         <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

+         <meta name="viewport" content="width=device-width, initial-scale=1.0" />

+         <meta name="ROBOTS" content="INDEX, FOLLOW" />

+         <title>{% block head_title %}{{ site_name }}{% endblock %}</title>

+         <meta name="author" content="" />

+         <meta name="dc.language" content="en" />

+         <link rel="shortcut icon" href="{% static 'hyperkitty/img/favicon.ico' %}" />

+         <link rel="stylesheet" href="{% static 'hyperkitty/libs/jquery/smoothness/jquery-ui-1.13.1.min.css' %}" type="text/css" media="all" />

+         <link rel="stylesheet" href="{% static 'hyperkitty/libs/fonts/font-awesome/css/font-awesome.min.css' %}" type="text/css" media="all" />

+         {% compress css %}

+         <link rel="stylesheet" href="{% static 'hyperkitty/libs/fonts/icomoon/icomoon.css' %}" type="text/css" media="all" />

+         <link rel="stylesheet" href="{% static 'hyperkitty/libs/fonts/droid/droid.css' %}" type="text/css" media="all" />

+         <link rel="stylesheet" href="{% static 'django-mailman3/css/main.css' %}" />

+         <link rel="stylesheet" type="text/x-scss" media="all" href="{% static 'hyperkitty/sass/hyperkitty.scss' %}" />

+         {% endcompress %}

+         {% block additional_stylesheets %} {% endblock %}

+         {% block head_feed %}{% endblock %}

+         {% include 'hyperkitty/headers.html' %}

+     </head>

+ 

+     <body>

+ 

+     {% include 'hyperkitty/top.html' %}

+ 

+     <nav class="navbar sticky-top navbar-light bg-light navbar-expand-md">

+         <div class="container">

+             <div class="navbar-header col-md"> <!--part of navbar that's always present-->

+                 <button type="button" class="navbar-toggler collapsed" data-toggle="collapse" data-target=".navbar-collapse">

+                     <span class="fa fa-bars"></span>

+                 </button>

+                 {% include 'hyperkitty/navbar-brand.html' %}

+             </div> <!-- /navbar-header -->

+ 

+             <div class="navbar-collapse collapse justify-content-end"> <!--part of navbar that's collapsed on small screens-->

+                 <!-- show dropdown for smaller viewports b/c login name/email may be too long -->

+                 <!-- only show this extra button/dropdown if we're in small screen sizes -->

+                 <div class="nav navbar-nav navbar-right auth dropdown d-sm-none">

+                   <a href="#" role="button" class="btn dropdown-toggle" id="loginDropdownMenu"

+                      data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">

+                         {% if user.is_authenticated %}

+                             {% gravatar user.email 20 %}

+                         {% else %}

+                             <span class="fa fa-bars"></span>

+                         {% endif %}

+                     </a>

+                       {% if user.is_authenticated %}

+                           <div class="dropdown-menu">

+                             <a role="menuitem" tabindex="-1" class="dropdown-item" href="{% url 'mm_user_profile' %}">

+                                 <span class="fa fa-user"></span>

+                                 {% trans 'Account' %}

+                             </a>

+                             {% if 'postorius' in INSTALLED_APPS %}

+                             <a role="menuitem" tabindex="-1" class="dropdown-item" href="{% url 'ps_user_profile' %}">

+                                 <span class="fa fa-cog"></span>

+                                 {% trans 'Mailman settings' %}

+                             </a>

+                             {% endif %}

+                             <a role="menuitem" tabindex="-1" class="dropdown-item" href="{% url 'hk_user_profile' %}">

+                                 <span class="fa fa-comments"></span>

+                                 {% trans 'Posting activity' %}

+                             </a>

+                             <div class="dropdown-divider"></div>

+                             <a role="menuitem" tabindex="-1" class="dropdown-item" href="{% url LOGOUT_URL %}?next={% url 'hk_root' %}">

+                                 <span class="fa fa-sign-out"></span>

+                                 {% trans "Logout" %}

+                             </a>

+                           </div> <!-- dropdown menu -->

+                         {% else %}

+                             <a role="menuitem" tabindex="-1" href="{% url LOGIN_URL %}?next={{next|default:request.path|urlencode}}">

+                                 <span class="fa fa-sign-in"></span>

+                                 {% trans "Sign In" %}

+                             </a>

+                             <a role="menuitem" tabindex="-1" href="{% url 'account_signup' %}?next={{next|default:request.path|urlencode}}">

+                                 <span class="fa fa-user-plus"></span>

+                                 {% trans "Sign Up" %}

+                             </a>

+                         {% endif %}

+ 

+                 </div>

+                 <ul class="nav navbar-nav order-2">

+                     <li class="nav-item" style="color:red">

+                         Search is temporarily disabled.

+                         See <a href="https://pagure.io/fedora-infrastructure/issue/12043">ticket</a> for more info.

+                     </li>

+                 </ul>

+ 

+ 		<!--

+                 <form name="search" method="get" action="{% url 'hk_search' %}" class="navbar-form navbar-right my-2 my-lg-2 order-1" role="search">

+                     {% if mlist %}<input type="hidden" name="mlist" value="{{ mlist.name }}" />{% endif %}

+                         <div class="input-group">

+                             <input name="q" type="text" class="form-control"

+                                    placeholder="{% if mlist %}{% trans 'Search this list' %}{% else %}{% trans 'Search all lists' %}{% endif %}"

+                                    {% if query %}value="{{ query }}"{% endif %}

+                                    />

+                             <span class="input-group-append">

+                                 <button class="btn btn-secondary" type="submit"><span class="fa fa-search"></span></button>

+                             </span>

+                         </div>

+                 </form>

+ 		-->

+                 <!-- larger viewports -->

+                 <ul class="nav navbar-nav d-none d-sm-flex auth order-3">

+                     {% if user.is_authenticated %}

+                         <li class="dropdown nav-item">

+                             <a href="#" class="nav-link dropdown-toggle" data-toggle="dropdown"

+                                role="button" aria-haspopup="true" aria-expanded="false">

+                                 {% gravatar user.email 20 %}

+                                 {{ user.username|truncatechars:"35" }}

+                                 <span class="caret"></span>

+                             </a>

+                             <div class="dropdown-menu dropdown-menu-right">

+                                 <a href="{% url 'mm_user_profile' %}" class="dropdown-item">

+                                     <span class="fa fa-user"></span>

+                                     {% trans 'Account' %}

+                                 </a>

+                                 {% if 'postorius' in INSTALLED_APPS %}

+                                 <a href="{% url 'ps_user_profile' %}" class="dropdown-item">

+                                     <span class="fa fa-cog"></span>

+                                     {% trans 'Mailman settings' %}

+                                 </a>

+                                 {% endif %}

+                                 <a href="{% url 'hk_user_profile' %}" class="dropdown-item">

+                                     <span class="fa fa-comments"></span>

+                                     {% trans 'Posting activity' %}

+                                 </a>

+                                 <div role="separator" class="dropdown-divider"></div>

+                                 <a href="{% url LOGOUT_URL %}?next={% url 'hk_root' %}" class="dropdown-item">

+                                     <span class="fa fa-sign-out"></span>

+                                     {% trans "Logout" %}

+                                 </a>

+                             </div>

+                         </li>

+                     {% else %}

+                         <li class="nav-item"><a href="{% url LOGIN_URL %}?next={{next|default:request.path|urlencode}}" class="nav-link">

+                             <span class="fa fa-sign-in"></span>

+                             {% trans "Sign In" %}

+                         </a></li>

+                         <li class="nav-item"><a href="{% url 'account_signup' %}?next={{next|default:request.path|urlencode}}" class="nav-link">

+                             <span class="fa fa-user-plus"></span>

+                             {% trans "Sign Up" %}

+                         </a></li>

+                     {% endif %}

+                 </ul>

+ 

+                 {% if 'postorius' in INSTALLED_APPS %}

+                 <ul class="nav navbar-nav order-2">

+                     <li class="nav-item">

+                     {% if mlist %}

+                     <a href="{% url 'list_summary' mlist.list_id %}" class="nav-link">

+                         <span class="fa fa-cog"></span>

+                         {% trans 'Manage this list' %}

+                     </a>

+                     {% else %}

+                     <a href="{% url 'list_index' %}" class="nav-link">

+                         <span class="fa fa-cog"></span>

+                         {% trans 'Manage lists' %}

+                     </a>

+                     {% endif %}

+                     </li>

+                 </ul>

+                 {% endif %}

+ 

+ 

+             </div> <!--/navbar-collapse -->

+         </div> <!-- /container for navbar -->

+     </nav>

+ 

+     {% if messages %}

+     <div class="flashmsgs">

+     {% for msg in messages %}

+         <div class="flashmsg-wrapper">

+             <!--<div class="alert alert-{{ msg.level_tag }}">-->

+             <div role="alert" class="alert alert-{{ msg.tags }} {{msg.tags}}

+                 {% if msg.level == DEFAULT_MESSAGE_LEVELS.SUCCESS %}

+                 ">

+                 {% else %}

+                 alert-dismissible">

+                 <button type="button" class="close" data-dismiss="alert" aria-label="Close">

+                     <span aria-hidden="true">&times;</span>

+                 </button>

+                 {% endif %}

+                 {{ msg }}

+             </div>

+         </div>

+     {% endfor %}

+     </div>

+     {% endif %}

+ 

+      <div class="modal fade" tabindex="-1" role="dialog" id="keyboard-shortcuts">

+        <div class="modal-dialog" role="document">

+          <div class="modal-content">

+            <div class="modal-header">

+              <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>

+              <h4 class="modal-title">{% trans "Keyboard Shortcuts" %}</h4>

+            </div>

+            <div class="modal-body">

+              <h3>{% trans "Thread View" %}</h3>

+              <ul>

+                <li><code>j</code>: {% trans "Next unread message" %} </li>

+                <li><code>k</code>: {% trans "Previous unread message" %} </li>

+                <li><code>j a</code>: {% trans "Jump to all threads" %}

+                <li><code>j l</code>: {% trans "Jump to MailingList overview" %}

+              </ul>

+            </div>

+          </div><!-- /.modal-content -->

+        </div><!-- /.modal-dialog -->

+      </div><!-- /.modal -->

+ 

+      <div class="container">

+         {% block content %} {% endblock %}

+     </div> <!-- /container for content -->

+ 

+     <footer class="footer">

+       <div class="container">

+         <p class="text-muted">

+             {% trans 'Powered by' %} <a href="http://hyperkitty.readthedocs.org">HyperKitty</a> {% trans 'version' %} {{ HYPERKITTY_VERSION }}.

+         </p>

+       </div>

+     </footer>

+ 

+     <script src="{% static 'hyperkitty/libs/jquery/jquery-3.6.0.min.js' %}"></script>

+     <script src="{% static 'hyperkitty/libs/jquery/jquery-ui-1.13.1.min.js' %}"></script>

+     {% compress js %}

+     <script type="text/javascript" src="{% static 'hyperkitty/libs/popper/popper.min.js' %}" />

+     <script type="text/javascript" src="{% static 'hyperkitty/libs/bootstrap/javascripts/bootstrap.min.js' %}" />

+     <script type="text/javascript" src="{% static 'hyperkitty/libs/mousetrap/mousetrap.min.js' %}" />

+     <script type="text/javascript" src="{% static 'hyperkitty/libs/jquery.expander.js' %}" />

+     <script type="text/javascript" src="{% static 'hyperkitty/libs/d3.v2.min.js' %}" />

+     <script type="text/javascript" src="{% static 'hyperkitty/libs/jquery.hotkeys.js' %}" />

+     <script type="text/javascript" src="{% static 'django-mailman3/js/main.js' %}" />

+     <script type="text/javascript" src="{% static 'hyperkitty/js/hyperkitty-common.js' %}" />

+     <script type="text/javascript" src="{% static 'hyperkitty/js/hyperkitty-index.js' %}" />

+     <script type="text/javascript" src="{% static 'hyperkitty/js/hyperkitty-overview.js' %}" />

+     <script type="text/javascript" src="{% static 'hyperkitty/js/hyperkitty-thread.js' %}" />

+     <script type="text/javascript" src="{% static 'hyperkitty/js/hyperkitty-userprofile.js' %}" />

+     {% endcompress %}

+     {% block additionaljs %} {% endblock %}

+ 

+     {% include 'hyperkitty/bottom.html' %}

+ 

+     </body>

+ </html>

@@ -411,6 +411,18 @@ 

    notify:

      - restart mailmanweb

  

+ # HyperKitty hotfix

+ - name: Disable search in hyperkitty

+   ansible.builtin.copy:

+     src: base.html

+     dest: /usr/lib/python3.9/site-packages/hyperkitty/templates/hyperkitty/base.html

+   tags:

+     - mailman

+     - hyperkitty

+     - patch

+   notify:

+     - restart mailmanweb

+ 

  # Memcached

  - name: Set the memcached sysconfig file

    ansible.builtin.copy:

@@ -25,6 +25,11 @@ 

  ProxyPass /static !

  ProxyPass /pipermail !

  ProxyPass /apache-status !

+ ProxyPass /favicon.ico !

+ ProxyPass /robots.txt !

+ # This needs to be removed to re-enable the search in hyperkitty

+ ProxyPass /archives/search !

+ 

  

  # Proxying to gunicorn mailmanweb backend

  ProxyPass / http://127.0.0.1:8000/
@@ -33,6 +38,8 @@ 

  # Redirecting to hyperkitty if nothing is specified

  RewriteEngine on

  RewriteRule  ^/$    /archives [R,L]

+ # This needs to be removed to re-enable the search in hyperkitty

+ RewriteRule  ^/archives/search$ - [F]

  

  # Spiders-gone-wild

  # These spiders may not follow robots.txt and will

Mailman has huge memory spikes after migration, those are caused by visiting
/archives/search URL. This is probably because of the search index still being
regenerated.

This patch will disable the search from both web UI and as a HTTP URL endpoint.

Fixes https://pagure.io/fedora-infrastructure/issue/12043

Signed-off-by: Michal Konecny mkonecny@redhat.com

rebased onto bd1f4f8

6 months ago

You are right, will fix that

rebased onto e6ef090

6 months ago

rebased onto e6ef090

6 months ago

Fixed the typo and added replacement text for search bar with link to ticket.

Pull-Request has been merged by zlopez

6 months ago