From 016d65473cf14e5153a497bd043cd6e1b62d860c Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Tue, 21 Jan 2014 00:52:40 -0500 Subject: [PATCH] fix notification message when deleting old history --- _locales/en/messages.json | 9 ++++++++- javascript/clearhistory.js | 8 ++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 7ea4116..13074bf 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -22,13 +22,20 @@ "optionsAutoclear": {"message": "Automatically purge old entries"}, "confirmPrompt": {"message": "Are you sure you want to delete the history?"}, "notificationTitle": {"message": "History deleted successfully!"}, - "notificationTime": { + "notificationTimeNewer": { "message": "for the last $num$ $units$", "placeholders": { "num": {"content": "$1"}, "units": {"content": "$2"} } }, + "notificationTimeOlder": { + "message": "older than $num$ $units$", + "placeholders": { + "num": {"content": "$1"}, + "units": {"content": "$2"} + } + }, "notificationTimeAll": {"message": "from the beginning of time"}, "notificationBody": { "message": "History deleted $when$.", diff --git a/javascript/clearhistory.js b/javascript/clearhistory.js index f614fff..28eb2b0 100644 --- a/javascript/clearhistory.js +++ b/javascript/clearhistory.js @@ -67,10 +67,10 @@ function clearDownloads(s) { function didClearHistory(s) { var time = ~~(s.time) || CONSTANTS.DEFAULT_TIME; time = getUnitsForTime(time); - var timeString = (time.time === -1) ? - chrome.i18n.getMessage('notificationTimeAll') : - chrome.i18n.getMessage('notificationTime', - [time.time, time.units]); + var timeMsg = (time.time === -1) ? 'notificationTimeAll' : + (s.timeStart === CONSTANTS.YES) ? 'notificationTimeNewer' : + 'notificationTimeOlder'; + var timeString = chrome.i18n.getMessage(timeMsg, [time.time, time.units]); var message = chrome.i18n.getMessage('notificationBody', timeString); var notification = webkitNotifications.createNotification( chrome.extension.getURL('/images/icon48.png'), -- 2.39.5