- $parents = Item::select(['id', 'author-link', 'owner-link', 'gravity', 'uri'], ['parent' => $item['parent']]);
- while ($parent = Item::fetch($parents)) {
- if ($parent['gravity'] == GRAVITY_PARENT) {
- $profile = APContact::getByURL($parent['owner-link'], false);
- if (!empty($profile)) {
- if ($item['gravity'] != GRAVITY_PARENT) {
- // Comments to forums are directed to the forum
- // But comments to forums aren't directed to the followers collection
- if ($profile['type'] == 'Group') {
- $data['to'][] = $profile['url'];
+ if (!empty($item['parent'])) {
+ $parents = Item::select(['id', 'author-link', 'owner-link', 'gravity', 'uri'], ['parent' => $item['parent']]);
+ while ($parent = Item::fetch($parents)) {
+ if ($parent['gravity'] == GRAVITY_PARENT) {
+ $profile = APContact::getByURL($parent['owner-link'], false);
+ if (!empty($profile)) {
+ if ($item['gravity'] != GRAVITY_PARENT) {
+ // Comments to forums are directed to the forum
+ // But comments to forums aren't directed to the followers collection
+ if ($profile['type'] == 'Group') {
+ $data['to'][] = $profile['url'];
+ } else {
+ $data['cc'][] = $profile['url'];
+ if (!$item['private']) {
+ $data['cc'][] = $actor_profile['followers'];
+ }
+ }