ajones05 / seearound.me-ionic

0 stars 0 forks source link

Alerts issue #125

Closed ajones05 closed 7 years ago

ajones05 commented 8 years ago

It used to show just the last 10 alerts. If you tapped on one, the count would go down to 9 and the one you viewed would be gray.

Now, however, the one that was tapped disappears and the next unread alert appears added to the list, so the number stays at 10.

I'm sure there is a better way to manage alerts, but for now pleaser change it back to how it was (show only the 10 most recent alerts and when tapped they turn gray and the number of alerts goes down).

abdulhafeez commented 8 years ago

Looks like this behaviour has changed on server side. All I was doing on client side was to fetch latest list of alerts and count unread alerts whenever the user tapped one (at that point we also used mobile/notification-read api to mark it read before fetching updated list). It is still the same on my side. Perhaps something changed on server side with 'mobile/notification' api. @yuriyua can tell better.

ajones05 commented 8 years ago

@yuriyua did you make a change? I didn't think you were making any changes at the moment?

yuriyua commented 8 years ago

@abdulhafeez These are response examples. What should I change?

Response before "tap":

{
    "status": "SUCCESS",
    "result": [
        {
            "id": "277",
            "type": "message",
            "is_read": "0",
            "created_at": "2016-11-06 01:22:37",
            "user_id": "302",
            "user_name": "Yuriy Kurilyuk 2",
            "user_image": "http://www.seearoundme.local/uploads/default.jpg",
            "message": "Yuriy Kurilyuk 2 sent you a new message"
        },
        {
            "id": "276",
            "type": "message",
            "is_read": "0",
            "created_at": "2016-09-25 23:59:18",
            "user_id": "302",
            "user_name": "Yuriy Kurilyuk 2",
            "user_image": "http://www.seearoundme.local/uploads/default.jpg",
            "message": "Yuriy Kurilyuk 2 sent you a new message"
        },
        {
            "id": "275",
            "type": "message",
            "is_read": "0",
            "created_at": "2016-09-25 23:58:40",
            "user_id": "302",
            "user_name": "Yuriy Kurilyuk 2",
            "user_image": "http://www.seearoundme.local/uploads/default.jpg",
            "message": "Yuriy Kurilyuk 2 sent you a new message"
        },
        {
            "id": "3742",
            "type": "comment",
            "is_read": "0",
            "created_at": "2016-08-10 05:40:05",
            "user_id": "302",
            "user_name": "Yuriy Kurilyuk 2",
            "user_image": "http://www.seearoundme.local/uploads/default.jpg",
            "post_id": "2561",
            "message": "Yuriy Kurilyuk 2 commented on your post"
        },
        {
            "id": "3614",
            "type": "comment",
            "is_read": "0",
            "created_at": "2016-07-12 01:11:15",
            "user_id": "302",
            "user_name": "Yuriy Kurilyuk 2",
            "user_image": "http://www.seearoundme.local/uploads/default.jpg",
            "post_id": "2311",
            "message": "Yuriy Kurilyuk 2 commented on your post"
        },
        {
            "id": "3613",
            "type": "comment",
            "is_read": "0",
            "created_at": "2016-07-12 01:02:29",
            "user_id": "302",
            "user_name": "Yuriy Kurilyuk 2",
            "user_image": "http://www.seearoundme.local/uploads/default.jpg",
            "post_id": "2311",
            "message": "Yuriy Kurilyuk 2 commented on your post"
        },
        {
            "id": "3612",
            "type": "comment",
            "is_read": "0",
            "created_at": "2016-07-12 00:56:40",
            "user_id": "302",
            "user_name": "Yuriy Kurilyuk 2",
            "user_image": "http://www.seearoundme.local/uploads/default.jpg",
            "post_id": "2311",
            "message": "Yuriy Kurilyuk 2 commented on your post"
        },
        {
            "id": "3611",
            "type": "comment",
            "is_read": "0",
            "created_at": "2016-07-12 00:54:31",
            "user_id": "302",
            "user_name": "Yuriy Kurilyuk 2",
            "user_image": "http://www.seearoundme.local/uploads/default.jpg",
            "post_id": "2311",
            "message": "Yuriy Kurilyuk 2 commented on your post"
        },
        {
            "id": "3610",
            "type": "comment",
            "is_read": "0",
            "created_at": "2016-07-12 00:23:20",
            "user_id": "302",
            "user_name": "Yuriy Kurilyuk 2",
            "user_image": "http://www.seearoundme.local/uploads/default.jpg",
            "post_id": "2311",
            "message": "Yuriy Kurilyuk 2 commented on your post"
        },
        {
            "id": "3609",
            "type": "comment",
            "is_read": "0",
            "created_at": "2016-07-12 00:22:19",
            "user_id": "302",
            "user_name": "Yuriy Kurilyuk 2",
            "user_image": "http://www.seearoundme.local/uploads/default.jpg",
            "post_id": "2311",
            "message": "Yuriy Kurilyuk 2 commented on your post"
        }
    ]
}

