parse-server icon indicating copy to clipboard operation
parse-server copied to clipboard

feat: Add trigger `beforeUnsubscribe` for LiveQuery

Open sadortun opened this issue 4 years ago • 29 comments
trafficstars

New Pull Request Checklist

  • [x] I am not disclosing a vulnerability.
  • [x] I am creating this PR in reference to an issue.

Issue Description

There is a very useful Before Subscribe Trigger, this PR add its counterpart beforeUnsubscribe

Related issue: #7420

Approach

TODOs before merging

  • [x] Add test cases
  • [x] Add entry to changelog

sadortun avatar Jun 06 '21 02:06 sadortun

Thanks for opening this PR.

Please make sure to also open an issue related to this PR.

mtrezza avatar Jun 06 '21 07:06 mtrezza

@mtrezza done.

sadortun avatar Jun 06 '21 16:06 sadortun

Codecov Report

Patch coverage: 88.88% and project coverage change: -0.01% :warning:

Comparison is base (3d6d50e) 94.31% compared to head (5d07966) 94.31%. Report is 1 commits behind head on alpha.

:exclamation: Current head 5d07966 differs from pull request most recent head 1d1660a. Consider uploading reports for the commit 1d1660a to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##            alpha    #7419      +/-   ##
==========================================
- Coverage   94.31%   94.31%   -0.01%     
==========================================
  Files         186      186              
  Lines       14770    14786      +16     
==========================================
+ Hits        13931    13946      +15     
- Misses        839      840       +1     
Files Changed Coverage Δ
src/triggers.js 95.35% <ø> (ø)
src/LiveQuery/ParseLiveQueryServer.js 95.72% <85.71%> (-0.32%) :arrow_down:
src/cloud-code/Parse.Cloud.js 99.31% <100.00%> (+0.01%) :arrow_up:

... and 1 file with indirect coverage changes

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Jun 06 '21 16:06 codecov[bot]

@mtrezza I had to commit with --no-verify, the prettier doesn't seems to work, it does with en error saying there Is no files in /src**/

I'll try to have a look later

sadortun avatar Jun 06 '21 19:06 sadortun

If you run npm run prettier it should work. But if that causes a lot of changes in files that are unrelated to this PR, please only run it for the files you edited. Then run npm run lint-fix.

mtrezza avatar Jun 07 '21 09:06 mtrezza

@mtrezza Sadly prettier wont work with the npm run (im using windows)

This fixes the issue. Do you want a PR ? Should i commit this in this PR ?

- prettier --write '{src,spec}/{**/*,*}.js'
+ prettier --write {src,spec}/{**/*,*}.js

sadortun avatar Jun 07 '21 13:06 sadortun

@mtrezza Docs added https://github.com/parse-community/docs/pull/833

sadortun avatar Jun 07 '21 15:06 sadortun

This fixes the issue. Do you want a PR ? Should i commit this in this PR ?

I assume that it still works on unix then, yes please go ahead, I'll test it.

mtrezza avatar Jun 07 '21 16:06 mtrezza

To clarify the TODO list, I think we can delete these, because they are irrelevant in this PR:

  • Add security check
  • Add new Parse Error codes to Parse JS SDK
  • Add changes to documentation (guides, repository pages, in-code descriptions)
  • ...

This PR just needs this I think, then we can do a final review:

  • Add entry to changelog

mtrezza avatar Jun 21 '21 22:06 mtrezza

@mtrezza Changelog entry added

sadortun avatar Jun 22 '21 02:06 sadortun

@sadortun I removed the n/a TODOs from the post. To clarify, TODOs that do not apply to a PR are removed, not checked, otherwise a reviewer may think you actually made these changes.

mtrezza avatar Jun 22 '21 05:06 mtrezza

Can you take a look at the coverage for src/LiveQuery/ParseLiveQueryServer.js#L848? https://github.com/parse-community/parse-server/pull/7419/checks?check_run_id=2881789028

mtrezza avatar Jun 26 '21 23:06 mtrezza

@sadortun Would you mind rebasing this on master and make sure the coverage is fine? I think this will be good to merge then.

mtrezza avatar Jul 25 '21 11:07 mtrezza

Ofc, sorry about the delayS, on this and others PRs !!

sadortun avatar Jul 25 '21 16:07 sadortun

No worries, thanks for looking into this.

mtrezza avatar Jul 25 '21 17:07 mtrezza

I have removed myself from review for now. Please feel free to request again when the merge conflicts are resolved.

mtrezza avatar Jul 29 '21 13:07 mtrezza

@mtrezza ✅ Rebased ✅ Fixed coverage

sadortun avatar Aug 11 '21 17:08 sadortun

It seems the changelog entry is still missing, even though the TODO is checked. I've unchecked it. I think if you rebase on master and add the changelog entry, this should be good to go!

mtrezza avatar Aug 13 '21 21:08 mtrezza

@mtrezza Added.

I guess it got lost during a rebase. The commit was there https://github.com/parse-community/parse-server/pull/7419/commits/dc21260a0a213645efea2054b6cfa22a5b9af0fa

sadortun avatar Aug 16 '21 15:08 sadortun

@sadortun thanks for the PR! Looks good, just some minor comments.

dblythy avatar Aug 16 '21 21:08 dblythy

⚠️ Important change for merging PRs from Parse Server 5.0 onwards!

We are planning to release the first beta version of Parse Server 5.0 in October 2021.

If a PR contains a breaking change and is not merged before the beta release of Parse Server 5.0, it cannot be merged until the end of 2022. Instead it has to follow the Deprecation Policy and phase-in breaking changes to be merged during the course of 2022.

One of the most voiced community feedbacks was the demand for predictability in breaking changes to make it easy to upgrade Parse Server. We have made a first step towards this by introducing the Deprecation Policy in February 2021 that assists to phase-in breaking changes, giving developers time to adapt. We will follow-up with the introduction of Release Automation and a branch model that will allow breaking changes only with a new major release, scheduled for the beginning of each calendar year.

We understand that some PRs are a long time in the making and we very much appreciate your contribution. We want to make it easy for PRs that contain a breaking change and were created before the introduction of the Deprecation Policy. These PRs can be merged with a breaking change without being phased-in before the beta release of Parse Server 5.0. We are making this exception because we appreciate that this is a time of transition that requires additional effort from contributors to adapt. We encourage everyone to prepare their PRs until the end of September and account for review time and possible adaptions.

If a PR contains a breaking change and should be merged before the beta release, please mention @parse-community/server-maintenance and we will coordinate with you to merge the PR.

Thanks for your contribution and support during this transition to Parse Server release automation!

mtrezza avatar Sep 03 '21 00:09 mtrezza

@mtrezza @dblythy

✅ Fixed last discussions ✅ Rebased on master

sadortun avatar Sep 03 '21 16:09 sadortun

@sadortun Do you think we could get this ready for merge?

mtrezza avatar Feb 12 '22 18:02 mtrezza

Ah, sorry, i was sure it was already merged !

I'll have a look later ~~today~~.

Edit: sorry about the delay(s) I haven't forgotten you!

sadortun avatar Feb 12 '22 19:02 sadortun

Thanks for opening this pull request!

  • 🎉 We are excited about your hands-on contribution!

@sadortun came across this PR; it looks almost ready to merge; would you want to take another look at the open comments, so we can merge this?

mtrezza avatar May 07 '22 19:05 mtrezza

I will reformat the title to use the proper commit message syntax.