[damned-lies] Removed bugs_product/bugs_component fields



commit 6a36430fe94f5e24dfa77eb7a5f63cf3a2eb5d18
Author: Claude Paroz <claude 2xlibre net>
Date:   Sat Feb 16 10:13:49 2019 +0100

    Removed bugs_product/bugs_component fields

 stats/admin.py                               |  2 +-
 stats/fixtures/sample_data.json              |  6 ------
 stats/migrations/0016_removed_bugs_fields.py | 19 +++++++++++++++++++
 stats/models.py                              | 28 +++++++++-------------------
 stats/tests/fixture_factory.py               | 16 ++++++++--------
 stats/tests/tests.py                         |  2 +-
 vertimus/tests/tests.py                      |  3 +--
 7 files changed, 39 insertions(+), 37 deletions(-)
---
diff --git a/stats/admin.py b/stats/admin.py
index d8fabfa1..83e469a0 100644
--- a/stats/admin.py
+++ b/stats/admin.py
@@ -100,7 +100,7 @@ class ModuleAdmin(admin.ModelAdmin):
         (None, {
             'fields': (('name','description'),
                         'homepage', 'comment', 'archived',
-                       ('bugs_base', 'bugs_product', 'bugs_component'),
+                       ('bugs_base',),
                        ('vcs_type', 'vcs_root', 'vcs_web'),
                        'ext_platform', 'maintainers')
         }),
diff --git a/stats/fixtures/sample_data.json b/stats/fixtures/sample_data.json
index df40b7d4..1082cfe6 100644
--- a/stats/fixtures/sample_data.json
+++ b/stats/fixtures/sample_data.json
@@ -198,10 +198,8 @@
   "vcs_web": "https://gitlab.gnome.org/GNOME/gnome-hello/";,
   "name": "gnome-hello",
   "vcs_root": "https://gitlab.gnome.org/GNOME/gnome-hello.git";,
-  "bugs_product": "test",
   "ext_platform": "",
   "maintainers": [],
-  "bugs_component": "test",
   "bugs_base": "https://gitlab.gnome.org/GNOME/gnome-hello/issues";,
   "vcs_type": "git",
   "homepage": "",
@@ -217,10 +215,8 @@
   "vcs_web": "https://gitlab.gnome.org/GNOME/zenity/";,
   "name": "zenity",
   "vcs_root": "https://gitlab.gnome.org/GNOME/zenity.git";,
-  "bugs_product": "zenity",
   "ext_platform": "",
   "maintainers": [],
-  "bugs_component": "general",
   "bugs_base": "https://gitlab.gnome.org/GNOME/zenity/issues";,
   "vcs_type": "git",
   "homepage": "",
@@ -236,10 +232,8 @@
   "vcs_web": "https://gitlab.freedesktop.org/xdg/shared-mime-info";,
   "name": "shared-mime-info",
   "vcs_root": "https://gitlab.freedesktop.org/xdg/shared-mime-info.git";,
-  "bugs_product": "shared-mime-info",
   "ext_platform": "",
   "maintainers": [],
-  "bugs_component": "general",
   "bugs_base": "https://gitlab.freedesktop.org/xdg/shared-mime-info/issues";,
   "vcs_type": "git",
   "homepage": "",
diff --git a/stats/migrations/0016_removed_bugs_fields.py b/stats/migrations/0016_removed_bugs_fields.py
new file mode 100644
index 00000000..4d5dae2c
--- /dev/null
+++ b/stats/migrations/0016_removed_bugs_fields.py
@@ -0,0 +1,19 @@
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('stats', '0015_remove_domain_directory'),
+    ]
+
+    operations = [
+        migrations.RemoveField(
+            model_name='module',
+            name='bugs_component',
+        ),
+        migrations.RemoveField(
+            model_name='module',
+            name='bugs_product',
+        ),
+    ]
diff --git a/stats/models.py b/stats/models.py
index 0c74fc75..9aa59710 100644
--- a/stats/models.py
+++ b/stats/models.py
@@ -85,8 +85,6 @@ class Module(models.Model):
     description = models.TextField(blank=True)
     comment = models.TextField(blank=True)
     bugs_base = models.CharField(max_length=250, blank=True)
-    bugs_product = models.CharField(max_length=50, blank=True)
-    bugs_component = models.CharField(max_length=50, blank=True)
     vcs_type = models.CharField(max_length=5, choices=VCS_TYPE_CHOICES)
     # URLField is too restrictive for vcs_root
     vcs_root = models.CharField(max_length=200)
@@ -133,23 +131,17 @@ class Module(models.Model):
         return re.search(settings.VCS_HOME_REGEX, self.vcs_root) is not None
 
     def get_bugs_i18n_url(self, content=None):
-        if self.bugs_base and ("bugzilla" in self.bugs_base or "bugs.freedesktop" in self.bugs_base):
-            link = utils.url_join(
-                self.bugs_base,
-                "buglist.cgi?product=%s&keywords_type=anywords&keywords=I18N+L10N"
-                
"&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&bug_status=NEEDINFO" % 
(self.bugs_product,))
+        if 'gitlab' in self.bugs_base:
+            return utils.url_join(self.bugs_base, '?state=opened&label_name[]=8.%20Translation')
             if content:
