Merge branch 'users-statuses-pinia' into shigusegubu-themes3

This commit is contained in:
Henry Jameson 2026-08-21 16:19:44 +03:00
commit aa41c6d2b7
5 changed files with 25 additions and 14 deletions

View file

@ -1,4 +1,5 @@
import { useSearchStore } from 'src/stores/search.js' import { useSearchStore } from 'src/stores/search.js'
import { useUsersStore } from 'src/stores/users.js'
/** /**
* suggest - generates a suggestor function to be used by emoji-input * suggest - generates a suggestor function to be used by emoji-input
@ -71,7 +72,7 @@ export const suggestEmoji = (emojis) => (input, nameKeywordLocalizer) => {
}) })
} }
export const suggestUsers = ({ dispatch, state }) => { export const suggestUsers = () => {
// Keep some persistent values in closure, most importantly for the // Keep some persistent values in closure, most importantly for the
// custom debounce to work. Lodash debounce does not return a promise. // custom debounce to work. Lodash debounce does not return a promise.
let suggestions = [] let suggestions = []
@ -107,7 +108,7 @@ export const suggestUsers = ({ dispatch, state }) => {
await debounceUserSearch(noPrefix) await debounceUserSearch(noPrefix)
} }
const newSuggestions = state.users.users const newSuggestions = [...useUsersStore().users.values()]
.filter( .filter(
(user) => (user) =>
user.screen_name && user.screen_name &&

View file

@ -136,6 +136,9 @@ const Status = {
status() { status() {
return this.statusoid ?? useStatusesStore().allStatuses.get(this.statusId) return this.statusoid ?? useStatusesStore().allStatuses.get(this.statusId)
}, },
repeatedStatus() {
return useStatusesStore().allStatuses.get(this.status.retweeted_status.id)
},
repeater() { repeater() {
return useUsersStore().findUser(this.status.user.id) return useUsersStore().findUser(this.status.user.id)
}, },
@ -164,7 +167,7 @@ const Status = {
userClass() { userClass() {
return highlightClass(this.user) return highlightClass(this.user)
}, },
deleted() { isDeleted() {
return this.status.deleted return this.status.deleted
}, },
repeaterStyle() { repeaterStyle() {
@ -184,11 +187,13 @@ const Status = {
const user = useUsersStore().findUser( const user = useUsersStore().findUser(
this.mainStatus.in_reply_to_user_id, this.mainStatus.in_reply_to_user_id,
) )
// FIXME Why user not found sometimes???
return user ? user.statusnet_profile_url : 'NOT_FOUND' // User referenced in post might not be yet present in store
// since their data is not included in status data
return user?.statusnet_profile_url
} }
}, },
retweet() { isRepeat() {
return !!this.status.retweeted_status return !!this.status.retweeted_status
}, },
repeaterName() { repeaterName() {
@ -204,8 +209,8 @@ const Status = {
) )
}, },
mainStatus() { mainStatus() {
if (this.retweet) { if (this.isRepeat) {
return this.status.retweeted_status return this.repeatedStatus
} else { } else {
return this.status return this.status
} }

View file

@ -22,7 +22,7 @@
<div class="status-container muted"> <div class="status-container muted">
<small class="status-username"> <small class="status-username">
<FAIcon <FAIcon
v-if="muted && retweet" v-if="muted && isRepeat"
class="fa-scale-110 fa-old-padding repeat-icon" class="fa-scale-110 fa-old-padding repeat-icon"
icon="retweet" icon="retweet"
/> />
@ -47,7 +47,7 @@
</template> </template>
<template v-else> <template v-else>
<div <div
v-if="retweet && !noHeading && !inConversation" v-if="isRepeat && !noHeading && !inConversation"
:class="[repeaterClass, { highlighted: repeaterStyle }]" :class="[repeaterClass, { highlighted: repeaterStyle }]"
:style="[repeaterStyle]" :style="[repeaterStyle]"
class="status-container repeat-info" class="status-container repeat-info"
@ -91,8 +91,8 @@
</div> </div>
<div <div
v-if="!deleted" v-if="!isDeleted"
:class="[userClass, { highlighted: userStyle, '-repeat': retweet && !inConversation }]" :class="[userClass, { highlighted: userStyle, '-repeat': isRepeat && !inConversation }]"
:style="[ userStyle ]" :style="[ userStyle ]"
class="status-container" class="status-container"
:data-tags="tags" :data-tags="tags"
@ -542,7 +542,7 @@
ref="postStatusForm" ref="postStatusForm"
class="reply-body" class="reply-body"
:closeable="true" :closeable="true"
:replied-status="status" :replied-status="mainStatus"
@posted="closeReplyForm" @posted="closeReplyForm"
@draft-done="closeReplyForm" @draft-done="closeReplyForm"
@close-accepted="closeReplyForm" @close-accepted="closeReplyForm"

View file

@ -115,7 +115,6 @@ export const useStatusesStore = defineStore('statuses', {
return addStatus(status) return addStatus(status)
}, },
retweet: (status) => { retweet: (status) => {
// RetweetedStatuses are never shown immediately
if (status.retweeted_status) addStatus(status.retweeted_status) if (status.retweeted_status) addStatus(status.retweeted_status)
return addStatus(status) return addStatus(status)
}, },
@ -143,6 +142,11 @@ export const useStatusesStore = defineStore('statuses', {
timestamp, timestamp,
}) })
const { in_reply_to_user_id } = status
if (in_reply_to_user_id) {
useUsersStore().fetchUserIfMissing({ id: in_reply_to_user_id })
}
existing.user = user // reactive update in case we return old existing.user = user // reactive update in case we return old
// implicit: if oldTimestamp is undefined this will still be false // implicit: if oldTimestamp is undefined this will still be false

View file

@ -158,6 +158,7 @@ export const useTimelinesStore = defineStore('timelines', {
timeline.newStatusCount = 0 timeline.newStatusCount = 0
timeline.maxId = '' timeline.maxId = ''
timeline.minId = '' timeline.minId = ''
timeline.flushMarker = 0
}, },
activatePersistents() { activatePersistents() {
TIMELINES.forEach((name) => { TIMELINES.forEach((name) => {