Allow multiple listeners for the same event


The original design of the cherry-pick bot disallowed multiple listeners
for the same event (e.g. staged_[changeId]) in order to avoid accidntal
duplication of work. However, there are some situations where the same
event should be subscribed to from multiple places. For example, if
a comment about staging a parent should be posted after 48 hours, we
need to listen for the staged_ event of the parent as a cancel event
for the comment poster as well as the automatic staging mechanism for
the child.

This change allows multiple listeners for the same event, but adds
a contextId to the event so that the listeners can be distinguished.
Since listeners are removed from the JS Events cache by function,
the callback function is now tied to the contextId rather than
a simple anonymous function, allowing the correct listener to be
removed when needed.

Fixes: QTQAINFRA-5696
Change-Id: Ib49f9fa36e47fc2d131fff3cb358250c31912e53
Reviewed-by: Daniel Smith <Daniel.Smith@qt.io>
commit5d1a8c9f24f4d8ddb9a2fa46434c192c1bfa92f1
parentf674e61a63454d2b1543fd8d00730de0e246cf1c
authorDaniel Smith <daniel.smith@qt.io>
committerDaniel Smith <daniel.smith@qt.io>
commit timeFri, 18 Aug 2023 15:55:53 +0200