Commit d9198a01d1d52b65aa49dc32dad5c127aa776e08
1 parent
bdb676c6
Exists in
master
and in
31 other branches
Fix gitlab links
Showing
2 changed files
with
31 additions
and
3 deletions
Show diff stats
colab/plugins/gitlab/migrations/0004_auto_20150630_1149.py
0 → 100644
| ... | ... | @@ -0,0 +1,26 @@ |
| 1 | +# -*- coding: utf-8 -*- | |
| 2 | +from __future__ import unicode_literals | |
| 3 | + | |
| 4 | +from django.db import models, migrations | |
| 5 | + | |
| 6 | + | |
| 7 | +class Migration(migrations.Migration): | |
| 8 | + | |
| 9 | + dependencies = [ | |
| 10 | + ('gitlab', '0003_auto_20150211_1203'), | |
| 11 | + ] | |
| 12 | + | |
| 13 | + operations = [ | |
| 14 | + migrations.AddField( | |
| 15 | + model_name='gitlabcomment', | |
| 16 | + name='iid', | |
| 17 | + field=models.IntegerField(null=True), | |
| 18 | + preserve_default=True, | |
| 19 | + ), | |
| 20 | + migrations.AddField( | |
| 21 | + model_name='gitlabmergerequest', | |
| 22 | + name='iid', | |
| 23 | + field=models.IntegerField(null=True), | |
| 24 | + preserve_default=True, | |
| 25 | + ), | |
| 26 | + ] | ... | ... |
colab/plugins/gitlab/models.py
| ... | ... | @@ -27,6 +27,7 @@ class GitlabProject(models.Model, HitCounterModelMixin): |
| 27 | 27 | class GitlabMergeRequest(Collaboration): |
| 28 | 28 | |
| 29 | 29 | id = models.IntegerField(primary_key=True) |
| 30 | + iid = models.IntegerField(null=True) | |
| 30 | 31 | target_branch = models.TextField() |
| 31 | 32 | source_branch = models.TextField() |
| 32 | 33 | project = models.ForeignKey(GitlabProject, null=True, |
| ... | ... | @@ -50,7 +51,7 @@ class GitlabMergeRequest(Collaboration): |
| 50 | 51 | @property |
| 51 | 52 | def url(self): |
| 52 | 53 | return u'/gitlab/{}/merge_requests/{}'.format( |
| 53 | - self.project.path_with_namespace, self.id) | |
| 54 | + self.project.path_with_namespace, self.iid) | |
| 54 | 55 | |
| 55 | 56 | def get_author(self): |
| 56 | 57 | return self.user |
| ... | ... | @@ -91,6 +92,7 @@ class GitlabIssue(Collaboration): |
| 91 | 92 | class GitlabComment(Collaboration): |
| 92 | 93 | |
| 93 | 94 | id = models.IntegerField(primary_key=True) |
| 95 | + iid = models.IntegerField(null=True) | |
| 94 | 96 | body = models.TextField() |
| 95 | 97 | created_at = models.DateTimeField(blank=True, null=True) |
| 96 | 98 | issue_comment = models.BooleanField(default=True) |
| ... | ... | @@ -133,10 +135,10 @@ class GitlabComment(Collaboration): |
| 133 | 135 | def url(self): |
| 134 | 136 | if self.issue_comment: |
| 135 | 137 | return u'/gitlab/{}/issues/{}#notes_{}'.format( |
| 136 | - self.project.path_with_namespace, self.parent_id, self.id) | |
| 138 | + self.project.path_with_namespace, self.parent_id, self.iid) | |
| 137 | 139 | else: |
| 138 | 140 | return u'/gitlab/{}/merge_requests/{}#notes_{}'.format( |
| 139 | - self.project.path_with_namespace, self.parent_id, self.id) | |
| 141 | + self.project.path_with_namespace, self.parent_id, self.iid) | |
| 140 | 142 | |
| 141 | 143 | class Meta: |
| 142 | 144 | verbose_name = _('Gitlab Comments') | ... | ... |