Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

EZP-31767: Use version contributor name on dashboard #1437

Merged
merged 1 commit into from
Sep 24, 2020
Merged

EZP-31767: Use version contributor name on dashboard #1437

merged 1 commit into from
Sep 24, 2020

Conversation

ITernovtsii
Copy link
Contributor

Question Answer
Tickets EZP-31767
Bug fix? yes
New feature? no
BC breaks? no
Tests pass? yes
Doc needed? no
License GPL-2.0

Currently, on content view page, we have displayed name of user who last edited the content.
Screenshot from 2020-07-22 13-19-47
But creator name displayed as a contributor on the dashboard (In common content block)
Screenshot from 2020-07-22 13-20-36

I would expect to see name of user who last edited the content.

Checklist:

  • Coding standards ($ composer fix-cs)
  • Ready for Code Review

*
* @return \eZ\Publish\API\Repository\Values\User\User|null
*/
protected function getContributor(ContentInfo $contentInfo): ?User
protected function getVersionContributor(VersionInfo $versionInfo): ?User
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if renaming protected function in abstract class is the safest way to do, it should be internal but maybe someone else have opinion on that too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May I create a separate getVersionContributor method, and keep getContributor as is? And, mark getContributor with @deprecated?

$userExists = (new UserExists($this->userService))->isSatisfiedBy($contentInfo->ownerId);

if (false === $userExists) {
try {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason why you did not reuse Specification just with different ID provided?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ViniTou This method called for each row, so this will save us a few userService->loadUser() calls, which will make the dashboard page a bit faster.
IMHO, UserExists->isSatisfiedBy is overcomplicating the simple thing, user service is doing this job quite well already. Probably, it is the reason why it's not used commonly through the code.

Let me know if these few extra calls are not a big deal and I'll change it to use UserExists.
Thanks.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, I didnt notice the last removed call, fine with me then.

@adamwojs adamwojs changed the title EZP-31767 use version contributor name on dashboard EZP-31767: Use version contributor name on dashboard Sep 23, 2020
@adamwojs adamwojs merged commit 523ac22 into ezsystems:2.1 Sep 24, 2020
@adamwojs
Copy link
Member

Thank you for contribution @ITernovtsiy!

# for free to join this conversation on GitHub. Already have an account? # to comment
Development

Successfully merging this pull request may close these issues.

7 participants