Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix comment URL in notification email when base_url is configured #66

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion code_comments/notification.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from urlparse import urlsplit

from trac.config import BoolOption
from trac.core import Component, implements
from trac.notification import NotifyEmail
Expand Down Expand Up @@ -95,9 +97,15 @@ def _get_author_name(self, comment):
def notify(self, comment):
self.comment_author = self._get_author_name(comment)

comment_base = self.env.abs_href()
if self.env.abs_href.base:
split = urlsplit(self.env.abs_href.base)
if split.scheme and split.netloc:
comment_base = '%s://%s' % (split.scheme, split.netloc)

self.data.update({
"comment": comment,
"comment_url": self.env.abs_href() + comment.href(),
"comment_url": comment_base + comment.href(),
"project_url": self.env.project_url or self.env.abs_href(),
})

Expand Down