Response after "tap":

{
    "status": "SUCCESS",
    "result": [
        {
            "id": "277",
            "type": "message",
            "is_read": "1",
            "created_at": "2016-11-06 01:22:37",
            "user_id": "302",
            "user_name": "Yuriy Kurilyuk 2",
            "user_image": "http://www.seearoundme.local/uploads/default.jpg",
            "message": "Yuriy Kurilyuk 2 sent you a new message"
        },
        {
            "id": "276",
            "type": "message",
            "is_read": "0",
            "created_at": "2016-09-25 23:59:18",
            "user_id": "302",
            "user_name": "Yuriy Kurilyuk 2",
            "user_image": "http://www.seearoundme.local/uploads/default.jpg",
            "message": "Yuriy Kurilyuk 2 sent you a new message"
        },
        {
            "id": "275",
            "type": "message",
            "is_read": "0",
            "created_at": "2016-09-25 23:58:40",
            "user_id": "302",
            "user_name": "Yuriy Kurilyuk 2",
            "user_image": "http://www.seearoundme.local/uploads/default.jpg",
            "message": "Yuriy Kurilyuk 2 sent you a new message"
        },
        {
            "id": "3742",
            "type": "comment",
            "is_read": "0",
            "created_at": "2016-08-10 05:40:05",
            "user_id": "302",
            "user_name": "Yuriy Kurilyuk 2",
            "user_image": "http://www.seearoundme.local/uploads/default.jpg",
            "post_id": "2561",
            "message": "Yuriy Kurilyuk 2 commented on your post"
        },
        {
            "id": "3614",
            "type": "comment",
            "is_read": "0",
            "created_at": "2016-07-12 01:11:15",
            "user_id": "302",
            "user_name": "Yuriy Kurilyuk 2",
            "user_image": "http://www.seearoundme.local/uploads/default.jpg",
            "post_id": "2311",
            "message": "Yuriy Kurilyuk 2 commented on your post"
        },
        {
            "id": "3613",
            "type": "comment",
            "is_read": "0",
            "created_at": "2016-07-12 01:02:29",
            "user_id": "302",
            "user_name": "Yuriy Kurilyuk 2",
            "user_image": "http://www.seearoundme.local/uploads/default.jpg",
            "post_id": "2311",
            "message": "Yuriy Kurilyuk 2 commented on your post"
        },
        {
            "id": "3612",
            "type": "comment",
            "is_read": "0",
            "created_at": "2016-07-12 00:56:40",
            "user_id": "302",
            "user_name": "Yuriy Kurilyuk 2",
            "user_image": "http://www.seearoundme.local/uploads/default.jpg",
            "post_id": "2311",
            "message": "Yuriy Kurilyuk 2 commented on your post"
        },
        {
            "id": "3611",
            "type": "comment",
            "is_read": "0",
            "created_at": "2016-07-12 00:54:31",
            "user_id": "302",
            "user_name": "Yuriy Kurilyuk 2",
            "user_image": "http://www.seearoundme.local/uploads/default.jpg",
            "post_id": "2311",
            "message": "Yuriy Kurilyuk 2 commented on your post"
        },
        {
            "id": "3610",
            "type": "comment",
            "is_read": "0",
            "created_at": "2016-07-12 00:23:20",
            "user_id": "302",
            "user_name": "Yuriy Kurilyuk 2",
            "user_image": "http://www.seearoundme.local/uploads/default.jpg",
            "post_id": "2311",
            "message": "Yuriy Kurilyuk 2 commented on your post"
        },
        {
            "id": "3609",
            "type": "comment",
            "is_read": "0",
            "created_at": "2016-07-12 00:22:19",
            "user_id": "302",
            "user_name": "Yuriy Kurilyuk 2",
            "user_image": "http://www.seearoundme.local/uploads/default.jpg",
            "post_id": "2311",
            "message": "Yuriy Kurilyuk 2 commented on your post"
        }
    ]
}
abdulhafeez commented 8 years ago