-                link += "&content=%s" % content
+                link += "&search=%s" % content
             return link
         else:
             return None
 
     def get_bugs_enter_url(self):
-        if self.bugs_base and ("bugzilla" in self.bugs_base or "bugs.freedesktop" in self.bugs_base):
-            link = utils.url_join(self.bugs_base, "enter_bug.cgi?product=%s&keywords=I18N+L10N" % 
(self.bugs_product,))
-            if self.bugs_component:
-                link += "&component=%s" % self.bugs_component
-            return link
+        if 'gitlab' in self.bugs_base:
+            return utils.url_join(self.bugs_base, 'new')
         else:
             return self.bugs_base
 
@@ -743,9 +735,8 @@ class Domain(models.Model):
 
         elif pot_method == 'intltool':
             pot_command = ['intltool-update', '-g', self.potbase(), '-p']
-            bugs_url = self.module.get_bugs_enter_url()
-            if bugs_url:
-                env = {"XGETTEXT_ARGS": "\"--msgid-bugs-address=%s\"" % bugs_url}
+            if self.module.bugs_base:
+                env = {"XGETTEXT_ARGS": "\"--msgid-bugs-address=%s\"" % self.module.bugs_base}
 
         elif pot_method == 'shell':
             pot_command = self.pot_params
@@ -836,9 +827,8 @@ class Domain(models.Model):
                         [str(branch.co_path / path) for path in datadirs]
                     )
         # Added last as some chars in it may disturb CLI parsing
-        bugs_url = self.module.get_bugs_enter_url()
-        if bugs_url:
-            pot_command.extend(['--msgid-bugs-address', bugs_url])
+        if self.module.bugs_base:
+            pot_command.extend(['--msgid-bugs-address', self.module.bugs_base])
         return pot_command, env
 
     def commit_info(self, branch, language):
diff --git a/stats/tests/fixture_factory.py b/stats/tests/fixture_factory.py
index 19270c0c..80ce1ddb 100644
--- a/stats/tests/fixture_factory.py
+++ b/stats/tests/fixture_factory.py
@@ -55,18 +55,18 @@ class FixtureFactory(TestCase):
         p0.delete()
 
         # Creating models: Modules
-        gnome_hello = Module.objects.create(name="gnome-hello", vcs_type="git",
+        gnome_hello = Module.objects.create(
+            name="gnome-hello", vcs_type="git",
             vcs_root="https://gitlab.gnome.org/GNOME/gnome-hello.git";,
             vcs_web="https://gitlab.gnome.org/GNOME/gnome-hello/";,
-            bugs_base="https://bugzilla.gnome.org";,
-            bugs_product="test", # This product really exists
-            bugs_component="test")
-        zenity = Module.objects.create(name="zenity", vcs_type="git",
+            bugs_base="https://gitlab.gnome.org/GNOME/gnome-hello/issues";,
+        )
+        zenity = Module.objects.create(
+            name="zenity", vcs_type="git",
             vcs_root="https://gitlab.gnome.org/GNOME/zenity.git";,
             vcs_web="https://gitlab.gnome.org/GNOME/zenity/";,
-            bugs_base="https://bugzilla.gnome.org";,
-            bugs_product="zenity",
-            bugs_component="general")
+            bugs_base="https://gitlab.gnome.org/GNOME/zenity/issues";,
+        )
         s_m_i = Module.objects.create(name="shared-mime-info", vcs_type="git",
             description="Shared MIME Info",
             vcs_root="https://gitlab.freedesktop.org/xdg/shared-mime-info.git";,
diff --git a/stats/tests/tests.py b/stats/tests/tests.py
index d5027dea..dc1cf6b8 100644
--- a/stats/tests/tests.py
+++ b/stats/tests/tests.py
@@ -82,7 +82,7 @@ class ModuleTestCase(TestCase):
         response = self.client.get(reverse('module', args=[self.mod.name]))
         self.assertContains(
             response,
-            '<li><a href="https://gitlab.gnome.org/GNOME/gnome-hello/issues";>Report a bug</a></li>',
+            '<li><a href="https://gitlab.gnome.org/GNOME/gnome-hello/issues/new";>Report a bug</a></li>',
             html=True
         )
         self.mod.bugs_base = ''
diff --git a/vertimus/tests/tests.py b/vertimus/tests/tests.py
index 407affa6..6f1b5705 100644
--- a/vertimus/tests/tests.py
+++ b/vertimus/tests/tests.py
@@ -39,8 +39,7 @@ class VertimusTest(TeamsAndRolesMixin, TestCase):
 
         self.m = Module.objects.create(
             name='gnome-hello', description='GNOME Hello',
-            bugs_base="https://bugzilla.gnome.org/";,
-            bugs_product='gnome-hello', bugs_component='general',
+            bugs_base="https://gitlab.gnome.org/GNOME/gnome-hello/issues";,
             vcs_type='git', vcs_root="https://gitlab.gnome.org/GNOME/gnome-hello.git";,
             vcs_web="https://gitlab.gnome.org/GNOME/gnome-hello/";
         )


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]