mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-05 17:02:47 +00:00
modified cookie set
This commit is contained in:
@@ -5,7 +5,6 @@ urlpatterns = patterns('notifications.views',
|
|||||||
url(r'^add/$', 'notification_add', name='notification_add'),
|
url(r'^add/$', 'notification_add', name='notification_add'),
|
||||||
url(r'^delete/(?P<nid>[\d]+)/$', 'notification_delete', name='notification_delete'),
|
url(r'^delete/(?P<nid>[\d]+)/$', 'notification_delete', name='notification_delete'),
|
||||||
url(r'^set-primary/(?P<nid>[\d]+)/$', 'set_primary', name='set_primary'),
|
url(r'^set-primary/(?P<nid>[\d]+)/$', 'set_primary', name='set_primary'),
|
||||||
url(r'^close/(?P<note_id>[\d]+)/$', 'notification_close', name='notification_close'),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@@ -9,18 +9,6 @@ from auth.decorators import login_required
|
|||||||
from seahub.notifications.models import Notification, NotificationForm
|
from seahub.notifications.models import Notification, NotificationForm
|
||||||
from seahub.notifications.utils import refresh_cache
|
from seahub.notifications.utils import refresh_cache
|
||||||
|
|
||||||
@login_required
|
|
||||||
def notification_close(request, note_id):
|
|
||||||
note_id += ','
|
|
||||||
topinfo_close = request.COOKIES.get('topinfo', '')
|
|
||||||
topinfo_close += note_id
|
|
||||||
|
|
||||||
next = request.GET.get('next', '/')
|
|
||||||
res = HttpResponseRedirect(next)
|
|
||||||
res.set_cookie("topinfo", topinfo_close, max_age=14*24*60*60)
|
|
||||||
|
|
||||||
return res
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def notification_list(request):
|
def notification_list(request):
|
||||||
if not request.user.is_staff:
|
if not request.user.is_staff:
|
||||||
|
@@ -136,19 +136,18 @@ $('#info-bar .close').click(function() {
|
|||||||
$('#info-bar').addClass('hide');
|
$('#info-bar').addClass('hide');
|
||||||
if (navigator.cookieEnabled) {
|
if (navigator.cookieEnabled) {
|
||||||
var cookies = document.cookie.split('; '),
|
var cookies = document.cookie.split('; '),
|
||||||
topinfo_exist = false;
|
topinfo_exist = false,
|
||||||
|
topinfo_new_value = $(this).attr('data') + ',' + '; max-age=' + 14*24*60*60 + '; path=' + '{{ SITE_ROOT }}';
|
||||||
for (var i = 0, len = cookies.length; i < len; i++) {
|
for (var i = 0, len = cookies.length; i < len; i++) {
|
||||||
if (cookies[i].split('=')[0] == 'topinfo') {
|
if (cookies[i].split('=')[0] == 'topinfo') {
|
||||||
cookies[i] += $(this).attr('data') + ',';
|
|
||||||
topinfo_exist = true;
|
topinfo_exist = true;
|
||||||
document.cookie = cookies.join('; ');
|
document.cookie = 'topinfo=' + cookies[i].split('=')[1] + topinfo_new_value;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!topinfo_exist) {
|
if (!topinfo_exist) {
|
||||||
document.cookie += '; topinfo=' + $(this).attr('data') + ',';
|
document.cookie = 'topinfo=' + topinfo_new_value;
|
||||||
}
|
}
|
||||||
document.cookie += '; max-age=' + 14*24*60*60;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
Reference in New Issue
Block a user