Warn with a desktop notification when we're running low on cached captchas. Close #1253.

Also increase delay to close the notifications from 5 to 7 seconds. #1252
This commit is contained in:
Mayhem 2013-08-21 16:24:48 +02:00
parent 08ea3cf7d0
commit 6454090cfd
3 changed files with 14 additions and 3 deletions

View File

@ -1,6 +1,8 @@
- **New feature**: `Linkify` and `Clean Links`, enabled by default
- Linkify will turn text URLs into working links.
- Clean Links will get rid of spoiler and code tags in linkified URLs used to bypass spam blocks.
- New desktop notification:
- The QR will now warn you when you are running low on cached captchas while auto-posting.
## 3.9.0 - *2013-08-18*

View File

@ -106,7 +106,7 @@ Unread =
window.focus()
setTimeout ->
notif.close()
, 5 * $.SECOND
, 7 * $.SECOND
onUpdate: (e) ->
if e.detail[404]

View File

@ -125,7 +125,7 @@ QR =
setTimeout ->
notif.onclose = null
notif.close()
, 5 * $.SECOND
, 7 * $.SECOND
<% } %>
notifications: []
cleanNotifications: ->
@ -1101,7 +1101,16 @@ QR =
}
# Enable auto-posting if we have stuff to post, disable it otherwise.
QR.cooldown.auto = QR.posts.length > 1 and isReply
postsCount = QR.posts.length
QR.cooldown.auto = postsCount > 1 and isReply
if QR.cooldown.auto and QR.captcha.isEnabled and (captchasCount = QR.captcha.captchas.length) < 3 and captchasCount < postsCount
notif = new Notification 'Quick reply warning',
body: "You are running low on cached captchas. Cache count: #{captchasCount}."
icon: Favicon.logo
notif.onclick = -> window.focus()
setTimeout ->
notif.close()
, 7 * $.SECOND
unless Conf['Persistent QR'] or QR.cooldown.auto
QR.close()