Opened 2 years ago
Closed 2 years ago
#3585 closed Enhancement (fixed)
unneeded code in relationship_notification_hook
| Reported by: | bencc | Owned by: | |
|---|---|---|---|
| Priority: | low | Milestone: | Elgg 1.8.0 |
| Component: | Core | Version: | 1.8 Beta |
| Severity: | trivial | Keywords: | |
| Cc: | brett@… | Difficulty: | trivial |
Description
There is no need to check for ElggRelationship, 'create' and 'friend' in the following function because the event handler already takes care of that.
https://github.com/Elgg/Elgg/blob/master/engine/lib/relationships.php#L611
function relationship_notification_hook($event, $object_type, $object) {
global $CONFIG;
if (
($object instanceof ElggRelationship) &&
($event == 'create') &&
($object_type == 'friend')
) {
$user_one = get_entity($object->guid_one);
$user_two = get_entity($object->guid_two);
// Notify target user
return notify_user($object->guid_two, $object->guid_one,
elgg_echo('friend:newfriend:subject', array($user_one->name)),
elgg_echo("friend:newfriend:body", array($user_one->name, $user_one->getURL()))
);
}
}
/** Register event to listen to some events **/
elgg_register_event_handler('create', 'friend', 'relationship_notification_hook');
Change History (2)
comment:1 Changed 2 years ago by cash
- Difficulty set to trivial
- Milestone changed from Needs Review to Elgg 1.8.0
- Priority changed from normal to low
- Severity changed from minor to trivial
- Type changed from Defect to Enhancement
comment:2 Changed 2 years ago by Cash Costello
- Resolution set to fixed
- Status changed from new to closed
Note: See
TracTickets for help on using
tickets.

Fixes #3585 do not need to check parameters because was registered for only one event