adjust leave action to match up with admin room rather than state_key
This commit is contained in:
parent
dfccd44b1d
commit
804af96194
1 changed files with 4 additions and 5 deletions
|
@ -110,9 +110,7 @@ def on_receive_events(transaction):
|
|||
|
||||
if event['state_key'] == app.config['MATRIX_AS_ID']:
|
||||
|
||||
if event['content']['membership'] == 'invite'
|
||||
and 'is_direct' in event['content']
|
||||
and event['content']['is_direct'] == True:
|
||||
if event['content']['membership'] == 'invite' and 'is_direct' in event['content'] and event['content']['is_direct'] == True:
|
||||
|
||||
logging.info('>> GOT INVITE')
|
||||
txId += 1
|
||||
|
@ -126,7 +124,9 @@ def on_receive_events(transaction):
|
|||
db.session.add(addadminrm)
|
||||
db.session.commit()
|
||||
|
||||
elif event['membership'] == 'leave':
|
||||
elif event['membership'] == 'leave':
|
||||
adminrm = MatrixAdminRooms.query.filter_by(room_id=event['room_id']).first()
|
||||
if adminrm:
|
||||
logging.info('>> GOT LEAVE')
|
||||
txId += 1
|
||||
url = app.config['MATRIX_HOST']
|
||||
|
@ -135,7 +135,6 @@ def on_receive_events(transaction):
|
|||
r = requests.post(url, headers={"Content-Type": "application/json"},
|
||||
data=json.dumps({}))
|
||||
if r.status_code == 200:
|
||||
adminrm = MatrixAdminRooms.query.filter_by(room_id=event['room_id']).first()
|
||||
db.session.delete(adminrm)
|
||||
db.session.commit()
|
||||
|
||||
|
|
Loading…
Reference in a new issue