Dark Mode

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Disable update notification for disabled packages #1005

Open
JonatanPaalsson wants to merge 3 commits into atom:master
base: master
Choose a base branch
Loading
from JonatanPaalsson:disabled-notifications
Open

Disable update notification for disabled packages #1005

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions lib/package-updates-status-view.js
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -152,5 +160,8 @@ export default class PackageUpdatesStatusView {
this.tile = null
this.destroyed = true
}
if (disabledPackages.length){
disabledPackages.filter(update => this.updates.push(update))
}
}
}
14 changes: 14 additions & 0 deletions spec/package-updates-status-view-spec.coffee
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -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()