imjacobclark / github-notifier

Chrome notifications for GitHub
MIT License
40 stars 9 forks source link

Don't notify users of existing pull requests when Chrome is launched #1

Closed imjacobclark closed 8 years ago

imjacobclark commented 9 years ago

When Chrome is launched, we check each project for PRs and notify accordingly, this possibly is not expected behaviour, if a users is watching several projects with many PRs, notifications could be exponential and very annoying.

We should add logic to ensure the first call to ghpr.getData() in background/background.js doesn't raise notifications.

Steps to implement:

  1. Pass a parameter of true to ghpr.getData() in background/background.js as follows: ghpr.getData(true)
  2. Change GitHubPullRequestNotifier.prototype.getData = function(){ to allow for the above parameter to be passed in background/background.js as follows GitHubPullRequestNotifier.prototype.getData = function(initialLaunch){
  3. Pass initialLaunch variable to _this.parseData background/background.js as follows _this.parseData(this.response, project.org, project.repo, initialLaunch);
  4. Modify if(this.currentPullRequests.indexOf(div.text.trim()) === -1){ to check against initialLaunch !== true background/background.js as follows: if(this.currentPullRequests.indexOf(div.text.trim()) === -1 && initialLaunch !== true){
imjacobclark commented 8 years ago

Implemented.