organize things a bit
This commit is contained in:
parent
08ad92c53d
commit
33c94665a1
1 changed files with 26 additions and 16 deletions
|
|
@ -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 {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue