mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-19 21:35:13 +00:00
location tagging stuff
This commit is contained in:
parent
46e07087dd
commit
457657da13
4 changed files with 50 additions and 9 deletions
|
@ -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.
|
||||
|
||||
|
|
|
@ -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');
|
||||
|
||||
|
|
|
@ -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']);
|
||||
}
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue