Problem/Motivation

Currently, project_issue_link_filter_callback checks that the "issue" is published, but that's making an assumption that might not always be desired.

Admin or priviledged users might have permissions to see unpublished nodes and still want the filter to be applied.

We might want to add special markup in the template for these cases too, but right now we don't have the opportunity for it.

Steps to reproduce

As superadmin or user with permissions to see unpublished nodes, type [#1234] where 1234 is an unpublished issue. The text will not be replaced by a link, even if the user has permissions to see it.

Proposed resolution

Allow modules to alter the behaviour if needed.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

fjgarlin created an issue. See original summary.

fjgarlin’s picture

Referenced two issues affected by this behaviour.

fjgarlin’s picture

Issue summary: View changes

fjgarlin’s picture

Assigned: fjgarlin » Unassigned
Status: Active » Needs review
FileSize
13.1 KB
16.91 KB

I used the code in the MR: https://git.drupalcode.org/project/project_issue/-/merge_requests/2

Then, in another module, implemented the hook like this:

/**
 * Implements hook_project_issue_allow_link_render_alter().
 */
function my_module_project_issue_allow_link_render_alter(&$data) {
   $data['allow_link_render'] = TRUE;
}

I logged in as user uid = 1 and unpublished the comment.

  • Before: Before
  • After: After

Note that if no other module alters the data, the behaviour is exactly the same as we have now.

drumm’s picture

We should do this with a separate filter in drupalorg module that we configure to run after the project_issue filter. project_issue leaves [#123] untouched when an issue isn’t matched, so it would be left for us to process. Then we can cleanly disable project_issue module, and keep the [#123] links in documentation and other non-issue content.

fjgarlin’s picture

Status: Needs review » Closed (works as designed)

Cool. In that case, nothing to do here. Thanks for the guidance.