Avoid inviting self when sending a PM from a different pnut client
Fixes #63
This commit is contained in:
parent
de7f4f5c35
commit
03ba94ecb9
2 changed files with 7 additions and 0 deletions
|
@ -4,6 +4,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
||||||
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
### Added
|
||||||
|
- Docker image
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- Self-invite when sending a PM from a pnut app
|
||||||
|
|
||||||
## [1.3.0] - 2022-08-20
|
## [1.3.0] - 2022-08-20
|
||||||
### Added
|
### Added
|
||||||
|
|
|
@ -70,6 +70,8 @@ def new_message(msg, meta):
|
||||||
invitees=[]
|
invitees=[]
|
||||||
for pm_user in meta['subscribed_user_ids']:
|
for pm_user in meta['subscribed_user_ids']:
|
||||||
user = Users.query.filter(Users.pnut_user_id == pm_user).one_or_none()
|
user = Users.query.filter(Users.pnut_user_id == pm_user).one_or_none()
|
||||||
|
if int(pm_user) == msg.user.id:
|
||||||
|
continue
|
||||||
if user is not None:
|
if user is not None:
|
||||||
invitees.append(user.matrix_id)
|
invitees.append(user.matrix_id)
|
||||||
if len(invitees) > 0:
|
if len(invitees) > 0:
|
||||||
|
|
Loading…
Reference in a new issue