Convert to use '/r/<reddit>' syntax for messages

This commit is contained in:
Keith Mitchell
2012-02-14 12:14:29 -08:00
parent 0cb9d4f106
commit fbfa8ba955
3 changed files with 11 additions and 4 deletions

View File

@@ -1013,9 +1013,16 @@ class VMessageRecipient(VExistingUname):
def run(self, name):
if not name:
return self.error()
if name.startswith('#'):
is_subreddit = False
if name.startswith('/r/'):
name = name[3:]
is_subreddit = True
elif name.startswith('#'):
name = name[1:]
is_subreddit = True
if is_subreddit:
try:
s = Subreddit._by_name(name.strip('#'))
s = Subreddit._by_name(name)
if isinstance(s, FakeSubreddit):
raise NotFound, "fake subreddit"
if s._spam:

View File

@@ -279,7 +279,7 @@ class Reddit(Templated):
if total > len(moderators):
more_text = "...and %d more" % (total - len(moderators))
mod_href = "http://%s/about/moderators" % get_domain()
helplink = ("/message/compose?to=%%23%s" % c.site.name,
helplink = ("/message/compose?to=%%2Fr%%2F%s" % c.site.name,
"message the moderators")
ps.append(SideContentBox(_('moderators'), moderators,
helplink = helplink,

View File

@@ -77,7 +77,7 @@ ${parent.thing_css_class(what)} ${"new" if thing.new else ""} ${"was-comment" if
%if thing.sr_id:
<span class="correspondent reddit rounded">
<a href="${thing.subreddit.path}message/moderator/inbox">
#${thing.subreddit.name}
/r/${thing.subreddit.name}
</a>
</span>
%else: