mirror of
https://github.com/friendica/friendica
synced 2025-04-26 22:30:18 +00:00
Forums now are working with AP as well
This commit is contained in:
parent
4b98200315
commit
cd0d6cb626
4 changed files with 82 additions and 44 deletions
|
@ -2226,8 +2226,35 @@ class Contact extends BaseObject
|
|||
return $redirect;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a contact from all groups
|
||||
*
|
||||
* @param integer $contact_id
|
||||
*
|
||||
* @return boolean Success
|
||||
*/
|
||||
public static function removeFromGroups($contact_id)
|
||||
{
|
||||
return DBA::delete('group_member', ['contact-id' => $contact_id]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Is the contact a forum?
|
||||
*
|
||||
* @param integer $contactid ID of the contact
|
||||
*
|
||||
* @return boolean "true" if it is a forum
|
||||
*/
|
||||
public static function isForum($contactid)
|
||||
{
|
||||
$fields = ['forum', 'prv'];
|
||||
$condition = ['id' => $contactid];
|
||||
$contact = DBA::selectFirst('contact', $fields, $condition);
|
||||
if (!DBA::isResult($contact)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Is it a forum?
|
||||
return ($contact['forum'] || $contact['prv']);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3592,4 +3592,31 @@ class Item extends BaseObject
|
|||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is the given item array a post that is sent as starting post to a forum?
|
||||
*
|
||||
* @param array $item
|
||||
* @param array $owner
|
||||
*
|
||||
* @return boolean "true" when it is a forum post
|
||||
*/
|
||||
public static function isForumPost(array $item, array $owner = [])
|
||||
{
|
||||
if (empty($owner)) {
|
||||
$owner = User::getOwnerDataById($item['uid']);
|
||||
if (empty($owner)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (($item['author-id'] == $item['owner-id']) ||
|
||||
($owner['id'] == $item['contact-id']) ||
|
||||
($item['uri'] != $item['parent-uri']) ||
|
||||
$item['origin']) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return Contact::isForum($item['contact-id']);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue