Replace almost every Introduction places

This commit is contained in:
Philipp 2021-10-18 22:49:25 +02:00
parent a40f503fdd
commit 7d7d310cc4
No known key found for this signature in database
GPG key ID: 24A7501396EB5432
8 changed files with 128 additions and 43 deletions

View file

@ -1352,7 +1352,7 @@ class DFRN
}
// Quit if we already have an introduction for this person
if (DBA::exists('intro', ['uid' => $uid, 'suggest-cid' => $cid])) {
if (DI::intro()->existsForContact($cid, $uid)) {
return false;
}
@ -1366,10 +1366,13 @@ class DFRN
$suggest['title'] = '';
$suggest['body'] = $note;
$hash = Strings::getRandomHex();
$fields = ['uid' => $suggest['uid'], 'suggest-cid' => $cid, 'contact-id' => $suggest['cid'],
'note' => $suggest['body'], 'hash' => $hash, 'datetime' => DateTimeFormat::utcNow(), 'blocked' => false];
DBA::insert('intro', $fields);
DI::intro()->save(DI::introFactory()->createNew(
$suggest['uid'],
$suggest['cid'],
$suggest['body'],
null,
$cid
));
DI::notify()->createFromArray([
'type' => Notification\Type::SUGGEST,