From d5d6422d288d64e06ef0f874d8446f1f6696b04f Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Thu, 20 Nov 2014 13:59:49 -0800 Subject: [PATCH 01/13] Add beginning of message system --- spec/message-manager-spec.coffee | 54 ++++++++++++++++++++++++++++++++ src/message-manager.coffee | 40 +++++++++++++++++++++++ src/message.coffee | 38 ++++++++++++++++++++++ 3 files changed, 132 insertions(+) create mode 100644 spec/message-manager-spec.coffee create mode 100644 src/message-manager.coffee create mode 100644 src/message.coffee diff --git a/spec/message-manager-spec.coffee b/spec/message-manager-spec.coffee new file mode 100644 index 000000000..06ea153b9 --- /dev/null +++ b/spec/message-manager-spec.coffee @@ -0,0 +1,54 @@ +MessageManager = require '../src/message-manager' +{$} = require '../src/space-pen-extensions' + +fdescribe "MessageManager", -> + [manager] = [] + + beforeEach -> + manager = new MessageManager + + describe "adding events", -> + addSpy = null + + beforeEach -> + addSpy = jasmine.createSpy() + manager.onDidAddMessage(addSpy) + + it "emits an event when a message has been added", -> + manager.add('error', 'Some error!', icon: 'someIcon') + expect(addSpy).toHaveBeenCalled() + + message = addSpy.mostRecentCall.args[0] + expect(message.getType()).toBe 'error' + expect(message.getMessage()).toBe 'Some error!' + expect(message.getIcon()).toBe 'someIcon' + + it "emits a fatal error ::addFatalError has been called", -> + manager.addFatalError('Some error!', icon: 'someIcon') + expect(addSpy).toHaveBeenCalled() + message = addSpy.mostRecentCall.args[0] + expect(message.getType()).toBe 'fatal' + + it "emits an error ::addError has been called", -> + manager.addError('Some error!', icon: 'someIcon') + expect(addSpy).toHaveBeenCalled() + message = addSpy.mostRecentCall.args[0] + expect(message.getType()).toBe 'error' + + it "emits a warning message ::addWarning has been called", -> + manager.addWarning('Something!', icon: 'someIcon') + expect(addSpy).toHaveBeenCalled() + message = addSpy.mostRecentCall.args[0] + expect(message.getType()).toBe 'warning' + + it "emits an info message ::addInfo has been called", -> + manager.addInfo('Something!', icon: 'someIcon') + expect(addSpy).toHaveBeenCalled() + message = addSpy.mostRecentCall.args[0] + expect(message.getType()).toBe 'info' + + it "emits a success message ::addSuccess has been called", -> + manager.addSuccess('Something!', icon: 'someIcon') + expect(addSpy).toHaveBeenCalled() + message = addSpy.mostRecentCall.args[0] + expect(message.getType()).toBe 'success' diff --git a/src/message-manager.coffee b/src/message-manager.coffee new file mode 100644 index 000000000..fa11370f1 --- /dev/null +++ b/src/message-manager.coffee @@ -0,0 +1,40 @@ +{Emitter, Disposable} = require 'event-kit' +Message = require '../src/message' + +# Experimental: Allows messaging the user. This will likely change, dont use +# quite yet! +module.exports = +class MessageManager + constructor: -> + @messages = [] + @emitter = new Emitter + + ### + Section: Events + ### + + onDidAddMessage: (callback) -> + @emitter.on 'did-add-message', callback + + addSuccess: (messageString, options) -> + @addMessage(new Message('success', messageString, options)) + + addInfo: (messageString, options) -> + @addMessage(new Message('info', messageString, options)) + + addWarning: (messageString, options) -> + @addMessage(new Message('warning', messageString, options)) + + addError: (messageString, options) -> + @addMessage(new Message('error', messageString, options)) + + addFatalError: (messageString, options) -> + @addMessage(new Message('fatal', messageString, options)) + + add: (type, messageString, options) -> + @addMessage(new Message(type, messageString, options)) + + addMessage: (message) -> + @messages.push(message) + @emitter.emit('did-add-message', message) + message diff --git a/src/message.coffee b/src/message.coffee new file mode 100644 index 000000000..3867f53ad --- /dev/null +++ b/src/message.coffee @@ -0,0 +1,38 @@ +module.exports = +class Message + constructor: (@type, @message, @options={}) -> + + getType: -> @type + + getMessage: -> @message + + isClosable: -> + !!@options.closable + + getIcon: -> + return @options.icon if @options.icon? + switch @type + when 'fatal' then 'flame' + when 'error' then 'bug' + when 'warning' then 'alert' + when 'info' then 'info' + when 'success' then 'check' + + getIssueUrl: -> + "https://github.com/atom/atom/issues/new?title=#{encodeURI(@getIssueTitle())}&body=#{encodeURI(@getIssueBody())}" + + getIssueTitle: -> + @message + + getIssueBody: -> + # TODO: crib version information from bug-report: https://github.com/lee-dohm/bug-report/blob/master/lib/bug-report.coffee#L69 + """ + There was an unhandled error + + Stack Trace + ``` + At #{@options.errorDetail} + + #{@options.stack} + ``` + """ From 3d6c9ee554d82446670704221e2e62518ae4750a Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Thu, 20 Nov 2014 14:25:11 -0800 Subject: [PATCH 02/13] Add a MessageManager to atom.messages --- spec/message-manager-spec.coffee | 4 ++++ src/atom.coffee | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/spec/message-manager-spec.coffee b/spec/message-manager-spec.coffee index 06ea153b9..e9950881f 100644 --- a/spec/message-manager-spec.coffee +++ b/spec/message-manager-spec.coffee @@ -7,6 +7,10 @@ fdescribe "MessageManager", -> beforeEach -> manager = new MessageManager + describe "the atom global", -> + it "has a messages instance", -> + expect(atom.messages instanceof MessageManager).toBe true + describe "adding events", -> addSpy = null diff --git a/src/atom.coffee b/src/atom.coffee index feeb7bfd7..861414b3f 100644 --- a/src/atom.coffee +++ b/src/atom.coffee @@ -146,6 +146,9 @@ class Atom extends Model # Public: A {TooltipManager} instance tooltips: null + # Experimental: A {MessageManager} instance + messages: null + # Public: A {Project} instance project: null @@ -220,6 +223,7 @@ class Atom extends Model ViewRegistry = require './view-registry' CommandRegistry = require './command-registry' TooltipManager = require './tooltip-manager' + MessageManager = require './message-manager' PackageManager = require './package-manager' Clipboard = require './clipboard' GrammarRegistry = require './grammar-registry' @@ -246,6 +250,7 @@ class Atom extends Model @keymaps = new KeymapManager({configDirPath, resourcePath}) @keymap = @keymaps # Deprecated @tooltips = new TooltipManager + @messages = new MessageManager @commands = new CommandRegistry @views = new ViewRegistry @packages = new PackageManager({devMode, configDirPath, resourcePath, safeMode}) From 568151b1a55f8e7eff920c39db688ca2e05c973b Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Thu, 20 Nov 2014 14:25:25 -0800 Subject: [PATCH 03/13] :memo: --- src/message-manager.coffee | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/message-manager.coffee b/src/message-manager.coffee index fa11370f1..4d0743c28 100644 --- a/src/message-manager.coffee +++ b/src/message-manager.coffee @@ -16,6 +16,10 @@ class MessageManager onDidAddMessage: (callback) -> @emitter.on 'did-add-message', callback + ### + Section: Adding Messages + ### + addSuccess: (messageString, options) -> @addMessage(new Message('success', messageString, options)) From 96d8721c9e378f0e0d22c8a1de1d97ab88d58276 Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Thu, 20 Nov 2014 14:25:46 -0800 Subject: [PATCH 04/13] Add some things to Message --- src/message.coffee | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/message.coffee b/src/message.coffee index 3867f53ad..7f356bfb2 100644 --- a/src/message.coffee +++ b/src/message.coffee @@ -1,11 +1,17 @@ + +# Experimental: This will likely change, do not use. module.exports = class Message constructor: (@type, @message, @options={}) -> + getOptions: -> @options + getType: -> @type getMessage: -> @message + getDetail: -> @optons.detail + isClosable: -> !!@options.closable @@ -31,7 +37,7 @@ class Message Stack Trace ``` - At #{@options.errorDetail} + At #{@options.detail} #{@options.stack} ``` From e462fdc4ceab30174cc806f6a125a16cef8381c9 Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Thu, 20 Nov 2014 14:26:21 -0800 Subject: [PATCH 05/13] Add specs for Message --- spec/message-spec.coffee | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 spec/message-spec.coffee diff --git a/spec/message-spec.coffee b/spec/message-spec.coffee new file mode 100644 index 000000000..dcee37a51 --- /dev/null +++ b/spec/message-spec.coffee @@ -0,0 +1,13 @@ +Message = require '../src/message' + +describe "Message", -> + [message] = [] + + describe "::getIcon()", -> + it "returns a default when no icon specified", -> + message = new Message('error', 'message!') + expect(message.getIcon()).toBe 'bug' + + it "returns the icon specified", -> + message = new Message('error', 'message!', icon: 'my-icon') + expect(message.getIcon()).toBe 'my-icon' From 78ee02f0c6f70f5b092d951355a88921aef6dad4 Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Thu, 20 Nov 2014 14:26:25 -0800 Subject: [PATCH 06/13] nof --- spec/message-manager-spec.coffee | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/spec/message-manager-spec.coffee b/spec/message-manager-spec.coffee index e9950881f..b96ae08bc 100644 --- a/spec/message-manager-spec.coffee +++ b/spec/message-manager-spec.coffee @@ -1,7 +1,6 @@ MessageManager = require '../src/message-manager' -{$} = require '../src/space-pen-extensions' -fdescribe "MessageManager", -> +describe "MessageManager", -> [manager] = [] beforeEach -> From 25caaa92f1a428aa3bb82b27a610d203dbb67c14 Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Thu, 20 Nov 2014 14:29:25 -0800 Subject: [PATCH 07/13] Export Message --- exports/atom.coffee | 1 + 1 file changed, 1 insertion(+) diff --git a/exports/atom.coffee b/exports/atom.coffee index 5149a9451..969cae16d 100644 --- a/exports/atom.coffee +++ b/exports/atom.coffee @@ -6,6 +6,7 @@ module.exports = BufferedNodeProcess: require '../src/buffered-node-process' BufferedProcess: require '../src/buffered-process' GitRepository: require '../src/git-repository' + Message: require '../src/message' Point: Point Range: Range Emitter: Emitter From 9c6a5fb4fabe20bc42df259d6b68c1c61bb01cfb Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Thu, 20 Nov 2014 18:53:06 -0800 Subject: [PATCH 08/13] Messages -> notifications --- exports/atom.coffee | 2 +- spec/message-manager-spec.coffee | 57 --------------------- spec/message-spec.coffee | 13 ----- spec/notification-manager-spec.coffee | 57 +++++++++++++++++++++ spec/notification-spec.coffee | 13 +++++ src/atom.coffee | 8 +-- src/message-manager.coffee | 44 ---------------- src/notification-manager.coffee | 44 ++++++++++++++++ src/{message.coffee => notification.coffee} | 2 +- 9 files changed, 120 insertions(+), 120 deletions(-) delete mode 100644 spec/message-manager-spec.coffee delete mode 100644 spec/message-spec.coffee create mode 100644 spec/notification-manager-spec.coffee create mode 100644 spec/notification-spec.coffee delete mode 100644 src/message-manager.coffee create mode 100644 src/notification-manager.coffee rename src/{message.coffee => notification.coffee} (98%) diff --git a/exports/atom.coffee b/exports/atom.coffee index 969cae16d..79d3d7269 100644 --- a/exports/atom.coffee +++ b/exports/atom.coffee @@ -6,7 +6,7 @@ module.exports = BufferedNodeProcess: require '../src/buffered-node-process' BufferedProcess: require '../src/buffered-process' GitRepository: require '../src/git-repository' - Message: require '../src/message' + Message: require '../src/notification' Point: Point Range: Range Emitter: Emitter diff --git a/spec/message-manager-spec.coffee b/spec/message-manager-spec.coffee deleted file mode 100644 index b96ae08bc..000000000 --- a/spec/message-manager-spec.coffee +++ /dev/null @@ -1,57 +0,0 @@ -MessageManager = require '../src/message-manager' - -describe "MessageManager", -> - [manager] = [] - - beforeEach -> - manager = new MessageManager - - describe "the atom global", -> - it "has a messages instance", -> - expect(atom.messages instanceof MessageManager).toBe true - - describe "adding events", -> - addSpy = null - - beforeEach -> - addSpy = jasmine.createSpy() - manager.onDidAddMessage(addSpy) - - it "emits an event when a message has been added", -> - manager.add('error', 'Some error!', icon: 'someIcon') - expect(addSpy).toHaveBeenCalled() - - message = addSpy.mostRecentCall.args[0] - expect(message.getType()).toBe 'error' - expect(message.getMessage()).toBe 'Some error!' - expect(message.getIcon()).toBe 'someIcon' - - it "emits a fatal error ::addFatalError has been called", -> - manager.addFatalError('Some error!', icon: 'someIcon') - expect(addSpy).toHaveBeenCalled() - message = addSpy.mostRecentCall.args[0] - expect(message.getType()).toBe 'fatal' - - it "emits an error ::addError has been called", -> - manager.addError('Some error!', icon: 'someIcon') - expect(addSpy).toHaveBeenCalled() - message = addSpy.mostRecentCall.args[0] - expect(message.getType()).toBe 'error' - - it "emits a warning message ::addWarning has been called", -> - manager.addWarning('Something!', icon: 'someIcon') - expect(addSpy).toHaveBeenCalled() - message = addSpy.mostRecentCall.args[0] - expect(message.getType()).toBe 'warning' - - it "emits an info message ::addInfo has been called", -> - manager.addInfo('Something!', icon: 'someIcon') - expect(addSpy).toHaveBeenCalled() - message = addSpy.mostRecentCall.args[0] - expect(message.getType()).toBe 'info' - - it "emits a success message ::addSuccess has been called", -> - manager.addSuccess('Something!', icon: 'someIcon') - expect(addSpy).toHaveBeenCalled() - message = addSpy.mostRecentCall.args[0] - expect(message.getType()).toBe 'success' diff --git a/spec/message-spec.coffee b/spec/message-spec.coffee deleted file mode 100644 index dcee37a51..000000000 --- a/spec/message-spec.coffee +++ /dev/null @@ -1,13 +0,0 @@ -Message = require '../src/message' - -describe "Message", -> - [message] = [] - - describe "::getIcon()", -> - it "returns a default when no icon specified", -> - message = new Message('error', 'message!') - expect(message.getIcon()).toBe 'bug' - - it "returns the icon specified", -> - message = new Message('error', 'message!', icon: 'my-icon') - expect(message.getIcon()).toBe 'my-icon' diff --git a/spec/notification-manager-spec.coffee b/spec/notification-manager-spec.coffee new file mode 100644 index 000000000..dfc16322c --- /dev/null +++ b/spec/notification-manager-spec.coffee @@ -0,0 +1,57 @@ +NotificationManager = require '../src/notification-manager' + +describe "NotificationManager", -> + [manager] = [] + + beforeEach -> + manager = new NotificationManager + + describe "the atom global", -> + it "has a notifications instance", -> + expect(atom.notifications instanceof NotificationManager).toBe true + + describe "adding events", -> + addSpy = null + + beforeEach -> + addSpy = jasmine.createSpy() + manager.onDidAddNotification(addSpy) + + it "emits an event when a notification has been added", -> + manager.add('error', 'Some error!', icon: 'someIcon') + expect(addSpy).toHaveBeenCalled() + + notification = addSpy.mostRecentCall.args[0] + expect(notification.getType()).toBe 'error' + expect(notification.getMessage()).toBe 'Some error!' + expect(notification.getIcon()).toBe 'someIcon' + + it "emits a fatal error ::addFatalError has been called", -> + manager.addFatalError('Some error!', icon: 'someIcon') + expect(addSpy).toHaveBeenCalled() + notification = addSpy.mostRecentCall.args[0] + expect(notification.getType()).toBe 'fatal' + + it "emits an error ::addError has been called", -> + manager.addError('Some error!', icon: 'someIcon') + expect(addSpy).toHaveBeenCalled() + notification = addSpy.mostRecentCall.args[0] + expect(notification.getType()).toBe 'error' + + it "emits a warning notification ::addWarning has been called", -> + manager.addWarning('Something!', icon: 'someIcon') + expect(addSpy).toHaveBeenCalled() + notification = addSpy.mostRecentCall.args[0] + expect(notification.getType()).toBe 'warning' + + it "emits an info notification ::addInfo has been called", -> + manager.addInfo('Something!', icon: 'someIcon') + expect(addSpy).toHaveBeenCalled() + notification = addSpy.mostRecentCall.args[0] + expect(notification.getType()).toBe 'info' + + it "emits a success notification ::addSuccess has been called", -> + manager.addSuccess('Something!', icon: 'someIcon') + expect(addSpy).toHaveBeenCalled() + notification = addSpy.mostRecentCall.args[0] + expect(notification.getType()).toBe 'success' diff --git a/spec/notification-spec.coffee b/spec/notification-spec.coffee new file mode 100644 index 000000000..293d0b171 --- /dev/null +++ b/spec/notification-spec.coffee @@ -0,0 +1,13 @@ +Notification = require '../src/notification' + +describe "Notification", -> + [notification] = [] + + describe "::getIcon()", -> + it "returns a default when no icon specified", -> + notification = new Notification('error', 'message!') + expect(notification.getIcon()).toBe 'bug' + + it "returns the icon specified", -> + notification = new Notification('error', 'message!', icon: 'my-icon') + expect(notification.getIcon()).toBe 'my-icon' diff --git a/src/atom.coffee b/src/atom.coffee index 861414b3f..a8b4a8ff0 100644 --- a/src/atom.coffee +++ b/src/atom.coffee @@ -146,8 +146,8 @@ class Atom extends Model # Public: A {TooltipManager} instance tooltips: null - # Experimental: A {MessageManager} instance - messages: null + # Experimental: A {NotificationManager} instance + notifications: null # Public: A {Project} instance project: null @@ -223,7 +223,7 @@ class Atom extends Model ViewRegistry = require './view-registry' CommandRegistry = require './command-registry' TooltipManager = require './tooltip-manager' - MessageManager = require './message-manager' + NotificationManager = require './notification-manager' PackageManager = require './package-manager' Clipboard = require './clipboard' GrammarRegistry = require './grammar-registry' @@ -250,7 +250,7 @@ class Atom extends Model @keymaps = new KeymapManager({configDirPath, resourcePath}) @keymap = @keymaps # Deprecated @tooltips = new TooltipManager - @messages = new MessageManager + @notifications = new NotificationManager @commands = new CommandRegistry @views = new ViewRegistry @packages = new PackageManager({devMode, configDirPath, resourcePath, safeMode}) diff --git a/src/message-manager.coffee b/src/message-manager.coffee deleted file mode 100644 index 4d0743c28..000000000 --- a/src/message-manager.coffee +++ /dev/null @@ -1,44 +0,0 @@ -{Emitter, Disposable} = require 'event-kit' -Message = require '../src/message' - -# Experimental: Allows messaging the user. This will likely change, dont use -# quite yet! -module.exports = -class MessageManager - constructor: -> - @messages = [] - @emitter = new Emitter - - ### - Section: Events - ### - - onDidAddMessage: (callback) -> - @emitter.on 'did-add-message', callback - - ### - Section: Adding Messages - ### - - addSuccess: (messageString, options) -> - @addMessage(new Message('success', messageString, options)) - - addInfo: (messageString, options) -> - @addMessage(new Message('info', messageString, options)) - - addWarning: (messageString, options) -> - @addMessage(new Message('warning', messageString, options)) - - addError: (messageString, options) -> - @addMessage(new Message('error', messageString, options)) - - addFatalError: (messageString, options) -> - @addMessage(new Message('fatal', messageString, options)) - - add: (type, messageString, options) -> - @addMessage(new Message(type, messageString, options)) - - addMessage: (message) -> - @messages.push(message) - @emitter.emit('did-add-message', message) - message diff --git a/src/notification-manager.coffee b/src/notification-manager.coffee new file mode 100644 index 000000000..499905667 --- /dev/null +++ b/src/notification-manager.coffee @@ -0,0 +1,44 @@ +{Emitter, Disposable} = require 'event-kit' +Notification = require '../src/notification' + +# Experimental: Allows messaging the user. This will likely change, dont use +# quite yet! +module.exports = +class NotificationManager + constructor: -> + @notifications = [] + @emitter = new Emitter + + ### + Section: Events + ### + + onDidAddNotification: (callback) -> + @emitter.on 'did-add-notification', callback + + ### + Section: Adding Notifications + ### + + addSuccess: (message, options) -> + @addNotification(new Notification('success', message, options)) + + addInfo: (message, options) -> + @addNotification(new Notification('info', message, options)) + + addWarning: (message, options) -> + @addNotification(new Notification('warning', message, options)) + + addError: (message, options) -> + @addNotification(new Notification('error', message, options)) + + addFatalError: (message, options) -> + @addNotification(new Notification('fatal', message, options)) + + add: (type, message, options) -> + @addNotification(new Notification(type, message, options)) + + addNotification: (notification) -> + @notifications.push(notification) + @emitter.emit('did-add-notification', notification) + notification diff --git a/src/message.coffee b/src/notification.coffee similarity index 98% rename from src/message.coffee rename to src/notification.coffee index 7f356bfb2..ab2079987 100644 --- a/src/message.coffee +++ b/src/notification.coffee @@ -1,7 +1,7 @@ # Experimental: This will likely change, do not use. module.exports = -class Message +class Notification constructor: (@type, @message, @options={}) -> getOptions: -> @options From e24a56238782526bcaad71980e7a9d25e065daa9 Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Thu, 20 Nov 2014 18:54:51 -0800 Subject: [PATCH 09/13] Use bug icon for fatal errors --- spec/notification-manager-spec.coffee | 2 +- spec/notification-spec.coffee | 4 ++-- src/notification.coffee | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/spec/notification-manager-spec.coffee b/spec/notification-manager-spec.coffee index dfc16322c..f9cd5fcf9 100644 --- a/spec/notification-manager-spec.coffee +++ b/spec/notification-manager-spec.coffee @@ -1,6 +1,6 @@ NotificationManager = require '../src/notification-manager' -describe "NotificationManager", -> +fdescribe "NotificationManager", -> [manager] = [] beforeEach -> diff --git a/spec/notification-spec.coffee b/spec/notification-spec.coffee index 293d0b171..b0c201452 100644 --- a/spec/notification-spec.coffee +++ b/spec/notification-spec.coffee @@ -1,12 +1,12 @@ Notification = require '../src/notification' -describe "Notification", -> +fdescribe "Notification", -> [notification] = [] describe "::getIcon()", -> it "returns a default when no icon specified", -> notification = new Notification('error', 'message!') - expect(notification.getIcon()).toBe 'bug' + expect(notification.getIcon()).toBe 'flame' it "returns the icon specified", -> notification = new Notification('error', 'message!', icon: 'my-icon') diff --git a/src/notification.coffee b/src/notification.coffee index ab2079987..6bfc21c3c 100644 --- a/src/notification.coffee +++ b/src/notification.coffee @@ -18,8 +18,8 @@ class Notification getIcon: -> return @options.icon if @options.icon? switch @type - when 'fatal' then 'flame' - when 'error' then 'bug' + when 'fatal' then 'bug' + when 'error' then 'flame' when 'warning' then 'alert' when 'info' then 'info' when 'success' then 'check' From 68693e3ca06e5842f45c795413151874b0f6739b Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Thu, 20 Nov 2014 19:17:03 -0800 Subject: [PATCH 10/13] Remove issue related stuff --- src/notification.coffee | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/src/notification.coffee b/src/notification.coffee index 6bfc21c3c..e4b5fec54 100644 --- a/src/notification.coffee +++ b/src/notification.coffee @@ -23,22 +23,3 @@ class Notification when 'warning' then 'alert' when 'info' then 'info' when 'success' then 'check' - - getIssueUrl: -> - "https://github.com/atom/atom/issues/new?title=#{encodeURI(@getIssueTitle())}&body=#{encodeURI(@getIssueBody())}" - - getIssueTitle: -> - @message - - getIssueBody: -> - # TODO: crib version information from bug-report: https://github.com/lee-dohm/bug-report/blob/master/lib/bug-report.coffee#L69 - """ - There was an unhandled error - - Stack Trace - ``` - At #{@options.detail} - - #{@options.stack} - ``` - """ From f3dd757537c23138be966502f7825513abb0bdee Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Mon, 24 Nov 2014 10:44:13 -0800 Subject: [PATCH 11/13] Export Notification, not Message --- exports/atom.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exports/atom.coffee b/exports/atom.coffee index 79d3d7269..676e9e4e7 100644 --- a/exports/atom.coffee +++ b/exports/atom.coffee @@ -6,7 +6,7 @@ module.exports = BufferedNodeProcess: require '../src/buffered-node-process' BufferedProcess: require '../src/buffered-process' GitRepository: require '../src/git-repository' - Message: require '../src/notification' + Notification: require '../src/notification' Point: Point Range: Range Emitter: Emitter From 1ae8862a9c50d6eeaf4de58dd9fe155ff8ad2422 Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Mon, 24 Nov 2014 14:43:12 -0800 Subject: [PATCH 12/13] Notification::getTimestamp() --- spec/notification-manager-spec.coffee | 2 +- spec/notification-spec.coffee | 7 ++++++- src/notification.coffee | 3 +++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/spec/notification-manager-spec.coffee b/spec/notification-manager-spec.coffee index f9cd5fcf9..dfc16322c 100644 --- a/spec/notification-manager-spec.coffee +++ b/spec/notification-manager-spec.coffee @@ -1,6 +1,6 @@ NotificationManager = require '../src/notification-manager' -fdescribe "NotificationManager", -> +describe "NotificationManager", -> [manager] = [] beforeEach -> diff --git a/spec/notification-spec.coffee b/spec/notification-spec.coffee index b0c201452..c564edc89 100644 --- a/spec/notification-spec.coffee +++ b/spec/notification-spec.coffee @@ -1,8 +1,13 @@ Notification = require '../src/notification' -fdescribe "Notification", -> +describe "Notification", -> [notification] = [] + describe "::getTimestamp()", -> + it "returns a Date object", -> + notification = new Notification('error', 'message!') + expect(notification.getTimestamp() instanceof Date).toBe true + describe "::getIcon()", -> it "returns a default when no icon specified", -> notification = new Notification('error', 'message!') diff --git a/src/notification.coffee b/src/notification.coffee index e4b5fec54..04de5db18 100644 --- a/src/notification.coffee +++ b/src/notification.coffee @@ -3,6 +3,7 @@ module.exports = class Notification constructor: (@type, @message, @options={}) -> + @timestamp = new Date() getOptions: -> @options @@ -10,6 +11,8 @@ class Notification getMessage: -> @message + getTimestamp: -> @timestamp + getDetail: -> @optons.detail isClosable: -> From aaee54bd08195f9c1403d17df2b008996a9ac3b5 Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Mon, 24 Nov 2014 14:57:55 -0800 Subject: [PATCH 13/13] Remove unnecessary error flash classes --- static/utilities.less | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/static/utilities.less b/static/utilities.less index 88a5209cf..dd71b44dd 100644 --- a/static/utilities.less +++ b/static/utilities.less @@ -64,13 +64,3 @@ div > .inline-block-tight:last-child { margin-left: 0; } } - -.error { - -webkit-animation: flash-error 0.3s ease-in; -} - -@-webkit-keyframes flash-error { - 0% { background: @background-color-error; } - - 100% { background: auto; } -}