Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Changed BlogProfileImage publish from onBeforeWrite to $owns #750

Merged

Conversation

purplespider
Copy link
Contributor

Redo of #749

Description

Due to the order in onBeforeWrite, the BlogProfileImage added in BlogMemberExtension doesn't get automatically published unless you have also changed the member's name (unlikely).

This is because if FirstName or Surname are unchanged, then onBeforeWrite returns, before being able to publish the profile image.

This PR sets it to use $owns to take care of publishing the image instead.

Manual testing steps

  1. Create a new user in Security.
  2. Click Create
  3. Upload a new "Blog profile image" for the user.
  4. Click Save

What I expect to happen: The image gets published.
What actually happens: The image stays as "Draft".

Issues

Pull request checklist

  • The target branch is correct
  • All commits are relevant to the purpose of the PR (e.g. no debug statements, unrelated refactoring, or arbitrary linting)
    • Small amounts of additional linting are usually okay, but if it makes it hard to concentrate on the relevant changes, ask for the unrelated changes to be reverted, and submitted as a separate PR.
  • The commit messages follow our commit message guidelines
  • The PR follows our contribution guidelines
  • Code changes follow our coding conventions
  • This change is covered with tests (or tests aren't necessary for this change)
  • Any relevant User Help/Developer documentation is updated; for impactful changes, information is added to the changelog for the intended release
  • CI is green

Copy link
Member

@GuySartorelli GuySartorelli left a comment

Choose a reason for hiding this comment

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

Great! Thanks for doing this. Just one tiny change.

src/Model/BlogMemberExtension.php Outdated Show resolved Hide resolved
@michalkleiner
Copy link
Contributor

I've updated the commit message to have the type prefix as well (it's a FIX) and for it to be a bit more descriptive.

@michalkleiner michalkleiner merged commit 0315457 into silverstripe:3.12 Mar 20, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants