Hello,

I've got this little problem I can't resolve...

I reinstalled complety the module, I still have it.

I'm using the default activity view to display messages.

"You....." message is always displaying four times (Author message).

[author-name] (Public message) is well display.

Any idea?

Thanks :)

Comments

sirkitree’s picture

Are you using the default views that come with the module or have you created your own?

junro’s picture

Title: Author message is displaying always four times. » Author message is displaying always four times for authenticated user role.

The default view, that's the problem.

OK, I just find where the problem come from.

I've got the good display with my "webmaster" role.
I've got the bug with authenticated user role.

I'm going to desable webmaster permissions and see which module the bug come from.

Scott Reynolds’s picture

Ah so does your webmaster have "administer nodes", then it won't have node_access rules applied (cause they have access for all of it).

Therefore, the query doesn't have DISTINCT(amid) in the query, creating duplicate results

junro’s picture

There is no problem with "administer nodes" permissions.

I chech it for authenticated user role and I still have the problem.

It should be another permissions from another modules.

junro’s picture

ah ok, you're talking about "administer nodes". Sorry about that, I was mistaken with "administer activity".

Exactly, If you check "administer nodes" for authenticated user, it's good. But, sure, I can't chech it.

So, Is it a bug that will be fixe, or something I have to do about my configuration ?

Scott Reynolds’s picture

wow thats not what I expected something else is going nutz.

If the user has administer nodes permission, then they see things properly? I expected the opposite.

Do you have access control on? (node access and activity access)?

sirkitree’s picture

I think Junro is saying that your expected behavior is actually happening, english is just off a bit ;)

However, the main cause of the problem here is our db_rewrite_sql() and using views_data_alter() instead of building a relationship handler. We'll be able to get rid of some cruft, and this bug, by doing so.

I'll create a new ticket for this if I can't find one already.

junro’s picture

sorry guys about my english, I'm French... i'm moving to north america next year hoping to speak better than that! :)

with "admister nodes" permission ---> GOOD display.

without ---> BAD display. ONLY when users are viewing their own activities. Viewing others users activities is good.
So all simple user with authenticated role have a bad display of their own activities.

I have node access module on.

activity access ? I don't know what is it. What do you mean exactly?

junro’s picture

Priority: Normal » Critical

Hello,

I disabled activity module and I've got some strange things related to this issue:

All nodes created are created four times!

I really don't know what's going on with this module... I still can't use it... I rally want to use for my website. :)

Scott Reynolds’s picture

Priority: Critical » Normal
Status: Active » Postponed (maintainer needs more info)

Heres what I did to see if i could get this to repeat.
1.) created one additional content type
2.) Created activity templates for all 3 content types (page, story, test type)
3.) created a page
4) created a story
5.) created a test type
6.) created a template for ALL templates (meaning I did not check off any type for the template)
7.) created a story (this produced two messages, the template for the story insert and the themplate for All insert)

Everything worked as expected. So I believe that what I expected to happen is not what you expect to happen. So what I would like is for you to share with us your actions table

SELECT * from actions\G

This way we can see how the messages are being recorded

rjbrown99’s picture

I was having what initially seemed like a similar problem with views. What I was trying to do was to pull and display the specific comment that a user posted to the node. The activity trigger for this was "Record an activity message when: comment insert types Question" where Question is my CCK content type.

Based on the default Activity view, I did this to expand it:

1) Created a relationship "Comment: Node" to "Activity: Node" to grab the comments from nodes related to the activity.
2) Added a field "Comment: Body" tied to that relationship to display the comment.

Things related to comments now show up multiple times, and it is the relationship specifically causing it. Removing the field didn't help, but removing the relationship did. Setting distinct to yes did not help with this.

It is likely that I am just munging the view. Thoughts are welcome.

Original poster - are you using any views relationships?

Scott Reynolds’s picture

Things related to comments now show up multiple times,

I would guess that the things that showed up multiple times showed up 4 times when there were 4 comments, 3 times when there were 3 comments, 6 times when there was 6 comments. This is the way SQL works and it makes total sense.

sorrow’s picture

I’ve just experienced this problem and yes, the number of duplicate items displayed corresponds to the number of individual items activity is supposed to be showing.

I’m using a custom view with three relationships (Activity: User and two flag entries). Upon deletion of the flags the view functions as it should. When I recreate the flag entries within views and refresh the activity page it carries on working correctly until I choose to flag an entry, then the problem starts again (cycling back to two entries at first, because I deleted previous activity logs?).

