The counters displayed on the homepage show not the correct number of content:

1. the view commons_bw_all has a "Require relationship" for "OG membership from node". In this case only content linked to a group would show up. But the 2 other views "commons_bw_polls" and "commons_bw_posts" have not this required relationship and show also content outside of a groups.
As this is the only place to show content not belonging to a group, except activity streams, the relationship should not be required and all content displayed.
2. If the relationship is not required, still only content related to group is counted for the numbers. The amount of items the view shows in teaser mode on the page does not equal the number shown on top in the tab header.
| Comment | File | Size | Author |
|---|---|---|---|
| #13 | 2075053-commons-tab-counts-incorrect-13.patch | 7.24 KB | ezra-g |
| #8 | 2075053-commons-tab-counts-incorrect-8.patch | 5.42 KB | ezra-g |
| Clipboard03.jpg | 3.91 KB | slowflyer |
Comments
Comment #1
ezra-g commentedThanks for the report. Adding to the 3.4 radar.
Comment #2
ezra-g commentedComment #3
slowflyer commentedBy the way... it was still the case with the dev from 18th August I installed yesterday.
Comment #4
ezra-g commentedI'm looking into this issue today, however please note the latest Commons dev snapshot is from 2013-Sep-26, rather than mid-August.
Comment #5
ezra-g commentedI tested this hypothesis by creating a "post" node outside of any groups.
I made the following changes to the commons_bw_all view, reverting back to the default between each change so that I could test the changes in isolation.
I set the exposed "following" filter to display all content regardless of whether it was flagged in all tests below where the exposed filter was present. The list below is in the format of "Change made: Whether the post node outside of groups appears in the view when the view is previewed":
* View in its current state in the Commons codebase: doesn't show
* Remove only OG membership relationship: Doesn't show
* Remove only flag relationship: Doesn't show
* Make OG relationship not required: doesn't show
* Make OG relationship not required *and* remove "group content type" filter - post shows.
So, it seems like the filter introduced in #2037417: All views using OG references require a OG group type filter is more likely part of the discrepancy. We may also need to change whether the group relationship is required for the other commons_bw views for consistency.
Comment #6
ezra-g commentedAs outlined in the OP here, there are 2 parts to this issue:
1) Whether the site homepage browsing widget should include content posted outside of groups as its default behavior.
2) Tab counts being out of sync with their counters.
@slowflyer, can you provide steps to reproduce the second item? I haven't been able to do so yet.
Comment #7
slowflyer commentedHi Ezra,
you mentioned in #5 that you've created a new post outside of any groups.
Click on the Posts tab on the homepage.
I guess the number schown in the widget of the tab does not equal the number of posts shown below.
In general
create post, assign a group -> counter will increase
create post, do not assign a group -> counter will not increase
Comment #8
ezra-g commentedThanks for those reproduction steps, slowflyer!
Here's a patch to address the incorrect tab counts as in the 2nd part of the OP. It would be great to get your review here! Please note that you need to clear cache and run update.php or the "drush updatedb" command.
I believe having the site homepage browsing widget include content outside of groups is a new feature request, so I encourage you to file one so that others who are interested can express their interest.
Comment #9
slowflyer commentedThanks for tha patch Ezra,
I will review it tomorrow when back in office.
On the short term it looks, you took the "easy" way to solve the issue... just dont let the views display content outside of groups.
But there is one remaining question:
The user creates a post using the small widget form and does not assign any groups - maybe by accident -
In this case the content is not displayed a little confusing because the look and feel suggests that the content a user enters in the form, will be displayed below after saving - no matter of assigned to groups or not.
By the way, I think it was introduced with 3.3 that a group is not mandatory for these content types.
So I wont call it a new feature request, it's more an evolution we need to handle.
Comment #10
ezra-g commentedThat's a good point, slowflyer. I was thinking in the context of the Trusted Contacts feature being enabled, which enforces form validation to ensure that content from the browsing widget has a group audience (either in the og_group_ref field or to a user's trusted contacts. You're right that without this validation, the proposed patch could make some potentially confusing behavior possible.
Comment #11
slowflyer commentedThe patch from #8 works technically fine.
All things related user experience have been mentioned in #9 and #10
Comment #12
ezra-g commentedAgreed on the UX issues. Marking needs work for additional form validation so that at least the current Commons behavior is consistent with/without Trusted Contacts enabled.
Comment #13
ezra-g commentedRe-roll per #12.
Note that I added a call in commons_bw.module to node_validate(). The documentation at https://api.drupal.org/api/drupal/modules%21node%21node.api.php/function... claims that field_attach_validate() invokes hook_node_validate() but I don't see how that's accurate looking at the codebase. I'm asking folks who might be able to weigh in and update the documentation if it needs revision.
Comment #14
ezra-g commented#13 is committed: http://drupalcode.org/project/commons.git/commit/726a400.
Thanks for the helpful feedback, slowflyer! Let's continue with the feature-request aspect of this issue in #2020061: Allow users to create content outside of groups.
Comment #15
ezra-g commentedI left a draft validation error message in here. "needs more groups" - We should have a more appropriate message.
Comment #16
ezra-g commentedhttp://drupalcode.org/project/commons.git/commitdiff/1e6b7c7?hp=3259dbf2...
Comment #17
slowflyer commentedUsing the dev from 2nd October...
I tried to create a post, poll, wiki, Q&A in a group using the small widget form, results in the new error message "needs more groups".
Using the full form everything works as expected.
Comment #18
ezra-g commentedYes, that's what we fixed with #16, thanks!
Comment #19
RobKoberg commentedI just wanted to point out https://drupal.org/project/entityreference_count does the same thing in a more modular way. Every thing works as expected, but I do have an issue, https://drupal.org/node/2103371.
Once enabled, the counts can be initialized/updated by:
* go into maintenance mode :)
* Use devel's Execute PHP code to run (or create code to run in an update):
Comment #20
slowflyer commentedI'm not sure if entityreference_count would solve the initial problem on the homepage.
Content of several groups or even no groups is displayed. And content outside groups does not have a referenced entity.
In between I got my initial problem solved using https://drupal.org/node/2020061#comment-7922081