-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Aztec: match undo
and discard local changes
options
#8011
Conversation
…ted, and compare to show discardLocalChanges menu option
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking care of this odd case related to discarding local changes!
I only have one very minor comment. If you think mOriginalPostHadLocalChangesOnOpen
is better with its current name, I'm fine with merging this as is.
@@ -505,6 +506,7 @@ public void run() { | |||
private void initializePostObject() { | |||
if (mPost != null) { | |||
mOriginalPost = mPost.clone(); | |||
mOriginalPostHadLocalChangesOnOpen = mOriginalPost.isLocallyChanged(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about naming mOriginalPostHadLocalChangesOnOpen
something like mOriginalPostWasLocallyChanged
since its only assignment is mOriginalPost.isLocallyChanged()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the suggestion @theck13 ! I think the current name, while a bit lengthier than the suggested one, better describes the specific situation where it's going to be used - that is, the value it's carrying is only meaningful OnOpen
. We could either leave it as is or maybe rename it to mOriginalPostWasLocallyChangedOnOpen
if you want? wdyt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not a big deal so we can leave it as is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -505,6 +506,7 @@ public void run() { | |||
private void initializePostObject() { | |||
if (mPost != null) { | |||
mOriginalPost = mPost.clone(); | |||
mOriginalPostHadLocalChangesOnOpen = mOriginalPost.isLocallyChanged(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not a big deal so we can leave it as is.
Fixes #8010
From the point of view of the Editor, there are basically 2 moments where a Post can have a "Local changes" status:
a. either the Post already has that status when it's opened in the Editor, or
b. the Editor sets the
isLocallyChanged
flag on thePost
object as a result of the user making changes to the title or content (or for the case, any of the Post's configuration settings).This PR takes these two situations into account by making the
Discard local changes
appear either when there's some local history available (noting that the "change history" for now starts only when the Post is opened in the Editor), or when theisLocallyChanged
flag was already set at the time this Post was opened in the Editor.To test:
CASE A: post already had local changes.
Local changes
flag in the Posts list (to make this happen, you can start a new draft, enter some text, turn airplane mode ON, and tap BACK - remember to turn airplane mode OFF then).Discard Local Changes
optionCASE B: post doesn't already have local changes.
Discard Local Changes
optionDiscard Local Changes
optionUndo
option - if you entered more text in step 3 just make sure there's nothing left to be undone by tappingundo
until it's greyed out.undo
option is not tappable anymore, obseve theDiscard Local Changes
option is not shown anymore.cc @SylvesterWilmott following up from #8005 (comment)