Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Disable update notification for disabled packages #1005

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

JonatanPaalsson
Copy link

Description of the Change

The purpose of this pull request is to fix the bug where a notification is given that updates are available even though the package is disabled.

This is done by looking at all the packages in the list updatesin the package-updates-status-view.jsand then temporarily remove all disabled packages from the list when calculating the number of packages that have available updates.

A event is also introduced which is triggered by enabling or disabling a package. The purpose of this is so that the user is immediately informed if the package has an available update or it let's Atom know that the user is not interested to know if updates are available for the selected package.

Alternate Designs

An alternative is the remove all the disabled packages from the list updates completely and then add them when the package is enabled. This however would lead to that the packages won't show up in the available-updates view.

Benefits

Now all disabled packages will not trigger the update status message that appears in the lower right corner. The status message will also be updated when enabling or disabling a package.

Possible Drawbacks

The function updateTilebecomes a bit more complex and also have some impact on performance depending on how many packages that are in the updates list.

Applicable Issues

Fixes #956

@JonatanPaalsson
Copy link
Author

I'm having some problems writing specs for my implementation. My problem is trying to disable packages. I want to do something similar to:

describe "When a package is disabled", ->
    waitsForPromise ->
      atom.packages.disablePackage('out-dated-1')

    it "update the tile", ->
      expect(atom.packages.isPackageDisabled('out-dated-1')).toBe true

This probably fails because the package is not loaded, however I'm not sure. In a similar way I'm having problem loading this package. If anyone could help me out or point me in some direction I would be very grateful.

@JonatanPaalsson JonatanPaalsson changed the title Disable update notification for disabled packages [WiP] Disable update notification for disabled packages Oct 30, 2017
}
}
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe that these two loops can be replaced with:

const updatesWithoutDisabled = this.updates.filter(update => !atom.packages.isPackageDisabled(update.name))

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, I refactored the code using filter instead of for-loops and no the specs seem to be working.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update status message should not count disabled packages
3 participants