From f94b5cf2fa3c9fe0fb99b788f4cb9e688611846f Mon Sep 17 00:00:00 2001 From: Morgan McMillian Date: Wed, 3 May 2017 20:02:11 -0700 Subject: [PATCH] minor re-order to avoid un-nessesary code when appropriate --- appservice.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/appservice.py b/appservice.py index a079f72..7c4219c 100644 --- a/appservice.py +++ b/appservice.py @@ -27,6 +27,12 @@ def on_receive_events(transaction): embed = None + chan = MatrixRoom.query.filter_by(room_id=event['room_id']).first() + if chan: + chan_id = chan.pnut_chan + else: + return jsonify({}) + if (event['content']['msgtype'] == 'm.text' or event['content']['msgtype'] == 'm.notice'): if user: @@ -65,11 +71,11 @@ def on_receive_events(transaction): else: text = None - chan = MatrixRoom.query.filter_by(room_id=event['room_id']).first() - if chan: - chan_id = chan.pnut_chan - else: - return jsonify({}) + # chan = MatrixRoom.query.filter_by(room_id=event['room_id']).first() + # if chan: + # chan_id = chan.pnut_chan + # else: + # return jsonify({}) if user == None and not chan.pnut_write: txId += 1