Skip to content

Commit

Permalink
Block a little less when blocking user
Browse files Browse the repository at this point in the history
* User name shows up in PMs
* Message indicates that one should unblock the user if they
    want to see the PM
  • Loading branch information
kemitche committed Jul 7, 2011
1 parent b7df2c3 commit 14b38b7
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 15 deletions.
2 changes: 2 additions & 0 deletions r2/r2/controllers/listingcontroller.py
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,8 @@ def keep(item):
# TODO: Consider a flag to disable this (and see above plus builder.py)
if (item._deleted or item._spam) and not c.user_is_admin:
return False
if item.author_id in c.user.enemies:
return False
# don't show user their own unread stuff
if ((self.where == 'unread' or self.subwhere == 'unread')
and (item.author_id == c.user._id or not item.new)):
Expand Down
9 changes: 0 additions & 9 deletions r2/r2/models/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -655,12 +655,3 @@ def __setattr__(self, attr, val):
pass
else:
object.__setattr__(self, attr, val)

class BlockedUser(DeletedUser):
@property
def name(self):
return '[blocked]'

@property
def _deleted(self):
return False
9 changes: 4 additions & 5 deletions r2/r2/models/link.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from r2.lib.db.operators import desc
from r2.lib.utils import base_url, tup, domain, title_to_url, UrlParser
from r2.lib.utils.trial_utils import trial_info
from account import Account, DeletedUser, BlockedUser
from account import Account, DeletedUser
from subreddit import Subreddit
from printable import Printable
from r2.config import cache
Expand Down Expand Up @@ -1105,12 +1105,11 @@ def add_props(cls, user, wrapped):
item.is_collapsed = item.author_collapse
if c.user.pref_collapse_read_messages:
item.is_collapsed = (item.is_collapsed is not False)
if item.author_id in c.user.enemies:
if item.author_id in c.user.enemies and not item.was_comment:
item.is_collapsed = True
if not c.user_is_admin:
item.author = BlockedUser()
item.subject = _('[blocked]')
item.body = _('[blocked]')
item.subject = _('[message from blocked user]')
item.body = _('[unblock user to see this message]')


# Run this last
Expand Down
2 changes: 1 addition & 1 deletion r2/r2/templates/wrappeduser.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
%if thing.user_deleted:
<span>[deleted]</span>
%elif thing.name == '[blocked]':
<span>${_(thing.name)}</span>
<span>${_(thing.thing.original_author.name)}</span>
%else:
${plain_link(thing.name + thing.karma, "/user/%s" % thing.name,
_class = thing.author_cls + (" id-%s" % thing.fullname),
Expand Down

0 comments on commit 14b38b7

Please sign in to comment.