# Bug AGILE-384 - Display the correct activity message when the user doesn't have the permission to see admin only custom field journals.

Project: Stream agile
Status: closed
URL: https://community.openproject.org/work_packages/AGILE-384

## Open points

_No work packages_

## Details

| Attribute | Value |
| --- | --- |
| Date |  |
| Priority | Medium |
| Module |  |
| Target versions | 18.0.0 |
| Observed in versions |  |
| Sprint | Sprint 14 |
| Backlog bucket |  |
| Bug found in version (deprecated) |  |
| Requires doc change | No |
| Accessibility | No |
| Pull preview |  |
| List |  |
| Labels |  |

## People

| Attribute | Value |
| --- | --- |
| Assignee |  |
| Accountable |  |
| Product manager |  |
| Developers | Attila Dombi |
| Designer |  |
| Ordered by |  |
| Signed off by |  |
| Interest by |  |

## Planning

| Attribute | Value |
| --- | --- |
| Relevance |  |

## Costs

| Attribute | Value |
| --- | --- |
| Votes |  |
| Effort (shirt size) |  |
| Work |  |
| Labor costs |  |

## Description

### Steps to reproduce

1.  Create an admin only project custom field and set a value to it.

2.  Login with a non-admin user and navigate to the project activity page.

3.  Enable the "Project details" in the filter section and look for the journal produced in step 1.

### What is the buggy behavior?

  - The message displayed for the member user is `_The changes were retracted._`

### What is the expected behavior?

1.  `_You do not have permission to see this journal activity._`

### Technical details

The [JournalChanges\#get\_custom\_fields\_changes](https://github.com/opf/openproject/blob/a2fb66452d46165e3de4d870860a14673be2a4a3/lib_static/plugins/acts_as_journalized/lib/journal_changes.rb#L104) filters out admin only fields using the [JournalChanges\#filter\_admin\_only\_custom\_fields](https://github.com/opf/openproject/blob/a2fb66452d46165e3de4d870860a14673be2a4a3/lib_static/plugins/acts_as_journalized/lib/journal_changes.rb#L225-L230) if the user doesn't have the permission to see them. This is a problem, because the JournalFormatter does not receive the field to check permission against, and display the correct permission denied message. See [JournalFormatter::Base\#render](https://github.com/opf/openproject/blob/a2fb66452d46165e3de4d870860a14673be2a4a3/lib_static/plugins/acts_as_journalized/lib/journal_formatter/base.rb#L52).

Since all the journals displayed go through the JournalFormatter::Base\#render, the solution is to remove the [filter\_admin\_only\_custom\_fields](https://github.com/opf/openproject/blob/a2fb66452d46165e3de4d870860a14673be2a4a3/lib_static/plugins/acts_as_journalized/lib/journal_changes.rb#L225-L230) method from the JournalChanges, and let all the fields to bubble up to the JournalFormatter and allow it to render the correct permission denied message.
