Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Message: Don't crash if Inbox exists.
Browse files Browse the repository at this point in the history
  • Loading branch information
bsimpson63 committed Oct 1, 2014
1 parent ff878cc commit 0063ea6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions r2/r2/models/link.py
Expand Up @@ -1449,14 +1449,18 @@ def _new(cls, author, to, subject, body, ip, parent=None, sr=None,
first_sender_modmail = sr.is_moderator_with_perms(
first_sender, 'mail')

if first_sender != author and not first_sender_modmail:
if (first_sender != author and
first_sender != to and
not first_sender_modmail):
inbox_rel.append(Inbox._add(first_sender, m, 'inbox'))

if first_message.to_id:
first_recipient = Account._byID(first_message.to_id, data=True)
first_recipient_modmail = sr.is_moderator_with_perms(
first_recipient, 'mail')
if first_recipient != author and not first_recipient_modmail:
if (first_recipient != author and
first_recipient != to and
not first_recipient_modmail):
inbox_rel.append(Inbox._add(first_recipient, m, 'inbox'))

hooks.get_hook('message.new').call(message=m)
Expand Down

0 comments on commit 0063ea6

Please sign in to comment.