@@ -425,7 +425,7 @@ import humanDate from '@/composables/filters/humanDate'
425
425
import dayjs from ' dayjs'
426
426
import { userRoleHighlight } from ' @/composables/utils/userUtils'
427
427
import truncate from ' @/composables/filters/truncate'
428
- import { inject , reactive , watch , toRefs } from ' vue'
428
+ import { inject , reactive , watch , toRefs , nextTick } from ' vue'
429
429
import { postsApi , pollsApi , threadsApi , usersApi , watchlistApi } from ' @/api'
430
430
import { AuthStore } from ' @/composables/stores/auth'
431
431
import { PreferencesStore , localStoragePrefs } from ' @/composables/stores/prefs'
@@ -905,7 +905,17 @@ export default {
905
905
}
906
906
907
907
const createPost = post => postsApi .create (post)
908
- .then (p => $router .push ({ path: $route .path , query: $route .query , hash: ` #${ p .id } ` }))
908
+ .then (p => {
909
+ const limit = localStoragePrefs ().data .posts_per_page
910
+ if (v .postData .data .posts .length === limit) {
911
+ const postCount = v .postData .data .thread .post_count + 1
912
+ const lastPage = Math .ceil (postCount / limit)
913
+ Object .assign (v .postData .data .thread .post_count , postCount)
914
+ Object .assign (v .postData .data .page , lastPage)
915
+ nextTick (() => $router .push ({ path: $route .path , query: { ... $route .query , page: lastPage }, hash: ` #${ p .id } ` }))
916
+ }
917
+ else $router .push ({ path: $route .path , query: $route .query , hash: ` #${ p .id } ` })
918
+ })
909
919
910
920
const updatePost = post => postsApi .update (post)
911
921
.then (processPosts)
0 commit comments