From e327b8cb9aa7c31975ba26f8d7bc871b4da59df9 Mon Sep 17 00:00:00 2001 From: Andrew Manning Date: Fri, 24 Nov 2017 13:50:29 -0500 Subject: Provide system config option for minimum registration age. --- Zotlabs/Module/Register.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Zotlabs/Module/Register.php b/Zotlabs/Module/Register.php index 95e3ca96f..deaee31bf 100644 --- a/Zotlabs/Module/Register.php +++ b/Zotlabs/Module/Register.php @@ -234,7 +234,11 @@ class Register extends \Zotlabs\Web\Controller { if(get_config('system','no_age_restriction')) $label_tos = sprintf( t('I accept the %s for this website'), $toslink); else - $label_tos = sprintf( t('I am over 13 years of age and accept the %s for this website'), $toslink); + $age = get_config('system','minimum_age'); + if(!$age) { + $age = 13; + } + $label_tos = sprintf( t('I am over %s years of age and accept the %s for this website'), $age, $toslink); $enable_tos = 1 - intval(get_config('system','no_termsofservice')); -- cgit v1.2.3 From ee929752e345f4d2fb02503fd589f9ad834a745c Mon Sep 17 00:00:00 2001 From: Klaus Weidenbach Date: Fri, 24 Nov 2017 23:38:41 +0100 Subject: :construction_worker:Improve Travis, add PHP7.2. Improve Travis CI configuration a bit and add PHP7.2 to the test matrix. Add PHPUnit Testdox output and optionally deploy test results on release tags. Add a configuration file for infection (Mutation Testing Framework). --- .travis.yml | 24 +++++++++++++++++++----- tests/infection.json.dist | 15 +++++++++++++++ tests/phpunit-mariadb.xml | 1 - tests/phpunit-mysql.xml | 37 ------------------------------------- tests/phpunit-pgsql.xml | 1 + tests/phpunit.xml.dist | 38 ++++++++++++++++++++++++++++++++++++++ 6 files changed, 73 insertions(+), 43 deletions(-) create mode 100644 tests/infection.json.dist delete mode 120000 tests/phpunit-mariadb.xml delete mode 100644 tests/phpunit-mysql.xml create mode 100644 tests/phpunit.xml.dist diff --git a/.travis.yml b/.travis.yml index 41b480cf9..94c7b4226 100644 --- a/.travis.yml +++ b/.travis.yml @@ -39,6 +39,7 @@ addons: php: - '7.0' - '7.1' + - '7.2' # HHVM does not fulfil PHPUnit platform requirements as being compatible with PHP7 yet #- 'hhvm' @@ -69,7 +70,7 @@ matrix: mariadb: '10.1' # PHP7.1, PostgreSQL 9.6 - php: '7.1' - env: DB=pgsql POSTGRESQL_VERSION=9.6 + env: DB=pgsql POSTGRESQL_VERSION=9.6 PHPUNITFILE=phpunit-pgsql.xml # Use newer postgres than 9.2 default addons: postgresql: '9.6' @@ -125,15 +126,19 @@ before_script: - if [[ "$DB" == "pgsql" ]]; then ./tests/travis/prepare_pgsql.sh; fi # omitting "script:" will default to phpunit -script: ./vendor/bin/phpunit $PHPUCOV -c tests/phpunit-$DB.xml +script: + - ./vendor/bin/phpunit $PHPUCOV -c tests/$PHPUNITFILE after_success: - # Generate API documentation and deploy it to gh-pages + - cat tests/results/testdox.txt + # Generate API documentation and prepare for deployment - ./tests/travis/gen_apidocs.sh -#after_failure: +after_failure: + - cat tests/results/testdox.txt # Deploying release and API documentation to GitHub -#before_deploy: +before_deploy: + - if [[ "$CODECOV" == "1" ]]; then zip -9 -r -q tests/hubzilla-testresults.zip tests/results; fi deploy: - provider: pages skip_cleanup: true @@ -152,6 +157,15 @@ deploy: repo: redmatrix/hubzilla tags: true condition: '(-n "$GH_TOKEN") && ("$TRAVIS_JOB_NUMBER" == "${TRAVIS_BUILD_NUMBER}.1")' + # add code coverage and test results to release + - provider: releases + skip_cleanup: true + api_key: $GH_TOKEN + file: 'tests/hubzilla-testresults.zip' + on: + repo: redmatrix/hubzilla + tags: true + condition: '(-n "$GH_TOKEN") && ("$CODECOV" == "1")' #after_deploy: #after_script: diff --git a/tests/infection.json.dist b/tests/infection.json.dist new file mode 100644 index 000000000..36b251982 --- /dev/null +++ b/tests/infection.json.dist @@ -0,0 +1,15 @@ +{ + "timeout": 13, + "source": { + "directories": [ + "include", + "Zotlabs" + ] + }, + "logs": { + "text": "tests/results/infection-log.txt" + }, + "phpUnit": { + "configDir": "tests" + } +} diff --git a/tests/phpunit-mariadb.xml b/tests/phpunit-mariadb.xml deleted file mode 120000 index 63656b78b..000000000 --- a/tests/phpunit-mariadb.xml +++ /dev/null @@ -1 +0,0 @@ -phpunit-mysql.xml \ No newline at end of file diff --git a/tests/phpunit-mysql.xml b/tests/phpunit-mysql.xml deleted file mode 100644 index 171211094..000000000 --- a/tests/phpunit-mysql.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - ./unit/ - - - ./unit/ - - - ./unit/eximport/ - - - - postgresql - - - - - - ../Zotlabs/ - ../include/ - - - - - - - - diff --git a/tests/phpunit-pgsql.xml b/tests/phpunit-pgsql.xml index ace14e196..ec4a6fc2d 100644 --- a/tests/phpunit-pgsql.xml +++ b/tests/phpunit-pgsql.xml @@ -30,5 +30,6 @@ + diff --git a/tests/phpunit.xml.dist b/tests/phpunit.xml.dist new file mode 100644 index 000000000..a22317b08 --- /dev/null +++ b/tests/phpunit.xml.dist @@ -0,0 +1,38 @@ + + + + ./unit/ + + + ./unit/ + + + + + + + postgresql + + + + + + ../Zotlabs/ + ../include/ + + + + + + + + + -- cgit v1.2.3 From 063654373d4dd560c8cc4f5ca9b9e74fc06332fd Mon Sep 17 00:00:00 2001 From: Klaus Weidenbach Date: Sat, 25 Nov 2017 19:01:53 +0100 Subject: Fix a PHP error in a unit test for PHP7.2. --- tests/unit/AutonameTest.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/unit/AutonameTest.php b/tests/unit/AutonameTest.php index 9f92f736f..33e237bb9 100644 --- a/tests/unit/AutonameTest.php +++ b/tests/unit/AutonameTest.php @@ -57,7 +57,7 @@ class AutonameTest extends TestCase { // public function testAutonameMaxLength() { // $autoname2=autoname(PHP_INT_MAX); - // $this->assertEquals(PHP_INT_MAX, count($autoname2)); + // $this->assertEquals(PHP_INT_MAX, strlen($autoname2)); // } /** @@ -65,14 +65,14 @@ class AutonameTest extends TestCase { */ public function testAutonameLength1() { $autoname1=autoname(1); - $this->assertEquals(1, count($autoname1)); + $this->assertEquals(1, strlen($autoname1)); $autoname2=autoname(1); - $this->assertEquals(1, count($autoname2)); + $this->assertEquals(1, strlen($autoname2)); // The following test is problematic, with only 26 possibilities // generating the same thing twice happens often aka // birthday paradox // $this->assertFalse($autoname1==$autoname2); } -} \ No newline at end of file +} -- cgit v1.2.3 From 0e91810ed6764fbbee54e918711bfb45a1d9fd72 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Sun, 26 Nov 2017 18:29:24 -0800 Subject: pubstream comments and a few other bugfixes that were discovered along the way --- Zotlabs/Daemon/Notifier.php | 6 ++-- Zotlabs/Lib/ThreadStream.php | 8 +++++ Zotlabs/Module/Item.php | 23 +++++++----- Zotlabs/Module/Like.php | 17 ++++++--- Zotlabs/Module/Pubstream.php | 15 ++++---- Zotlabs/Module/React.php | 25 ++++++++++--- Zotlabs/Module/Subthread.php | 32 ++++++++++++++--- Zotlabs/Module/Tagger.php | 30 +++++++++++++--- Zotlabs/Module/Update_pubstream.php | 18 +--------- include/conversation.php | 4 +-- include/feedutils.php | 31 ++++++++++++---- include/items.php | 72 ++++++++++++++++++++++++++++--------- 12 files changed, 204 insertions(+), 77 deletions(-) diff --git a/Zotlabs/Daemon/Notifier.php b/Zotlabs/Daemon/Notifier.php index 3f07d4ce0..ca6a7c08a 100644 --- a/Zotlabs/Daemon/Notifier.php +++ b/Zotlabs/Daemon/Notifier.php @@ -309,7 +309,7 @@ class Notifier { if($s) $channel = $s[0]; - if($channel['channel_hash'] !== $target_item['author_xchan'] && $channel['channel_hash'] !== $target_item['owner_xchan'] && ( ! intval($channel['channel_system']))) { + if($channel['channel_hash'] !== $target_item['author_xchan'] && $channel['channel_hash'] !== $target_item['owner_xchan']) { logger("notifier: Sending channel {$channel['channel_hash']} is not owner {$target_item['owner_xchan']} or author {$target_item['author_xchan']}", LOGGER_NORMAL, LOG_WARNING); return; } @@ -426,8 +426,10 @@ class Notifier { logger('notifier: encoded item: ' . print_r($x,true), LOGGER_DATA, LOG_DEBUG); stringify_array_elms($recipients); - if(! $recipients) + if(! $recipients) { + logger('no recipients'); return; + } // logger('notifier: recipients: ' . print_r($recipients,true), LOGGER_NORMAL, LOG_DEBUG); diff --git a/Zotlabs/Lib/ThreadStream.php b/Zotlabs/Lib/ThreadStream.php index bdd2e9657..d0c964149 100644 --- a/Zotlabs/Lib/ThreadStream.php +++ b/Zotlabs/Lib/ThreadStream.php @@ -54,6 +54,10 @@ class ThreadStream { $this->profile_owner = local_channel(); $this->writable = true; break; + case 'pubstream': + $this->profile_owner = local_channel(); + $this->writable = ((local_channel()) ? true : false); + break; case 'hq': $this->profile_owner = local_channel(); $this->writable = true; @@ -188,6 +192,10 @@ class ThreadStream { $item->set_commentable(can_comment_on_post($ob_hash,$item->data)); } } + if($this->mode === 'pubstream' && (! local_channel())) { + $item->set_commentable(false); + } + require_once('include/channel.php'); $item->set_conversation($this); diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php index ecbefa1c2..2528645f3 100644 --- a/Zotlabs/Module/Item.php +++ b/Zotlabs/Module/Item.php @@ -59,6 +59,7 @@ class Item extends \Zotlabs\Web\Controller { $profile_uid = ((x($_REQUEST,'profile_uid')) ? intval($_REQUEST['profile_uid']) : 0); require_once('include/channel.php'); + $sys = get_sys_channel(); if($sys && $profile_uid && ($sys['channel_id'] == $profile_uid) && is_site_admin()) { $uid = intval($sys['channel_id']); @@ -171,7 +172,7 @@ class Item extends \Zotlabs\Web\Controller { ); } // if this isn't the real parent of the conversation, find it - if($r !== false && count($r)) { + if($r) { $parid = $r[0]['parent']; $parent_mid = $r[0]['mid']; if($r[0]['id'] != $r[0]['parent']) { @@ -179,9 +180,16 @@ class Item extends \Zotlabs\Web\Controller { intval($parid) ); } + + // if interacting with a pubstream item, + // create a copy of the parent in your stream + + if($r[0]['uid'] === $sys['channel_id'] && local_channel()) { + $r = [ copy_of_pubitem(\App::get_channel(), $r[0]['mid']) ]; + } } - - if(($r === false) || (! count($r))) { + + if(! $r) { notice( t('Unable to locate original post.') . EOL); if($api_source) return ( [ 'success' => false, 'message' => 'invalid post id' ] ); @@ -189,15 +197,12 @@ class Item extends \Zotlabs\Web\Controller { goaway(z_root() . "/" . $return_path ); killme(); } - - // can_comment_on_post() needs info from the following xchan_query - // This may be from the discover tab which means we need to correct the effective uid - xchan_query($r,true,(($r[0]['uid'] == local_channel()) ? 0 : local_channel())); - + xchan_query($r,true); + $parent_item = $r[0]; $parent = $r[0]['id']; - + // multi-level threading - preserve the info but re-parent to our single level threading $thr_parent = $parent_mid; diff --git a/Zotlabs/Module/Like.php b/Zotlabs/Module/Like.php index 0abf111e0..16580e60f 100644 --- a/Zotlabs/Module/Like.php +++ b/Zotlabs/Module/Like.php @@ -258,20 +258,27 @@ class Like extends \Zotlabs\Web\Controller { // get the item. Allow linked photos (which are normally hidden) to be liked $r = q("SELECT * FROM item WHERE id = %d - and (item_type = 0 or item_type = 6) and item_deleted = 0 and item_unpublished = 0 + and (item_type in (0,6,7) and item_deleted = 0 and item_unpublished = 0 and item_delayed = 0 and item_pending_remove = 0 and item_blocked = 0 LIMIT 1", intval($item_id) ); + // if interacting with a pubstream item, + // create a copy of the parent in your stream. If not the conversation + // parent, copy that as well. + + if($r) { + if($r[0]['uid'] === $sys_channel['channel_id'] && local_channel()) { + $r = [ copy_of_pubitem(\App::get_channel(), $r[0]['mid']) ]; + } + } + if(! $item_id || (! $r)) { logger('like: no item ' . $item_id); killme(); } - // Use the $effective_uid option of xchan_query to sort out comment permission - // for public stream items - - xchan_query($r,true,(($r[0]['uid'] == $sys_channel_id) ? local_channel() : 0)); + xchan_query($r,true); $item = $r[0]; diff --git a/Zotlabs/Module/Pubstream.php b/Zotlabs/Module/Pubstream.php index 0e6c2360f..c469a0eca 100644 --- a/Zotlabs/Module/Pubstream.php +++ b/Zotlabs/Module/Pubstream.php @@ -162,18 +162,16 @@ class Pubstream extends \Zotlabs\Web\Controller { $net_query2 = (($net) ? " and xchan_network = '" . protect_sprintf(dbesc($net)) . "' " : ''); - $simple_update = (($update) ? " and item.item_unseen = 1 " : ''); + $simple_update = (($_SESSION['loadtime']) ? " AND item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' " : ''); - if($update && $_SESSION['loadtime']) - $simple_update = " AND (( item_unseen = 1 AND item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) OR item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) "; if($load) $simple_update = ''; if($static && $simple_update) - $simple_update .= " and item_thread_top = 0 and author_xchan = '" . protect_sprintf(get_observer_hash()) . "' "; + $simple_update .= " and author_xchan = '" . protect_sprintf(get_observer_hash()) . "' "; //logger('update: ' . $update . ' load: ' . $load); - + if($update) { $ordering = "commented"; @@ -214,17 +212,18 @@ class Pubstream extends \Zotlabs\Web\Controller { ); } else { - $r = q("SELECT distinct item.id AS item_id, $ordering FROM item + $r = q("SELECT distinct parent AS item_id, $ordering FROM item left join abook on item.author_xchan = abook.abook_xchan $net_query WHERE true $uids $item_normal_update - AND item.parent = item.id $simple_update + $simple_update and (abook.abook_blocked = 0 or abook.abook_flags is null) $sql_extra3 $sql_extra $sql_nets $net_query2" ); } $_SESSION['loadtime'] = datetime_convert(); } + // Then fetch all the children of the parents that are on this page $parents_str = ''; $update_unseen = ''; @@ -254,7 +253,7 @@ class Pubstream extends \Zotlabs\Web\Controller { } // fake it - $mode = ('network'); + $mode = ('pubstream'); $o .= conversation($items,$mode,$update,$page_mode); diff --git a/Zotlabs/Module/React.php b/Zotlabs/Module/React.php index 6cd79c952..6473317c7 100644 --- a/Zotlabs/Module/React.php +++ b/Zotlabs/Module/React.php @@ -6,15 +6,21 @@ namespace Zotlabs\Module; class React extends \Zotlabs\Web\Controller { function get() { + if(! local_channel()) return; + $sys = get_sys_channel(); + $channel = \App::get_channel(); + $postid = $_REQUEST['postid']; if(! $postid) return; $emoji = $_REQUEST['emoji']; + + if($_REQUEST['emoji']) { $i = q("select * from item where id = %d and uid = %d", @@ -22,10 +28,22 @@ class React extends \Zotlabs\Web\Controller { intval(local_channel()) ); - if(! $i) + if(! $i) { + $i = q("select * from item where id = %d and uid = %d", + intval($postid), + intval($sys['channel_id']) + ); + + if($i) { + $i = [ copy_of_pubitem($channel, $i[0]['mid']) ]; + $postid = (($i) ? $i[0]['id'] : 0); + } + } + + if(! $i) { return; + } - $channel = \App::get_channel(); $n = array(); $n['aid'] = $channel['channel_account_id']; @@ -40,8 +58,7 @@ class React extends \Zotlabs\Web\Controller { $x = item_store($n); - if(local_channel()) - retain_item($postid); + retain_item($postid); if($x['success']) { $nid = $x['item_id']; diff --git a/Zotlabs/Module/Subthread.php b/Zotlabs/Module/Subthread.php index dae8bf020..1a9caff6c 100644 --- a/Zotlabs/Module/Subthread.php +++ b/Zotlabs/Module/Subthread.php @@ -11,10 +11,13 @@ class Subthread extends \Zotlabs\Web\Controller { function get() { - if((! local_channel()) && (! remote_channel())) { + if(! local_channel()) { return; } + $sys = get_sys_channel(); + $channel = \App::get_channel(); + $item_id = ((argc() > 2) ? notags(trim(argv(2))) : 0); if(argv(1) === 'sub') @@ -23,10 +26,31 @@ class Subthread extends \Zotlabs\Web\Controller { $activity = ACTIVITY_UNFOLLOW; - $r = q("SELECT parent FROM item WHERE id = '%s'", - dbesc($item_id) + $i = q("select * from item where id = %d and uid = %d", + intval($item_id), + intval(local_channel()) ); - + + if(! $i) { + $i = q("select * from item where id = %d and uid = %d", + intval($postid), + intval($sys['channel_id']) + ); + + if($i) { + $i = [ copy_of_pubitem($channel, $i[0]['mid']) ]; + $item_id = (($i) ? $i[0]['id'] : 0); + } + } + + if(! $i) { + return; + } + + $r = q("SELECT parent FROM item WHERE id = %d", + intval($item_id) + ); + if($r) { $r = q("select * from item where id = parent and id = %d limit 1", dbesc($r[0]['parent']) diff --git a/Zotlabs/Module/Tagger.php b/Zotlabs/Module/Tagger.php index 98e901965..603a95f2b 100644 --- a/Zotlabs/Module/Tagger.php +++ b/Zotlabs/Module/Tagger.php @@ -11,10 +11,12 @@ class Tagger extends \Zotlabs\Web\Controller { function get() { - if(! local_channel() && ! remote_channel()) { + if(! local_channel()) { return; } + $sys = get_sys_channel(); + $observer_hash = get_observer_hash(); //strip html-tags $term = notags(trim($_GET['term'])); @@ -26,9 +28,29 @@ class Tagger extends \Zotlabs\Web\Controller { logger('tagger: tag ' . $term . ' item ' . $item_id); - - $r = q("SELECT * FROM item left join xchan on xchan_hash = author_xchan WHERE id = '%s' and uid = %d LIMIT 1", - dbesc($item_id), + $r = q("select * from item where id = %d and uid = %d limit 1", + intval($item_id), + intval(local_channel()) + ); + + if(! $r) { + $r = q("select * from item where id = %d and uid = %d limit 1", + intval($item_id), + intval($sys['channel_id']) + ); + if($r) { + $r = [ copy_of_pubitem($channel, $i[0]['mid']) ]; + $item_id = (($r) ? $r[0]['id'] : 0); + } + } + + if(! $r) { + notice( t('Post not found.') . EOL); + return; + } + + $r = q("SELECT * FROM item left join xchan on xchan_hash = author_xchan WHERE id = %d and uid = %d LIMIT 1", + intval($item_id), intval(local_channel()) ); diff --git a/Zotlabs/Module/Update_pubstream.php b/Zotlabs/Module/Update_pubstream.php index 952b48df3..8bb5ebfe7 100644 --- a/Zotlabs/Module/Update_pubstream.php +++ b/Zotlabs/Module/Update_pubstream.php @@ -17,23 +17,7 @@ class Update_pubstream extends \Zotlabs\Web\Controller { $mod = new Pubstream(); $text = $mod->get($profile_uid, $load); - $pattern = "/]*) src=\"([^\"]*)\"/"; - $replace = "'; - $pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i"; - $text = preg_replace($pattern, $replace, $text); - $pattern = "/<\s*video[^>]*>(.*?)<\s*\/\s*video>/i"; - $text = preg_replace($pattern, $replace, $text); - $pattern = "/<\s*embed[^>]*>(.*?)<\s*\/\s*embed>/i"; - $text = preg_replace($pattern, $replace, $text); - $pattern = "/<\s*iframe[^>]*>(.*?)<\s*\/\s*iframe>/i"; - $text = preg_replace($pattern, $replace, $text); - } - */ - echo str_replace("\t",' ',$text); + echo str_replace("\t",' ',$text); echo ((array_key_exists('msie',$_GET) && $_GET['msie'] == 1) ? '' : ''); echo "\r\n"; killme(); diff --git a/include/conversation.php b/include/conversation.php index 70a38ee8e..841a00d85 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -482,10 +482,10 @@ function conversation($items, $mode, $update, $page_mode = 'traditional', $prepa $previewing = (($preview) ? ' preview ' : ''); $preview_lbl = t('This is an unsaved preview'); - if ($mode === 'network') { + if (in_array($mode, [ 'network', 'pubstream'])) { $profile_owner = local_channel(); - $page_writeable = true; + $page_writeable = ((local_channel()) ? true : false); if (!$update) { // The special div is needed for liveUpdate to kick in for this page. diff --git a/include/feedutils.php b/include/feedutils.php index 50f76b550..8f2c5d988 100644 --- a/include/feedutils.php +++ b/include/feedutils.php @@ -65,15 +65,34 @@ function get_feed_for($channel, $observer_hash, $params) { if(! $channel) http_status_exit(401); + + // logger('params: ' . print_r($params,true)); + + + $interactive = ((is_array($params) && array_key_exists('interactive',$params)) ? intval($params['interactive']) : 0); + + if($params['pages']) { - if(! perm_is_allowed($channel['channel_id'],$observer_hash,'view_pages')) - http_status_exit(403); - } else { - if(! perm_is_allowed($channel['channel_id'],$observer_hash,'view_stream')) - http_status_exit(403); + if(! perm_is_allowed($channel['channel_id'],$observer_hash,'view_pages')) { + if($interactive) { + return ''; + } + else { + http_status_exit(403); + } + } + } + else { + if(! perm_is_allowed($channel['channel_id'],$observer_hash,'view_stream')) { + if($interactive) { + return ''; + } + else { + http_status_exit(403); + } + } } - // logger('params: ' . print_r($params,true)); $feed_template = get_markup_template('atom_feed.tpl'); diff --git a/include/items.php b/include/items.php index 042deed1b..baf11ac69 100755 --- a/include/items.php +++ b/include/items.php @@ -1749,22 +1749,6 @@ function item_store($arr, $allow_exec = false, $deliver = true) { intval($arr['uid']) ); - // perhaps the system channel owns the post and it's a pubstream item - - if(! $r) { - $s = q("select channel_id from channel where channel_system = 1 limit 1"); - if($s) { - $r = q("SELECT * FROM item WHERE mid = '%s' AND uid = %d ORDER BY id ASC LIMIT 1", - dbesc($arr['parent_mid']), - intval($s[0]['channel_id']) - ); - } - if($r) { - $arr['uid'] = $r[0]['uid']; - $arr['aid'] = 0; - } - } - if($r) { // in case item_store was killed before the parent's parent attribute got set, @@ -4725,3 +4709,59 @@ function item_create_edit_activity($post) { \Zotlabs\Daemon\Master::Summon(array('Notifier', 'edit_activity', $post_id)); } + +/** + * @brief copies an entire conversation from the pubstream to this channel's stream + * which will allow you to interact with it. + */ + + + +function copy_of_pubitem($channel,$mid) { + + $result = null; + $syschan = get_sys_channel(); + + // logger('copy_of_pubitem: ' . $channel['channel_id'] . ' mid: ' . $mid); + + $r = q("select * from item where mid = '%s' and uid = %d limit 1", + dbesc($mid), + intval($channel['channel_id']) + ); + + if($r) { + logger('exists'); + $item = fetch_post_tags($r,true); + return $item[0]; + } + + + $r = q("select * from item where parent_mid = (select parent_mid from item where mid = '%s' and uid = %d ) order by id ", + dbesc($mid), + intval($syschan['channel_id']) + ); + + if($r) { + $items = fetch_post_tags($r,true); + foreach($items as $rv) { + $d = q("select id from item where mid = '%s' and uid = %d limit 1", + dbesc($rv['mid']), + intval($channel['channel_id']) + ); + if($d) { + continue; + } + + unset($rv['id']); + unset($rv['parent']); + $rv['aid'] = $channel['channel_account_id']; + $rv['uid'] = $channel['channel_id']; + $x = item_store($rv); + if($x['item_id'] && $x['item']['mid'] === $mid) { + $result = $x['item']; + } + + } + } + return $result; +} -- cgit v1.2.3 From 1ad1b745128b7c5d7a90a825077c08f5c951c604 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Mon, 27 Nov 2017 10:07:45 +0100 Subject: fix mod like after recent changes --- Zotlabs/Module/Like.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Zotlabs/Module/Like.php b/Zotlabs/Module/Like.php index 16580e60f..b07824363 100644 --- a/Zotlabs/Module/Like.php +++ b/Zotlabs/Module/Like.php @@ -258,7 +258,7 @@ class Like extends \Zotlabs\Web\Controller { // get the item. Allow linked photos (which are normally hidden) to be liked $r = q("SELECT * FROM item WHERE id = %d - and (item_type in (0,6,7) and item_deleted = 0 and item_unpublished = 0 + and item_type in (0,6,7) and item_deleted = 0 and item_unpublished = 0 and item_delayed = 0 and item_pending_remove = 0 and item_blocked = 0 LIMIT 1", intval($item_id) ); -- cgit v1.2.3 From dc53573975361075c62cd7f9721bac2e8eff8ea8 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Mon, 27 Nov 2017 02:47:57 -0800 Subject: unset item_wall and item_origin on pubstream to channel copy --- include/items.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/items.php b/include/items.php index baf11ac69..e4727e19e 100755 --- a/include/items.php +++ b/include/items.php @@ -4756,6 +4756,9 @@ function copy_of_pubitem($channel,$mid) { unset($rv['parent']); $rv['aid'] = $channel['channel_account_id']; $rv['uid'] = $channel['channel_id']; + $rv['item_wall'] = 0; + $rv['item_origin'] = 0; + $x = item_store($rv); if($x['item_id'] && $x['item']['mid'] === $mid) { $result = $x['item']; -- cgit v1.2.3 From 56772e4807de635b6cc127f0d2a22f7877cf77ff Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Mon, 27 Nov 2017 12:59:14 +0100 Subject: do not stop click propagation --- view/tpl/notifications_widget.tpl | 1 - 1 file changed, 1 deletion(-) diff --git a/view/tpl/notifications_widget.tpl b/view/tpl/notifications_widget.tpl index eeb2011cd..e8d51caca 100644 --- a/view/tpl/notifications_widget.tpl +++ b/view/tpl/notifications_widget.tpl @@ -41,7 +41,6 @@ if(path === 'display' && b64mid) { {{/if}} e.preventDefault(); - e.stopPropagation(); if(! page_load) { $(this).fadeOut(); -- cgit v1.2.3 From 70924589458259f04e27899440b30ac148501bd7 Mon Sep 17 00:00:00 2001 From: albigro Date: Mon, 27 Nov 2017 13:25:23 +0100 Subject: Update dark.css --- view/theme/redbasic/schema/dark.css | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/view/theme/redbasic/schema/dark.css b/view/theme/redbasic/schema/dark.css index a921f42af..0a142a07f 100644 --- a/view/theme/redbasic/schema/dark.css +++ b/view/theme/redbasic/schema/dark.css @@ -140,7 +140,7 @@ option { } .nav-link.active { - color:#000 !important; + color:#fff !important; } a.btn, aside a { @@ -305,6 +305,13 @@ a, a:visited, a:link, .fakelink, .fakelink:visited, .fakelink:link { background-color: #222; } +.text-dark { + color: #aaa !important; +} +a.text-dark:focus, a.text-dark:hover { + color: #ddd !important; +} + .group-selected, .fileas-selected, .categories-selected, .search-selected, a.active { color: #fff !important; text-decoration: underline !important; -- cgit v1.2.3