mirror of
https://github.com/friendica/friendica
synced 2024-11-20 06:23:41 +00:00
Fix: posted unprepared posts hadn't been deleted
This commit is contained in:
parent
d938e37767
commit
cd96955fcf
2 changed files with 21 additions and 7 deletions
|
@ -63,7 +63,7 @@ class Delayed
|
||||||
|
|
||||||
Logger::notice('Adding post for delayed publishing', ['uid' => $item['uid'], 'delayed' => $delayed, 'uri' => $uri]);
|
Logger::notice('Adding post for delayed publishing', ['uid' => $item['uid'], 'delayed' => $delayed, 'uri' => $uri]);
|
||||||
|
|
||||||
if (!Worker::add(['priority' => PRIORITY_HIGH, 'delayed' => $delayed], 'DelayedPublish', $item, $notify, $taglist, $attachments, $unprepared)) {
|
if (!Worker::add(['priority' => PRIORITY_HIGH, 'delayed' => $delayed], 'DelayedPublish', $item, $notify, $taglist, $attachments, $unprepared, $uri)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,9 +106,10 @@ class Delayed
|
||||||
* @param array $taglist
|
* @param array $taglist
|
||||||
* @param array $attachments
|
* @param array $attachments
|
||||||
* @param bool $unprepared
|
* @param bool $unprepared
|
||||||
|
* @param string $uri
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public static function publish(array $item, int $notify = 0, array $taglist = [], array $attachments = [], bool $unprepared = false)
|
public static function publish(array $item, int $notify = 0, array $taglist = [], array $attachments = [], bool $unprepared = false, string $uri = '')
|
||||||
{
|
{
|
||||||
if ($unprepared) {
|
if ($unprepared) {
|
||||||
$_SESSION['authenticated'] = true;
|
$_SESSION['authenticated'] = true;
|
||||||
|
@ -126,15 +127,27 @@ class Delayed
|
||||||
require_once 'mod/item.php';
|
require_once 'mod/item.php';
|
||||||
$id = item_post(DI::app());
|
$id = item_post(DI::app());
|
||||||
|
|
||||||
Logger::notice('Unprepared post stored', ['id' => $id, 'uid' => $item['uid'], 'extid' => $item['extid']]);
|
if (empty($uri) && !empty($item['extid'])) {
|
||||||
|
$uri = $item['extid'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Logger::notice('Unprepared post stored', ['id' => $id, 'uid' => $item['uid'], 'uri' => $uri]);
|
||||||
|
if (self::exists($uri, $item['uid'])) {
|
||||||
|
self::delete($uri, $item['uid']);
|
||||||
|
}
|
||||||
|
|
||||||
return $id;
|
return $id;
|
||||||
}
|
}
|
||||||
$id = Item::insert($item, $notify);
|
$id = Item::insert($item, $notify);
|
||||||
|
|
||||||
Logger::notice('Post stored', ['id' => $id, 'uid' => $item['uid'], 'cid' => $item['contact-id']]);
|
Logger::notice('Post stored', ['id' => $id, 'uid' => $item['uid'], 'cid' => $item['contact-id']]);
|
||||||
|
|
||||||
if (!empty($item['uri']) && self::exists($item['uri'], $item['uid'])) {
|
if (empty($uri) && !empty($item['uri'])) {
|
||||||
self::delete($item['uri'], $item['uid']);
|
$uri = $item['uri'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($uri) && self::exists($uri, $item['uid'])) {
|
||||||
|
self::delete($uri, $item['uid']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($id) && (!empty($taglist) || !empty($attachments))) {
|
if (!empty($id) && (!empty($taglist) || !empty($attachments))) {
|
||||||
|
|
|
@ -34,11 +34,12 @@ class DelayedPublish
|
||||||
* @param array $taglist
|
* @param array $taglist
|
||||||
* @param array $attachments
|
* @param array $attachments
|
||||||
* @param bool $unprepared
|
* @param bool $unprepared
|
||||||
|
* @param string $uri
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public static function execute(array $item, int $notify = 0, array $taglist = [], array $attachments = [], bool $unprepared = false)
|
public static function execute(array $item, int $notify = 0, array $taglist = [], array $attachments = [], bool $unprepared = false, string $uri = '')
|
||||||
{
|
{
|
||||||
$id = Post\Delayed::publish($item, $notify, $taglist, $attachments, $unprepared);
|
$id = Post\Delayed::publish($item, $notify, $taglist, $attachments, $unprepared, $uri);
|
||||||
Logger::notice('Post published', ['id' => $id, 'uid' => $item['uid'], 'cid' => $item['contact-id'], 'notify' => $notify, 'unprepared' => $unprepared]);
|
Logger::notice('Post published', ['id' => $id, 'uid' => $item['uid'], 'cid' => $item['contact-id'], 'notify' => $notify, 'unprepared' => $unprepared]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue