Misc fixes #416

Open
novenary wants to merge 6 commits from novenary/akkoma-fe:misc-fixes/2024-09-17 into develop
10 changed files with 58 additions and 13 deletions

View file

@ -267,11 +267,11 @@ const conversation = {
}, },
replies () { replies () {
let i = 1 let i = 1
return reduce(this.conversation, (result, { id, in_reply_to_status_id }) => { return reduce(this.conversation, (result, { id, in_reply_to_status_id }) => {
const irid = in_reply_to_status_id const irid = in_reply_to_status_id
if (irid) { if (irid) {
result[irid] = result[irid] || [] result[irid] = result[irid] || []
result[irid].push({ result[irid].push({
@ -414,6 +414,11 @@ const conversation = {
}, },
toggleExpanded () { toggleExpanded () {
this.expanded = !this.expanded this.expanded = !this.expanded
this.$nextTick(() => {
if (!this.expanded) {
this.$el.scrollIntoView({ block: 'nearest' })
}
})
}, },
getConversationId (statusId) { getConversationId (statusId) {
const status = this.$store.state.statuses.allStatusesObject[statusId] const status = this.$store.state.statuses.allStatusesObject[statusId]

View file

@ -278,5 +278,8 @@
&.-expanded.status-fadein { &.-expanded.status-fadein {
margin: calc(var(--status-margin, $status-margin) / 2); 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> </style>

View file

@ -183,7 +183,7 @@ const EmojiInput = {
// Async: cancel if textAtCaret has changed during wait // Async: cancel if textAtCaret has changed during wait
if (this.textAtCaret !== newWord) return if (this.textAtCaret !== newWord) return
if (matchedSuggestions.length <= 0) return if (matchedSuggestions.length <= 0) return
this.suggestions = take(matchedSuggestions, 5) this.suggestions = take(matchedSuggestions, 25)
.map(({ imageUrl, ...rest }) => ({ .map(({ imageUrl, ...rest }) => ({
...rest, ...rest,
img: imageUrl || '' img: imageUrl || ''
@ -300,6 +300,9 @@ const EmojiInput = {
if (this.highlighted < 0) { if (this.highlighted < 0) {
this.highlighted = this.suggestions.length - 1 this.highlighted = this.suggestions.length - 1
} }
const panelBody = this.$refs['panel-body']
const highlighted = panelBody.children[this.highlighted]
highlighted.scrollIntoView({ block: 'nearest' })
e.preventDefault() e.preventDefault()
} else { } else {
this.highlighted = 0 this.highlighted = 0
@ -312,6 +315,9 @@ const EmojiInput = {
if (this.highlighted >= len) { if (this.highlighted >= len) {
this.highlighted = 0 this.highlighted = 0
} }
const panelBody = this.$refs['panel-body']
const highlighted = panelBody.children[this.highlighted]
highlighted.scrollIntoView({ block: 'nearest' })
e.preventDefault() e.preventDefault()
} else { } else {
this.highlighted = 0 this.highlighted = 0

View file

@ -128,6 +128,12 @@
--postLink: var(--popoverPostLink, $fallback--link); --postLink: var(--popoverPostLink, $fallback--link);
--postFaintLink: var(--popoverPostFaintLink, $fallback--link); --postFaintLink: var(--popoverPostFaintLink, $fallback--link);
--icon: var(--popoverIcon, $fallback--icon); --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

@ -31,7 +31,7 @@ const EmojiPicker = {
data () { data () {
return { return {
keyword: '', keyword: '',
activeGroup: 'standard', activeGroup: 'recent',
showingStickers: false, showingStickers: false,
keepOpen: false keepOpen: false
} }

View file

@ -24,6 +24,7 @@
<button <button
v-if="options.length > 2" v-if="options.length > 2"
class="delete-option button-unstyled -hover-highlight" class="delete-option button-unstyled -hover-highlight"
type="button"
@click="deleteOption(index)" @click="deleteOption(index)"
> >
<FAIcon icon="times" /> <FAIcon icon="times" />
@ -32,6 +33,7 @@
<button <button
v-if="options.length < maxOptions" v-if="options.length < maxOptions"
class="add-option faint button-unstyled -hover-highlight" class="add-option faint button-unstyled -hover-highlight"
type="button"
@click="addOption" @click="addOption"
> >
<FAIcon <FAIcon

View file

@ -85,6 +85,7 @@ const PostStatusForm = {
'quoteId', 'quoteId',
'repliedUser', 'repliedUser',
'attentions', 'attentions',
'copyMessageLanguage',
'copyMessageScope', 'copyMessageScope',
'subject', 'subject',
'disableSubject', 'disableSubject',
@ -153,8 +154,7 @@ const PostStatusForm = {
statusText = buildMentionsString({ user: this.repliedUser, attentions: this.attentions }, currentUser) statusText = buildMentionsString({ user: this.repliedUser, attentions: this.attentions }, currentUser)
} }
const { postContentType: contentType, postLanguage: defaultPostLanguage, sensitiveByDefault, sensitiveIfSubject, interfaceLanguage, alwaysShowSubjectInput } = this.$store.getters.mergedConfig const { postContentType: contentType, sensitiveByDefault, sensitiveIfSubject, alwaysShowSubjectInput } = this.$store.getters.mergedConfig
const postLanguage = defaultPostLanguage || interfaceToISOLanguage(interfaceLanguage)
let statusParams = { let statusParams = {
spoilerText: this.subject || '', spoilerText: this.subject || '',
@ -165,7 +165,7 @@ const PostStatusForm = {
poll: {}, poll: {},
mediaDescriptions: {}, mediaDescriptions: {},
visibility: this.suggestedVisibility(), visibility: this.suggestedVisibility(),
language: postLanguage, language: this.suggestedLanguage(),
contentType contentType
} }
@ -180,7 +180,7 @@ const PostStatusForm = {
poll: this.statusPoll || {}, poll: this.statusPoll || {},
mediaDescriptions: this.statusMediaDescriptions || {}, mediaDescriptions: this.statusMediaDescriptions || {},
visibility: this.statusScope || this.suggestedVisibility(), visibility: this.statusScope || this.suggestedVisibility(),
language: this.statusLanguage || postLanguage, language: this.statusLanguage || this.suggestedLanguage(),
contentType: statusContentType contentType: statusContentType
} }
} }
@ -341,17 +341,22 @@ const PostStatusForm = {
this.saveDraft() this.saveDraft()
}, },
clearStatus () { clearStatus () {
const newStatus = this.newStatus const config = this.$store.getters.mergedConfig
this.newStatus = { this.newStatus = {
status: '', status: '',
spoilerText: '', spoilerText: '',
files: [], files: [],
visibility: newStatus.visibility, nsfw: !!config.sensitiveByDefault,
contentType: newStatus.contentType, visibility: this.suggestedVisibility(),
language: newStatus.language, contentType: config.postContentType,
language: this.suggestedLanguage(),
poll: {}, poll: {},
mediaDescriptions: {} mediaDescriptions: {}
} }
const scopeselector = this.$refs.scopeselector
if (scopeselector) {
scopeselector.currentScope = this.newStatus.visibility
}
this.pollFormVisible = false this.pollFormVisible = false
this.$refs.mediaUpload && this.$refs.mediaUpload.clearFile() this.$refs.mediaUpload && this.$refs.mediaUpload.clearFile()
this.clearPollForm() this.clearPollForm()
@ -760,6 +765,15 @@ const PostStatusForm = {
openProfileTab () { openProfileTab () {
this.$store.dispatch('openSettingsModalTab', 'profile') 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 () { suggestedVisibility () {
if (this.copyMessageScope) { if (this.copyMessageScope) {
if (this.copyMessageScope === 'direct') { if (this.copyMessageScope === 'direct') {

View file

@ -18,6 +18,7 @@
> >
<button <button
class="button-unstyled -link" class="button-unstyled -link"
type="button"
@click="openProfileTab" @click="openProfileTab"
> >
{{ $t('post_status.account_not_locked_warning_link') }} {{ $t('post_status.account_not_locked_warning_link') }}
@ -136,6 +137,7 @@
class="form-post-subject" class="form-post-subject"
@input="onSubjectInput" @input="onSubjectInput"
@focus="focusSubjectInput()" @focus="focusSubjectInput()"
@keydown.exact.enter.prevent
> >
</EmojiInput> </EmojiInput>
<i18n-t <i18n-t
@ -193,6 +195,7 @@
:class="{ 'visibility-tray-edit': isEdit }" :class="{ 'visibility-tray-edit': isEdit }"
> >
<scope-selector <scope-selector
ref="scopeselector"
v-if="!disableVisibilitySelector" v-if="!disableVisibilitySelector"
:user-default="userDefaultScope" :user-default="userDefaultScope"
:original-scope="copyMessageScope" :original-scope="copyMessageScope"
@ -272,6 +275,7 @@
<button <button
class="emoji-icon button-unstyled" class="emoji-icon button-unstyled"
:title="$t('emoji.add_emoji')" :title="$t('emoji.add_emoji')"
type="button"
@click="showEmojiPicker" @click="showEmojiPicker"
> >
<FAIcon icon="smile-beam" /> <FAIcon icon="smile-beam" />
@ -281,6 +285,7 @@
class="poll-icon button-unstyled" class="poll-icon button-unstyled"
:class="{ selected: pollFormVisible }" :class="{ selected: pollFormVisible }"
:title="$t('polls.add_poll')" :title="$t('polls.add_poll')"
type="button"
@click="togglePollForm" @click="togglePollForm"
> >
<FAIcon icon="poll-h" /> <FAIcon icon="poll-h" />
@ -290,6 +295,7 @@
class="spoiler-icon button-unstyled" class="spoiler-icon button-unstyled"
:class="{ selected: subjectVisible }" :class="{ selected: subjectVisible }"
:title="$t('post_status.toggle_content_warning')" :title="$t('post_status.toggle_content_warning')"
type="button"
@click="toggleSubjectVisible" @click="toggleSubjectVisible"
> >
<FAIcon icon="eye-slash" /> <FAIcon icon="eye-slash" />

View file

@ -519,6 +519,7 @@
:reply-to="status.id" :reply-to="status.id"
:attentions="status.attentions" :attentions="status.attentions"
:replied-user="status.user" :replied-user="status.user"
:copy-message-language="status.language"
:copy-message-scope="status.visibility" :copy-message-scope="status.visibility"
:subject="replySubject" :subject="replySubject"
@posted="toggleReplying" @posted="toggleReplying"
@ -533,6 +534,7 @@
:quote-id="status.id" :quote-id="status.id"
:attentions="[status.user]" :attentions="[status.user]"
:replied-user="status.user" :replied-user="status.user"
:copy-message-language="status.language"
:copy-message-scope="status.visibility" :copy-message-scope="status.visibility"
:subject="replySubject" :subject="replySubject"
@posted="toggleQuoting" @posted="toggleQuoting"

View file

@ -326,6 +326,7 @@ export const parseStatus = (data) => {
} }
output.pinned = data.pinned output.pinned = data.pinned
output.muted = data.muted output.muted = data.muted
output.language = data.language
} else { } else {
output.favorited = data.favorited output.favorited = data.favorited
output.fave_num = data.fave_num output.fave_num = data.fave_num