-
-
Notifications
You must be signed in to change notification settings - Fork 69
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
fix: Don't encode unmodified email when updating a user #241
Conversation
Thanks for opening this pull request!
|
@dblythy can you try out this branch and see if it fixes your problem? If it works, it seems the server is allowing |
Codecov Report
@@ Coverage Diff @@
## main #241 +/- ##
==========================================
- Coverage 83.75% 83.41% -0.34%
==========================================
Files 78 78
Lines 7360 7331 -29
==========================================
- Hits 6164 6115 -49
- Misses 1196 1216 +20
Continue to review full report at Codecov.
|
I sure can, give me a moment |
See comment here #239 (comment) |
@dblythy Try this, if it works, I'll add the necessary testcases. |
I will have a look tomorrow morning if that's ok. So there's no way to only send mutated keys to the server using Parse Swift? I'm worried this will cause race conditions with int fields, and unnecessary database ops. Alternatively I could use |
Just a quick comment - whilst this will likely fix the issue, the core problem of
@cbaker6 is there a way we could perhaps store the serverData from the initial fetch of the object, and then compare changes to keys onSave if we can’t directly listen to property changes on a struct? I’m not overly familiar with swift but happy to look into creative solutions if it helps. |
There are a few ways, but the developer has to take some action here. For example, developers can add the following method (or a similar one) to their struct MyUser: ParseUser {
var authData: [String: [String: String]?]?
var username: String?
var email: String?
var emailVerified: Bool?
var password: String?
var objectId: String?
var createdAt: Date?
var updatedAt: Date?
var ACL: ParseACL?
// method that creates empty versions of self
func emptyObject() -> Self {
var object = Self()
object.objectId = objectId
return object
}
} Then add properties what will be mutated and saved. Only these get sent to the server: var myObject = MyUser()
myObject.email = "myNewEmail@parse.com"
myObject.save { _ in } This also can be easily achieved by using Parse-Swift/Tests/ParseSwiftTests/ParseOperationTests.swift Lines 100 to 103 in ddcf35f
These examples should address most of your comments below:
When it comes to:
"Listening to property changes" is typically associated to |
How would ParseSwift cause race conditions where the other SDK's wouldn't? |
If you have questions about my previous comments feel free to continue commenting even though this PR is closed. |
Should we move this discussion to an issue regarding |
Sure! |
Just confirming that this PR has fixed the problem for me 😊 Sorry it took a while to test, being in Australia means timezones become complicated. Thanks again @cbaker6! |
New Pull Request Checklist
Issue Description
When a current user email isn't modified, it shouldn't be sent to the server or else it will trigger verify email.
Related issue: #239
Approach
Only encode email if it's modified.
TODOs before merging