Skip to content

Ability to revert all changes or changes for key #70

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

Merged
merged 1 commit into from
Aug 27, 2015

Conversation

kashif
Copy link
Contributor

@kashif kashif commented Aug 20, 2015

For issue #52

@facebook-github-bot
Copy link

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla - and if you have received this in error or have any questions, please drop us a line at [email protected]. Thanks!

@facebook-github-bot
Copy link

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

- (void)revert;

/*!
@abstract Reverts any changes to an object's key that were done after last sucessful save/fetch.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should actually be

Clears any changes to this object made since the last call to save.

Since it won't revert anything prior to the current operation set in the queue.

@nlutsenko nlutsenko self-assigned this Aug 20, 2015
@nlutsenko
Copy link
Contributor

@kashif Few nits and important parts, but overall looks amazing.

The important part here:
operationSetQueue is an NSMutableArray of PFOperationSet objects.
PFOperationSet is roughly close to NSMutableDictionary, which consists of key- > change.
What you are interested in is that last PFOperationSet, not modifying the operationSetQueue itself.

@kashif
Copy link
Contributor Author

kashif commented Aug 20, 2015

thanks @nlutsenko gonna fix it up now

@abstract Clears any changes to this object's key that were done after last successful save and sets it back to the
server state.

@param key The key to check for.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: The key to revert changes for.

@nlutsenko
Copy link
Contributor

One more set of changes, almost there... Looks almost perfect.

@kashif
Is there any chance you can also add some unit tests for these methods?
Tests around simple offline objects would be the minimal set, while it would be amazing to have tests using _objectFromDictionary:defaultClassName:completeData: - that one is used internally to create objects that are assumed to be fetched.

@nlutsenko nlutsenko removed their assignment Aug 21, 2015
@kashif
Copy link
Contributor Author

kashif commented Aug 21, 2015

Thanks @nlutsenko I will now try to add some unit tests

@synchronized (lock) {
if ([self isDirty]) {
PFOperationSet *changes = [self unsavedChanges];
for (NSString* key in changes.keyEnumerator) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Supernit: Use for (NSString *key in... to be closer to overall coding style.

@nlutsenko
Copy link
Contributor

@kashif Restarted tests, and I think they are going to pass this time.
This looks very good, thanks for adding basic tests. There are few nits on the tests and one issue on the availableKeys, but we are close as ever to merging this in. I think a single iteration and we are done.

Please let me know if you have any questions around code or having trouble finding anything.

@nlutsenko
Copy link
Contributor

@kashif, sorry it takes a while to get to every single one of these, since there are literally 0 notifications on when the diff is pushed.
Let me know if I am wrong in my assumption or if you need/want any help.

@kashif
Copy link
Contributor Author

kashif commented Aug 26, 2015

ok @nlutsenko i think it should pass the tests hopefully thanks again for your helpful suggestions!

@nlutsenko
Copy link
Contributor

Hey @kashif, so sorry, it looks like there is a merge conflict somewhere in code on this branch.
Can you please rebase against the latest master as well as squash all the commits into a single one?

@kashif
Copy link
Contributor Author

kashif commented Aug 27, 2015

ok @nlutsenko rebased and squashed 👍

@nlutsenko
Copy link
Contributor

@kashif Thank you so much for all the help, I am merging this one in and it's going to be released as part of 1.8.2

nlutsenko added a commit that referenced this pull request Aug 27, 2015
Ability to revert all changes or changes for key
@nlutsenko nlutsenko merged commit 899a5da into parse-community:master Aug 27, 2015
@nlutsenko nlutsenko added this to the 1.8.2 milestone Aug 27, 2015
@nlutsenko nlutsenko self-assigned this Aug 27, 2015
@kashif kashif deleted the issue-52 branch August 27, 2015 00:42
@tahoecoop tahoecoop mentioned this pull request Apr 19, 2018
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.

4 participants