This repository was archived by the owner on Dec 15, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 277
Disable update notification for disabled packages #1005
Open
JonatanPaalsson
wants to merge
3
commits into
atom:master
from
JonatanPaalsson:disabled-notifications
Open
Disable update notification for disabled packages #1005
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,6 +27,7 @@ export default class PackageUpdatesStatusView { | |
| this.disposables.add(packageManager.on('package-updating theme-updating', ({pack, error}) => { this.onPackageUpdating(pack) })) | ||
| this.disposables.add(packageManager.on('package-updated theme-updated package-uninstalled theme-uninstalled', ({pack, error}) => { this.onPackageUpdated(pack) })) | ||
| this.disposables.add(packageManager.on('package-update-faile d theme-update-failed', ({pack, error}) => { this.onPackageUpdateFailed(pack) })) | ||
| this.disposables.add(atom.config.onDidChange('core.disabledP ackages', () => { this.updateTile() })) | ||
|
|
||
| const clickHandler = () => { | ||
| atom.commands.dispatch(atom.views.getView(atom.workspace), 'settings-view:check-for-package-updates') | ||
|
|
@@ -120,6 +121,13 @@ export default class PackageUpdatesStatusView { | |
| } | ||
|
|
||
| updateTile () { | ||
| const disabledPackages = [] | ||
| if (this.updates.length){ | ||
| const updatesWithoutDisabled = this.updates.filter(update => atom.packages.isPackageDisabled(update.name)) | ||
| updatesWithoutDisabled.filter(update => this.updates.splice(this.updates.indexOf(update),1)) | ||
| updatesWithoutDisabled.filter(update => disabledPackages.push(update)) | ||
| } | ||
|
|
||
| if (this.updates.length) { | ||
| if (this.tooltip) { | ||
| this.tooltip.dispose() | ||
|
|
@@ -152,5 +160,8 @@ export default class PackageUpdatesStatusView { | |
| this.tile = null | ||
| this.destroyed = true | ||
| } | ||
| if (disabledPackages.length){ | ||
| disabledPackages.filter(update => this.updates.push(update)) | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -150,3 +150,17 @@ describe "PackageUpdatesStatusView", -> | |
| packageManager.emitPackageEvent('update-failed', outdatedPackage1) | ||
| packageManager.emitPackageEvent('uninstalled', outdatedPackage1) | ||
| expect(document.querySelector('status-bar .package-updates-status-view').textContent).toBe '1 update' | ||
|
|
||
| describe "when one packages is disabled", -> | ||
| it "updates the tile", -> | ||
| spyOn(atom.packages, 'isPackageDisabled').andCallFake (args) -> | ||
| if args is outdatedPackage1.name | ||
| return true | ||
| atom.config.set('core.disabledPackages', ['something']) | ||
| expect(document.querySelector('status-bar .package-updates-status-view').textContent).toBe '1 update' | ||
|
|
||
| describe "when all packages are disabled", -> | ||
| it "destroys the tile", -> | ||
| spyOn(atom.packages, 'isPackageDisabled').andReturn true | ||
| atom.config.set('core.disabledPackages', ['something']) | ||
| expect(document.querySelector('status-bar .package-updates-status-view')).not.toExist() | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.