mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-14 13:17:24 +01:00
Only update user objects that don’t have notification yet (#14514)
* build(deps): bump stopword from 2.0.5 to 2.0.7 in /website/client (#14504) Bumps [stopword](https://github.com/fergiemcdowall/stopword) from 2.0.5 to 2.0.7. - [Release notes](https://github.com/fergiemcdowall/stopword/releases) - [Commits](https://github.com/fergiemcdowall/stopword/commits/v.2.0.7) --- updated-dependencies: - dependency-name: stopword dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * build(deps): bump stripe from 11.6.0 to 11.10.0 (#14503) Bumps [stripe](https://github.com/stripe/stripe-node) from 11.6.0 to 11.10.0. - [Release notes](https://github.com/stripe/stripe-node/releases) - [Changelog](https://github.com/stripe/stripe-node/blob/master/CHANGELOG.md) - [Commits](https://github.com/stripe/stripe-node/compare/v11.6.0...v11.10.0) --- updated-dependencies: - dependency-name: stripe dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * build(deps): bump apidoc from 0.53.1 to 0.54.0 (#14501) Bumps [apidoc](https://github.com/apidoc/apidoc) from 0.53.1 to 0.54.0. - [Release notes](https://github.com/apidoc/apidoc/releases) - [Changelog](https://github.com/apidoc/apidoc/blob/master/CHANGELOG.md) - [Commits](https://github.com/apidoc/apidoc/compare/0.53.1...0.54.0) --- updated-dependencies: - dependency-name: apidoc dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * build(deps): bump @sideway/formula in /website/client (#14495) Bumps [@sideway/formula](https://github.com/sideway/formula) from 3.0.0 to 3.0.1. - [Release notes](https://github.com/sideway/formula/releases) - [Commits](https://github.com/sideway/formula/compare/v3.0.0...v3.0.1) --- updated-dependencies: - dependency-name: "@sideway/formula" dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * build(deps): bump validator from 13.7.0 to 13.9.0 in /website/client (#14492) Bumps [validator](https://github.com/validatorjs/validator.js) from 13.7.0 to 13.9.0. - [Release notes](https://github.com/validatorjs/validator.js/releases) - [Changelog](https://github.com/validatorjs/validator.js/blob/master/CHANGELOG.md) - [Commits](https://github.com/validatorjs/validator.js/compare/13.7.0...13.9.0) --- updated-dependencies: - dependency-name: validator dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * build(deps): bump validator from 13.7.0 to 13.9.0 (#14488) Bumps [validator](https://github.com/validatorjs/validator.js) from 13.7.0 to 13.9.0. - [Release notes](https://github.com/validatorjs/validator.js/releases) - [Changelog](https://github.com/validatorjs/validator.js/blob/master/CHANGELOG.md) - [Commits](https://github.com/validatorjs/validator.js/compare/13.7.0...13.9.0) --- updated-dependencies: - dependency-name: validator dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * build(deps): bump hellojs from 1.19.5 to 1.20.0 in /website/client (#14479) Bumps [hellojs](https://github.com/MrSwitch/hello.js) from 1.19.5 to 1.20.0. - [Release notes](https://github.com/MrSwitch/hello.js/releases) - [Changelog](https://github.com/MrSwitch/hello.js/blob/master/CHANGELOG.md) - [Commits](https://github.com/MrSwitch/hello.js/compare/v1.19.5...v1.20.0) --- updated-dependencies: - dependency-name: hellojs dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * build(deps): bump ua-parser-js from 0.7.31 to 0.7.33 in /website/client (#14463) Bumps [ua-parser-js](https://github.com/faisalman/ua-parser-js) from 0.7.31 to 0.7.33. - [Release notes](https://github.com/faisalman/ua-parser-js/releases) - [Changelog](https://github.com/faisalman/ua-parser-js/blob/master/changelog.md) - [Commits](https://github.com/faisalman/ua-parser-js/compare/0.7.31...0.7.33) --- updated-dependencies: - dependency-name: ua-parser-js dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * build(deps): bump cookiejar from 2.1.3 to 2.1.4 (#14462) Bumps [cookiejar](https://github.com/bmeck/node-cookiejar) from 2.1.3 to 2.1.4. - [Release notes](https://github.com/bmeck/node-cookiejar/releases) - [Commits](https://github.com/bmeck/node-cookiejar/commits) --- updated-dependencies: - dependency-name: cookiejar dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * build(deps): bump glob from 8.0.3 to 8.1.0 (#14448) Bumps [glob](https://github.com/isaacs/node-glob) from 8.0.3 to 8.1.0. - [Release notes](https://github.com/isaacs/node-glob/releases) - [Changelog](https://github.com/isaacs/node-glob/blob/main/changelog.md) - [Commits](https://github.com/isaacs/node-glob/compare/v8.0.3...v8.1.0) --- updated-dependencies: - dependency-name: glob dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * build(deps): bump dompurify from 2.4.1 to 2.4.3 in /website/client (#14443) Bumps [dompurify](https://github.com/cure53/DOMPurify) from 2.4.1 to 2.4.3. - [Release notes](https://github.com/cure53/DOMPurify/releases) - [Commits](https://github.com/cure53/DOMPurify/compare/2.4.1...2.4.3) --- updated-dependencies: - dependency-name: dompurify dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * fixed typo (#14417) In "weaponSpecialWinter2023RogueNotes", changed "Incrases" to "Increases" * Only update user objects that don’t have notification yet * fix test * fix spy --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: gwenexner <49045733+gwenexner@users.noreply.github.com> Co-authored-by: SabreCat <sabe@habitica.com>
This commit is contained in:
@@ -1359,6 +1359,7 @@ describe('Group Model', () => {
|
||||
describe('#sendChat', () => {
|
||||
beforeEach(() => {
|
||||
sandbox.spy(User, 'update');
|
||||
sandbox.spy(User, 'updateMany');
|
||||
});
|
||||
|
||||
it('formats message', () => {
|
||||
@@ -1413,8 +1414,8 @@ describe('Group Model', () => {
|
||||
it('updates users about new messages in party', () => {
|
||||
party.sendChat({ message: 'message' });
|
||||
|
||||
expect(User.update).to.be.calledOnce;
|
||||
expect(User.update).to.be.calledWithMatch({
|
||||
expect(User.updateMany).to.be.calledOnce;
|
||||
expect(User.updateMany).to.be.calledWithMatch({
|
||||
'party._id': party._id,
|
||||
_id: { $ne: '' },
|
||||
});
|
||||
@@ -1427,8 +1428,8 @@ describe('Group Model', () => {
|
||||
|
||||
group.sendChat({ message: 'message' });
|
||||
|
||||
expect(User.update).to.be.calledOnce;
|
||||
expect(User.update).to.be.calledWithMatch({
|
||||
expect(User.updateMany).to.be.calledOnce;
|
||||
expect(User.updateMany).to.be.calledWithMatch({
|
||||
guilds: group._id,
|
||||
_id: { $ne: '' },
|
||||
});
|
||||
@@ -1437,8 +1438,8 @@ describe('Group Model', () => {
|
||||
it('does not send update to user that sent the message', () => {
|
||||
party.sendChat({ message: 'message', user: { _id: 'user-id', profile: { name: 'user' } } });
|
||||
|
||||
expect(User.update).to.be.calledOnce;
|
||||
expect(User.update).to.be.calledWithMatch({
|
||||
expect(User.updateMany).to.be.calledOnce;
|
||||
expect(User.updateMany).to.be.calledWithMatch({
|
||||
'party._id': party._id,
|
||||
_id: { $ne: 'user-id' },
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user