Skip to content

Commit

Permalink
fix issue trac-hacks#62 Wrong comment url in notifiy email
Browse files Browse the repository at this point in the history
  • Loading branch information
hsiao19 committed Nov 3, 2015
1 parent 68e266f commit 9ef72b6
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions code_comments/comment.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,27 @@ def validate(self):

def href(self):
if self.is_comment_to_file:
href = self.req.href.browser(self.path, rev=self.revision, codecomment=self.id)
href = self.req.href.browser(self.path, rev=self.revision,
codecomment=self.id)
elif self.is_comment_to_changeset:
href = self.req.href.changeset(self.revision, codecomment=self.id)
base_url = self.env.abs_href()
pathList = base_url.split('/')
projectPath = ""
if len(pathList) > 4:
del pathList[0:3]
projectPath = '/'.join(pathList)
projectPath = '/' + projectPath
if href.startswith(projectPath):
href = href.split("/")
del href[0:len(pathList)+1]
href = '/'.join(href)
href = '/' + href
elif self.is_comment_to_attachment:
href = self.req.href('/attachment/ticket/%d/%s' % (self.attachment_ticket, self.attachment_filename), codecomment=self.id)
href = self.req.href('/attachment/ticket/%d/%s' % (
self.attachment_ticket,
self.attachment_filename),
codecomment=self.id)
if self.line and not self.is_comment_to_changeset:
href += '#L' + str(self.line)
return href
Expand Down

0 comments on commit 9ef72b6

Please sign in to comment.