Skip to content
This repository was archived by the owner on Jul 27, 2022. It is now read-only.

Commit

Permalink
Merge pull request #1174 from ec-europa/ISAICP-4415
Browse files Browse the repository at this point in the history
Isaicp 4415: Allow moderators to edit the author of community content
  • Loading branch information
idimopoulos authored May 18, 2018
2 parents 49bb825 + b9c77da commit 80486b6
Show file tree
Hide file tree
Showing 8 changed files with 114 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ Feature: Add community content
And I go to the homepage of the "The night shift" collection
And I click "Add <content type>"
Then I should see the heading "Add <content type>"
And the following fields should be present "Authored by"
But I should not see the following lines of text:
| Authored by |
| Authored on |
| Create new revision |
| Generate automatic URL alias |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ content:
region: content
current_workflow_state:
type: current_workflow_state_widget
weight: 7
weight: 8
region: content
settings:
title: 'Current workflow state'
Expand Down Expand Up @@ -68,13 +68,13 @@ content:
type: options_select
region: content
field_replies:
weight: 6
weight: 7
settings: { }
third_party_settings: { }
type: comment_default
region: content
field_state:
weight: 8
weight: 9
settings:
use_transition_label: 1
third_party_settings: { }
Expand All @@ -96,7 +96,21 @@ content:
third_party_settings: { }
region: content
transition_motivation:
weight: 9
weight: 10
region: content
settings: { }
third_party_settings: { }
uid:
type: entity_reference_autocomplete
weight: 6
region: content
settings:
match_operator: CONTAINS
size: 60
placeholder: ''
third_party_settings: { }
url_redirects:
weight: 11
region: content
settings: { }
third_party_settings: { }
Expand All @@ -111,4 +125,3 @@ hidden:
promote: true
status: true
sticky: true
uid: true
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ content:
region: content
current_workflow_state:
type: current_workflow_state_widget
weight: 12
weight: 13
region: content
settings:
title: 'Current workflow state'
title_display: before
show_for_new_entities: false
third_party_settings: { }
field_comments:
weight: 10
weight: 11
settings: { }
third_party_settings: { }
type: comment_default
Expand Down Expand Up @@ -114,7 +114,7 @@ content:
region: content
field_state:
type: state_machine_buttons
weight: 13
weight: 14
settings:
use_transition_label: 1
third_party_settings: { }
Expand All @@ -134,7 +134,21 @@ content:
third_party_settings: { }
region: content
transition_motivation:
weight: 11
weight: 12
region: content
settings: { }
third_party_settings: { }
uid:
type: entity_reference_autocomplete
weight: 10
region: content
settings:
match_operator: CONTAINS
size: 60
placeholder: ''
third_party_settings: { }
url_redirects:
weight: 15
region: content
settings: { }
third_party_settings: { }
Expand All @@ -150,4 +164,3 @@ hidden:
promote: true
status: true
sticky: true
uid: true
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ content:
region: content
current_workflow_state:
type: current_workflow_state_widget
weight: 19
weight: 20
region: content
settings:
title: 'Current workflow state'
Expand All @@ -70,7 +70,7 @@ content:
type: file_generic
region: content
field_comments:
weight: 18
weight: 19
settings: { }
third_party_settings: { }
type: comment_default
Expand Down Expand Up @@ -182,7 +182,7 @@ content:
region: content
field_state:
type: state_machine_buttons
weight: 20
weight: 21
region: content
settings:
use_transition_label: 1
Expand All @@ -200,6 +200,20 @@ content:
region: content
settings: { }
third_party_settings: { }
uid:
type: entity_reference_autocomplete
weight: 18
region: content
settings:
match_operator: CONTAINS
size: 60
placeholder: ''
third_party_settings: { }
url_redirects:
weight: 22
region: content
settings: { }
third_party_settings: { }
hidden:
created: true
field_shared_in: true
Expand All @@ -212,4 +226,3 @@ hidden:
promote: true
status: true
sticky: true
uid: true
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ content:
region: content
current_workflow_state:
type: current_workflow_state_widget
weight: 12
weight: 13
region: content
settings:
title: 'Current workflow state'
Expand Down Expand Up @@ -113,7 +113,7 @@ content:
type: options_select
region: content
field_state:
weight: 13
weight: 14
settings:
use_transition_label: 1
third_party_settings: { }
Expand All @@ -135,8 +135,22 @@ content:
third_party_settings: { }
region: content
transition_motivation:
weight: 12
region: content
settings: { }
third_party_settings: { }
uid:
type: entity_reference_autocomplete
weight: 11
region: content
settings:
match_operator: CONTAINS
size: 60
placeholder: ''
third_party_settings: { }
url_redirects:
weight: 15
region: content
settings: { }
third_party_settings: { }
hidden:
Expand All @@ -150,4 +164,3 @@ hidden:
promote: true
status: true
sticky: true
uid: true
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,26 @@ content:
settings: { }
third_party_settings: { }
region: content
langcode:
type: language_select
weight: 2
region: content
settings:
include_locked: true
third_party_settings: { }
simplenews_issue:
type: options_select
weight: 1
settings: { }
third_party_settings: { }
region: content
status:
type: boolean_checkbox
settings:
display_label: true
weight: 120
region: content
third_party_settings: { }
title:
type: string_textfield
weight: 0
Expand All @@ -55,6 +69,9 @@ content:
placeholder: ''
third_party_settings: { }
region: content
url_redirects:
weight: 50
region: content
hidden:
current_workflow_state: true
og_audience: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ content:
hide_guidelines: '1'
region: content
field_comments:
weight: 5
weight: 6
settings: { }
third_party_settings: { }
type: comment_default
Expand Down Expand Up @@ -60,6 +60,13 @@ content:
third_party_settings: { }
type: entity_reference_autocomplete
region: content
status:
type: boolean_checkbox
settings:
display_label: true
weight: 8
region: content
third_party_settings: { }
title:
type: string_textfield
weight: 0
Expand All @@ -68,6 +75,20 @@ content:
size: 60
placeholder: ''
third_party_settings: { }
uid:
type: entity_reference_autocomplete
weight: 5
region: content
settings:
match_operator: CONTAINS
size: 60
placeholder: ''
third_party_settings: { }
url_redirects:
weight: 7
region: content
settings: { }
third_party_settings: { }
hidden:
created: true
current_workflow_state: true
Expand All @@ -76,4 +97,3 @@ hidden:
path: true
promote: true
sticky: true
uid: true
5 changes: 5 additions & 0 deletions web/profiles/joinup/joinup.profile
Original file line number Diff line number Diff line change
Expand Up @@ -214,12 +214,17 @@ function joinup_inline_entity_form_reference_form_alter(&$reference_form, &$form
* - Disable access to the comment settings. These are managed on collection
* level.
* - Disable access to the meta information.
* - Allow access to the uid field only to the moderators.
*/
function joinup_form_node_form_alter(&$form, FormStateInterface $form_state, $form_id) {
$form['revision_information']['#access'] = FALSE;
$form['revision']['#access'] = FALSE;
$form['meta']['#access'] = FALSE;

if (isset($form['uid'])) {
$form['uid']['#access'] = \Drupal::currentUser()->hasPermission('administer nodes');
}

foreach (['field_comments', 'field_replies'] as $field) {
if (!empty($form[$field])) {
$form[$field]['#access'] = FALSE;
Expand Down

0 comments on commit 80486b6

Please sign in to comment.