Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.

q2apro-on-site-notifications: I am receiving twice the same notification at the same time. What must be happening?

+1 vote
734 views
asked Feb 4, 2015 in Plugins by gunrose
edited Feb 4, 2015 by gunrose

I have not changed any configuration!
Maybe the notification is comming from 2 different sources, but I would like to stress that I am still developing in localhost. Is there a way to deal with this problem? It is quite strange to be notified twice.

Please see the image below (by the way, it seems the same issue happens in the figure presented in on-site-notifications):

Edit:

See repeated lines of the  the table eventlog:

2015-02-04 07:58:43     127.0.0.1     1     danielcajueiro     NULL    in_a_question     postid=16    parentid=4    parent=array(45)    content=Sugiro incluir na lista:  The Wal-Mart...    format=markdown    text=Sugiro incluir na lista: The Wal-Mart ...    categoryid=1    name=    notify=1    email=
2015-02-04 07:58:43     127.0.0.1     1     danielcajueiro     NULL    in_a_question     postid=16    parentid=4    parent=array(45)    content=Sugiro incluir na lista:  The Wal-Mart...    format=markdown    text=Sugiro incluir na lista: The Wal-Mart ...    categoryid=1    name=    notify=1    email=

Q2A version: 1.7.0
commented Feb 4, 2015 by pupi1985
This smells like a copy/paste issue somewhere. Try to find out whether the notification is actually twice in the event logger table or if this is just some issue when generating the UI
commented Feb 4, 2015 by gunrose
edited Feb 4, 2015 by gunrose
In qa_event_log table, for instance, up vote events arise twice (for the user who posted the question), answers arise twice for the user who posted the question. This does not seem to affect the history plugin, because it does not consider the effect of other people's actions, which is different from the on-site-notifications. Where is this table created? Is it in function process_event in qa_event_loger?

1 Answer

+4 votes
answered Feb 4, 2015 by pupi1985
selected Feb 5, 2015 by gunrose
 
Best answer

I don't know much about this plugin but I'm taking a look at this line: https://github.com/q2apro/q2apro-on-site-notifications/blob/master/q2apro-history-check.php#L143

In NoahY's history plugin, which is mentioned in that file, there is a similar line: https://github.com/NoahY/q2a-history/blob/master/qa-history-check.php#L102

So I guess you've installed both and they just aren't compatible because they are both doing the same thing (I told you it smelled to a copy/paste issue! :P).

As I said before, I don't know much about those plugins nor why they are inserting data to the event logger... that is something the core handles (related question: http://www.question2answer.org/qa/36034) but I guess they should have a good reason.

Anyway, I took a quick look at the code and it seems you can comment the code that inserts the record in that table in one of the plugins as the other one will add it anyway. That way you'll avoid the duplication. I'd do this in the NoahY's plugin as it is the one that seems less likely to be updated.

...