+ /**
+ * Check for a direct comment to the starting post of the given user
+ * @param array $item
+ * @param array $contacts Array of contact IDs
+ * @return bool The user had created this thread
+ */
+ private static function checkDirectCommentedThread(array $item, array $contacts)
+ {
+ $condition = ['uri' => $item['thr-parent'], 'uid' => $item['uid'], 'author-id' => $contacts, 'deleted' => false, 'gravity' => GRAVITY_PARENT];
+ return Item::exists($condition);
+ }
+
+ /**
+ * Check if the user had commented in this thread
+ * @param array $item
+ * @param array $contacts Array of contact IDs
+ * @return bool The user had commented in the thread
+ */
+ private static function checkCommentedParticipation(array $item, array $contacts)
+ {
+ $condition = ['parent' => $item['parent'], 'author-id' => $contacts, 'deleted' => false, 'gravity' => GRAVITY_COMMENT];
+ return Item::exists($condition);
+ }
+
+ /**
+ * Check if the user had interacted in this thread (Like, Dislike, ...)
+ * @param array $item
+ * @param array $contacts Array of contact IDs
+ * @return bool The user had interacted in the thread
+ */
+ private static function checkActivityParticipation(array $item, array $contacts)
+ {
+ $condition = ['parent' => $item['parent'], 'author-id' => $contacts, 'deleted' => false, 'gravity' => GRAVITY_ACTIVITY];
+ return Item::exists($condition);