Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ezra-g’s picture

Thanks, itamar. The third option is meant to be "all content" (eg, regardless of following).

itamar’s picture

Status: Active » Needs review

Setting as ready for review.

ezra-g’s picture

Status: Needs review » Needs work

Thanks, itamar.

A) I applied the patches on top of the previously referenced patches, and the filters display in the order "Limited to...Sorted by" but the designs call for the opposite order.
B) There's no "all content" (regardless of whether the user follows) as specified in #1.
C) I notice that these patches add the "following" relationships and filters into the Views definitions, and also add integrations from Commons Radioactivity.

The pattern we're currently following with changes to the bw views is to use a views_default_views_alter() hook for add-on functionality so that sites can disable the Radioactivity feature without having broken/overidden views. From commons_radioactivity.module:

/**
 * Implements hook_views_default_views_alter().
 */
function commons_radioactivity_views_default_views_alter(&$views) {
  // Add a "most active" exposed sort to Commons BW views.
  foreach ($views as $view_id => $view) {
    if (strpos($view_id, 'commons_bw_') === 0) {
      $views[$view_id]->display['default']->display_options['sorts']['field_radioactivity_radioactivity_energy']['id'] = 'field_radioactivity_radioactivity_energy';
      $views[$view_id]->display['default']->display_options['sorts']['field_radioactivity_radioactivity_energy']['table'] = 'field_data_field_radioactivity';
      $views[$view_id]->display['default']->display_options['sorts']['field_radioactivity_radioactivity_energy']['field'] = 'field_radioactivity_radioactivity_energy';
      $views[$view_id]->display['default']->display_options['sorts']['field_radioactivity_radioactivity_energy']['order'] = 'DESC';
      $views[$view_id]->display['default']->display_options['sorts']['field_radioactivity_radioactivity_energy']['exposed'] = TRUE;
      $views[$view_id]->display['default']->display_options['sorts']['field_radioactivity_radioactivity_energy']['expose']['label'] = 'most active';
    }
  }
}

My expectation (and I'm certainly open to feedback otherwise) is that we'd do the same for Commons Follow. Hopefully, since this would be a single alter implementation instead of a patch to each of the content type modules that makes the work here easier.

However, since we're adding a relationship as well, this may introduce more complexity than it's worth, and since the Commons Follow system is more fundamental to the product than radioactivity, I'm open to adding Commons Follow as a dependency for the content type modules.

@itamar/amitaibu: This is a good example of a pattern in Commons that hasn't been tested until a major refactoring such as this one - I really value your feedback as skilled developers getting acquainted with Commons in validating or revising these patterns :).

itamar’s picture

I rewrote it using hook_views_default_views_alter as you suggested which indeed makes this patch a lot more elegant.
In the previous version I forgot the patch to the theme, and that's why you saw the filters in the wrong order.

following.png

ezra-g’s picture

Status: Needs review » Reviewed & tested by the community

This worked as expected in my testing. Marking RTBC pending #1969088: Changes to group browsing widget & user status updates.

ezra-g’s picture

Status: Reviewed & tested by the community » Fixed

Automatically closed -- issue fixed for 2 weeks with no activity.