Commit e2298191 by benjaoming

Notify dropdown should look at the latest id of a notification and not retrieve…

Notify dropdown should look at the latest id of a notification and not retrieve any older notifications on updating from JSON.
parent 288e25a2
......@@ -3,6 +3,7 @@ from django.conf.urls.defaults import patterns, url
urlpatterns = patterns('',
url('^json/get/$', 'django_notify.views.get_notifications', name='json_get', kwargs={}),
url('^json/get/(?P<latest_id>\d+)/$', 'django_notify.views.get_notifications', name='json_get', kwargs={}),
url('^json/mark-read/$', 'django_notify.views.mark_read', name='json_mark_read_base', kwargs={}),
url('^json/mark-read/(\d+)/$', 'django_notify.views.mark_read', name='json_mark_read', kwargs={}),
url('^goto/(?P<notification_id>\d+)/$', 'django_notify.views.goto', name='goto', kwargs={}),
......
......@@ -15,7 +15,7 @@ def get_notifications(request, latest_id=None, is_viewed=False, max_results=10):
notifications = notifications.filter(is_viewed=is_viewed)
if not latest_id is None:
notifications = notifications.filter(latest_id__gt=latest_id)
notifications = notifications.filter(id__gt=latest_id)
notifications = notifications.prefetch_related('subscription')
notifications = notifications[:max_results]
......
......@@ -3,7 +3,7 @@ notify_update_timeout = 30000;
notify_update_timeout_adjust = 1.2; // factor to adjust between each timeout.
function notify_update() {
jsonWrapper(URL_NOTIFY_GET_NEW, function (data) {
jsonWrapper(URL_NOTIFY_GET_NEW+notify_latest_id+'/', function (data) {
if (data.success) {
$('.notification-cnt').html(data.objects.length);
if (data.objects.length> 0) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment