Skip to content

Commit 9ef72b6

Browse files
author
hsiao19
committed
fix issue trac-hacks#62 Wrong comment url in notifiy email
1 parent 68e266f commit 9ef72b6

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

code_comments/comment.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,27 @@ def validate(self):
7070

7171
def href(self):
7272
if self.is_comment_to_file:
73-
href = self.req.href.browser(self.path, rev=self.revision, codecomment=self.id)
73+
href = self.req.href.browser(self.path, rev=self.revision,
74+
codecomment=self.id)
7475
elif self.is_comment_to_changeset:
7576
href = self.req.href.changeset(self.revision, codecomment=self.id)
77+
base_url = self.env.abs_href()
78+
pathList = base_url.split('/')
79+
projectPath = ""
80+
if len(pathList) > 4:
81+
del pathList[0:3]
82+
projectPath = '/'.join(pathList)
83+
projectPath = '/' + projectPath
84+
if href.startswith(projectPath):
85+
href = href.split("/")
86+
del href[0:len(pathList)+1]
87+
href = '/'.join(href)
88+
href = '/' + href
7689
elif self.is_comment_to_attachment:
77-
href = self.req.href('/attachment/ticket/%d/%s' % (self.attachment_ticket, self.attachment_filename), codecomment=self.id)
90+
href = self.req.href('/attachment/ticket/%d/%s' % (
91+
self.attachment_ticket,
92+
self.attachment_filename),
93+
codecomment=self.id)
7894
if self.line and not self.is_comment_to_changeset:
7995
href += '#L' + str(self.line)
8096
return href

0 commit comments

Comments
 (0)