internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: Uberspace/lab

Issue:
link to "view changelog" no longer works
"view changelog" on each page will lead to the old master branch which now should be `main`


Discussion:

Resolving patch:
diff --git a/source/conf.py b/source/conf.py
--- a/source/conf.py
+++ b/source/conf.py
@@ -112,7 +112,7 @@
     "display_github": True,
     "github_user": "Uberspace",
     "github_repo": "lab",
-    "github_version": "master",
+    "github_version": "main",
     "conf_py_path": "/source/",
 }
 html_show_copyright = False


Test patch:
Repository: v7labs/darwin-py

Issue:
Remove unused requests_toolbelt requirement?
AFAICT, requests_toolbelt is not used anywhere, yet it exists in the install_requires.

https://github.com/v7labs/darwin-py/blob/878e9a0d639d6b70886bb53b00486908c3b6a14b/setup.py#L32

https://github.com/v7labs/darwin-py/search?q=requests_toolbelt


Discussion:
Hello @hajapy and thank you for your comment.
We will evaluate this situation and remove the dependency if that is the case. 

Best regards and happy holidays, 
Wind V7 team.

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -29,7 +29,6 @@
         "pillow",
         "pyyaml>=5.1",
         "requests",
-        "requests_toolbelt",
         "rich",
         "upolygon==0.1.6",
         "jsonschema",


Test patch:
Repository: mdn/kuma

Issue:
generate window.waffle without HTTP request
See https://github.com/jsocol/django-waffle/pull/100



Discussion:
Doing this in https://github.com/jsocol/django-waffle/pull/100 and will update our vendor submodule to the new commit after it's merged.


Resolving patch:
diff --git a/settings.py b/settings.py
--- a/settings.py
+++ b/settings.py
@@ -319,6 +319,7 @@ def lazy_language_deki_map():
     'admindocs',
     'registration',
     'grappelli',
