Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add context to Parse.Object.save #6626

Merged
merged 4 commits into from
Apr 28, 2020

Conversation

mtrezza
Copy link
Member

@mtrezza mtrezza commented Apr 18, 2020

Exposes the context object in Parse.Object.save() so that parameters can be made accessible in Cloud Code triggers beforeSave, afterSave.

Example:

const obj = new TestObject();
await obj.save(null, {context: {a: "a"}});

Parse.Cloud.beforeSave("TestObject", req => {
    console.log(req.context.a);
});

Parse.Cloud.afterSave("TestObject", req => {
    console.log(req.context.a);
});

Don't merge until

@acinader
Copy link
Contributor

seems useful to me and looks good. curious any thoughts you might have @davimacedo and @dplewis

if we merge, i can add to the PHP sdk

@mtrezza
Copy link
Member Author

mtrezza commented Apr 18, 2020

@acinader There is an open question regarding security when exposing the context to the client.

I added this question to #6459.
Let me know what you think. Maybe let's discuss there since it's a more visible thread.

@dplewis
Copy link
Member

dplewis commented Apr 28, 2020

@mtrezza The latest version of the SDK has been released and merged. You can update your branch and add the test cases.

@mtrezza
Copy link
Member Author

mtrezza commented Apr 28, 2020

@dplewis Great! Let's see if the tests pass 🤞

@codecov
Copy link

codecov bot commented Apr 28, 2020

Codecov Report

Merging #6626 into master will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #6626   +/-   ##
=======================================
  Coverage   93.88%   93.88%           
=======================================
  Files         169      169           
  Lines       11991    11994    +3     
=======================================
+ Hits        11258    11261    +3     
  Misses        733      733           
Impacted Files Coverage Δ
src/RestWrite.js 93.67% <100.00%> (+0.03%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 61546aa...51010fc. Read the comment docs.

@mtrezza
Copy link
Member Author

mtrezza commented Apr 28, 2020

@acinader ready for review

@uzaysan
Copy link

uzaysan commented Oct 14, 2020

How can we use master key with context?

Is this correct:
await obj.save(null, {context: {a: "a"}, useMasterKey: true});

@davimacedo
Copy link
Member

Yes. It should work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants