Skip to content

Commit

Permalink
Make diff code work w/ old + combined diffs
Browse files Browse the repository at this point in the history
Make sure everywhere we handle diffs works with the current setup and with the changes on edgi-govdata-archiving/web-monitoring-processing#136, where the HTML visual diff returns multiple diffs.
  • Loading branch information
Mr0grog committed Dec 21, 2017
1 parent e36b6fe commit 182e6bc
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/components/side-by-side-rendered-diff.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,27 @@ const showAdditions = showType.bind(null, 'additions');
*/
export default class SideBySideRenderedDiff extends React.Component {
render () {
// The newest version of this diff includes separate, more accurate
// versions to show for each side, but the old one needs transformations.
// TODO: remove this transforms business when new diffs are fully deployed.
let transformDeletions = (x) => x;
let transformInsertions = transformDeletions;
if (!this.props.diffData.deletions) {
transformDeletions = showRemovals;
transformInsertions = showAdditions;
}

return (
<div className="side-by-side-render">
<SandboxedHtml
html={this.props.diffData.deletions}
html={this.props.diffData.deletions || this.props.diffData.diff}
baseUrl={this.props.page.url}
// transform={showRemovals}
transform={transformDeletions}
/>
<SandboxedHtml
html={this.props.diffData.insertions}
html={this.props.diffData.insertions || this.props.diffData.diff}
baseUrl={this.props.page.url}
// transform={showAdditions}
transform={transformInsertions}
/>
</div>
);
Expand Down

0 comments on commit 182e6bc

Please sign in to comment.