This commit is contained in:
Henry Jameson 2026-07-30 15:03:16 +03:00
commit ca4fa0da3e
4 changed files with 29 additions and 17 deletions

View file

@ -76,9 +76,7 @@ const ChatMessage = {
return !!this.message.user return !!this.message.user
}, },
authorId() { authorId() {
return this.isStatus return this.isStatus ? this.message.user.id : this.message.account_id
? this.message.user.id
: this.message.account_id
}, },
author() { author() {
return this.$store.getters.findUser(this.authorId) return this.$store.getters.findUser(this.authorId)

View file

@ -27,8 +27,8 @@ import {
readChat, readChat,
sendChatMessage, sendChatMessage,
} from 'src/api/chats.js' } from 'src/api/chats.js'
import { WSConnectionStatus } from 'src/api/websocket.js'
import { fetchConversation, fetchStatus } from 'src/api/public.js' import { fetchConversation, fetchStatus } from 'src/api/public.js'
import { WSConnectionStatus } from 'src/api/websocket.js'
import { library } from '@fortawesome/fontawesome-svg-core' import { library } from '@fortawesome/fontawesome-svg-core'
import { faChevronDown, faChevronLeft } from '@fortawesome/free-solid-svg-icons' import { faChevronDown, faChevronLeft } from '@fortawesome/free-solid-svg-icons'
@ -180,11 +180,20 @@ const Chat = {
}, },
$route: async function (newVal) { $route: async function (newVal) {
if (this.messagesIndex[newVal.params.statusId]) { if (this.messagesIndex[newVal.params.statusId]) {
const focused = document.getElementById(`chatmessage-${this.$route.params.statusId}`) const focused = document.getElementById(
`chatmessage-${this.$route.params.statusId}`,
)
if (focused?.getBoundingClientRect == null) return if (focused?.getBoundingClientRect == null) return
const bottomBoundary = window.innerHeight - this.$refs.footer.clientHeight const bottomBoundary =
const topBoundary = this.$refs.header.clientHeight + document.getElementById('nav').clientHeight window.innerHeight - this.$refs.footer.clientHeight
const margin = Number(window.getComputedStyle(this.$refs.messageList.$el).gap.replace('px','')) const topBoundary =
this.$refs.header.clientHeight +
document.getElementById('nav').clientHeight
const margin = Number(
window
.getComputedStyle(this.$refs.messageList.$el)
.gap.replace('px', ''),
)
const rect = focused.getBoundingClientRect() const rect = focused.getBoundingClientRect()
const scrollAmount = (() => { const scrollAmount = (() => {
@ -293,7 +302,9 @@ const Chat = {
if (this.isConversation) { if (this.isConversation) {
const [ const [
{ data: status }, { data: status },
{ data: { ancestors, descendants } } {
data: { ancestors, descendants },
},
] = await Promise.all([ ] = await Promise.all([
fetchStatus({ fetchStatus({
id: this.statusId, id: this.statusId,
@ -302,7 +313,7 @@ const Chat = {
fetchConversation({ fetchConversation({
id: this.statusId, id: this.statusId,
credentials: useOAuthStore().token, credentials: useOAuthStore().token,
}) }),
]) ])
messages = [...ancestors, status, ...descendants] messages = [...ancestors, status, ...descendants]
} else { } else {
@ -378,7 +389,7 @@ const Chat = {
const message = newMessages[i] const message = newMessages[i]
// Sanity check // Sanity check
if (!this.isConversation && (message.chat_id !== this.chat.id)) { if (!this.isConversation && message.chat_id !== this.chat.id) {
console.warn( console.warn(
`Chat message doesn't belong to current chat (id: ${this.chat.id})!!`, `Chat message doesn't belong to current chat (id: ${this.chat.id})!!`,
message, message,
@ -516,7 +527,10 @@ const Chat = {
// Event handlers // Event handlers
onPosted(data) { onPosted(data) {
this.explicitReplyStatus = null this.explicitReplyStatus = null
this.$router.push({ name: 'conversation2', params: { statusId: data.id } }) this.$router.push({
name: 'conversation2',
params: { statusId: data.id },
})
}, },
handleVisibilityChange() { handleVisibilityChange() {
this.$nextTick(() => { this.$nextTick(() => {

View file

@ -82,13 +82,13 @@ const ScopeSelector = {
changeVis(scope) { changeVis(scope) {
this.currentScope = scope this.currentScope = scope
this.$emit('change', scope) this.$emit('change', scope)
} },
}, },
watch: { watch: {
originalScope(newVal) { originalScope(newVal) {
this.currentScope = newVal this.currentScope = newVal
} },
} },
} }
export default ScopeSelector export default ScopeSelector

View file

@ -17,21 +17,21 @@ import {
faCheck, faCheck,
faChevronDown, faChevronDown,
faChevronRight, faChevronRight,
faComments,
faExternalLinkAlt, faExternalLinkAlt,
faEye, faEye,
faEyeSlash, faEyeSlash,
faHistory, faHistory,
faMinus, faMinus,
faPencil,
faPlus, faPlus,
faReply, faReply,
faRetweet, faRetweet,
faShareAlt, faShareAlt,
faStar, faStar,
faThumbtack, faThumbtack,
faPencil,
faTimes, faTimes,
faWrench, faWrench,
faComments,
} from '@fortawesome/free-solid-svg-icons' } from '@fortawesome/free-solid-svg-icons'
library.add( library.add(