Notify users about invites.

This commit is contained in:
Erik Johnston 2014-11-10 11:15:02 +00:00
parent 407d8a5019
commit 65f846ade0
3 changed files with 14 additions and 10 deletions

View File

@ -337,15 +337,17 @@ class Auth(object):
if join_rule_event: if join_rule_event:
join_rule = join_rule_event.content.get("join_rule") join_rule = join_rule_event.content.get("join_rule")
is_public = join_rule == JoinRules.PUBLIC if join_rule else False is_public = join_rule == JoinRules.PUBLIC if join_rule else False
else:
is_public = False
if event.type == RoomMemberEvent.TYPE: if event.type == RoomMemberEvent.TYPE:
if event.content["membership"] == Membership.JOIN: e_type = event.content["membership"]
if is_public: if e_type in [Membership.JOIN, Membership.INVITE]:
auth_events.append(join_rule_event.event_id) auth_events.append(join_rule_event.event_id)
elif member_event:
if member_event and not is_public:
auth_events.append(member_event.event_id) auth_events.append(member_event.event_id)
elif member_event:
if member_event:
if member_event.content["membership"] == Membership.JOIN: if member_event.content["membership"] == Membership.JOIN:
auth_events.append(member_event.event_id) auth_events.append(member_event.event_id)

View File

@ -431,7 +431,10 @@ class FederationHandler(BaseHandler):
backfilled=False, backfilled=False,
) )
yield self.notifier.on_new_room_event(event) target_user = self.hs.parse_userid(event.state_key)
yield self.notifier.on_new_room_event(
event, extra_users=[target_user],
)
defer.returnValue(self.pdu_codec.pdu_from_event(event)) defer.returnValue(self.pdu_codec.pdu_from_event(event))

View File

@ -177,10 +177,9 @@ class StreamStore(SQLBaseStore):
sql = ( sql = (
"SELECT *, (%(redacted)s) AS redacted FROM events AS e WHERE " "SELECT *, (%(redacted)s) AS redacted FROM events AS e WHERE "
"((room_id IN (%(current)s)) OR " "(e.outlier = 0 AND (room_id IN (%(current)s)) OR "
"(event_id IN (%(invites)s))) " "(event_id IN (%(invites)s))) "
"AND e.stream_ordering > ? AND e.stream_ordering <= ? " "AND e.stream_ordering > ? AND e.stream_ordering <= ? "
"AND e.outlier = 0 "
"ORDER BY stream_ordering ASC LIMIT %(limit)d " "ORDER BY stream_ordering ASC LIMIT %(limit)d "
) % { ) % {
"redacted": del_sql, "redacted": del_sql,