+    'waffle'
 )
 
 TEMPLATE_CONTEXT_PROCESSORS = (


Test patch:
Repository: mdn/kuma

Issue:
Fix up Sentry configuration to not raise a ValueError all the time
God, this is super annoying and is so confusion me. Imagine how it looks to new contributors.



Discussion:

Resolving patch:
diff --git a/puppet/files/vagrant/settings_local.py b/puppet/files/vagrant/settings_local.py
--- a/puppet/files/vagrant/settings_local.py
+++ b/puppet/files/vagrant/settings_local.py
@@ -154,4 +154,10 @@
 ES_LIVE_INDEX = True
 ES_INDEXING_TIMEOUT = 30
 
-SENTRY_DSN = 'https://mana.mozilla.org/wiki/display/websites/Developer+Cluster#DeveloperCluster-Sentry'
+# See https://mana.mozilla.org/wiki/display/websites/Developer+Cluster#DeveloperCluster-Sentry
+SENTRY_DSN = ''
+
+if SENTRY_DSN:
+    INSTALLED_APPS = INSTALLED_APPS + (
+        'raven.contrib.django.raven_compat',
+    )
diff --git a/settings.py b/settings.py
--- a/settings.py
+++ b/settings.py
@@ -459,7 +459,6 @@ def lazy_language_deki_map():
     'teamwork',
     'djcelery',
     'taggit',
-    'raven.contrib.django.raven_compat',
     'dbgettext',
 
     'dashboards',
@@ -1129,7 +1128,6 @@ def JINJA_CONFIG():
 CSRF_COOKIE_SECURE = True
 X_FRAME_OPTIONS = 'DENY'
 
-SENTRY_DSN = 'set this in settings_local.py'
 TEAMWORK_BASE_POLICIES = {
     'anonymous': (
         'wiki.view_document',),


Test patch:
Repository: mdn/kuma

Issue:
restore django-debug-toolbar
We disabled django-debug-toolbar before we upgraded to django 1.4. Now that we're on it we should be able to restore it in `settings_local.py`.

restore django-debug-toolbar
We disabled django-debug-toolbar before we upgraded to django 1.4. Now that we're on it we should be able to restore it in `settings_local.py`.



Discussion:

Resolving patch:
diff --git a/puppet/files/vagrant/settings_local.py b/puppet/files/vagrant/settings_local.py
--- a/puppet/files/vagrant/settings_local.py
+++ b/puppet/files/vagrant/settings_local.py
@@ -34,31 +34,30 @@
 
 INSTALLED_APPS = INSTALLED_APPS + (
     "django_extensions",
-    # TODO: re-enable after django 1.4
-    # "debug_toolbar",
+    "debug_toolbar",
     "devserver",
 )
 
-MIDDLEWARE_CLASSES = (
-    # TODO: re-enable after django 1.4
-    # "debug_toolbar.middleware.DebugToolbarMiddleware",
-) + MIDDLEWARE_CLASSES
+JINGO_EXCLUDE_APPS = JINGO_EXCLUDE_APPS + (
+    'debug_toolbar',
+)
 
 DEBUG_TOOLBAR_CONFIG = {
     "INTERCEPT_REDIRECTS": False,
 }
 
 DEBUG_TOOLBAR_PANELS = (
-    'debug_toolbar.panels.version.VersionDebugPanel',
-    'debug_toolbar.panels.timer.TimerDebugPanel',
-    'debug_toolbar.panels.settings_vars.SettingsVarsDebugPanel',
-    'debug_toolbar.panels.headers.HeaderDebugPanel',
-    'debug_toolbar.panels.request_vars.RequestVarsDebugPanel',
-    'debug_toolbar.panels.template.TemplateDebugPanel',
-    #'cache_panel.CachePanel',
-    'debug_toolbar.panels.sql.SQLDebugPanel',
-    'debug_toolbar.panels.signals.SignalDebugPanel',
-    'debug_toolbar.panels.logger.LoggingPanel',
+    'debug_toolbar.panels.versions.VersionsPanel',
+    'debug_toolbar.panels.timer.TimerPanel',
+    'debug_toolbar.panels.settings.SettingsPanel',
+    'debug_toolbar.panels.headers.HeadersPanel',
+    'debug_toolbar.panels.request.RequestPanel',
+    'debug_toolbar.panels.templates.TemplatesPanel',
+    'debug_toolbar.panels.cache.CachePanel',
+    'debug_toolbar.panels.sql.SQLPanel',
+    'debug_toolbar.panels.signals.SignalsPanel',
+    'debug_toolbar.panels.logging.LoggingPanel',
+    'debug_toolbar.panels.redirects.RedirectsPanel',
 )
 
 DEVSERVER_MODULES = (


Test patch:
Repository: mdn/kuma

Issue:
Research: Could we compress CSS/JS more aggressively?



Discussion:

Resolving patch:
diff --git a/settings.py b/settings.py
--- a/settings.py
+++ b/settings.py
@@ -583,6 +583,9 @@ def JINJA_CONFIG():
 
 # Bundles for JS/CSS Minification
 JINGO_MINIFY_USE_STATIC = False
+CLEANCSS_BIN = '/usr/bin/cleancss'
+UGLIFY_BIN = '/usr/bin/uglifyjs'
+
 MINIFY_BUNDLES = {
     'css': {
         'mdn': (
@@ -745,8 +748,6 @@ def JINJA_CONFIG():
     },
 }
 
-JAVA_BIN = '/usr/bin/java'
-
 #
 # Session cookies
 SESSION_COOKIE_SECURE = True


Test patch:
Repository: mdn/kuma

Issue:
Unnecessary SQL select for react home landing page
The React landing page view extracts the default filters. Every time but it's never used. 
<img width="1502" alt="Screen Shot 2019-08-13 at 2 44 39 PM" src="https://user-images.githubusercontent.com/26739/62968514-34a08a00-bdd9-11e9-92fb-c584683c7085.png">



Discussion:

Resolving patch:
diff --git a/kuma/landing/views.py b/kuma/landing/views.py
--- a/kuma/landing/views.py
+++ b/kuma/landing/views.py
@@ -24,19 +24,16 @@ def contribute_json(request):
 @shared_cache_control
 def home(request):
     """Home page."""
+    context = {}
+    # Need for both wiki and react homepage
+    context['updates'] = list(
+        Bundle.objects.recent_entries(SECTION_HACKS.updates)[:5])
+
+    # The default template name
+    template_name = 'landing/react_homepage.html'
     if is_wiki(request):
-        return render_home(request, 'landing/homepage.html')
-    return render_home(request, 'landing/react_homepage.html')
-
-
-def render_home(request, template_name):
-    """Render the home page with the template named "template_name"."""
-    updates = list(Bundle.objects.recent_entries(SECTION_HACKS.updates)[:5])
-    default_filters = Filter.objects.default_filters()
-    context = {
-        'updates': updates,
-        'default_filters': default_filters,
-    }
+        template_name = 'landing/homepage.html'
+        context['default_filters'] = Filter.objects.default_filters()
     return render(request, template_name, context)
 
 


Test patch:
Repository: mdn/kuma

Issue:
Why does SSR rendering /en-US/docs/Web require 54 SQL queries?
<img width="1500" alt="Screen Shot 2019-08-13 at 3 05 10 PM" src="https://user-images.githubusercontent.com/26739/62969706-da54f880-bddb-11e9-8405-dd1ecd25b657.png">




Discussion:

Resolving patch:
diff --git a/kuma/api/v1/views.py b/kuma/api/v1/views.py
--- a/kuma/api/v1/views.py
+++ b/kuma/api/v1/views.py
@@ -125,7 +125,7 @@ def document_api_data(doc=None, ensure_contributors=False, redirect_url=None):
         en_slug = ''
 
     other_translations = doc.get_other_translations(
-        fields=('locale', 'slug', 'title'))
+        fields=('locale', 'slug', 'title', 'parent'))
     available_locales = (
         set([doc.locale]) | set(t.locale for t in other_translations))
 


Test patch:
Repository: mdn/kuma

Issue:
Reindex dangerously excludes slugs
The reindexing exludes these slugs: https://github.com/mozilla/kuma/blob/71816ee9280238aa5460bd3f7e12eaad9589abb5/kuma/wiki/search.py#L30-L31
But [the way it does it](https://github.com/mozilla/kuma/blob/71816ee9280238aa5460bd3f7e12eaad9589abb5/kuma/wiki/search.py#L228) is that it uses `icontains` instead of `startswith` which is more inefficient and it's also potentially excluding slugs that contain any of those strings later. E.g. `Learn/HTML/user:prefixing`


Discussion:
Also, that list doesn't exclude the "Archive".

Resolving patch:
diff --git a/kuma/wiki/search.py b/kuma/wiki/search.py
--- a/kuma/wiki/search.py
+++ b/kuma/wiki/search.py
@@ -2,7 +2,6 @@
 from __future__ import division
 
 import logging
-import operator
 from math import ceil
 
 from celery import chain
@@ -15,7 +14,6 @@
 from elasticsearch_dsl.connections import connections
 from elasticsearch_dsl.mapping import Mapping
 from elasticsearch_dsl.search import Search
-from six.moves import reduce
 
 from kuma.core.utils import chord_flow, chunked
 
@@ -223,13 +221,11 @@ def get_indexable(cls, percent=100):
         """
         model = cls.get_model()
 
-        excludes = []
+        excludes = Q()
         for exclude in cls.exclude_slugs:
-            excludes.append(Q(slug__icontains=exclude))
+            excludes |= Q(slug__startswith=exclude)
 
-        qs = (model.objects
-                   .filter(is_redirect=False, deleted=False)
-                   .exclude(reduce(operator.or_, excludes)))
+        qs = model.objects.filter(is_redirect=False).exclude(excludes)
 
         percent = percent / 100
         if percent < 1:


Test patch:
Repository: mdn/kuma

Issue:
Combine all print styles in print.css and serve with media=print
Currently, we have print specific styling peppered throughout the codebase. This is a maintenance problem and adds to the overall size of our CSS bundles.

Moving all our print specific styling into its own CSS file will improve maintainability but, now that it is its own "bundle", we can serve it separately with `media="print"`. When the site is viewed on screen, the `media` type of `print` won't match, and so the browser will:

1. Mark it is low priority in terms of download and parsing
2. When it does load it, it will be loaded in a non-blocking manner


Discussion:

Resolving patch:
diff --git a/kuma/settings/common.py b/kuma/settings/common.py
--- a/kuma/settings/common.py
+++ b/kuma/settings/common.py
@@ -737,7 +737,6 @@ def pipeline_one_scss(slug, **kwargs):
         ),
         'output_filename': 'build/styles/react-mdn.css',
     },
-
     'mdn': {
         'source_filenames': (
             'styles/main.scss',
@@ -764,6 +763,15 @@ def pipeline_one_scss(slug, **kwargs):
         ),
         'output_filename': 'build/styles/home.css',
     },
+    'print': {
+        'source_filenames': (
+            'styles/minimalist/print.scss',
+        ),
+        'output_filename': 'build/styles/print.css',
+        'extra_context': {
+            'media': 'print',
+        },
+    },
     'search': {
         'source_filenames': (
             'styles/search.scss',


Test patch:
Repository: mdn/kuma

Issue:
Site-search CSS busted
Screenshot says it all...

<img width="1680" alt="Screen Shot 2019-09-04 at 3 20 45 PM" src="https://user-images.githubusercontent.com/26739/64284462-a7f47200-cf27-11e9-81bb-31f82a4fd363.png">



Discussion:
@peterbe Did you hook up the new CSS? https://github.com/mozilla/kuma/blob/master/kuma/static/styles/minimalist/structure/_search-results.scss

Also, I believe I made some changes to the classes, but those probably made their way across when you rebased against master. Let me know if the above does not resolve the problem.
So, you can either add `_search-results.scss` to its own main `search-page.scss` file and then create a custom bundle inside `common.py` for the search results page or, you can include it in `minimalist/document.scss` if that works for now.
> Did you hook up the new CSS?

I haven't touched any of that :)
Also, my work on site-search is only in a branch on my laptop. Would you mind assigning this one to yourself?

Resolving patch:
diff --git a/kuma/settings/common.py b/kuma/settings/common.py
--- a/kuma/settings/common.py
+++ b/kuma/settings/common.py
@@ -733,6 +733,12 @@ def pipeline_one_scss(slug, **kwargs):
         ),
         'output_filename': 'build/styles/react-mdn.css',
     },
+    'react-search': {
+        'source_filenames': (
+            'styles/minimalist/search-page.scss',
+        ),
+        'output_filename': 'build/styles/react-search.css',
+    },
     'mdn': {
         'source_filenames': (
             'styles/main.scss',


Test patch:
Repository: mdn/kuma

Issue:
Display the auth service logo in first step
**Summary**

As part of the new account signup flow, and in support of more auth options, we want to clearly show which auth provider the user is currently signing up with.

To that end, we need to add the relevant logo to the header portion of the signup flow as detailed in the below screenshot.

![Screenshot 2019-09-16 at 11 26 32](https://user-images.githubusercontent.com/10350960/64947390-2977c880-d875-11e9-8425-03f019acb7bd.png)


**Audience**

Users signing up for a new account

**Rationale**

See Epic https://github.com/mdn/sprints/issues/1857

**Workaround**

N/A

**Proposal**

See summary above

**Additional context**

Nothing



Discussion:

Resolving patch:
diff --git a/kuma/settings/common.py b/kuma/settings/common.py
--- a/kuma/settings/common.py
+++ b/kuma/settings/common.py
@@ -857,6 +857,12 @@ def pipeline_one_scss(slug, **kwargs):
         ),
         'output_filename': 'build/styles/submission.css',
     },
+    'signupflow': {
+        'source_filenames': (
+            'styles/minimalist/structure/signup-flow.scss',
+        ),
+        'output_filename': 'build/styles/signup-flow.css',
+    },
     'user-banned': {
         'source_filenames': (
             'styles/user-banned.scss',


Test patch:
Repository: mdn/kuma

Issue:
Unable to see number of SQL queries for XHR requests
We have [`django-debug-toolbar`](https://github.com/mozilla/kuma/blob/de54288505213e8d60f3308f1cb586f9ca9befdf/requirements/dev.txt#L16) as a dev requirement. It's great for seeing how many and which SQL queries get used in a HTML rendering page. 

But we're moving away from rendering HTML and more and more rendering JSON where `django-debug-toolbar` can't help. 


Discussion:

Resolving patch:
diff --git a/kuma/api/v1/views.py b/kuma/api/v1/views.py
--- a/kuma/api/v1/views.py
+++ b/kuma/api/v1/views.py
@@ -222,7 +222,6 @@ def whoami(request):
         'switches': {s.name: s.is_active() for s in Switch.get_all()},
         'samples': {s.name: s.is_active() for s in Sample.get_all()},
     }
-
     return JsonResponse(data)
 
 
diff --git a/kuma/settings/common.py b/kuma/settings/common.py
--- a/kuma/settings/common.py
+++ b/kuma/settings/common.py
@@ -460,6 +460,15 @@ def _get_locales():
     # For more config, see "Content Security Policy (CSP)" below
     MIDDLEWARE += ('csp.middleware.CSPMiddleware',)
 
+ENABLE_QUERYCOUNT = config('ENABLE_QUERYCOUNT', default=False, cast=bool)
+if ENABLE_QUERYCOUNT:
+    # Prints heavy query counts per request.
+    QUERYCOUNT = {
+        'IGNORE_REQUEST_PATTERNS': [r'^/admin/'],
+        'DISPLAY_DUPLICATES': config(
+            'QUERYCOUNT_DISPLAY_DUPLICATES', cast=int, default=0),
+    }
+    MIDDLEWARE += ('querycount.middleware.QueryCountMiddleware',)
 
 # Auth
 AUTHENTICATION_BACKENDS = (


Test patch:
Repository: mdn/kuma

Issue:
Create header CSS bundle
Create a `header.css` bundle. It should contain styling for the following:

```
Logo
Main navigation
Search widget
Sign in
Avatar
```


Discussion:

Resolving patch:
diff --git a/kuma/settings/common.py b/kuma/settings/common.py
--- a/kuma/settings/common.py
+++ b/kuma/settings/common.py
@@ -696,6 +696,12 @@ def pipeline_one_scss(slug, **kwargs):
         ),
         'output_filename': 'build/styles/react-mdn.css',
     },
+    'react-header': {
+        'source_filenames': (
+            'styles/minimalist/organisms/header.scss',
+        ),
+        'output_filename': 'build/styles/react-header.css',
+    },
     'react-search': {
         'source_filenames': (
             'styles/minimalist/search-page.scss',


Test patch:
Repository: mdn/kuma

Issue:
iframes don't have titles causing accessibiltiy issues
iframes are used heavily on MDN for interactive examples, but they don't have titles causing accessibility issues. We should add titles to them, so screen reader users can tell whether they want explore or skip them.


Discussion:
The iframes actually have titles added to them, but we bleach them out here: https://github.com/mozilla/kuma/blob/d85d09f9c2a15353ef527464021e061b7712ec3f/kuma/wiki/constants.py#L39

Resolving patch:
diff --git a/kuma/wiki/constants.py b/kuma/wiki/constants.py
--- a/kuma/wiki/constants.py
+++ b/kuma/wiki/constants.py
@@ -38,7 +38,7 @@
 # Note: <iframe> is allowed, but src="" is pre-filtered before bleach
 ALLOWED_ATTRIBUTES['iframe'] = ['id', 'src', 'sandbox', 'seamless',
                                 'frameborder', 'width', 'height', 'class',
-                                'allow']
+                                'allow', 'title']
 ALLOWED_ATTRIBUTES['p'] = ['style', 'class', 'id', 'align', 'lang', 'dir']
 ALLOWED_ATTRIBUTES['span'] = ['style', 'class', 'id', 'title', 'lang', 'dir']
 ALLOWED_ATTRIBUTES['abbr'] = ['style', 'class', 'id', 'title', 'lang', 'dir']


Test patch:
Repository: mdn/kuma

Issue:
Remove components/compact.scss from codebase
The Sass file `kuma/static/styles/components/compact.scss` is hanging around the codebase with no purpose. It is one less Sass file I(@schalkneethling) have to think about ;p


Discussion:

Resolving patch:
diff --git a/kuma/settings/common.py b/kuma/settings/common.py
--- a/kuma/settings/common.py
+++ b/kuma/settings/common.py
@@ -811,6 +811,7 @@ def pipeline_one_scss(slug, **kwargs):
     },
     'dashboards': {
         'source_filenames': (
+            'styles/components/compact.scss',
             'styles/dashboards.scss',
             'styles/diff.scss',
         ),


Test patch:
Repository: mdn/kuma

Issue:
Do not ship selectivizr
As with https://github.com/mozilla/kuma/issues/5905, once we ship "reader mode" to version of `lte IE10`, we should remove the following from the base Jinja template:

```
<!--[if lte IE 8]>{% javascript 'selectivizr' %}<![endif]-->
```


Discussion:

Resolving patch:
diff --git a/kuma/settings/common.py b/kuma/settings/common.py
--- a/kuma/settings/common.py
+++ b/kuma/settings/common.py
@@ -1099,12 +1099,6 @@ def pipeline_one_scss(slug, **kwargs):
         ),
         'output_filename': 'build/js/html5shiv.js',
     },
-    'selectivizr': {
-        'source_filenames': (
-            'js/libs/selectivizr/selectivizr.js',
-        ),
-        'output_filename': 'build/js/selectivizr.js',
-    },
     'perf': {
         'source_filenames': (
             'js/utils/perf.js',


Test patch:
Repository: mdn/kuma

Issue:
Stop shipping html5shiv
In the head of all document we have the following that targets all versions of IE:

```
<!--[if IE]>
  <meta http-equiv="imagetoolbar" content="no">
  {% javascript 'html5shiv' %}
<![endif]-->
```

We *really* do not need this any longer, especially once we have switched to a "reader mode" for `lte IE10`.


Discussion:

Resolving patch:
diff --git a/kuma/settings/common.py b/kuma/settings/common.py
--- a/kuma/settings/common.py
+++ b/kuma/settings/common.py
@@ -1098,12 +1098,6 @@ def pipeline_one_scss(slug, **kwargs):
             'async': True,
         },
     },
-    'html5shiv': {
-        'source_filenames': (
-            'js/libs/html5shiv/html5shiv.js',
-        ),
-        'output_filename': 'build/js/html5shiv.js',
-    },
     'perf': {
         'source_filenames': (
             'js/utils/perf.js',


Test patch:
Repository: mdn/kuma

Issue:
Stop serving bug1522937-iex-test.js
As part of the `wiki` JavaScript bundle, we are still including 'js/utils/bug1522937-iex-test.js'. This is no longer needed so we can safely remove the inclusion inside `common.py` and delete the `.js` file.


Discussion:

Resolving patch:
diff --git a/kuma/settings/common.py b/kuma/settings/common.py
--- a/kuma/settings/common.py
+++ b/kuma/settings/common.py
@@ -1037,7 +1037,6 @@ def pipeline_one_scss(slug, **kwargs):
             'js/utils/utils.js',
             'js/utils/post-message-handler.js',
             'js/wiki.js',
-            'js/utils/bug1522937-iex-test.js',
             'js/interactive.js',
             'js/wiki-samples.js',
             'js/wiki-toc.js',


Test patch:
Repository: mdn/kuma

Issue:
AttributeError: 'NoneType' object has no attribute 'sites'
**Summary**
_What is the problem?_
I was installing `Kuma` on my computer.
When I run the command `docker-compose exec web ./manage.py configure_github_social`, console desk show the Error `AttributeError: 'NoneType' object has no attribute 'sites'`.

**Steps To Reproduce (STR)**
_How can we reproduce the problem?_

1. Get in [https://kuma.readthedocs.io/en/latest/installation.html#load-the-sample-database](https://kuma.readthedocs.io/en/latest/installation.html#load-the-sample-database)
2. Find the step **Enable GitHub authentication (optional)**
3. At that step I run `docker-compose exec web ./manage.py configure_github_social`, and error occured.


**Actual behavior**
_What actually happened?_
I checked the code and found that in file `kuma/attachments/management/commands/configure_github_social.py` line 75, the variable `social_app` is None. Was I got something wrong? 


Discussion:

Resolving patch:
diff --git a/kuma/attachments/management/commands/configure_github_social.py b/kuma/attachments/management/commands/configure_github_social.py
--- a/kuma/attachments/management/commands/configure_github_social.py
+++ b/kuma/attachments/management/commands/configure_github_social.py
@@ -52,7 +52,7 @@ def handle(self, **options):
         print('\n')
 
         social_app = SocialApp.objects.filter(provider='github').first()
-        if social_app is not None and input(OVERWRITE_PROMPT) == 'yes':
+        if social_app is None or input(OVERWRITE_PROMPT) == 'yes':
             print('\n')
 
             print(GITHUB_INFO)


Test patch: