-
Notifications
You must be signed in to change notification settings - Fork 16
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
Acting upon group type creation #187
Conversation
I need help from the bug guns @damiankloip @pfrenssen @chx - How can I inject a service into the group manager service? After I'm creating a new group I want to invoke a module(or should this need to be an event dispatching?) but I can't user the What i'm missing here? |
That is very odd. Did you do a |
@RoySegall what's left here? |
I want to have a second look on this one and extend testing. |
👍 |
@@ -44,6 +45,62 @@ function og_entity_insert(EntityInterface $entity) { | |||
} | |||
|
|||
/** | |||
* Implements hook_og_group_created(). | |||
*/ | |||
function og_og_group_created($entity_type, $bundle) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add some documentation on why this hook is implemented and what is being done here? That will be helpful for people that are not familiar with this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, sure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we implement our own hook? Wouldn't it be better to handle this in GroupManager::addGroup()
? This just adds unnecessary overhead of passing the data to a new function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seem to me much more easy to pass this logic into a hook rather keep the code in the group manager. I'll try something.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But I still keeping the hook invocation.
* | ||
* @see og_og_group_created() | ||
*/ | ||
function hook_og_group_created($entity_type, $bundle) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pfrenssen ^^
What do yo think?
@amitaibu I'm waiting for a couple of comments from our comrades but this is ready for review. |
@@ -459,6 +470,12 @@ protected function refreshGroupRelationMap() { | |||
|
|||
foreach ($this->entityTypeBundleInfo->getAllBundleInfo() as $group_content_entity_type_id => $bundles) { | |||
foreach ($bundles as $group_content_bundle_id => $bundle_info) { | |||
|
|||
if ($group_content_bundle_id == 'user') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we've seen we might have multiple user bundles, so probably this needs a better check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like a good idea, as in Og8 we indeed no longer treat a user as group content. A user is a special case.
/cc @pfrenssen
I've added a few comments, but in general looks good. Thanks. |
A re roll is needed and improving the test. |
@amitaibu I added another bundle for the user for testing. Ready for review. |
@amitaibu I fixed another conflicts issues. Ready for review and merge. |
* The created group. | ||
*/ | ||
public function createUserGroupAudienceField(GroupCreationEventInterface $event) | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move to line above.
* Mocked method calls when system under test should attach OG audience field | ||
* on the user. | ||
*/ | ||
protected function expectGroupCreation() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this needs its own method. You can move the code back to above method.
Minor comment, after that I'll merge. |
@amitaibu I changed the location. |
Thanks. |
#174