Skip to content

Commit

Permalink
fixed a bug #110
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielflorit committed Nov 22, 2014
1 parent be6e7ef commit cb58189
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/js/Updates.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,21 @@ var Updates = React.createClass({
},

// Handle clicking the close button.
onButtonClick: function(dismissedUpdateNumbers) {
onButtonClick: function(newUpdateNumbers) {

// Save dismissed update numbers in local storage, so we don't
// display them again.
localStorage.setItem(Updates.DISMISSED_UPDATE_NUMBERS, dismissedUpdateNumbers);
var dismissedUpdateNumbers = [];
var localNumbers = localStorage.getItem(Updates.DISMISSED_UPDATE_NUMBERS);
if (localNumbers) {
dismissedUpdateNumbers = localNumbers.split(',').map(function(v) {
return +v;
});
}

var allDismissedNumbers = _.uniq(dismissedUpdateNumbers.concat(newUpdateNumbers));

localStorage.setItem(Updates.DISMISSED_UPDATE_NUMBERS, allDismissedNumbers);

// Change this component's state to closed. This will trigger a
// re-render.
Expand Down

0 comments on commit cb58189

Please sign in to comment.