Browse Source

fix post sending

main
ghost 3 years ago
parent
commit
6d38bd2f58
  1. 6
      src/application/controller/api/post/add.php
  2. 6
      src/public/js/module/post.js

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

@ -12,8 +12,8 @@ if (isset($_SESSION['userName'])) { @@ -12,8 +12,8 @@ if (isset($_SESSION['userName'])) {
if ($userPosts = $_twister->getPosts([$_SESSION['userName']], 1)) {
if (isset($userPosts[0]['userpost']['k'])) {
$postK = Filter::int($userPosts[0]['userpost']['k']) + 1;
if (isset($userPosts[0]['k'])) {
$postK = Filter::int($userPosts[0]['k']) + 1;
}
}
@ -24,7 +24,7 @@ if (isset($_SESSION['userName'])) { @@ -24,7 +24,7 @@ if (isset($_SESSION['userName'])) {
$response = [
'success' => true,
'message' => _('Post successfully sent')
'message' => $postK
];
} else {

6
src/public/js/module/post.js

@ -35,7 +35,7 @@ var ModulePost = { @@ -35,7 +35,7 @@ var ModulePost = {
if (response.success) {
$('#modulePostMessage').val('');
$('#modulePostPreview').hide();
$('#modulePostPreview').removeClass('active');
$('#modulePostPreview .text').html('');
$(document).trigger('ModulePost.add:success', [response]);
@ -88,10 +88,6 @@ $(document).ready(function() { @@ -88,10 +88,6 @@ $(document).ready(function() {
ModulePost.loadAvatar();
// Event listeners
$(document).on('ModulePost.add:success', function(/*event, response*/) {
ModuleFeed.load('#moduleFeed', 1, true);
});
$('#modulePostMessage').on('keyup', function() {
ModulePost.preview();
});

Loading…
Cancel
Save