apply-hotfix: shuffle handling of message-failed
Phillip Davis
created
this does not change any functionality, it removes a case where we
initially lie about which values is `others_num`
Change summary
sgx-bwmsgsv2.rb | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
Detailed changes
@@ -997,10 +997,13 @@ class WebhookHandler < Goliath::API
return [400, {}, "Missing params\n"] unless jparams && type
- users_num, others_num = if jparams['direction'] == 'in'
+ users_num, others_num =
+ if type == 'message-failed' # NOTE: This implies direction == 'out'
+ [jparams['from'], params['_json'][0]['to']]
+ elsif jparams['direction'] == 'in'
[jparams['owner'], jparams['from']]
elsif jparams['direction'] == 'out'
- [jparams['from'], jparams['owner']]
+ [jparams['from'], jparams['owner']] # NOTE: for outbound, 'from' == 'owner'
else
puts "big prob: '#{jparams['direction']}'"
return [400, {}, "OK"]
@@ -1125,11 +1128,9 @@ class WebhookHandler < Goliath::API
msg = msg.as_error(
'recipient-unavailable',
:wait,
- jparams['description']
+ params['_json'][0]['description']
)
- # TODO: make prettier: this should be done above
- others_num = params['_json'][0]['to']
when 'message-delivered'
msg = ReceiptMessage.new(bare_jid)