# Change Management

It’s not enough to simply let the user change the values of an object’s properties directly. Because we need to sync changes to the server, we have to track changes, and because we want to let the user jump around without worrying about state, we need to persist those changes locally until they are merged.

## GHManagedObject (Change)

This category exposes an unordered to-many relationship of LEChange objects, as well as methods for setting and getting change values.

Users of GHManagedObjects can then access and mutate their change values, as distinct from their original values, which will continue to reflect the truth from the server.

## LEChange

Changes are embodied by the LEChange model object, which exposes a local property name, a remote key name, and the change, stored as a string value for simplicity.

Change objects are not handled directly, but are exposed through methods on GHManagedObject.

## NSDate (GitHub)

Upgrade this convenience category to a two-way transformer between GitHub-formatted date strings and NSDate objects.
## GHManagedObject (Change)

* Add a convenience method for getting the current value of a key, which is its change value if it has been changed, and its original value otherwise.
# Change Management

## LETalk

* Replace the problematic body property with a pass-through plainBody property that is implemented in GHManagedObject+LETalk to pull the currentValue.
* Create a named constant for the body property.

## GHManagedObject (Change)

* Fix a crasher caused by an improperly written predicate.

## LEWorkViewController

* Become the text field delegate.
  * On did edit: Push changes to the current talk via the new change API.
  * On end edit: Save changes to the Core Data context

## Next Steps

* Create change objects when they do not exist.
* Hide Save / Share button when there are no changes.
* What about undo?
# Change Management

Changes made in the editor now persist and are reflected in the preview and table views.

## GHManagedObject

Create a new LEChange object if necessary.

## GHIssue

Use the plainBody property.

## Next Steps

1. Do things according to the presence of changes:
  * Show a badge (only) when there are changes.
  * Show the save button (only) when there are changes.
  * Show a reply button (only) when on the preview pane and there are no changes.
2. Push changes to GitHub.
3. Verify changes and remove LEChange objects.
# Jump from talk list to editor

A new experience that feels natural, and makes the extra accessory not just an indicator of comments, but a convenient shortcut for the less likely use case of wanting to edit the issue directly and immediately.

## LETalkListController

1. When an issue has comments, selecting that issue goes into the talk view controller.
  * From here selecting any talk goes into the work view controller (preview / editor)
2. When an issue has no comments, selecting that issue jumps into the work view controller.
3. Issue with comments show the detail disclosure accessory, which jumps as if it had no comments.

## Storyboard

The talk list now has its own segue as well as the same segue as the talk view, which allows it to jump over the talk view, as nicely displayed by the storyboard editor.

Refs #21
## GHIssue

Add a factory method for creating new issues
Update this todo, and add an issue number, which should be the new standard.
## LETalkListController

* Use the new method for creating new issues.
* Take out the old add button and behavior
* Add a stubbed implementation for showOptions:
Remove the add button here as well.
Add the protocol to the parameter type.
Default to editing mode when there is an uncommitted talk in the work controller.
New navigation items for adding and responding to issues, as well as the action menu. Some buttons trigger segues and perform their actions that way!
Here’s one way of doing it: backwards issue numbers from integer max to create an unsynced issue stack.

## Regression

Does not load into editor. Maybe because it needs a body to be editable?
Remove old reference to UAGitHubEngine
Set the font each time we toggle editing to prevent a bug where the styles would hang around from the preview.
Switch to simplified table reloading in an attempt to prevent a crasher coming from the more complex method.
Fix a bug where we were not returning the baseURL, but the name of the baseURL property instead.
Fix a bug where the editor was not being selected automatically. I swear this was working earlier, but regressed, due to an apparent fight over first responder.
Set the created and modified dates so these issues will sort properly.
* Change the save button to a reply button when there are no changes.
* Add a reply action.