Bugfix: Avoid duplicate target Dapnet call signs (#521)

This commit is contained in:
Joerg Schultze-Lutter 2022-01-25 21:38:40 +01:00 committed by GitHub
parent aa3d30f7b7
commit 6fbe23832b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 3 deletions

View File

@ -201,8 +201,10 @@ class NotifyDapnet(NotifyBase):
)
continue
# Store callsign
self.targets.append(result['callsign'])
# Store callsign without SSID and
# ignore duplicates
if result['callsign'] not in self.targets:
self.targets.append(result['callsign'])
return
@ -356,7 +358,8 @@ class NotifyDapnet(NotifyBase):
# Support the 'to' variable so that we can support rooms this way too
# The 'to' makes it easier to use yaml configuration
if 'to' in results['qsd'] and len(results['qsd']['to']):
results['targets'] += parse_call_sign(results['qsd']['to'])
results['targets'] += \
NotifyDapnet.parse_list(results['qsd']['to'])
# Check for priority
if 'priority' in results['qsd'] and len(results['qsd']['priority']):

View File

@ -59,6 +59,15 @@ apprise_url_tests = (
'instance': plugins.NotifyDapnet,
'requests_response_code': requests.codes.created,
}),
('dapnet://user:pass@DF1ABC-1/DF1ABC/DF1ABC-15', {
# valid call signs; but a few are duplicates;
# at the end there will only be 1 entry
'instance': plugins.NotifyDapnet,
'requests_response_code': requests.codes.created,
# Our expected url(privacy=True) startswith() response:
# Note that only 1 entry is saved (as other 2 are duplicates)
'privacy_url': 'dapnet://user:****@D...C?',
}),
('dapnet://user:pass@?to={},{}'.format('DF1ABC', 'DF1DEF'), {
# support the to= argument
'instance': plugins.NotifyDapnet,