Skip to content
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

Closed
wants to merge 17 commits into from

Conversation

GhalebKhaled
Copy link

Includes:

  1. List all notifications (both read/unread)

  2. Add before filter so it can used to show more action

menu.innerHTML = "";
for (var i=0; i < data.all_list.length; i++) {
var item = data.all_list[i];
console.log(item)

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.

@yangyubo
Copy link
Member

yangyubo commented Dec 4, 2016

@GhalebKhaled Travis CI was failed, could you please give a glance at it?
Thanks

return JsonResponse(data)

try:
num_to_fetch = request.GET.get('max', 5) # If they don't specify, make it 5.

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()

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)

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]:

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?

@coveralls
Copy link

coveralls commented Dec 14, 2016

Coverage Status

Coverage decreased (-9.9%) to 79.454% when pulling 2f8f740 on foundertherapy:master into 0e658dc on django-notifications:master.

@coveralls
Copy link

coveralls commented Dec 19, 2016

Coverage Status

Coverage decreased (-9.9%) to 79.542% when pulling 9bfcf77 on foundertherapy:master into 0e658dc on django-notifications:master.

@coveralls
Copy link

coveralls commented Dec 19, 2016

Coverage Status

Coverage decreased (-9.9%) to 79.542% when pulling a696727 on foundertherapy:master into 0e658dc on django-notifications:master.

@AlvaroLQueiroz
Copy link
Contributor

Sorry @GhalebKhaled, i can't acept this PR.

  1. It changes more things than you described.
  2. You can't change the lib version.
  3. Make actor not required escapes the purpouse of de lib.
  4. The new field uuid isn't used .
  5. You didn't correct the points cited by @danaspiegel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants