Added one minor thing so *all* unexpired news items aren't shown.

This commit is contained in:
Jeremy Fincher 2003-10-15 05:30:02 +00:00
parent 5be65f1caf
commit b6fb71d5a5
2 changed files with 3 additions and 1 deletions

View File

@ -262,7 +262,7 @@ class News(plugins.ChannelDBHandler, callbacks.Privmsg):
irc.reply(msg, '%s: %s' % (cursor, item))
else:
cursor.execute("""SELECT id, subject FROM news
WHERE expires_at < %s
WHERE expires_at <> 0 AND expires_at < %s
ORDER BY id DESC""", int(time.time()))
if cursor.rowcount == 0:
irc.error(msg, 'I have no news for that channel.')

View File

@ -75,6 +75,8 @@ if sqlite is not None:
self.assertRegexp('news 1', 'baz')
def testOldnews(self):
self.assertError('oldnews')
self.assertNotError('addnews 0 a: b')
self.assertError('oldnews')
self.assertNotError('addnews 5 foo: bar')
self.assertError('oldnews')