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

users's profile - notifications page is empty even though I get red envelope icon #846

Open
damascene opened this issue Sep 29, 2019 · 2 comments

Comments

@damascene
Copy link

On the 0.11.x version after I get a notification, I click on the red envelope icon but the page doesn't display any notification.

I've tested on Desktop and mobile version too.

Peek 2019-09-29 09-31

@martin-bts
Copy link

martin-bts commented Nov 3, 2019

Steps to reproduce:

  1. create a question or answer with some user, e.g. user A
  2. add a comment as another user, e.g. user B

Result:
User A will get the red envelope when refreshing the page. Clicking on the envelope will lead them to their empty notifications inbox.

The red envelope will continue to appear in the top bar until user A views the thread with the new comment.

The database shows "1" new_response_count and "0" seen_response_count, after user B created the comment. When user A opens the corresponsing thread, new_response_count and seen_response_count become "0" and "1", respectively, and the red envelope vanishes.

Analysis:

  • I created ...
    • a comment, as user 4,
    • to an answer, by user 3,
    • to a question, by user 1.
  • When I create the comment, it is added to the table askbot_post, which is how comments are implemented.
  • The Activity is recorded with content_type postrevision by user 4. There is also another Activity recorded immediately afterwards, with content_type post, for user 1.
    • The postrevision Activity is of type 4, i.e. TYPE_ACTIVITY_COMMENT_ANSWER. The name describes what I did. This type is listed in RESPONSE_ACTIVITY_TYPES_FOR_DISPLAY
  • Both new Activities create an ActivityAuditStatus for user 3 with a status of STATUS_NEW. This is what makes the new_response_count increase and ultimately makes Askbot show the red envelope. The red envelope is intended behaviour. The issue is that the notifications list remains empty!
  • The notifications list is rendered by askbot.views.users.user_responses().
    • This method names notifications it wants to display memos, retrieved as memo_set
    • a memo may be omitted, if memo.activity.content_object is None
      • content_object is a GenericForeignKey. Its use in askbot.models.user.Activity matches the fine manual.
      • the referenced IDs match existing DB entries and they contain my comment (side note: how often is a comment stored in the DB?!)
      • I don't think we drop the memo here
    • I added some debug output and it would appear the problem lies with our use of Jinja
      • askbot.views.users.user_responses() correctly creates an item for the new comment
      • the array is passed to Jinja as 'messages'
      • Jinja thinks messages is empty
      • possible name collision of messages in Jinja?
        • YES

martin-bts pushed a commit to martin-bts/askbot-devel that referenced this issue Dec 12, 2019
@martin-bts
Copy link

Addressed and merged. As far as I can tell, this issue has been fixed and may be closed.

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

No branches or pull requests

2 participants