Merge branch 'chat-refactor' into shigusegubu-themes3

This commit is contained in:
Henry Jameson 2026-07-23 16:48:52 +03:00
commit b687c355d0
8 changed files with 62 additions and 69 deletions

View file

@ -64,25 +64,27 @@ const ChatMessage = {
Timeago, Timeago,
}, },
computed: { computed: {
isMessage() {
return this.chatItem.type === 'message'
},
message() {
if (!this.isMessage) return null
return this.chatItem.data.retweeted_status ?? this.chatItem.data
},
isStatus() { isStatus() {
// ChatMessage only has account_id while Status has full user data // ChatMessage only has account_id while Status has full user data
return !!this.message.user return !!this.message.user
}, },
author() { author() {
const accountId = this.message.account_id || this.message.user.id const accountId = this.isStatus ? this.message.user.id : this.message.account_id
return this.$store.getters.findUser(accountId) return this.$store.getters.findUser(accountId)
}, },
isCurrentUser() { isCurrentUser() {
return this.author.id === this.currentUser.id return this.author.id === this.currentUser.id
}, },
message() {
if (!this.isMessage) return null // Reply stuff
return this.chatItem.data.retweeted_status ?? this.chatItem.data
},
isMessage() {
return this.chatItem.type === 'message'
},
isCustomReply() { isCustomReply() {
if (!this.previousItem) return false if (!this.previousItem) return false
if (!this.message.in_reply_to_status_id) return false if (!this.message.in_reply_to_status_id) return false
@ -116,6 +118,8 @@ const ChatMessage = {
return user ? user.statusnet_profile_url : 'NOT_FOUND' return user ? user.statusnet_profile_url : 'NOT_FOUND'
} }
}, },
// Quote stuff
quoteId() { quoteId() {
return this.message.quote_id return this.message.quote_id
}, },
@ -125,6 +129,8 @@ const ChatMessage = {
quoteVisible() { quoteVisible() {
return this.message.quote_visible return this.message.quote_visible
}, },
// Content
messageForStatusContent() { messageForStatusContent() {
return { return {
...this.message, ...this.message,
@ -137,6 +143,8 @@ const ChatMessage = {
hasAttachment() { hasAttachment() {
return this.message.attachments.length > 0 return this.message.attachments.length > 0
}, },
// Stylistic
classnames() { classnames() {
return { return {
'-outgoing': this.isCurrentUser, '-outgoing': this.isCurrentUser,
@ -145,13 +153,6 @@ const ChatMessage = {
'-focused': this.focused, '-focused': this.focused,
} }
}, },
...mapPiniaState(useInterfaceStore, {
betterShadow: (store) => store.browserSupport.cssFilter,
}),
...mapState({
currentUser: (state) => state.users.currentUser,
restrictedNicknames: (state) => useInstanceStore().restrictedNicknames,
}),
popoverMarginStyle() { popoverMarginStyle() {
if (this.isCurrentUser) { if (this.isCurrentUser) {
return {} return {}
@ -159,7 +160,16 @@ const ChatMessage = {
return { left: 50 } return { left: 50 }
} }
}, },
...mapPiniaState(useMergedConfigStore, ['mergedConfig', 'findUser']),
// Global stuff
...mapPiniaState(useInterfaceStore, {
betterShadow: (store) => store.browserSupport.cssFilter,
}),
...mapState({
currentUser: (state) => state.users.currentUser,
restrictedNicknames: (state) => useInstanceStore().restrictedNicknames,
}),
...mapPiniaState(useMergedConfigStore, ['mergedConfig']),
}, },
data() { data() {
return { return {

View file

@ -145,8 +145,12 @@
:full-content="true" :full-content="true"
> >
<template #footer> <template #footer>
<EmojiReactions :status="message" /> <EmojiReactions
v-if="isStatus"
:status="message"
/>
<Quote <Quote
v-if="isStatus"
class="quoted-post" class="quoted-post"
:status-id="quoteId" :status-id="quoteId"
:status-url="quoteUrl" :status-url="quoteUrl"

View file

@ -343,6 +343,8 @@ const Chat = {
accountId: this.recipientId, accountId: this.recipientId,
credentials: useOAuthStore().token, credentials: useOAuthStore().token,
}) })
this.$store.commit('addNewUsers', [data.account])
data.account = this.$store.getters.findUser(data.account.id)
this.chat = data this.chat = data
} catch (e) { } catch (e) {
console.error('Error creating or getting a chat', e) console.error('Error creating or getting a chat', e)

View file

@ -93,38 +93,18 @@
} }
} }
.auto-reply-to-section {
margin: 0 1em;
gap: 0.5em;
h4 {
margin: 0.5em 0;
line-height: 1.1;
button {
line-height: 1.1;
}
}
.reply-to-preview {
display: flex;
align-items: center;
gap: 0.5em;
border: 1px solid var(--border);
border-radius: var(--roundness);
padding: 0.5em;
}
}
.chat-view-reply-form { .chat-view-reply-form {
position: sticky; position: sticky;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: stretch; align-items: stretch;
bottom: 0; bottom: 0;
padding: 0;
}
.reply-form form { .reply-to-text {
margin-top: 0; line-height: 1.2;
} padding-top: 0.5em;
margin-bottom: -0.5em;
} }
} }

View file

@ -219,7 +219,7 @@
class="chat-view-reply-form panel-footer -flexible-height" class="chat-view-reply-form panel-footer -flexible-height"
> >
<div class="auto-reply-to-section"> <div class="auto-reply-to-section">
<span class="reply-to-text"> <center class="reply-to-text">
{{ explicitReplyStatus ? $t('status.reply_to_selected') : $t('status.reply_to_last') }} {{ explicitReplyStatus ? $t('status.reply_to_selected') : $t('status.reply_to_last') }}
<button <button
v-if="explicitReplyStatus" v-if="explicitReplyStatus"
@ -229,7 +229,7 @@
<FAIcon icon="times" /> <FAIcon icon="times" />
{{ $t('general.cancel') }} {{ $t('general.cancel') }}
</button> </button>
</span> </center>
</div> </div>
<PostStatusForm <PostStatusForm
class="reply-form" class="reply-form"
@ -242,6 +242,8 @@
:preserve-focus="!mobileLayout" :preserve-focus="!mobileLayout"
:auto-focus="!mobileLayout" :auto-focus="!mobileLayout"
disable-quotes disable-quotes
disable-lock-warning
disable-notice
mentions-line mentions-line
mentions-line-read-only mentions-line-read-only
@posted="onPosted" @posted="onPosted"

View file

@ -1,6 +1,20 @@
.post-status-form { .post-status-form {
position: relative; position: relative;
form {
display: flex;
flex-direction: column;
padding: 0.5em;
position: relative;
gap: 0.25em;
}
.form-group {
display: flex;
flex-direction: column;
line-height: 1.85;
}
.attachments { .attachments {
margin-bottom: 0.5em; margin-bottom: 0.5em;
} }
@ -16,7 +30,6 @@
.form-bottom { .form-bottom {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
padding: 0.5em 0.5em 0.25em;
height: 2.5em; height: 2.5em;
.post-button-group { .post-button-group {
@ -42,11 +55,11 @@
.form-bottom-left { .form-bottom-left {
display: flex; display: flex;
gap: 1.5em; gap: 1.5em;
margin-right: 1em; margin: 0 0.5em;
button { button {
padding: 0.5em; padding: 0.25em;
margin: -0.5em; margin: -0.25em;
} }
} }
@ -190,20 +203,6 @@
cursor: not-allowed; cursor: not-allowed;
} }
form {
display: flex;
flex-direction: column;
margin: 0.6em;
position: relative;
}
.form-group {
display: flex;
flex-direction: column;
padding: 0.25em 0.5em 0.5em;
line-height: 1.85;
}
.inputs-wrapper { .inputs-wrapper {
padding: 0; padding: 0;
display: flex; display: flex;
@ -212,9 +211,7 @@
.keyboard-enter-hint { .keyboard-enter-hint {
text-align: right; text-align: right;
margin-right: 1em;
line-height: 1; line-height: 1;
margin-bottom: 0.5em;
} }
textarea.input.form-post-body { textarea.input.form-post-body {

View file

@ -74,7 +74,7 @@
</a> </a>
</p> </p>
<p <p
v-else-if="newStatus.visibility === 'direct'" v-else-if="!hideScopeNotice && newStatus.visibility === 'direct'"
class="visibility-notice notice-dismissible" class="visibility-notice notice-dismissible"
> >
<span v-if="safeDMEnabled">{{ $t('post_status.direct_warning_to_first_only') }}</span> <span v-if="safeDMEnabled">{{ $t('post_status.direct_warning_to_first_only') }}</span>

View file

@ -39,9 +39,7 @@
} }
.post-status-form { .post-status-form {
form { margin: 0.5em;
margin-top: 0;
}
} }
.signed-in { .signed-in {