Fix support for /contact/123456/conversations
URLs in Module\Contact\Hovercard
This commit is contained in:
parent
5a2a8db21f
commit
83c04ac433
1 changed files with 6 additions and 5 deletions
|
@ -44,11 +44,12 @@ class Hovercard extends BaseModule
|
||||||
throw new HTTPException\ForbiddenException();
|
throw new HTTPException\ForbiddenException();
|
||||||
}
|
}
|
||||||
|
|
||||||
// If a contact is connected the url is internally changed to 'contact/redir/CID'. We need the pure url to search for
|
/* Possible formats for relative URLs that need to be converted to the absolute contact URL:
|
||||||
// the contact. So we strip out the contact id from the internal url and look in the contact table for
|
* - contact/redir/123456
|
||||||
// the real url (nurl)
|
* - contact/123456/conversations
|
||||||
if (strpos($contact_url, 'contact/') === 0) {
|
*/
|
||||||
$remote_contact = Contact::selectFirst(['nurl'], ['id' => intval(basename($contact_url))]);
|
if (strpos($contact_url, 'contact/') === 0 && preg_match('/(\d+)/', $contact_url, $matches)) {
|
||||||
|
$remote_contact = Contact::selectFirst(['nurl'], ['id' => $matches[1]]);
|
||||||
$contact_url = $remote_contact['nurl'] ?? '';
|
$contact_url = $remote_contact['nurl'] ?? '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue