summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xheartbeat.module19
-rw-r--r--includes/heartbeatactivity.inc4
-rw-r--r--includes/heartbeatstream.inc7
-rwxr-xr-xmodules/heartbeat_rules/heartbeat_rules.inc2
-rwxr-xr-xmodules/heartbeat_rules/heartbeat_rules.rules.inc1
5 files changed, 30 insertions, 3 deletions
diff --git a/heartbeat.module b/heartbeat.module
index 8dd72df..e6942e1 100755
--- a/heartbeat.module
+++ b/heartbeat.module
@@ -799,6 +799,7 @@ function heartbeat_api_log($message_id, $uid, $uid_target = 0, $nid = 0, $nid_ta
$data['uid_target'] = $uid_target;
$data['nid'] = $nid;
$data['nid_target'] = $nid_target;
+ $data['cid'] = isset($variables['cid']) ? $variables['cid'] : 0;
$data['access'] = $access;
$data['in_group'] = $in_group;
$data['timestamp'] = $time == 0 ? $_SERVER['REQUEST_TIME'] : $time;
@@ -1599,8 +1600,24 @@ function _heartbeat_map_assoc($options, $field, $value) {
* of the Template or the User setting.
*/
function _heartbeat_activity_get_access($uid, $template) {
+
$templates = heartbeat_user_templates_load($uid);
- $access = isset($templates[$template->message_id]) ? $templates[$template->message_id]->status : (isset($templates['0']) ? $templates['0']->status : $template->perms);
+
+ // If the user has configured access to this type, use it.
+ if (isset($templates[$template->message_id])) {
+ $access = $templates[$template->message_id]->status;
+ }
+ else {
+ // If the user configured general access.
+ if (isset($templates['0'])) {
+ $access = $templates['0']->status;
+ }
+ // Use the general permission for this template.
+ else {
+ $access = $template->perms;
+ }
+ }
+
return $access;
}
diff --git a/includes/heartbeatactivity.inc b/includes/heartbeatactivity.inc
index d0803ae..c4b8e38 100644
--- a/includes/heartbeatactivity.inc
+++ b/includes/heartbeatactivity.inc
@@ -100,6 +100,10 @@ class HeartbeatActivity extends stdClass {
$this->nid_target = $data['nid_target'];
}
+ if (isset($data['cid'])) {
+ $this->cid = $data['cid'];
+ }
+
if (isset($data['in_group'])) {
$this->in_group = $data['in_group'];
}
diff --git a/includes/heartbeatstream.inc b/includes/heartbeatstream.inc
index 705ae26..91a68d1 100644
--- a/includes/heartbeatstream.inc
+++ b/includes/heartbeatstream.inc
@@ -517,6 +517,10 @@ abstract class HeartbeatStream {
$access_expression = "LEAST ( IFNULL ( ha.access, " . HEARTBEAT_PUBLIC_TO_ALL . "), IFNULL ( hut.status, " . HEARTBEAT_PUBLIC_TO_ALL . "))";
$this->query->addExpression($access_expression, 'user_access');
+ // Exclude unpublished comments.
+ $this->query->leftJoin('comment', 'c', 'ha.cid = c.cid');
+ $this->query->where("c.status = 1 OR ha.cid = 0");
+
$db_or = db_or();
foreach ($this->getCurrentLanguages() as $lang_code) {
$db_or->condition('ha.language', $lang_code, "=");
@@ -581,6 +585,7 @@ abstract class HeartbeatStream {
$this->query->condition($or);
}
+ // Exclude denied message templates.
if (!empty($this->templates_denied)) {
$this->query->where("ha.message_id NOT IN (:messages)", array(':messages' => array_unique($this->templates_denied)));
}
@@ -598,7 +603,7 @@ abstract class HeartbeatStream {
*/
protected function executeQuery() {
- // dqm($this->query);
+ // dqm($this->query);
$result = $this->query->execute()->fetchAll();
$messages = array();
diff --git a/modules/heartbeat_rules/heartbeat_rules.inc b/modules/heartbeat_rules/heartbeat_rules.inc
index affdf3a..ba4d61d 100755
--- a/modules/heartbeat_rules/heartbeat_rules.inc
+++ b/modules/heartbeat_rules/heartbeat_rules.inc
@@ -46,7 +46,7 @@ function rules_action_heartbeat_activity_log() {
$variables[$key] = $val;
}
- if (in_array($key, array('nid', 'uid', 'nid_target', 'uid_target'))) {
+ if (in_array($key, array('nid', 'uid', 'nid_target', 'uid_target', 'cid'))) {
$variables[$key] = (int) $variables[$key];
}
}
diff --git a/modules/heartbeat_rules/heartbeat_rules.rules.inc b/modules/heartbeat_rules/heartbeat_rules.rules.inc
index 50ebadd..b50f858 100755
--- a/modules/heartbeat_rules/heartbeat_rules.rules.inc
+++ b/modules/heartbeat_rules/heartbeat_rules.rules.inc
@@ -35,6 +35,7 @@ function heartbeat_rules_rules_action_info() {
'uid' => array('type' => 'text', 'label' => t('User ID')),
'nid_target' => array('type' => 'text', 'label' => t('Entity target ID'), 'optional' => TRUE),
'uid_target' => array('type' => 'text', 'label' => t('User target ID'), 'optional' => TRUE),
+ 'cid' => array('type' => 'text', 'label' => t('Comment ID'), 'optional' => TRUE),
);
$actions = array();