forked from friendica/friendica-addons
fbsync: prevent falsely added copntacts
This commit is contained in:
parent
0a6d1f9e49
commit
97fe8aef5c
|
@ -278,10 +278,19 @@ function fbsync_createpost($a, $uid, $self, $contacts, $applications, $post, $cr
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($contact_id <= 0) {
|
if ($contact_id <= 0) {
|
||||||
// To-Do:
|
if ($post->actor_id != $post->source_id) {
|
||||||
// $contacts[$post->source_id] seems to be wrong by repeated posts
|
// Testing if we know the source or the actor
|
||||||
// must be changed in future
|
$contact_id = fbsync_fetch_contact($uid, $contacts[$post->source_id], false);
|
||||||
|
|
||||||
|
if (($contact_id == 0) and array_key_exists($post->actor_id, $contacts))
|
||||||
|
$contact_id = fbsync_fetch_contact($uid, $contacts[$post->actor_id], false);
|
||||||
|
|
||||||
|
// If we don't know anyone, we guess we should know the source. Could be the wrong decision
|
||||||
|
if ($contact_id == 0)
|
||||||
$contact_id = fbsync_fetch_contact($uid, $contacts[$post->source_id], $create_user);
|
$contact_id = fbsync_fetch_contact($uid, $contacts[$post->source_id], $create_user);
|
||||||
|
} else
|
||||||
|
$contact_id = fbsync_fetch_contact($uid, $contacts[$post->source_id], $create_user);
|
||||||
|
|
||||||
|
|
||||||
if ($contact_id == -1) {
|
if ($contact_id == -1) {
|
||||||
logger('fbsync_createpost: Contact is blocked. Post not imported '.print_r($post, true), LOGGER_DEBUG);
|
logger('fbsync_createpost: Contact is blocked. Post not imported '.print_r($post, true), LOGGER_DEBUG);
|
||||||
|
|
Loading…
Reference in a new issue