wingbot-mongodb 2.21.0 → 2.21.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -774,10 +774,11 @@ class NotificationsStorage {
|
|
|
774
774
|
* @param {string|string[]} senderId
|
|
775
775
|
* @param {string} pageId
|
|
776
776
|
* @param {string} tag
|
|
777
|
-
* @param {boolean} [
|
|
777
|
+
* @param {boolean} [onlyToKnown]
|
|
778
778
|
* @returns {Promise}
|
|
779
779
|
*/
|
|
780
|
-
async subscribe (senderId, pageId, tag,
|
|
780
|
+
async subscribe (senderId, pageId, tag, onlyToKnown) {
|
|
781
|
+
// !IMPORTANT: do not add a default value to the fourth parameter!
|
|
781
782
|
const senderIds = Array.isArray(senderId) ? senderId : [senderId];
|
|
782
783
|
|
|
783
784
|
if (senderIds.length === 0) {
|
|
@@ -790,7 +791,7 @@ class NotificationsStorage {
|
|
|
790
791
|
updateOne: {
|
|
791
792
|
filter: { senderId: sid, pageId },
|
|
792
793
|
update: { $addToSet: { subs: tag } },
|
|
793
|
-
upsert
|
|
794
|
+
upsert: !onlyToKnown
|
|
794
795
|
}
|
|
795
796
|
}))
|
|
796
797
|
);
|