minor re-order to avoid un-nessesary code when appropriate

This commit is contained in:
Morgan McMillian 2017-05-03 20:02:11 -07:00
parent 8949029923
commit f94b5cf2fa

View file

@ -27,6 +27,12 @@ def on_receive_events(transaction):
embed = None 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' if (event['content']['msgtype'] == 'm.text'
or event['content']['msgtype'] == 'm.notice'): or event['content']['msgtype'] == 'm.notice'):
if user: if user:
@ -65,11 +71,11 @@ def on_receive_events(transaction):
else: else:
text = None text = None
chan = MatrixRoom.query.filter_by(room_id=event['room_id']).first() # chan = MatrixRoom.query.filter_by(room_id=event['room_id']).first()
if chan: # if chan:
chan_id = chan.pnut_chan # chan_id = chan.pnut_chan
else: # else:
return jsonify({}) # return jsonify({})
if user == None and not chan.pnut_write: if user == None and not chan.pnut_write:
txId += 1 txId += 1