There’s something not right with the flags to begin with although I’m not sure if that’s by design (i.e. I’m doing it wrong) or not. The two flags correspond to Like and Dislike. The url’s they’re generating within the view for activity are all the same per flag (so when I like one, upon refresh I like everything in the stream) and are being sourced from the first item in the activity stream I can like. When the view is broke each subsequent copy of like has a unique url which is then copied for the same duplicate entry number of the activity stream. My intention is obviously to have unique url’s for each item in the list (which is the case when I look at them in a basic list outside of the activity stream).

In terms of previously requested actions I can’t access the configuration page for each (Fatal error: Call to undefined function activity_record_form() in mysite\modules\system\system.module on line 1501) which I presume is because they were created by the publisher? If the actions copied directly from the database will assist please let me know. Thanks!

sorrow’s picture

Ok, after playing around with another view incorporating flags I don’t think this issue (or at least my version of it) is Activity caused. I created a basic view to pull in facebook style status each with Like and Dislike flags. While the url’s are all unique, when more than one user flags one of them, upon refresh the status has a duplicate listing within the view that corresponds to the number of users who flagged. Either I’m setting up the flags incorrectly or I’m guessing this is a Views problem.

Scott Reynolds’s picture

In terms of previously requested actions I can’t access the configuration page for each

Opened up an issue for that #635264: Add back in activity_record_form ?. You can of course goto admin/build/activity and configure them there.

Regarding sorrow's problem, I would guess that you need to add Distinct to your query as your pulling in the flag relationship? Sounds its just because of the way your View is built.

In regards to #11, yes that is just the way SQL works. You should write code that creates a relationship from the comment (cid) to the activity table (type = 'comment' and eid = comment.cid).

sorrow’s picture

Distinct has been set from the beginning unless there’s a way to filter specific fields with it that I'm missing? As far as I can tell it’s a result of using Flags in the relationships, it seems like they’re being processed as unique user content because when I take them out it works fine.

Between the two views I mentioned I’ve gone through basically every single Flag relationship variant I can create and the only one that’s stopping duplicates appearing is within the basic facebook status view, that’s a result of unchecking “Include only flagged content” and selecting By as “Current User”. This has no effect within the Activity view.

The problem with this is that I’m also creating an output for “Users who liked this” within the view. With that relationship set it only shows the first person who liked the content in the field. When I change to a different relationship the duplicates reappear, each seemingly owned by the user who flagged them because each duplicate shows a different user who liked.

Would this be a Views or Flag fault? Searching within the Views issues seems to produce a lot of duplicate entry problems so I’m guessing Views although maybe posting a Flag issue first would be better. While I don’t think it’s Activity caused it does seem certain types of relationships will break it and in comparison between the views I’ve made the Activity output is much worse, the test site I’m editing is up to about 20 duplicates per single feed heh. There’s also the issue of the flags being created with duplicate url’s, this behaviour isn’t present in my other view.

I’ll see if anything further happens over here before posting an issue elsewhere. Thanks.

Scott Reynolds’s picture

Would this be a Views or Flag fault? Searching within the Views issues seems to produce a lot of duplicate entry problems so I’m guessing Views although maybe posting a Flag issue first would be better.

You may think things are broken but they arn't. The SQL query you are creating is crazy advanced and you have done so very easily through the Views UI. Using the UI, it has prevented you from having to think about the SQL query and how to construct it and thus has allowed you to construct a bad SQL query.

There is nothing broken, its just that the Views UI makes you think it should work one way when it just can't possibly. You will probably need to write custom relationship/filter/fields handlers to achieve your goal.

There is no bug, just an illusion of one...

This too is the reason why there are a lot of issues in the Views queue. A lot of people trying to do advanced things without thinking about how the SQL should be constructed and then how to use Views to create that SQL.

sorrow’s picture

I understand your point and do agree. Although… something is/was broken hah. After you mentioned the distinct query I checked the output and noticed it wasn’t being called. A search of the Views issues notes some people having faults with the 6.x-2.7 release. I installed the last dev, distinct is now working. Although I’d selected it I should have noticed it not being called, my bad.

Now I need to make the flag links within Activity distinct. I imagine should that be achieved the duplicates will disappear as well rendering distinct unnecessary. Help appreciated, thanks.

Scott Reynolds’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)

Closing this down as original reporter hasn't commented on the issue in months and this is starting to be come a "hey I created a View and got X duplicates". This will happen with bad Views queries...