Merge branch 'users-statuses-pinia' into shigusegubu-themes3
This commit is contained in:
commit
aa41c6d2b7
5 changed files with 25 additions and 14 deletions
|
|
@ -1,4 +1,5 @@
|
|||
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
|
||||
|
|
@ -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
|
||||
// custom debounce to work. Lodash debounce does not return a promise.
|
||||
let suggestions = []
|
||||
|
|
@ -107,7 +108,7 @@ export const suggestUsers = ({ dispatch, state }) => {
|
|||
await debounceUserSearch(noPrefix)
|
||||
}
|
||||
|
||||
const newSuggestions = state.users.users
|
||||
const newSuggestions = [...useUsersStore().users.values()]
|
||||
.filter(
|
||||
(user) =>
|
||||
user.screen_name &&
|
||||
|
|
|
|||
|
|
@ -136,6 +136,9 @@ const Status = {
|
|||
status() {
|
||||
return this.statusoid ?? useStatusesStore().allStatuses.get(this.statusId)
|
||||
},
|
||||
repeatedStatus() {
|
||||
return useStatusesStore().allStatuses.get(this.status.retweeted_status.id)
|
||||
},
|
||||
repeater() {
|
||||
return useUsersStore().findUser(this.status.user.id)
|
||||
},
|
||||
|
|
@ -164,7 +167,7 @@ const Status = {
|
|||
userClass() {
|
||||
return highlightClass(this.user)
|
||||
},
|
||||
deleted() {
|
||||
isDeleted() {
|
||||
return this.status.deleted
|
||||
},
|
||||
repeaterStyle() {
|
||||
|
|
@ -184,11 +187,13 @@ const Status = {
|
|||
const user = useUsersStore().findUser(
|
||||
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
|
||||
},
|
||||
repeaterName() {
|
||||
|
|
@ -204,8 +209,8 @@ const Status = {
|
|||
)
|
||||
},
|
||||
mainStatus() {
|
||||
if (this.retweet) {
|
||||
return this.status.retweeted_status
|
||||
if (this.isRepeat) {
|
||||
return this.repeatedStatus
|
||||
} else {
|
||||
return this.status
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
<div class="status-container muted">
|
||||
<small class="status-username">
|
||||
<FAIcon
|
||||
v-if="muted && retweet"
|
||||
v-if="muted && isRepeat"
|
||||
class="fa-scale-110 fa-old-padding repeat-icon"
|
||||
icon="retweet"
|
||||
/>
|
||||
|
|
@ -47,7 +47,7 @@
|
|||
</template>
|
||||
<template v-else>
|
||||
<div
|
||||
v-if="retweet && !noHeading && !inConversation"
|
||||
v-if="isRepeat && !noHeading && !inConversation"
|
||||
:class="[repeaterClass, { highlighted: repeaterStyle }]"
|
||||
:style="[repeaterStyle]"
|
||||
class="status-container repeat-info"
|
||||
|
|
@ -91,8 +91,8 @@
|
|||
</div>
|
||||
|
||||
<div
|
||||
v-if="!deleted"
|
||||
:class="[userClass, { highlighted: userStyle, '-repeat': retweet && !inConversation }]"
|
||||
v-if="!isDeleted"
|
||||
:class="[userClass, { highlighted: userStyle, '-repeat': isRepeat && !inConversation }]"
|
||||
:style="[ userStyle ]"
|
||||
class="status-container"
|
||||
:data-tags="tags"
|
||||
|
|
@ -542,7 +542,7 @@
|
|||
ref="postStatusForm"
|
||||
class="reply-body"
|
||||
:closeable="true"
|
||||
:replied-status="status"
|
||||
:replied-status="mainStatus"
|
||||
@posted="closeReplyForm"
|
||||
@draft-done="closeReplyForm"
|
||||
@close-accepted="closeReplyForm"
|
||||
|
|
|
|||
|
|
@ -115,7 +115,6 @@ export const useStatusesStore = defineStore('statuses', {
|
|||
return addStatus(status)
|
||||
},
|
||||
retweet: (status) => {
|
||||
// RetweetedStatuses are never shown immediately
|
||||
if (status.retweeted_status) addStatus(status.retweeted_status)
|
||||
return addStatus(status)
|
||||
},
|
||||
|
|
@ -143,6 +142,11 @@ export const useStatusesStore = defineStore('statuses', {
|
|||
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
|
||||
|
||||
// implicit: if oldTimestamp is undefined this will still be false
|
||||
|
|
|
|||
|
|
@ -158,6 +158,7 @@ export const useTimelinesStore = defineStore('timelines', {
|
|||
timeline.newStatusCount = 0
|
||||
timeline.maxId = ''
|
||||
timeline.minId = ''
|
||||
timeline.flushMarker = 0
|
||||
},
|
||||
activatePersistents() {
|
||||
TIMELINES.forEach((name) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue