Skip to content

Commit

Permalink
Only send the ping if it actually changed
Browse files Browse the repository at this point in the history
  • Loading branch information
joshaber committed May 24, 2017
1 parent 5ae8aaf commit c388541
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app/src/lib/stats/stats-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,11 +232,17 @@ export class StatsStore {

/** Set whether the user has opted out of stats reporting. */
public setOptOut(optOut: boolean): Promise<void> {
const changed = this.optOut !== optOut

this.optOut = optOut

localStorage.setItem(StatsOptOutKey, optOut ? '1' : '0')

return this.sendOptInStatusPing(!optOut)
if (changed) {
return this.sendOptInStatusPing(!optOut)
} else {
return Promise.resolve()
}
}

/** Has the user opted out of stats reporting? */
Expand Down

0 comments on commit c388541

Please sign in to comment.