diff --git a/Zotlabs/Lib/Libzotdir.php b/Zotlabs/Lib/Libzotdir.php index 0c4ac6e50..30472dee4 100644 --- a/Zotlabs/Lib/Libzotdir.php +++ b/Zotlabs/Lib/Libzotdir.php @@ -111,7 +111,7 @@ class Libzotdir { '$forumsurl' => $forumsurl, '$safemode' => array('safemode', t('Safe Mode'),$safe_mode,'',array(t('No'), t('Yes')),' onchange=\'window.location.href="' . $forumsurl . '&safe="+(this.checked ? 1 : 0)\''), '$pubforums' => array('pubforums', t('Groups Only'),(($pubforums == 1) ? true : false),'',array(t('No'), t('Yes')),' onchange=\'window.location.href="' . $forumsurl . '&type="+(this.checked ? 1 : 0)\''), - '$collections' => array('collections', t('Collections Only'),(($pubforums == 2) ? true : false),'',array(t('No'), t('Yes')),' onchange=\'window.location.href="' . $forumsurl . '&type="+(this.checked ? 2 : 0)\''), +// '$collections' => array('collections', t('Collections Only'),(($pubforums == 2) ? true : false),'',array(t('No'), t('Yes')),' onchange=\'window.location.href="' . $forumsurl . '&type="+(this.checked ? 2 : 0)\''), '$hide_local' => $hide_local, '$globaldir' => array('globaldir', t('This Website Only'), 1-intval($globaldir),'',array(t('No'), t('Yes')),' onchange=\'window.location.href="' . $forumsurl . '&global="+(this.checked ? 0 : 1)\''), '$activedir' => array('activedir', t('Recently Updated'), intval($activedir),'',array(t('No'), t('Yes')),' onchange=\'window.location.href="' . $forumsurl . '&active="+(this.checked ? 1 : 0)\''), diff --git a/Zotlabs/Lib/ThreadItem.php b/Zotlabs/Lib/ThreadItem.php index d549b844c..81b9e2b27 100644 --- a/Zotlabs/Lib/ThreadItem.php +++ b/Zotlabs/Lib/ThreadItem.php @@ -914,6 +914,7 @@ class ThreadItem { '$anonurl' => [ 'anonurl', t('Your website URL (optional)') ], '$auto_save_draft' => $feature_auto_save_draft, '$save' => $permanent_draft, + '$top' => $this->is_toplevel() )); return $comment_box; diff --git a/Zotlabs/Module/Poke.php b/Zotlabs/Module/Poke.php index b3e3de847..90d4f9495 100644 --- a/Zotlabs/Module/Poke.php +++ b/Zotlabs/Module/Poke.php @@ -1,76 +1,53 @@ '; + $allow_gid = EMPTY_STR; + $deny_cid = EMPTY_STR; + $deny_gid = EMPTY_STR; } - elseif($contact_id) { - - $item_private = ((x($_GET,'private')) ? intval($_GET['private']) : 0); - - $allow_cid = (($item_private) ? '<' . $target['abook_xchan']. '>' : $channel['channel_allow_cid']); - $allow_gid = (($item_private) ? '' : $channel['channel_allow_gid']); - $deny_cid = (($item_private) ? '' : $channel['channel_deny_cid']); - $deny_gid = (($item_private) ? '' : $channel['channel_deny_gid']); - } - $arr = []; - - $arr['item_wall'] = 1; - $arr['owner_xchan'] = (($parent_item) ? $parent_item['owner_xchan'] : $channel['channel_hash']); - $arr['parent_mid'] = (($parent_mid) ? $parent_mid : ''); - $arr['title'] = ''; + $arr['owner_xchan'] = $channel['channel_hash']; + $arr['author_xchan'] = $channel['channel_hash']; $arr['allow_cid'] = $allow_cid; $arr['allow_gid'] = $allow_gid; $arr['deny_cid'] = $deny_cid; $arr['deny_gid'] = $deny_gid; - $arr['verb'] = $activity; - $arr['item_private'] = $item_private; - $arr['obj_type'] = ACTIVITY_OBJ_PERSON; + $arr['verb'] = 'Create'; + $arr['item_private'] = 1; + $arr['obj_type'] = 'Note'; $arr['body'] = '[zrl=' . $channel['xchan_url'] . ']' . $channel['xchan_name'] . '[/zrl]' . ' ' . t($verbs[$verb][0]) . ' ' . '[zrl=' . $target['xchan_url'] . ']' . $target['xchan_name'] . '[/zrl]'; - $obj = array( - 'type' => ACTIVITY_OBJ_PERSON, - 'title' => $target['xchan_name'], - 'id' => $target['xchan_hash'], - 'link' => array( - array('rel' => 'alternate', 'type' => 'text/html', 'href' => $target['xchan_url']), - array('rel' => 'photo', 'type' => $target['xchan_photo_mimetype'], 'href' => $target['xchan_photo_l']) - ), - ); - - $arr['obj'] = json_encode($obj); $arr['item_origin'] = 1; $arr['item_wall'] = 1; - $arr['item_unseen'] = 1; - if(! $parent_item) - $item['item_thread_top'] = 1; - - - post_activity_item($arr); - - return; + + $obj = Activity::encode_item($arr,((get_config('system','activitypub', ACTIVITYPUB_ENABLED)) ? true : false)); + + $i = post_activity_item($arr); + + if ($i['success']) { + $item_id = $i['item_id']; + $r = q("select * from item where id = %d", + intval($item_id) + ); + if ($r) { + xchan_query($r); + $sync_item = fetch_post_tags($r); + Libsync::build_sync_packet($uid, [ 'item' => [ encode_item($sync_item[0],true) ] ] ); + } + + info(sprintf( t('You %1$s %2$s'),t($verbs[$verb][0]), $target['xchan_name'])); + } + + json_return_and_die([ 'success' => true ]); } @@ -157,11 +113,8 @@ class Poke extends Controller { } if(! Apps::system_app_installed(local_channel(), 'Poke')) { - //Do not display any associated widgets at this point - App::$pdl = ''; - - $o = 'Poke App (Not Installed):
'; - $o .= t('Poke somebody in your addressbook'); + $o = '' . t('Poke App (Not Installed)') . '
'; + $o .= t('Poke or do something else to somebody'); return $o; } @@ -170,54 +123,28 @@ class Poke extends Controller { $name = ''; $id = ''; - if(intval($_REQUEST['c'])) { - $r = q("select abook_id, xchan_name from abook left join xchan on abook_xchan = xchan_hash - where abook_id = %d and abook_channel = %d limit 1", - intval($_REQUEST['c']), - intval(local_channel()) - ); - if($r) { - $name = $r[0]['xchan_name']; - $id = $r[0]['abook_id']; - } - } - - $parent = ((x($_REQUEST,'parent')) ? intval($_REQUEST['parent']) : '0'); - $verbs = get_poke_verbs(); $shortlist = []; - foreach($verbs as $k => $v) - if($v[1] !== 'NOTRANSLATION') - $shortlist[] = array($k,$v[1]); - - - $poke_basic = get_config('system','poke_basic'); - if($poke_basic) { - $title = t('Poke'); - $desc = t('Poke somebody'); - } - else { - $title = t('Poke/Prod'); - $desc = t('Poke, prod or do other things to somebody'); + $current = get_pconfig(local_channel(),'system','pokeverb','poke'); + foreach($verbs as $k => $v) { + $shortlist[] = [ $k,$v[1], (($k === $current) ? true : false) ]; } + + + $title = t('Poke'); + $desc = t('Poke, prod or do other things to somebody'); $o = replace_macros(get_markup_template('poke_content.tpl'),array( '$title' => $title, - '$poke_basic' => $poke_basic, '$desc' => $desc, '$clabel' => t('Recipient'), - '$choice' => t('Choose what you wish to do to recipient'), + '$choice' => t('Choose your default action'), '$verbs' => $shortlist, - '$parent' => $parent, - '$prv_desc' => t('Make this post private'), - '$private' => array('private', t('Make this post private'), false, ''), '$submit' => t('Submit'), - '$name' => $name, '$id' => $id )); return $o; - } } diff --git a/app/poke.apx b/app/poke.apd similarity index 100% rename from app/poke.apx rename to app/poke.apd diff --git a/include/conversation.php b/include/conversation.php index 97c8ba5f8..2d0d4262c 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -927,8 +927,9 @@ function thread_author_menu($item, $mode = '') { } } + $poke_label = ucfirst( t(get_pconfig($local_channel,'system','pokeverb','poke')) ); + if($contact) { - $poke_link = z_root() . '/poke/?f=&c=' . $contact['abook_id']; if (! (isset($contact['abook_self']) && intval($contact['abook_self']))) { $contact_url = z_root() . '/connedit/' . $contact['abook_id']; } @@ -998,6 +999,16 @@ function thread_author_menu($item, $mode = '') { ]; } + if (Apps::system_app_installed($local_channel,'Poke')) { + $menu[] = [ + 'menu' => 'poke', + 'title' => $poke_label, + 'icon' => 'fw', + 'action' => 'doPoke(\'' . urlencode($item['author_xchan']) . '\'); return false;', + 'href' => '#' + ]; + } + if (local_channel()) { $menu[] = [ 'menu' => 'superblocksite', diff --git a/include/items.php b/include/items.php index 1b8414be8..f01a98ee1 100644 --- a/include/items.php +++ b/include/items.php @@ -465,7 +465,7 @@ function post_activity_item($arr, $allow_code = false, $deliver = true) { $arr['mimetype'] = 'text/bbcode'; } - if (! isset($arr['mid']) && $arr['mid']) { + if (! (isset($arr['mid']) && $arr['mid'])) { $arr['uuid'] = ((isset($arr['uuid'])) ? $arr['uuid'] : new_uuid()); } $arr['mid'] = ((isset($arr['mid'])) ? $arr['mid'] : z_root() . '/item/' . $arr['uuid']); @@ -493,7 +493,6 @@ function post_activity_item($arr, $allow_code = false, $deliver = true) { $arr['plink'] = substr(z_root() . '/channel/' . $channel['channel_address'] . '/?f=&mid=' . urlencode($arr['mid']),0,190); } - // for the benefit of plugins, we will behave as if this is an API call rather than a normal online post $_REQUEST['api_source'] = 1; diff --git a/include/photo_factory.php b/include/photo_factory.php index 474a6d082..2e51a8aad 100644 --- a/include/photo_factory.php +++ b/include/photo_factory.php @@ -389,9 +389,11 @@ function import_remote_xchan_photo($photo, $xchan, $thing = false) { // continue using our cached copy, although we still need to figure out the type // for the benefit of upstream callers that may require it - $info = getimagesize('cache/xp/' . $hash . '-4' . (($thing) ? '.obj' : EMPTY_STR)); - if (isset($info) && is_array($info) && array_key_exists('mime',$info)) { - $type = $info['mime']; + if (file_exists($cached_file)) { + $info = getimagesize($cached_file); + if (isset($info) && is_array($info) && array_key_exists('mime',$info)) { + $type = $info['mime']; + } } $photo = z_root() . '/xp/' . $hash . '-4' . (($thing) ? '.obj' : EMPTY_STR); diff --git a/view/js/main.js b/view/js/main.js index 9bc7f5c11..f23f0acdb 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -261,6 +261,12 @@ function handle_comment_form(e) { } } +function doreply(parent, ident) { + showHideCommentBox(parent); + openClose('wall-item-comment-wrapper-' + ident.toString()); +} + + function commentClose(obj, id) { if(obj.value === '') { obj.value = aStr.comment; @@ -434,6 +440,12 @@ function doFollowAuthor(url) { return true; } +function doPoke(xchan) { + $.get('poke?xchan=' + xchan, function(data) { notificationsUpdate(); }); + return true; +} + + function update_role_text() { var new_role = $("#id_permissions_role").val(); diff --git a/view/theme/redbasic/css/style.css b/view/theme/redbasic/css/style.css index 8966ca224..5b37640ce 100644 --- a/view/theme/redbasic/css/style.css +++ b/view/theme/redbasic/css/style.css @@ -1203,12 +1203,15 @@ img.mail-conv-sender-photo { font-size: 1rem; } - .comment-edit-text { - border: 1px solid #ccc; + border: 1px solid #007bff; border-radius: $radius; } +.comment-edit-text.toplevel { + border: 1px solid #ccc; +} + .divgrow-showmore { display: block; border-top: 1px dashed #ccc; diff --git a/view/tpl/comment_item.tpl b/view/tpl/comment_item.tpl index 683b77d8d..fc10da5c0 100755 --- a/view/tpl/comment_item.tpl +++ b/view/tpl/comment_item.tpl @@ -23,7 +23,7 @@ {{$anon_extras}} {{/if}} - +
{{if $feature_markup}} diff --git a/view/tpl/conv_item.tpl b/view/tpl/conv_item.tpl index e909dd626..da5e98d8e 100755 --- a/view/tpl/conv_item.tpl +++ b/view/tpl/conv_item.tpl @@ -119,7 +119,7 @@ {{/if}} {{if $item.comment && $item.thread_level > 1 && $item.thread_level < $item.thread_max }} - {{/if}} diff --git a/view/tpl/poke_content.tpl b/view/tpl/poke_content.tpl index 36d67c131..3bb693c1a 100755 --- a/view/tpl/poke_content.tpl +++ b/view/tpl/poke_content.tpl @@ -5,44 +5,22 @@
-
{{$desc}}
+
{{$desc}}
+
+
-
-
+
+
+ + +
- - - -
- - -
- - - - - -{{if $poke_basic}} - -{{else}} -
- - -
-{{/if}} - -{{if ! $parent}} -{{include file="field_checkbox.tpl" field=$private}} -{{/if}} - - -
- - -
+ + +