diff --git a/src/components/emoji_input/suggestor.js b/src/components/emoji_input/suggestor.js index 6a7dbff9a..72e376648 100644 --- a/src/components/emoji_input/suggestor.js +++ b/src/components/emoji_input/suggestor.js @@ -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 && diff --git a/src/components/status/status.js b/src/components/status/status.js index 8230b0917..749e0a12e 100644 --- a/src/components/status/status.js +++ b/src/components/status/status.js @@ -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 } diff --git a/src/components/status/status.vue b/src/components/status/status.vue index a42432f25..f0b2f1277 100644 --- a/src/components/status/status.vue +++ b/src/components/status/status.vue @@ -22,7 +22,7 @@
@@ -47,7 +47,7 @@