Shorten recent clicks cookie to at most 5 elements.

This commit is contained in:
Max Goodman
2012-07-18 18:08:46 -07:00
parent bcbba69a7e
commit e2ca4f3d03
2 changed files with 5 additions and 5 deletions

View File

@@ -163,8 +163,8 @@ def set_recent_clicks():
if valid_click_cookie(click_cookie):
names = [ x for x in UniqueIterator(click_cookie.split(',')) if x ]
if len(click_cookie) > 1000:
names = names[:20]
if len(names) > 5:
names = names[:5]
set_user_cookie('recentclicks2', ','.join(names))
#eventually this will look at the user preference
names = names[:5]

View File

@@ -496,9 +496,9 @@ function add_thing_id_to_cookie(id, cookie_name) {
cookie.data = id + ',' + cookie.data;
if(cookie.data.length > 1000) {
var fullnames = cookie.data.split(',');
fullnames = $.uniq(fullnames, 20);
var fullnames = cookie.data.split(',');
if(fullnames.length > 5) {
fullnames = $.uniq(fullnames, 5);
cookie.data = fullnames.join(',');
}