Browse Source

fix initial post sending

main
ghost 3 years ago
parent
commit
871b56b79f
  1. 21
      src/application/controller/api/post/add.php

21
src/application/controller/api/post/add.php

@ -7,17 +7,20 @@ $response = [
if (isset($_SESSION['userName'])) { if (isset($_SESSION['userName'])) {
if (!$userPosts = $_twister->getPosts([$_SESSION['userName']], 1)) { // Get post index
$postK = 1;
$response = [ if ($userPosts = $_twister->getPosts([$_SESSION['userName']], 1)) {
'success' => false,
'message' => _('Could not receive last user post') if (isset($userPosts[0]['userpost']['k'])) {
]; $postK = Filter::int($userPosts[0]['userpost']['k']) + 1;
}
}
} else if (isset($userPosts[0]['userpost']['k']) && if ($postK && $result = $_twister->newPostMessage($_SESSION['userName'],
$result = $_twister->newPostMessage($_SESSION['userName'], $postK,
Filter::int($userPosts[0]['userpost']['k']) + 1, Filter::post($_POST['message']))) {
Filter::post($_POST['message']))) {
$response = [ $response = [
'success' => true, 'success' => true,

Loading…
Cancel
Save