allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [14/50] git commit: [#4602] ticket:541 Add strikethrough to 'Related' section
Date Tue, 25 Mar 2014 14:27:12 GMT
[#4602] ticket:541 Add strikethrough to 'Related' section


Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/79992213
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/79992213
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/79992213

Branch: refs/heads/db/5995
Commit: 7999221357c04952b496279f9a6529923315388e
Parents: e1fc875
Author: Igor Bondarenko <jetmind2@gmail.com>
Authored: Fri Feb 21 13:19:47 2014 +0200
Committer: Tim Van Steenburgh <tvansteenburgh@gmail.com>
Committed: Tue Mar 11 14:17:19 2014 +0000

----------------------------------------------------------------------
 Allura/allura/model/artifact.py                         |  4 ++--
 Allura/allura/model/discuss.py                          |  2 +-
 Allura/allura/model/repo.py                             |  4 ++--
 ForgeTracker/forgetracker/model/ticket.py               | 12 +++++++++++-
 ForgeTracker/forgetracker/tests/functional/test_root.py | 12 ++++++++++++
 5 files changed, 28 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/79992213/Allura/allura/model/artifact.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/artifact.py b/Allura/allura/model/artifact.py
index cd8f5e2..d819897 100644
--- a/Allura/allura/model/artifact.py
+++ b/Allura/allura/model/artifact.py
@@ -364,11 +364,11 @@ class Artifact(MappedClass):
         """Return the link text to use when a shortlink to this artifact
         is expanded into an <a></a> tag.
 
-        By default this method returns :meth:`shorthand_id`. Subclasses should
+        By default this method returns :attr:`type_s` + :meth:`shorthand_id`. Subclasses
should
         override this method to provide more descriptive link text.
 
         """
-        return self.shorthand_id()
+        return '%s: %s' % (self.type_s, self.shorthand_id())
 
     def get_discussion_thread(self, data=None):
         """Return the discussion thread and parent_id for this artifact.

http://git-wip-us.apache.org/repos/asf/allura/blob/79992213/Allura/allura/model/discuss.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/discuss.py b/Allura/allura/model/discuss.py
index b9f25d1..4a9c6ef 100644
--- a/Allura/allura/model/discuss.py
+++ b/Allura/allura/model/discuss.py
@@ -648,7 +648,7 @@ class Post(Message, VersionedArtifact, ActivityObject):
             return None
 
     def link_text(self):
-        return self.subject
+        return '%s: %s' % (self.type_s, self.subject)
 
     def reply_subject(self):
         if self.subject and self.subject.lower().startswith('re:'):

http://git-wip-us.apache.org/repos/asf/allura/blob/79992213/Allura/allura/model/repo.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repo.py b/Allura/allura/model/repo.py
index 9f11cc8..29e04c1 100644
--- a/Allura/allura/model/repo.py
+++ b/Allura/allura/model/repo.py
@@ -292,10 +292,10 @@ class Commit(RepoObject, ActivityObject):
         '''The link text that will be used when a shortlink to this artifact
         is expanded into an <a></a> tag.
 
-        By default this method returns shorthand_id(). Subclasses should
+        By default this method returns type_s + shorthand_id(). Subclasses should
         override this method to provide more descriptive link text.
         '''
-        return self.shorthand_id()
+        return '%s: %s' % (self.type_s, self.shorthand_id())
 
     def context(self):
         result = dict(prev=None, next=None)

http://git-wip-us.apache.org/repos/asf/allura/blob/79992213/ForgeTracker/forgetracker/model/ticket.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/model/ticket.py b/ForgeTracker/forgetracker/model/ticket.py
index ecba850..b308416 100644
--- a/ForgeTracker/forgetracker/model/ticket.py
+++ b/ForgeTracker/forgetracker/model/ticket.py
@@ -621,6 +621,12 @@ class Ticket(VersionedArtifact, ActivityObject, VotableArtifact):
 
     reported_by = RelationProperty(User, via='reported_by_id')
 
+    def link_text(self):
+        text = super(Ticket, self).link_text()
+        if self.is_closed:
+            return jinja2.Markup('<s>') + text + jinja2.Markup('</s>')
+        return text
+
     @property
     def activity_name(self):
         return 'ticket #%s' % self.ticket_num
@@ -755,7 +761,11 @@ class Ticket(VersionedArtifact, ActivityObject, VotableArtifact):
 
     @property
     def open_or_closed(self):
-        return 'closed' if self.status in c.app.globals.set_of_closed_status_names else 'open'
+        return 'closed' if self.status in self.app.globals.set_of_closed_status_names else
'open'
+
+    @property
+    def is_closed(self):
+        return self.open_or_closed == 'closed'
 
     @property
     def monitoring_email(self):

http://git-wip-us.apache.org/repos/asf/allura/blob/79992213/ForgeTracker/forgetracker/tests/functional/test_root.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/tests/functional/test_root.py b/ForgeTracker/forgetracker/tests/functional/test_root.py
index 9642c38..59c878d 100644
--- a/ForgeTracker/forgetracker/tests/functional/test_root.py
+++ b/ForgeTracker/forgetracker/tests/functional/test_root.py
@@ -879,6 +879,18 @@ class TestFunctionalController(TrackerTestController):
         response = self.app.get('/wiki/aaa/')
         assert 'alink notfound' in response
 
+    def test_related_artifacts_closed_tickets(self):
+        self.new_ticket(summary='Ticket 1')
+        self.new_ticket(summary='Ticket 2', status='closed')
+        self.new_ticket(summary='Ticket 3', description='[#1]\n\n[#2]')
+        ThreadLocalORMSession.flush_all()
+        M.MonQTask.run_ready()
+        ThreadLocalORMSession.flush_all()
+        r = self.app.get('/p/test/bugs/3/')
+        assert_in('Ticket: #1', r)
+        assert_not_in('<s>Ticket: #1</s>', r)
+        assert_in('<s>Ticket: #2</s>', r)
+
     def test_ticket_view_editable(self):
         summary = 'test ticket view page can be edited'
         self.new_ticket(summary=summary)


Mime
View raw message