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

Remove unnecessary conditionals #885

Merged
merged 2 commits into from
Dec 8, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 0 additions & 5 deletions lib/main.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,3 @@ module.exports =
notification.dismiss()
}]
localStorage.setItem('hasSeenDeprecatedNotification', true)

if parseFloat(atom.getVersion()) < 1.7
atom.deserializers.add
name: 'SettingsView'
deserialize: module.exports.createSettingsView.bind(module.exports)
11 changes: 4 additions & 7 deletions lib/package-card.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,10 @@ class PackageCard extends View
@updateButton.on 'click', (event) =>
event.stopPropagation()
@update().then =>
buttons = []
# TODO: Remove conditional after 1.12.0 is released as stable
if atom.restartApplication?
buttons.push({
text: 'Restart',
onDidClick: -> atom.restartApplication()
})
buttons = [{
text: 'Restart',
onDidClick: -> atom.restartApplication()
}]
atom.notifications.addSuccess("Restart Atom to complete the update of `#{@pack.name}`.", {
dismissable: true, buttons: buttons
})
Expand Down
11 changes: 4 additions & 7 deletions lib/updates-panel.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,10 @@ class UpdatesPanel extends ScrollView
pluralizedPackages += 's' if successfulUpdatesCount > 1
message = "Restart Atom to complete the update of #{successfulUpdatesCount} #{pluralizedPackages}."

buttons = []
# TODO: Remove conditional after 1.12.0 is released as stable
if atom.restartApplication?
buttons.push({
text: 'Restart',
onDidClick: -> atom.restartApplication()
})
buttons = [{
text: 'Restart',
onDidClick: -> atom.restartApplication()
}]
atom.notifications.addSuccess(message, {dismissable: true, buttons})

onUpdateResolved = ->
Expand Down
8 changes: 3 additions & 5 deletions spec/package-card-spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -462,11 +462,9 @@ describe "PackageCard", ->
notifications = atom.notifications.getNotifications()
expect(notifications.length).toBe 1

# TODO: Remove conditional after 1.12.0 is released as stable
if atom.restartApplication?
spyOn(atom, 'restartApplication')
notifications[0].options.buttons[0].onDidClick()
expect(atom.restartApplication).toHaveBeenCalled()
spyOn(atom, 'restartApplication')
notifications[0].options.buttons[0].onDidClick()
expect(atom.restartApplication).toHaveBeenCalled()

describe "when hasAlternative is true and alternative is core", ->
beforeEach ->
Expand Down
8 changes: 3 additions & 5 deletions spec/updates-panel-spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@ describe 'UpdatesPanel', ->
notifications = atom.notifications.getNotifications()
expect(notifications.length).toBe 1

# TODO: Remove conditional after 1.12.0 is released as stable
if atom.restartApplication?
spyOn(atom, 'restartApplication')
notifications[0].options.buttons[0].onDidClick()
expect(atom.restartApplication).toHaveBeenCalled()
spyOn(atom, 'restartApplication')
notifications[0].options.buttons[0].onDidClick()
expect(atom.restartApplication).toHaveBeenCalled()