Add some QoL patches from upstream PRs

This commit is contained in:
Oneric 2024-10-03 19:09:28 +02:00
parent 4aa816ffdf
commit ab99a0cde2
10 changed files with 551 additions and 0 deletions

View file

@ -0,0 +1,36 @@
From 13383982bce4a2db54585ee2cac93f8b91941094 Mon Sep 17 00:00:00 2001
From: novenary <novenary@kwak.zip>
Date: Mon, 16 Sep 2024 22:40:33 +0300
Subject: [PATCH] post_status_form: enable sync flush for watcher
This fixes drafts not clearing after posting a reply.
Vue 3.3.11 changed watchers to stop firing after component unmount.
After posting a reply, the post form is removed, now causing the queued
event to be discarded.
Synchronous flush causes the handler to be called immediately when
changes happen, solving the problem.
See: https://github.com/vuejs/core/pull/7181
See: https://github.com/vuejs/docs/commit/80e2128d52603856a26a8bb7258606cfe80561e9
Fixes: a7dea2f70f2beba781068a7ff7d8a2a9ef8a9478
Fixes: #413
---
src/components/post_status_form/post_status_form.js | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js
index 6eee23ce..0c77199b 100644
--- a/src/components/post_status_form/post_status_form.js
+++ b/src/components/post_status_form/post_status_form.js
@@ -329,6 +329,7 @@ const PostStatusForm = {
watch: {
'newStatus': {
deep: true,
+ flush: 'sync',
handler () {
this.statusChanged()
}
--
2.34.1

View file

@ -0,0 +1,85 @@
From 5886765d8904de98db84b93d23b536fefd31373f Mon Sep 17 00:00:00 2001
From: novenary <novenary@kwak.zip>
Date: Tue, 17 Sep 2024 00:36:48 +0300
Subject: [PATCH] post_status_form: fix enter key in subject field
This fixes random actions being triggered by the enter key while the
subject field is focused.
When pressing enter, the browser simulates a click on the first "submit"
button it finds in the form.
A submit button is a button without `type="button"` set.
Remediate this by setting the type attribute on all but the "Post"
button.
Additionally, inhibit the enter key in the subject field (ctrl+enter
still works).
---
src/components/poll/poll_form.vue | 2 ++
src/components/post_status_form/post_status_form.vue | 5 +++++
2 files changed, 7 insertions(+)
diff --git a/src/components/poll/poll_form.vue b/src/components/poll/poll_form.vue
index 146754db..a67115b6 100644
--- a/src/components/poll/poll_form.vue
+++ b/src/components/poll/poll_form.vue
@@ -24,6 +24,7 @@
<button
v-if="options.length > 2"
class="delete-option button-unstyled -hover-highlight"
+ type="button"
@click="deleteOption(index)"
>
<FAIcon icon="times" />
@@ -32,6 +33,7 @@
<button
v-if="options.length < maxOptions"
class="add-option faint button-unstyled -hover-highlight"
+ type="button"
@click="addOption"
>
<FAIcon
diff --git a/src/components/post_status_form/post_status_form.vue b/src/components/post_status_form/post_status_form.vue
index 79049f05..085a06a2 100644
--- a/src/components/post_status_form/post_status_form.vue
+++ b/src/components/post_status_form/post_status_form.vue
@@ -18,6 +18,7 @@
>
<button
class="button-unstyled -link"
+ type="button"
@click="openProfileTab"
>
{{ $t('post_status.account_not_locked_warning_link') }}
@@ -136,6 +137,7 @@
class="form-post-subject"
@input="onSubjectInput"
@focus="focusSubjectInput()"
+ @keydown.exact.enter.prevent
>
</EmojiInput>
<i18n-t
@@ -272,6 +274,7 @@
<button
class="emoji-icon button-unstyled"
:title="$t('emoji.add_emoji')"
+ type="button"
@click="showEmojiPicker"
>
<FAIcon icon="smile-beam" />
@@ -281,6 +284,7 @@
class="poll-icon button-unstyled"
:class="{ selected: pollFormVisible }"
:title="$t('polls.add_poll')"
+ type="button"
@click="togglePollForm"
>
<FAIcon icon="poll-h" />
@@ -290,6 +294,7 @@
class="spoiler-icon button-unstyled"
:class="{ selected: subjectVisible }"
:title="$t('post_status.toggle_content_warning')"
+ type="button"
@click="toggleSubjectVisible"
>
<FAIcon icon="eye-slash" />

View file

@ -0,0 +1,23 @@
From 2765a5c163c9d11a4c38f5f84f62dfa6bdfb5b52 Mon Sep 17 00:00:00 2001
From: novenary <novenary@kwak.zip>
Date: Tue, 17 Sep 2024 00:50:22 +0300
Subject: [PATCH] emoji_picker: select recents tab by default
This saves a click to get at your most commonly used emoji.
---
src/components/emoji_picker/emoji_picker.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/components/emoji_picker/emoji_picker.js b/src/components/emoji_picker/emoji_picker.js
index 9a2307cb..1e53665d 100644
--- a/src/components/emoji_picker/emoji_picker.js
+++ b/src/components/emoji_picker/emoji_picker.js
@@ -31,7 +31,7 @@ const EmojiPicker = {
data () {
return {
keyword: '',
- activeGroup: 'standard',
+ activeGroup: 'recent',
showingStickers: false,
keepOpen: false
}

View file

@ -0,0 +1,62 @@
From 7b8429aa24985bb53e5c0c8c26276e4d5e0b050f Mon Sep 17 00:00:00 2001
From: novenary <novenary@kwak.zip>
Date: Tue, 17 Sep 2024 03:28:40 +0300
Subject: [PATCH] emoji_input: show more suggestions
5 suggestions is really too little, so increase the limit and make the
list scrollable.
---
src/components/emoji_input/emoji_input.js | 8 +++++++-
src/components/emoji_input/emoji_input.vue | 6 ++++++
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/src/components/emoji_input/emoji_input.js b/src/components/emoji_input/emoji_input.js
index 138a5b51..d6e5da53 100644
--- a/src/components/emoji_input/emoji_input.js
+++ b/src/components/emoji_input/emoji_input.js
@@ -183,7 +183,7 @@ const EmojiInput = {
// Async: cancel if textAtCaret has changed during wait
if (this.textAtCaret !== newWord) return
if (matchedSuggestions.length <= 0) return
- this.suggestions = take(matchedSuggestions, 5)
+ this.suggestions = take(matchedSuggestions, 25)
.map(({ imageUrl, ...rest }) => ({
...rest,
img: imageUrl || ''
@@ -300,6 +300,9 @@ const EmojiInput = {
if (this.highlighted < 0) {
this.highlighted = this.suggestions.length - 1
}
+ const panelBody = this.$refs['panel-body']
+ const highlighted = panelBody.children[this.highlighted]
+ highlighted.scrollIntoView({ block: 'nearest' })
e.preventDefault()
} else {
this.highlighted = 0
@@ -312,6 +315,9 @@ const EmojiInput = {
if (this.highlighted >= len) {
this.highlighted = 0
}
+ const panelBody = this.$refs['panel-body']
+ const highlighted = panelBody.children[this.highlighted]
+ highlighted.scrollIntoView({ block: 'nearest' })
e.preventDefault()
} else {
this.highlighted = 0
diff --git a/src/components/emoji_input/emoji_input.vue b/src/components/emoji_input/emoji_input.vue
index aeacf544..c4174c27 100644
--- a/src/components/emoji_input/emoji_input.vue
+++ b/src/components/emoji_input/emoji_input.vue
@@ -128,6 +128,12 @@
--postLink: var(--popoverPostLink, $fallback--link);
--postFaintLink: var(--popoverPostFaintLink, $fallback--link);
--icon: var(--popoverIcon, $fallback--icon);
+
+ overflow-y: scroll;
+ scrollbar-gutter: stable;
+ scrollbar-width: thin;
+ max-height: calc((0.2em * 2 + 1px + 32px) * 5);
+ scroll-padding-block: calc((0.2em * 2 + 1px + 32px) * 2);
}
}

View file

@ -0,0 +1,54 @@
From 65dbac098eb39a862c1f3d4bd45f89208e72c4a5 Mon Sep 17 00:00:00 2001
From: novenary <novenary@kwak.zip>
Date: Tue, 17 Sep 2024 10:59:08 +0300
Subject: [PATCH] post_status_form: reset all to defaults on clear
---
.../post_status_form/post_status_form.js | 14 ++++++++++----
.../post_status_form/post_status_form.vue | 1 +
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js
index 6eee23ce..ac3e7b23 100644
--- a/src/components/post_status_form/post_status_form.js
+++ b/src/components/post_status_form/post_status_form.js
@@ -341,17 +341,23 @@ const PostStatusForm = {
this.saveDraft()
},
clearStatus () {
- const newStatus = this.newStatus
+ const config = this.$store.getters.mergedConfig
+ const postLanguage = config.postLanguage || interfaceToISOLanguage(config.interfaceLanguage)
this.newStatus = {
status: '',
spoilerText: '',
files: [],
- visibility: newStatus.visibility,
- contentType: newStatus.contentType,
- language: newStatus.language,
+ nsfw: !!config.sensitiveByDefault,
+ visibility: this.suggestedVisibility(),
+ contentType: config.postContentType,
+ language: postLanguage,
poll: {},
mediaDescriptions: {}
}
+ const scopeselector = this.$refs.scopeselector
+ if (scopeselector) {
+ scopeselector.currentScope = this.newStatus.visibility
+ }
this.pollFormVisible = false
this.$refs.mediaUpload && this.$refs.mediaUpload.clearFile()
this.clearPollForm()
diff --git a/src/components/post_status_form/post_status_form.vue b/src/components/post_status_form/post_status_form.vue
index 085a06a2..1a56685b 100644
--- a/src/components/post_status_form/post_status_form.vue
+++ b/src/components/post_status_form/post_status_form.vue
@@ -195,6 +195,7 @@
:class="{ 'visibility-tray-edit': isEdit }"
>
<scope-selector
+ ref="scopeselector"
v-if="!disableVisibilitySelector"
:user-default="userDefaultScope"
:original-scope="copyMessageScope"

View file

@ -0,0 +1,119 @@
From 8f06566ddd504a9c5d712e64b945ddb74090d1eb Mon Sep 17 00:00:00 2001
From: novenary <novenary@kwak.zip>
Date: Tue, 17 Sep 2024 12:27:56 +0300
Subject: [PATCH] post_status_form: inherit language from parent
If I'm replying to a post in Klingon, chances are I'm going to write in
Klingon. This reduces friction for properly marking post language in a
conversation.
---
.../post_status_form/post_status_form.js | 20 +++++++++++++------
src/components/status/status.vue | 2 ++
.../entity_normalizer.service.js | 1 +
3 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js
index ac3e7b23..cad8d3c2 100644
--- a/src/components/post_status_form/post_status_form.js
+++ b/src/components/post_status_form/post_status_form.js
@@ -85,6 +85,7 @@ const PostStatusForm = {
'quoteId',
'repliedUser',
'attentions',
+ 'copyMessageLanguage',
'copyMessageScope',
'subject',
'disableSubject',
@@ -153,8 +154,7 @@ const PostStatusForm = {
statusText = buildMentionsString({ user: this.repliedUser, attentions: this.attentions }, currentUser)
}
- const { postContentType: contentType, postLanguage: defaultPostLanguage, sensitiveByDefault, sensitiveIfSubject, interfaceLanguage, alwaysShowSubjectInput } = this.$store.getters.mergedConfig
- const postLanguage = defaultPostLanguage || interfaceToISOLanguage(interfaceLanguage)
+ const { postContentType: contentType, sensitiveByDefault, sensitiveIfSubject, alwaysShowSubjectInput } = this.$store.getters.mergedConfig
let statusParams = {
spoilerText: this.subject || '',
@@ -165,7 +165,7 @@ const PostStatusForm = {
poll: {},
mediaDescriptions: {},
visibility: this.suggestedVisibility(),
- language: postLanguage,
+ language: this.suggestedLanguage(),
contentType
}
@@ -180,7 +180,7 @@ const PostStatusForm = {
poll: this.statusPoll || {},
mediaDescriptions: this.statusMediaDescriptions || {},
visibility: this.statusScope || this.suggestedVisibility(),
- language: this.statusLanguage || postLanguage,
+ language: this.statusLanguage || this.suggestedLanguage(),
contentType: statusContentType
}
}
@@ -342,7 +342,6 @@ const PostStatusForm = {
},
clearStatus () {
const config = this.$store.getters.mergedConfig
- const postLanguage = config.postLanguage || interfaceToISOLanguage(config.interfaceLanguage)
this.newStatus = {
status: '',
spoilerText: '',
@@ -350,7 +349,7 @@ const PostStatusForm = {
nsfw: !!config.sensitiveByDefault,
visibility: this.suggestedVisibility(),
contentType: config.postContentType,
- language: postLanguage,
+ language: this.suggestedLanguage(),
poll: {},
mediaDescriptions: {}
}
@@ -766,6 +765,15 @@ const PostStatusForm = {
openProfileTab () {
this.$store.dispatch('openSettingsModalTab', 'profile')
},
+ suggestedLanguage () {
+ // Make sure the inherited language is actually valid
+ if (this.postLanguageOptions.find(o => o.value === this.copyMessageLanguage)) {
+ return this.copyMessageLanguage
+ }
+ const { postLanguage: defaultPostLanguage, interfaceLanguage } = this.$store.getters.mergedConfig
+ const postLanguage = defaultPostLanguage || interfaceToISOLanguage(interfaceLanguage)
+ return postLanguage
+ },
suggestedVisibility () {
if (this.copyMessageScope) {
if (this.copyMessageScope === 'direct') {
diff --git a/src/components/status/status.vue b/src/components/status/status.vue
index f51462bb..dc6491cc 100644
--- a/src/components/status/status.vue
+++ b/src/components/status/status.vue
@@ -519,6 +519,7 @@
:reply-to="status.id"
:attentions="status.attentions"
:replied-user="status.user"
+ :copy-message-language="status.language"
:copy-message-scope="status.visibility"
:subject="replySubject"
@posted="toggleReplying"
@@ -533,6 +534,7 @@
:quote-id="status.id"
:attentions="[status.user]"
:replied-user="status.user"
+ :copy-message-language="status.language"
:copy-message-scope="status.visibility"
:subject="replySubject"
@posted="toggleQuoting"
diff --git a/src/services/entity_normalizer/entity_normalizer.service.js b/src/services/entity_normalizer/entity_normalizer.service.js
index b7f382d8..7bf8c33d 100644
--- a/src/services/entity_normalizer/entity_normalizer.service.js
+++ b/src/services/entity_normalizer/entity_normalizer.service.js
@@ -326,6 +326,7 @@ export const parseStatus = (data) => {
}
output.pinned = data.pinned
output.muted = data.muted
+ output.language = data.language
} else {
output.favorited = data.favorited
output.fave_num = data.fave_num

View file

@ -0,0 +1,56 @@
From c6de61e081381eaceb9b8b025f86a9fe0fbf3edc Mon Sep 17 00:00:00 2001
From: novenary <novenary@kwak.zip>
Date: Wed, 18 Sep 2024 01:06:26 +0300
Subject: [PATCH] conversation: scrollIntoView when collapsed
This helps find the original context when collapsing a thread on the
timeline.
---
src/components/conversation/conversation.js | 11 ++++++++---
src/components/conversation/conversation.vue | 3 +++
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/src/components/conversation/conversation.js b/src/components/conversation/conversation.js
index 68b90c72..c1e79072 100644
--- a/src/components/conversation/conversation.js
+++ b/src/components/conversation/conversation.js
@@ -267,11 +267,11 @@ const conversation = {
},
replies () {
let i = 1
-
+
return reduce(this.conversation, (result, { id, in_reply_to_status_id }) => {
-
+
const irid = in_reply_to_status_id
-
+
if (irid) {
result[irid] = result[irid] || []
result[irid].push({
@@ -414,6 +414,11 @@ const conversation = {
},
toggleExpanded () {
this.expanded = !this.expanded
+ this.$nextTick(() => {
+ if (!this.expanded) {
+ this.$el.scrollIntoView({ block: 'nearest' })
+ }
+ })
},
getConversationId (statusId) {
const status = this.$store.state.statuses.allStatusesObject[statusId]
diff --git a/src/components/conversation/conversation.vue b/src/components/conversation/conversation.vue
index 61f1358a..934dd7ee 100644
--- a/src/components/conversation/conversation.vue
+++ b/src/components/conversation/conversation.vue
@@ -278,5 +278,8 @@
&.-expanded.status-fadein {
margin: calc(var(--status-margin, $status-margin) / 2);
}
+
+ /* HACK: this value was picked arbitrarily and this is likely not even the right place */
+ scroll-margin-block-start: calc(var(--navbar-height) * 2);
}
</style>

View file

@ -0,0 +1,30 @@
From 1ae09458c6450642b74fd79674d7ab935b76ac02 Mon Sep 17 00:00:00 2001
From: Oneric <oneric@oneric.stub>
Date: Sat, 28 Sep 2024 17:47:28 +0200
Subject: [PATCH] Fix redirect on logout
An instance may restrict access to the public timeline (among others)
to authenticated users and there already is a setting to decide which page
to show authenticated and unauthenticated viewers by default each.
However, the logout redirect didn't honour this setting
leading to potentially broken pages and errors on logout
---
src/components/settings_modal/settings_modal.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/components/settings_modal/settings_modal.js b/src/components/settings_modal/settings_modal.js
index 27dab3ec..9a2df9b0 100644
--- a/src/components/settings_modal/settings_modal.js
+++ b/src/components/settings_modal/settings_modal.js
@@ -69,7 +69,7 @@ const SettingsModal = {
this.$store.dispatch('closeSettingsModal')
},
logout () {
- this.$router.replace('/main/public')
+ this.$router.replace(this.$store.state.instance.redirectRootNoLogin || '/main/all')
this.$store.dispatch('closeSettingsModal')
this.$store.dispatch('logout')
},
--
2.34.1

View file

@ -0,0 +1,75 @@
From c4301ae8025189e41b7b485a64ae4ba9f2539d14 Mon Sep 17 00:00:00 2001
From: Oneric <oneric@oneric.stub>
Date: Sat, 28 Sep 2024 18:33:30 +0200
Subject: [PATCH] Allow using custom source URLs
---
src/boot/after_store.js | 6 ++++++
src/components/settings_modal/tabs/version_tab.js | 9 ++++-----
src/modules/instance.js | 2 ++
3 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/src/boot/after_store.js b/src/boot/after_store.js
index d45584c0..af457cb4 100644
--- a/src/boot/after_store.js
+++ b/src/boot/after_store.js
@@ -183,6 +183,12 @@ const setSettings = async ({ apiConfig, staticConfig, store }) => {
copyInstanceOption('renderMisskeyMarkdown')
copyInstanceOption('sidebarRight')
+ if (typeof config.backendCommitUrl !== 'undefined')
+ copyInstanceOption('backendCommitUrl')
+
+ if (typeof config.frontendCommitUrl !== 'undefined')
+ copyInstanceOption('frontendCommitUrl')
+
return store.dispatch('setTheme', config['theme'])
}
diff --git a/src/components/settings_modal/tabs/version_tab.js b/src/components/settings_modal/tabs/version_tab.js
index d69b131d..2a8999f9 100644
--- a/src/components/settings_modal/tabs/version_tab.js
+++ b/src/components/settings_modal/tabs/version_tab.js
@@ -1,22 +1,21 @@
import { extractCommit } from 'src/services/version/version.service'
-const pleromaFeCommitUrl = 'https://akkoma.dev/AkkomaGang/pleroma-fe/commit/'
-const pleromaBeCommitUrl = 'https://akkoma.dev/AkkomaGang/akkoma/commit/'
-
const VersionTab = {
data () {
const instance = this.$store.state.instance
return {
+ backendCommitUrl: instance.backendCommitUrl,
backendVersion: instance.backendVersion,
+ frontendCommitUrl: instance.frontendCommitUrl,
frontendVersion: instance.frontendVersion
}
},
computed: {
frontendVersionLink () {
- return pleromaFeCommitUrl + this.frontendVersion
+ return this.frontendCommitUrl + this.frontendVersion
},
backendVersionLink () {
- return pleromaBeCommitUrl + extractCommit(this.backendVersion)
+ return this.backendCommitUrl + extractCommit(this.backendVersion)
}
}
}
diff --git a/src/modules/instance.js b/src/modules/instance.js
index 0c856352..c60e1918 100644
--- a/src/modules/instance.js
+++ b/src/modules/instance.js
@@ -73,6 +73,8 @@ const defaultState = {
conversationOtherRepliesButton: 'below',
conversationTreeFadeAncestors: false,
maxDepthInThread: 6,
+ backendCommitUrl: 'https://akkoma.dev/AkkomaGang/akkoma/commit/',
+ frontendCommitUrl: 'https://akkoma.dev/AkkomaGang/pleroma-fe/commit/',
// Nasty stuff
customEmoji: [],
--
2.34.1

View file

@ -1 +1,12 @@
000_plant-a-forest.patch
# crucial; else source links broken!
pr421_custom-source-urls.patch
# QoL improvements, minor bugfixes
pr420_logout-redirect.patch
pr414_sync-flush.patch
pr416_01_fix-enter-in-subject.patch
pr416_02_default-to-recent-emoji.patch
pr416_03_more-emoji-suggestions.patch
pr416_04_reset-post-form-on-send.patch
pr416_05_post-form-default-to-parent-lang.patch
pr416_06_fix-conversation-collapse-focus.patch