alphagov/govuk_need_api — pull request #12 by fatbusinessman (2013-11-01 19:11:20+00:00)
Title: Refactor revision functionality.

For discussion: @bishboria and I came up with this modified way to present revisions. Note that this is a request against the `show-event-history` branch, rather than `master`.

The main difference here is that, instead of the decorator pairing up revisions with their predecessors to be passed into a method further down the line, we now have a `Changeset` class, which decorates a need revision and includes knowledge of which revision came before it, so it can have a no-argument method to calculate the changes. This means the presenters don't need to know about how to interpret a pair of revisions.

The names of `NeedDecorator` and `RevisionDecorator` also weren't very descriptive as to what they were actually *doing* to decorate needs and revisions, hence becoming `NeedWithChangesets` and `Changeset`.

(I tried to put this together as a series of atomic commits, but that didn’t work particularly well. I still have the commits in their original order if that’ll help put this in context.)