Currently there is some code in drupalorg module to hide the file attachments fieldset on basically everything but issues. That makes sense, because we don't allow images, and that would just encourage people to post them.

However, if we do #528682: Allow inline images to be posted to Drupal.org project pages, docs pages, and comments without any special permissions, this would be no longer necessary. So we could either remove this restriction entirely, or at the very least, remove it for book nodes.

CommentFileSizeAuthor
#1 drupalorg-show-attachments.patch579 byteswebchick
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

webchick’s picture

Status: Active » Needs review
FileSize
579 bytes

Here's the conservative approach that just does this for documentation.

sun’s picture

Status: Needs review » Reviewed & tested by the community

I didn't really study the surrounding code, but based no the visible fragment, the change makes sense and seems to be correct.

webchick’s picture

dww asked about the origin of this code, and it came from #379072: Attachments are Disabled on Book Pages. The intent was to limit file uploads to only the docs team, since only the docs team has access to the input format to post images. However, now that this restriction has been lifted, it makes sense to lift it for everyone else.

The patch doesn't have enough context to adequately eyeball, so here's the entire relevant chunk of code:

function drupalorg_form_alter(&$form, $form_state, $form_id) {
 ...
  // List of forms to check for overrides, and the corresponding permissions.
  $override_forms = array(
    'book_node_form' => 'revert revisions',
    'forum_node_form' => 'administer nodes',
    'page_node_form' => 'administer nodes',
    'story_node_form' => 'administer nodes',
  );

  // Override the access for attachments if it's a forbidden form,
  // and the user does not have sufficient permissions.
  if (in_array($form_id, array_keys($override_forms)) && !user_access($override_forms[$form_id])) {
    if (isset($form['attachments']['#access'])) {
      $form['attachments']['#access'] = FALSE;
    }
  }
  ...
}
jthorson’s picture

Couldn't apply the patch on rfay.redesign.devdrupal.org, but that's likely due to it being an old codebase.

Manually made the change, and the file attachment box appeared at /node/add/book, while it wasn't there before the change.

dww’s picture

Status: Reviewed & tested by the community » Fixed

Thanks folks. Committed, pushed, and deployed live.

Status: Fixed » Closed (fixed)

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

  • Commit d443bd5 on 6.x-3.x, 7.x-3.x-dev authored by webchick, committed by dww:
    [#1274938] by webchick: Allow file attachments on book nodes again (#...