mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-25 06:48:01 -05:00
Block a little less when blocking user
* User name shows up in PMs
* Message indicates that one should unblock the user if they
want to see the PM
This commit is contained in:
@@ -629,6 +629,8 @@ class MessageController(ListingController):
|
||||
# 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)):
|
||||
|
||||
@@ -655,12 +655,3 @@ class DeletedUser(FakeAccount):
|
||||
pass
|
||||
else:
|
||||
object.__setattr__(self, attr, val)
|
||||
|
||||
class BlockedUser(DeletedUser):
|
||||
@property
|
||||
def name(self):
|
||||
return '[blocked]'
|
||||
|
||||
@property
|
||||
def _deleted(self):
|
||||
return False
|
||||
|
||||
@@ -24,7 +24,7 @@ from r2.lib.db.thing import Thing, Relation, NotFound, MultiRelation, \
|
||||
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
|
||||
@@ -1105,12 +1105,11 @@ class Message(Thing, Printable):
|
||||
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
|
||||
|
||||
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user