dm button in profile: don't show if the observer is the channel page owner.

This commit is contained in:
nobody 2022-01-04 02:31:41 -08:00
parent 305a88f725
commit 717934fbf3
2 changed files with 29 additions and 0 deletions

View file

@ -284,6 +284,10 @@ class Libprofile
$profdm_url = EMPTY_STR;
$can_dm = perm_is_allowed($profile['uid'], (is_array($observer)) ? $observer['xchan_hash'] : EMPTY_STR, 'post_mail') && intval($observer['xchan_type']) !== XCHAN_TYPE_GROUP ;
if (intval($profile['uid']) === local_channel()) {
$can_dm = false;
}
if ($can_dm) {
$dm_path = Libzot::get_rpost_path($observer);

View file

@ -1147,6 +1147,31 @@ function discover_by_webbie($webbie, $protocol = '', $verify = true)
}
}
if (strpos($webbie, 'http') === 0 && !$x) {
$record = Zotfinger::exec($webbie, null, $verify);
// Check the HTTP signature
if ($record) {
if ($verify) {
$hsig = $record['signature'];
if ($hsig && ($hsig['signer'] === $url || $hsig['signer'] === $webbie) && $hsig['header_valid'] === true && $hsig['content_valid'] === true) {
$hsig_valid = true;
}
if (! $hsig_valid) {
logger('http signature not valid: ' . print_r($hsig, true));
return false;
}
}
$x = Libzot::import_xchan($record['data']);
if ($x['success']) {
return $x['hash'];
}
}
}
if (strpos($webbie, 'http') === 0) {
$ap = ActivityPub::discover($webbie);
if ($ap) {