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

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

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

Loading…
Cancel
Save