Merge pull request #10300 from annando/issue-10264
Issue 10264: Remote comments for visitors
This commit is contained in:
commit
48a783c91a
3 changed files with 14 additions and 1 deletions
|
@ -128,6 +128,7 @@ function dfrn_poll_init(App $a)
|
||||||
$_SESSION['visitor_handle'] = $r[0]['addr'];
|
$_SESSION['visitor_handle'] = $r[0]['addr'];
|
||||||
$_SESSION['visitor_visiting'] = $r[0]['uid'];
|
$_SESSION['visitor_visiting'] = $r[0]['uid'];
|
||||||
$_SESSION['my_url'] = $r[0]['url'];
|
$_SESSION['my_url'] = $r[0]['url'];
|
||||||
|
$_SESSION['remote_comment'] = $r[0]['subscribe'];
|
||||||
|
|
||||||
Session::setVisitorsContacts();
|
Session::setVisitorsContacts();
|
||||||
|
|
||||||
|
@ -497,8 +498,10 @@ function dfrn_poll_content(App $a)
|
||||||
$_SESSION['authenticated'] = 1;
|
$_SESSION['authenticated'] = 1;
|
||||||
$_SESSION['visitor_id'] = $r[0]['id'];
|
$_SESSION['visitor_id'] = $r[0]['id'];
|
||||||
$_SESSION['visitor_home'] = $r[0]['url'];
|
$_SESSION['visitor_home'] = $r[0]['url'];
|
||||||
|
$_SESSION['visitor_handle'] = $r[0]['addr'];
|
||||||
$_SESSION['visitor_visiting'] = $r[0]['uid'];
|
$_SESSION['visitor_visiting'] = $r[0]['uid'];
|
||||||
$_SESSION['my_url'] = $r[0]['url'];
|
$_SESSION['my_url'] = $r[0]['url'];
|
||||||
|
$_SESSION['remote_comment'] = $r[0]['subscribe'];
|
||||||
|
|
||||||
Session::setVisitorsContacts();
|
Session::setVisitorsContacts();
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,7 @@ use Friendica\Core\L10n;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Core\Theme;
|
use Friendica\Core\Theme;
|
||||||
use Friendica\Database\Database;
|
use Friendica\Database\Database;
|
||||||
|
use Friendica\Model\Contact;
|
||||||
use Friendica\Model\Profile;
|
use Friendica\Model\Profile;
|
||||||
use Friendica\Module\Special\HTTPException as ModuleHTTPException;
|
use Friendica\Module\Special\HTTPException as ModuleHTTPException;
|
||||||
use Friendica\Network\HTTPException;
|
use Friendica\Network\HTTPException;
|
||||||
|
@ -464,6 +465,11 @@ class App
|
||||||
if (Core\Session::get('visitor_home') != $_GET["zrl"]) {
|
if (Core\Session::get('visitor_home') != $_GET["zrl"]) {
|
||||||
Core\Session::set('my_url', $_GET['zrl']);
|
Core\Session::set('my_url', $_GET['zrl']);
|
||||||
Core\Session::set('authenticated', 0);
|
Core\Session::set('authenticated', 0);
|
||||||
|
|
||||||
|
$remote_contact = Contact::getByURL($_GET['zrl'], false, ['subscribe']);
|
||||||
|
if (!empty($remote_contact['subscribe'])) {
|
||||||
|
$_SESSION['remote_comment'] = $remote_contact['subscribe'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Model\Profile::zrlInit($this);
|
Model\Profile::zrlInit($this);
|
||||||
|
|
|
@ -401,9 +401,13 @@ class Post
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fetching of Diaspora posts doesn't always work. There are issues with reshares and possibly comments
|
// Fetching of Diaspora posts doesn't always work. There are issues with reshares and possibly comments
|
||||||
if (($item['network'] != Protocol::DIASPORA) && empty($comment) && !empty(Session::get('remote_comment'))) {
|
if (!local_user() && ($item['network'] != Protocol::DIASPORA) && !empty(Session::get('remote_comment'))) {
|
||||||
$remote_comment = [DI::l10n()->t('Comment this item on your system'), DI::l10n()->t('Remote comment'),
|
$remote_comment = [DI::l10n()->t('Comment this item on your system'), DI::l10n()->t('Remote comment'),
|
||||||
str_replace('{uri}', urlencode($item['uri']), Session::get('remote_comment'))];
|
str_replace('{uri}', urlencode($item['uri']), Session::get('remote_comment'))];
|
||||||
|
|
||||||
|
// Ensure to either display the remote comment or the local activities
|
||||||
|
$buttons = [];
|
||||||
|
$comment_html = '';
|
||||||
} else {
|
} else {
|
||||||
$remote_comment = '';
|
$remote_comment = '';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue