-
Notifications
You must be signed in to change notification settings - Fork 398
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
list all notification + before filter #156
Conversation
menu.innerHTML = ""; | ||
for (var i=0; i < data.all_list.length; i++) { | ||
var item = data.all_list[i]; | ||
console.log(item) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@GhalebKhaled remove log message please.
@GhalebKhaled Travis CI was failed, could you please give a glance at it? |
return JsonResponse(data) | ||
|
||
try: | ||
num_to_fetch = request.GET.get('max', 5) # If they don't specify, make it 5. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will feel a lot simpler if you combine it all into 1 line instead of 4:
min(max(1, int(request.GET.get('max', 5))), 100)
|
||
all_list = [] | ||
|
||
all_notifications_qa = request.user.notifications.all() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you should drop the _qa
postfix. its unnecessary
for n in all_notifications_qa[0:num_to_fetch]: | ||
struct = model_to_dict(n) | ||
if n.actor: | ||
struct['actor'] = str(n.actor) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these should be unicode casts. but also, why cast at all. these should already be strings...
all_notifications_qa = all_notifications_qa.filter(timestamp__lt=dateutil.parser.parse(before_datetime)) | ||
|
||
|
||
for n in all_notifications_qa[0:num_to_fetch]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you name this notification
?
Sorry @GhalebKhaled, i can't acept this PR.
|
Includes:
List all notifications (both read/unread)
Add
before
filter so it can used toshow more
action