diff --git a/Code/Lib/Activity.php b/Code/Lib/Activity.php index 81914c44c..d386f4525 100644 --- a/Code/Lib/Activity.php +++ b/Code/Lib/Activity.php @@ -3339,6 +3339,15 @@ class Activity // set_iconfig($s, 'activitypub', 'rawmsg', $act->raw, 0); ObjCache::Set($s['mid'],$act->raw); + + if ($s['verb'] === 'Arrive') { + if ($s['lat'] || $s[['lon']]) { + $s['body'] .= "\n\n" . '[map=' . $s['lat'] . ',' . $s['lon'] . ']' . "\n"; + } + elseif ($s['location']) { + $s['body'] .= "\n\n" . '[map]' . $s['location'] . '[/map]' . "\n"; + } + } // Restrict html caching to ActivityPub senders. // Zot has dynamic content and this library is used by both. diff --git a/Code/Module/Item.php b/Code/Module/Item.php index cecd6ebc6..d4d4ef0c7 100644 --- a/Code/Module/Item.php +++ b/Code/Module/Item.php @@ -973,6 +973,12 @@ class Item extends Controller $str_group_allow = ''; } + if (!strlen($verb)) { + $verb = ACTIVITY_POST; + } + if ($checkin) { + $verb = 'Arrive'; + } if (in_array($mimetype, [ 'text/bbcode', 'text/x-multicode' ])) { // BBCODE alert: the following functions assume bbcode input @@ -1176,6 +1182,18 @@ class Item extends Controller } } + if ($verb === 'Arrive') { + $body = preg_replace('/\[map=(.*?)\]/','', $body); + $body = preg_replace('/\[map\](.*?)\[\/map\]/','', $body); + + if ($lat || $lon) { + $body .= "\n\n" . '[map=' . $lat . ',' . $lon . ']' . "\n"; + } + elseif ($location) { + $body .= "\n\n" . '[map]' . $location . '[/map]' . "\n"; + } + } + // BBCODE end alert $netgroup = false; @@ -1308,12 +1326,7 @@ class Item extends Controller } - if (!strlen($verb)) { - $verb = ACTIVITY_POST; - } - if ($checkin) { - $verb = 'Arrive'; - } + $notify_type = (($parent) ? 'comment-new' : 'wall-new'); diff --git a/include/conversation.php b/include/conversation.php index 06e312d45..983c489fc 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -818,6 +818,16 @@ function thread_author_menu($item, $mode = '') ]; } + if (local_channel() && ($item['lat'] || $item['lon'])) { + $menu[] = [ + 'menu' => 'distance_search', + 'title' => t('Nearby'), + 'icon' => 'fw', + 'action' => '', + 'href' => 'stream?distance=1&distance_from=' . $item['lat'] . ',' . $item['lon'] + ]; + } + if (isset($posts_link) && $posts_link) { $menu[] = [ 'menu' => 'view_posts', @@ -1033,7 +1043,7 @@ function z_status_editor($x, $popup = false) $feature_markup = false; } - $feature_checkin = false; + $feature_checkin = true; $lat = ''; $lon = ''; @@ -1684,6 +1694,9 @@ function sort_thr_distance($a, $b) if (!isset($b['distance'])) { $b['distance'] = 999999999; } + if ($a['distance'] === $b['distance']) { + return strcmp($b['commented'], $a['commented']); + } return floatval($a['distance']) <=> floatval($b['distance']); } diff --git a/view/tpl/jot-header.tpl b/view/tpl/jot-header.tpl index 724e1912a..02f0d5486 100755 --- a/view/tpl/jot-header.tpl +++ b/view/tpl/jot-header.tpl @@ -335,8 +335,14 @@ let activeCommentText = ''; } function jotCheckin() { - let checkinVal = $('#jot-checkin').val(); - $('#jot-checkin').val(1 - checkinVal); + let checkinVal = 1 - $('#jot-checkin').val(); + $('#jot-checkin').val(checkinVal); + if (checkinVal) { + $('#profile-checkin-wrapper').addClass('_orange'); + } + else { + $('#profile-checkin-wrapper').removeClass('_orange'); + } } function jotEmbed(id,post_type) {