handles permalinks on cnamed profile pages correctly

This commit is contained in:
KeyserSosa
2008-09-10 12:28:48 -07:00
parent 1c6190fb2b
commit 886ceb2a88
2 changed files with 12 additions and 3 deletions

View File

@@ -219,7 +219,7 @@ class Link(Thing, Printable):
if not c.cname:
res = "/r/%s/%s" % (sr.name, p)
elif sr != c.site or force_domain:
res = "http://%s/r/%s/%s" % (get_domain(cname = c.cname,
res = "http://%s/r/%s/%s" % (get_domain(cname = (c.cname and sr == c.site),
subreddit = False), sr.name, p)
else:
res = "/%s" % p

View File

@@ -84,7 +84,16 @@
</%def>
<%def name="subreddit()" buffered="True">
<a id="subreddit_${thing._fullname}" href="${thing.subreddit.path}" class="hover">
<%
if c.cname:
path = "http://" + get_domain(cname = (c.site == thing.subreddit),
subreddit = (c.site != thing.subreddit))
else:
path = thing.subreddit.path
endif
%>
<a id="subreddit_${thing._fullname}" href="${path}" class="hover"
${'target="_top"' if c.cname else ''} >
${thing.subreddit.name}
</a>
<script type="text/javascript">
@@ -123,7 +132,7 @@
from r2.lib.utils import timeago
from r2.models import FakeSubreddit
if isinstance(c.site, FakeSubreddit):
if isinstance(c.site, FakeSubreddit) or c.site != thing.subreddit:
taglinetext = _("submitted %(when)s ago by %(author)s to %(reddit)s")
else:
taglinetext = _("submitted %(when)s ago by %(author)s")