aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2015-02-10 00:11:37 -0800
committerfriendica <info@friendica.com>2015-02-10 00:11:37 -0800
commit81e7b47b76e6cc72995e910190e4164d28ec5664 (patch)
tree5cc764df8547d529bf52c06ac30981332db47b3f /include
parentc69494524590b7ffa07fcab6780c603ded2cb720 (diff)
downloadvolse-hubzilla-81e7b47b76e6cc72995e910190e4164d28ec5664.tar.gz
volse-hubzilla-81e7b47b76e6cc72995e910190e4164d28ec5664.tar.bz2
volse-hubzilla-81e7b47b76e6cc72995e910190e4164d28ec5664.zip
more progress on event confirmations
Diffstat (limited to 'include')
-rw-r--r--include/ItemObject.php9
-rw-r--r--include/conversation.php31
2 files changed, 35 insertions, 5 deletions
diff --git a/include/ItemObject.php b/include/ItemObject.php
index 8f1112f6a..3638b2ffb 100644
--- a/include/ItemObject.php
+++ b/include/ItemObject.php
@@ -134,16 +134,19 @@ class Item extends BaseObject {
$profile_name = $item['author']['xchan_name'];
$location = format_location($item);
-
+ $isevent = false;
+ $attend = null;
// process action responses - e.g. like/dislike/attend/agree/whatever
$response_verbs = array('like');
if(feature_enabled($conv->get_profile_owner(),'dislike'))
$response_verbs[] = 'dislike';
- if($item['resource_type'] === 'event') {
+ if($item['obj_type'] === ACTIVITY_OBJ_EVENT) {
$response_verbs[] = 'attendyes';
$response_verbs[] = 'attendno';
$response_verbs[] = 'attendmaybe';
+ $isevent = true;
+ $attend = array( t('I will attend'), t('I will not attend'), t('I might attend'));
}
$consensus = (($item['item_flags'] & ITEM_CONSENSUS)? true : false);
if($consensus) {
@@ -275,6 +278,8 @@ class Item extends BaseObject {
'body' => $body,
'text' => strip_tags($body),
'id' => $this->get_id(),
+ 'isevent' => $isevent,
+ 'attend' => $attend,
'linktitle' => sprintf( t('View %s\'s profile - %s'), $profile_name, $item['author']['xchan_addr']),
'olinktitle' => sprintf( t('View %s\'s profile - %s'), $this->get_owner_name(), $item['owner']['xchan_addr']),
'llink' => $item['llink'],
diff --git a/include/conversation.php b/include/conversation.php
index 244c812ef..308b56586 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -402,7 +402,7 @@ function visible_activity($item) {
// likes (etc.) can apply to other things besides posts. Check if they are post children,
// in which case we handle them specially
- $hidden_activities = array(ACTIVITY_LIKE, ACTIVITY_DISLIKE, ACTIVITY_AGREE, ACTIVITY_DISAGREE, ACTIVITY_ABSTAIN);
+ $hidden_activities = array(ACTIVITY_LIKE, ACTIVITY_DISLIKE, ACTIVITY_AGREE, ACTIVITY_DISAGREE, ACTIVITY_ABSTAIN, ACTIVITY_ATTEND, ACTIVITY_ATTENDNO, ACTIVITY_ATTENDMAYBE);
foreach($hidden_activities as $act) {
if((activity_match($item['verb'],$act)) && ($item['mid'] != $item['parent_mid'])) {
return false;
@@ -552,7 +552,7 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $
$items = $cb['items'];
- $conv_responses = array(array('like'),array('dislike'),array('agree'),array('disagree'),array('abstain'));
+ $conv_responses = array(array('like'),array('dislike'),array('agree'),array('disagree'),array('abstain'),array('attendyes'),array('attendno'),array('attendmaybe'));
// array with html for each thread (parent+comments)
$threads = array();
@@ -784,10 +784,20 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $
if(feature_enabled($profile_owner, 'dislike'))
like_puller($a, $item, $conv_responses, 'dislike');
+ if($item['obj_type'] === ACTIVITY_OBJ_EVENT) {
+ like_puller($a, $item, $conv_responses, 'attendyes');
+ like_puller($a, $item, $conv_responses, 'attendno');
+ like_puller($a, $item, $conv_responses, 'attendmaybe');
+
+logger('responses: ' . print_r($conv_responses,true));
+
+ }
+
like_puller($a, $item, $conv_responses, 'agree');
like_puller($a, $item, $conv_responses, 'disagree');
like_puller($a, $item, $conv_responses, 'abstain');
+
if(! visible_activity($item)) {
continue;
}
@@ -998,13 +1008,28 @@ function like_puller($a, $item, &$arr, $mode) {
case 'unabstain':
$verb = ACTIVITY_ABSTAIN;
break;
+ case 'attendyes':
+ case 'unattendyes':
+ $verb = ACTIVITY_ATTEND;
+ break;
+ case 'attendno':
+ case 'unattendno':
+ $verb = ACTIVITY_ATTENDNO;
+ break;
+ case 'attendmaybe':
+ case 'unattendmaybe':
+ $verb = ACTIVITY_ATTENDMAYBE;
+ break;
default:
return;
break;
}
+logger('verb: ' . $verb);
+if($verb === ACTIVITY_ATTENDNO)
+ logger('item: ' . $item['verb']);
if((activity_match($item['verb'], $verb)) && ($item['id'] != $item['parent'])) {
-
+logger('match:' . $verb);
if($item['author']['xchan_url'])
$url = chanlink_url($item['author']['xchan_url']);