This response is OK. I am getting the same and I don't see this issue with 10 or less than 10 alerts. May be the problem happens when alerts are more than 10 but I could not reproduce that either.

ajones05 commented 8 years ago

Log into my account, since it has a lot of alerts, and you should be able to see the issue: vvhatif@gmail.com Resource17

abdulhafeez commented 8 years ago

This screen shot shows the log out put I am getting:

screenshot 2016-11-07 22 59 30

It is all coming from server side. You can see that on start, 3957 is the first alert and 3933 is the second. When I click the first alert, it is marked read and then new alert list is fetched. This new alert list does not have 3957 ... it has 3933 as the first alert. It also has a new alert at the end of the list (3791). So, it is clear that this is happening on server side. It seems the server is ignoring the alerts where is_read = 1 and including new unread alert.

abdulhafeez commented 8 years ago

I think what @yuriyua should do is keep returning same list of 10 alerts until all 10 are marked read. When all 10 are marked read, return next 10. @ajones05 is that the correct logic?

yuriyua commented 8 years ago

Let me check

ajones05 commented 8 years ago

I think what @yuriyua should do is keep returning same list of 10 alerts until all 10 are marked read. When all 10 are marked read, return next 10.

No, it should just show the most recent 10 alerts, whether they are read or not. However, once an alert has been read, it should appear gray (marked as read). It used to function this way, but something changed recently where alerts that have been read are no longer shown, even if it is one of the 10 most recent.

yuriyua commented 8 years ago

I see issue. Let me fix it.

abdulhafeez commented 8 years ago

I think then the only wrong thing is that server is excluding the read alert ... but but but ... server may be doing it right as it picks most recent ... quite complex

ajones05 commented 8 years ago

Thanks @yuriyua @abdulhafeez it should be simple:

  1. Always show most recent 10 alerts - this never changes
  2. For each of those alerts: it has either been read (or) not read
yuriyua commented 8 years ago

In the list we load notification for latest 2 weeks. I made query for load unread notifications for unlimited date OR all notificatin for latest two weeks

...
is_read=0 OR created_at>'2016-10-22 00:00:00'
....

Remove OLD notifications from the list?

These are old notifications 0e466a20-a53e-11e6-8ab8-c4ef166497ad

yuriyua commented 8 years ago

Remove OLD notifications from the list?

I mean more than two weeks old unread notifications

ajones05 commented 8 years ago

Old notifications should always be removed, so only the newest 10 alerts are shown (whether they have been read or not). Let me know if some examples would help...

abdulhafeez commented 8 years ago

is_read=0 OR created_at>'2016-10-22 00:00:00'

This query seems to ignore read messages. Should you not remove is_read=0 condition?

yuriyua commented 8 years ago

done

ajones05 commented 7 years ago

I checked and now have no alerts, so unless I am missing something it seems something is still not right.

yuriyua commented 7 years ago

I made fer requests to your account. Can you test it again, please?

http://www.seearound.me/admin/mobile-api/notification/token/1X3DVG1677A2I47Y67R5XPNPN327NXLPSP4N75VDC6FX9MTFVMKSCAI2CK93HXSB/submit

ajones05 commented 7 years ago

I still see no alerts. I see I have a new message if I go manually to messages, though.

ajones05 commented 7 years ago

I just logged out, logged in as another user - looked fine. Logged back in with the original account and it looks fine now, too

ajones05 commented 7 years ago

The alerts for messages aren't working (if you tap on it, nothing happens). Only the alerts for "X user liked/commented on your post" seem to be working.

yuriyua commented 7 years ago

http://www.seearound.me/admin/mobile-api/notification/token/Y2T3X9F4PCDD7VATG48RM969H9RE35316X447I8XXLA5GK11P8RDGZM28FGBKIBR/submit

...
        {
            "id": "215",
            "type": "message",
            "is_read": "1",
            "created_at": "2016-11-08 08:00:54",
            "user_id": "276",
            "user_name": "Yuriy Kurilyuk",
            "user_image": "http://www.seearound.me/uploads/default.jpg",
            "message": "Yuriy Kurilyuk sent you a new message"
        },
...

It was marked as read. @abdulhafeez can you test it from your side?