add option to prevent page from getting pushed when making a new post with streaming api enabled

This commit is contained in:
notfire 2025-08-09 18:28:36 -04:00
commit 526f7464d1
No known key found for this signature in database
6 changed files with 23 additions and 0 deletions

View file

@ -34,6 +34,7 @@
- script to get new emojis is included for future unicode versions
- add toggle for showing post edit notifications
- add support for accepted follow request notifications
- add option to prevent page from getting pushed when making a new post with streaming api enabled (similar to 3rd "for unreads" option)
- add a script to download ruffle for flash support (requires python3 and requests library)
- download by entering `tools/` and running `python3 download_ruffle.py`

View file

@ -436,6 +436,8 @@ const PostStatusForm = {
const postHandler = this.postHandler ? this.postHandler : statusPoster.postStatus
let bef = document.getElementsByClassName("Timeline")[0].scrollHeight
postHandler(postingOptions).then((data) => {
if (!data.error) {
this.clearStatus()
@ -444,6 +446,14 @@ const PostStatusForm = {
this.error = data.error
}
this.posting = false
// same as timeline.js
if (this.$store.getters.mergedConfig.fixupScrollOnPostWStreaming && window.scrollY > 0) {
let after = document.getElementsByClassName("Timeline")[0].scrollHeight
let diff = bef - after
if (diff < 0) diff = diff * -1
window.scrollTo({ top: (window.scrollY + diff) })
}
})
},
previewStatus () {

View file

@ -229,6 +229,15 @@
{{ $t('settings.deletePostsStreaming') }}
</BooleanSetting>
</li>
<li>
<BooleanSetting
path="fixupScrollOnPostWStreaming"
:disabled="!useStreamingApi"
expert="1"
>
{{ $t('settings.fixup_scroll_on_post_with_streaming') }}
</BooleanSetting>
</li>
</ul>
</li>
<li>

View file

@ -577,6 +577,7 @@
},
"filtering": "Filtering",
"filtering_explanation": "All posts containing these words will be muted, one per line",
"fixup_scroll_on_post_with_streaming": "Prevent the page from getting pushed down by new posts you make",
"follow_export": "Follow export",
"follow_export_button": "Export your follows to a csv file",
"follow_import": "Follow import",

View file

@ -129,6 +129,7 @@ export const defaultState = {
recurseSearchLimit: 100,
dedupeBoosts: true,
scrollToTopOnNewPostClick: true,
fixupScrollOnPostWStreaming: false,
showFaviconBadge: true,
autoRefreshOnRequired: true,
showUnreadInTitle: true,

View file

@ -85,6 +85,7 @@ const defaultState = {
recurseSearchLimit: 100,
dedupeBoosts: true,
scrollToTopOnNewPostClick: true,
fixupScrollOnPostWStreaming: false,
showFaviconBadge: true,
autoRefreshOnRequired: true,
showUnreadInTitle: true,