2026-01-06 17:32:22 +02:00
|
|
|
import { unescape as ldUnescape, uniqBy } from 'lodash'
|
2026-01-08 17:26:52 +02:00
|
|
|
|
2026-01-06 16:23:17 +02:00
|
|
|
import MentionLink from 'src/components/mention_link/mention_link.vue'
|
|
|
|
|
import MentionsLine from 'src/components/mentions_line/mentions_line.vue'
|
|
|
|
|
import RichContent from 'src/components/rich_content/rich_content.jsx'
|
|
|
|
|
import StatusActionButtons from 'src/components/status_action_buttons/status_action_buttons.vue'
|
|
|
|
|
import { muteFilterHits } from '../../services/status_parser/status_parser.js'
|
|
|
|
|
import {
|
|
|
|
|
highlightClass,
|
|
|
|
|
highlightStyle,
|
|
|
|
|
} from '../../services/user_highlighter/user_highlighter.js'
|
|
|
|
|
import AvatarList from '../avatar_list/avatar_list.vue'
|
|
|
|
|
import EmojiReactions from '../emoji_reactions/emoji_reactions.vue'
|
|
|
|
|
import PostStatusForm from '../post_status_form/post_status_form.vue'
|
|
|
|
|
import StatusContent from '../status_content/status_content.vue'
|
|
|
|
|
import StatusPopover from '../status_popover/status_popover.vue'
|
|
|
|
|
import Timeago from '../timeago/timeago.vue'
|
|
|
|
|
import UserAvatar from '../user_avatar/user_avatar.vue'
|
|
|
|
|
import UserLink from '../user_link/user_link.vue'
|
|
|
|
|
import UserListPopover from '../user_list_popover/user_list_popover.vue'
|
|
|
|
|
import UserPopover from '../user_popover/user_popover.vue'
|
2020-10-19 19:38:49 +03:00
|
|
|
|
2026-01-29 20:40:00 +02:00
|
|
|
import { useInstanceStore } from 'src/stores/instance.js'
|
2026-02-05 00:28:45 +02:00
|
|
|
import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js'
|
2026-03-24 21:42:22 +02:00
|
|
|
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
2026-02-13 13:59:00 +02:00
|
|
|
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
2026-03-06 15:21:30 +02:00
|
|
|
import { useUserHighlightStore } from 'src/stores/user_highlight.js'
|
2026-01-29 20:40:00 +02:00
|
|
|
|
|
|
|
|
import generateProfileLink from 'src/services/user_profile_link_generator/user_profile_link_generator'
|
|
|
|
|
|
2026-01-08 17:26:52 +02:00
|
|
|
import { library } from '@fortawesome/fontawesome-svg-core'
|
|
|
|
|
import {
|
|
|
|
|
faAngleDoubleRight,
|
|
|
|
|
faChevronDown,
|
|
|
|
|
faChevronUp,
|
|
|
|
|
faEllipsisH,
|
|
|
|
|
faEnvelope,
|
|
|
|
|
faEye,
|
|
|
|
|
faEyeSlash,
|
|
|
|
|
faGlobe,
|
|
|
|
|
faIgloo,
|
|
|
|
|
faLock,
|
|
|
|
|
faLockOpen,
|
|
|
|
|
faPlay,
|
|
|
|
|
faPlusSquare,
|
|
|
|
|
faReply,
|
|
|
|
|
faRetweet,
|
|
|
|
|
faSmileBeam,
|
|
|
|
|
faStar,
|
|
|
|
|
faThumbtack,
|
|
|
|
|
faTimes,
|
|
|
|
|
} from '@fortawesome/free-solid-svg-icons'
|
|
|
|
|
|
2020-10-19 19:38:49 +03:00
|
|
|
library.add(
|
|
|
|
|
faEnvelope,
|
2020-10-21 00:25:59 +03:00
|
|
|
faGlobe,
|
2025-06-18 17:49:40 +03:00
|
|
|
faIgloo,
|
2020-10-19 19:38:49 +03:00
|
|
|
faLock,
|
2020-10-21 00:28:24 +03:00
|
|
|
faLockOpen,
|
2020-10-19 19:38:49 +03:00
|
|
|
faTimes,
|
|
|
|
|
faRetweet,
|
|
|
|
|
faReply,
|
|
|
|
|
faPlusSquare,
|
|
|
|
|
faStar,
|
|
|
|
|
faSmileBeam,
|
|
|
|
|
faEllipsisH,
|
|
|
|
|
faEyeSlash,
|
|
|
|
|
faEye,
|
2021-08-07 00:33:06 -04:00
|
|
|
faThumbtack,
|
2021-08-07 11:59:10 -04:00
|
|
|
faChevronUp,
|
|
|
|
|
faChevronDown,
|
2023-11-09 15:03:21 -07:00
|
|
|
faAngleDoubleRight,
|
2026-01-06 16:22:52 +02:00
|
|
|
faPlay,
|
2020-10-19 19:38:49 +03:00
|
|
|
)
|
|
|
|
|
|
2026-01-06 16:22:52 +02:00
|
|
|
const camelCase = (name) => name.charAt(0).toUpperCase() + name.slice(1)
|
2021-09-16 00:29:14 -04:00
|
|
|
|
2026-01-06 16:22:52 +02:00
|
|
|
const controlledOrUncontrolledGetters = (list) =>
|
|
|
|
|
list.reduce((res, name) => {
|
|
|
|
|
const camelized = camelCase(name)
|
|
|
|
|
const toggle = `controlledToggle${camelized}`
|
|
|
|
|
const controlledName = `controlled${camelized}`
|
|
|
|
|
const uncontrolledName = `uncontrolled${camelized}`
|
|
|
|
|
res[name] = function () {
|
|
|
|
|
return (this.$data[toggle] !== undefined ||
|
|
|
|
|
this.$props[toggle] !== undefined) &&
|
|
|
|
|
this[toggle]
|
|
|
|
|
? this[controlledName]
|
|
|
|
|
: this[uncontrolledName]
|
|
|
|
|
}
|
|
|
|
|
return res
|
|
|
|
|
}, {})
|
2021-09-16 00:29:14 -04:00
|
|
|
|
|
|
|
|
const controlledOrUncontrolledToggle = (obj, name) => {
|
|
|
|
|
const camelized = camelCase(name)
|
|
|
|
|
const toggle = `controlledToggle${camelized}`
|
|
|
|
|
const uncontrolledName = `uncontrolled${camelized}`
|
|
|
|
|
if (obj[toggle]) {
|
|
|
|
|
obj[toggle]()
|
|
|
|
|
} else {
|
|
|
|
|
obj[uncontrolledName] = !obj[uncontrolledName]
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const controlledOrUncontrolledSet = (obj, name, val) => {
|
|
|
|
|
const camelized = camelCase(name)
|
|
|
|
|
const set = `controlledSet${camelized}`
|
|
|
|
|
const uncontrolledName = `uncontrolled${camelized}`
|
|
|
|
|
if (obj[set]) {
|
|
|
|
|
obj[set](val)
|
|
|
|
|
} else {
|
|
|
|
|
obj[uncontrolledName] = val
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-10-28 15:19:42 +02:00
|
|
|
const Status = {
|
2018-04-09 19:43:31 +03:00
|
|
|
name: 'Status',
|
2020-07-16 17:42:16 +03:00
|
|
|
components: {
|
|
|
|
|
PostStatusForm,
|
|
|
|
|
UserAvatar,
|
|
|
|
|
AvatarList,
|
|
|
|
|
Timeago,
|
|
|
|
|
StatusPopover,
|
|
|
|
|
UserListPopover,
|
|
|
|
|
EmojiReactions,
|
2021-06-07 18:39:51 +03:00
|
|
|
StatusContent,
|
2021-06-08 11:38:44 +03:00
|
|
|
RichContent,
|
2021-06-08 14:34:47 +03:00
|
|
|
MentionLink,
|
2022-06-13 13:45:04 +03:00
|
|
|
MentionsLine,
|
2022-08-29 18:46:41 -04:00
|
|
|
UserPopover,
|
2025-01-09 17:43:48 +02:00
|
|
|
UserLink,
|
2026-01-06 16:22:52 +02:00
|
|
|
StatusActionButtons,
|
2020-07-16 17:42:16 +03:00
|
|
|
},
|
2017-02-04 13:53:28 +01:00
|
|
|
props: [
|
|
|
|
|
'statusoid',
|
2026-02-15 21:31:52 +02:00
|
|
|
'replies',
|
|
|
|
|
|
2019-05-06 21:36:55 -04:00
|
|
|
'expandable',
|
2017-04-12 18:25:19 +03:00
|
|
|
'focused',
|
2017-05-31 11:47:18 +03:00
|
|
|
'highlight',
|
2017-06-04 23:58:15 +03:00
|
|
|
'compact',
|
2019-03-02 16:35:38 +00:00
|
|
|
'isPreview',
|
2018-04-09 19:43:31 +03:00
|
|
|
'noHeading',
|
2019-04-30 11:06:22 -04:00
|
|
|
'inlineExpanded',
|
2019-09-13 15:34:17 -04:00
|
|
|
'showPinned',
|
2019-11-25 12:25:01 -05:00
|
|
|
'inProfile',
|
2026-02-15 21:31:52 +02:00
|
|
|
'inConversation',
|
2023-07-13 00:37:57 -04:00
|
|
|
'inQuote',
|
2026-02-15 21:31:52 +02:00
|
|
|
'profileUserId',
|
2021-08-07 18:53:23 -04:00
|
|
|
'simpleTree',
|
2021-09-05 16:35:47 -04:00
|
|
|
'showOtherRepliesAsButton',
|
2026-02-15 21:31:52 +02:00
|
|
|
'dive',
|
2021-08-07 10:28:45 -04:00
|
|
|
|
2026-02-15 21:31:52 +02:00
|
|
|
'controlledThreadDisplayStatus',
|
|
|
|
|
'controlledToggleThreadDisplay',
|
2021-08-07 10:28:45 -04:00
|
|
|
'controlledShowingTall',
|
|
|
|
|
'controlledToggleShowingTall',
|
|
|
|
|
'controlledExpandingSubject',
|
|
|
|
|
'controlledToggleExpandingSubject',
|
|
|
|
|
'controlledShowingLongSubject',
|
2021-08-07 11:59:10 -04:00
|
|
|
'controlledToggleShowingLongSubject',
|
2021-09-16 00:29:14 -04:00
|
|
|
'controlledReplying',
|
|
|
|
|
'controlledToggleReplying',
|
|
|
|
|
'controlledMediaPlaying',
|
|
|
|
|
'controlledSetMediaPlaying',
|
2017-02-04 13:53:28 +01:00
|
|
|
],
|
2026-02-15 21:31:52 +02:00
|
|
|
emits: ['interacted', 'goto', 'toggleExpanded'],
|
2026-01-06 16:22:52 +02:00
|
|
|
data() {
|
2018-08-20 02:59:06 +01:00
|
|
|
return {
|
2021-09-16 00:29:14 -04:00
|
|
|
uncontrolledReplying: false,
|
2018-08-20 02:59:06 +01:00
|
|
|
unmuted: false,
|
|
|
|
|
userExpanded: false,
|
2021-09-16 00:29:14 -04:00
|
|
|
uncontrolledMediaPlaying: [],
|
2020-09-29 10:18:37 +00:00
|
|
|
suspendable: true,
|
2021-06-11 03:11:58 +03:00
|
|
|
error: null,
|
2023-07-13 00:37:57 -04:00
|
|
|
headTailLinks: null,
|
2026-01-06 16:22:52 +02:00
|
|
|
displayQuote: !this.inQuote,
|
2018-08-20 02:59:06 +01:00
|
|
|
}
|
|
|
|
|
},
|
2016-10-28 18:08:03 +02:00
|
|
|
computed: {
|
2021-09-16 00:29:14 -04:00
|
|
|
...controlledOrUncontrolledGetters(['replying', 'mediaPlaying']),
|
2026-01-06 16:22:52 +02:00
|
|
|
showReasonMutedThread() {
|
2020-05-25 23:38:31 +03:00
|
|
|
return (
|
2026-01-06 16:22:52 +02:00
|
|
|
(this.status.thread_muted ||
|
|
|
|
|
(this.status.reblog && this.status.reblog.thread_muted)) &&
|
|
|
|
|
!this.inConversation
|
|
|
|
|
)
|
2020-05-25 23:38:31 +03:00
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
repeaterClass() {
|
2018-06-18 11:36:58 +03:00
|
|
|
const user = this.statusoid.user
|
2018-06-19 16:17:50 +03:00
|
|
|
return highlightClass(user)
|
2018-06-18 11:36:58 +03:00
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
userClass() {
|
|
|
|
|
const user = this.retweet
|
|
|
|
|
? this.statusoid.retweeted_status.user
|
|
|
|
|
: this.statusoid.user
|
2018-06-19 16:17:50 +03:00
|
|
|
return highlightClass(user)
|
2018-06-18 11:36:58 +03:00
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
deleted() {
|
2018-12-05 00:15:08 +05:30
|
|
|
return this.statusoid.deleted
|
|
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
repeaterStyle() {
|
2018-06-18 11:36:58 +03:00
|
|
|
const user = this.statusoid.user
|
2026-03-06 15:21:30 +02:00
|
|
|
return highlightStyle(useUserHighlightStore().get(user.screen_name))
|
2018-06-18 11:36:58 +03:00
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
userStyle() {
|
2018-08-05 05:41:37 +03:00
|
|
|
if (this.noHeading) return
|
2026-01-06 16:22:52 +02:00
|
|
|
const user = this.retweet
|
|
|
|
|
? this.statusoid.retweeted_status.user
|
|
|
|
|
: this.statusoid.user
|
2026-03-06 15:21:30 +02:00
|
|
|
return highlightStyle(useUserHighlightStore().get(user.screen_name))
|
2018-04-25 17:35:25 +03:00
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
userProfileLink() {
|
|
|
|
|
return this.generateUserProfileLink(
|
|
|
|
|
this.status.user.id,
|
|
|
|
|
this.status.user.screen_name,
|
|
|
|
|
)
|
2019-01-22 23:57:51 +03:00
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
replyProfileLink() {
|
2019-01-22 23:57:51 +03:00
|
|
|
if (this.isReply) {
|
2026-01-06 16:22:52 +02:00
|
|
|
const user = this.$store.getters.findUser(
|
|
|
|
|
this.status.in_reply_to_user_id,
|
|
|
|
|
)
|
2021-06-10 13:01:00 +03:00
|
|
|
// FIXME Why user not found sometimes???
|
|
|
|
|
return user ? user.statusnet_profile_url : 'NOT_FOUND'
|
2019-01-22 23:57:51 +03:00
|
|
|
}
|
|
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
retweet() {
|
|
|
|
|
return !!this.statusoid.retweeted_status
|
|
|
|
|
},
|
|
|
|
|
retweeterUser() {
|
|
|
|
|
return this.statusoid.user
|
|
|
|
|
},
|
|
|
|
|
retweeter() {
|
|
|
|
|
return this.statusoid.user.name || this.statusoid.user.screen_name_ui
|
|
|
|
|
},
|
|
|
|
|
retweeterHtml() {
|
|
|
|
|
return this.statusoid.user.name
|
|
|
|
|
},
|
|
|
|
|
retweeterProfileLink() {
|
|
|
|
|
return this.generateUserProfileLink(
|
|
|
|
|
this.statusoid.user.id,
|
|
|
|
|
this.statusoid.user.screen_name,
|
|
|
|
|
)
|
|
|
|
|
},
|
|
|
|
|
status() {
|
2016-10-28 18:08:03 +02:00
|
|
|
if (this.retweet) {
|
|
|
|
|
return this.statusoid.retweeted_status
|
|
|
|
|
} else {
|
|
|
|
|
return this.statusoid
|
|
|
|
|
}
|
2016-11-06 20:45:26 +01:00
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
statusFromGlobalRepository() {
|
2019-04-09 11:45:33 -04:00
|
|
|
// NOTE: Consider to replace status with statusFromGlobalRepository
|
|
|
|
|
return this.$store.state.statuses.allStatusesObject[this.status.id]
|
|
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
loggedIn() {
|
2019-11-14 00:18:14 +02:00
|
|
|
return !!this.currentUser
|
2017-02-14 00:01:50 +01:00
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
muteFilterHits() {
|
2025-03-25 21:26:04 +02:00
|
|
|
return muteFilterHits(
|
2026-02-13 13:59:00 +02:00
|
|
|
Object.values(useSyncConfigStore().prefsStorage.simple.muteFilters),
|
2026-01-06 16:22:52 +02:00
|
|
|
this.status,
|
2025-03-25 21:26:04 +02:00
|
|
|
)
|
2017-04-09 15:53:23 +02:00
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
botStatus() {
|
2023-12-27 22:55:58 -05:00
|
|
|
return this.status.user.actor_type === 'Service'
|
2022-02-28 23:07:20 +03:00
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
showActorTypeIndicator() {
|
2023-12-27 22:54:44 -05:00
|
|
|
return !this.hideBotIndication
|
2022-03-21 20:39:56 +02:00
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
sensitiveStatus() {
|
2024-02-21 21:27:12 +03:00
|
|
|
return this.status.nsfw
|
|
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
mentionsLine() {
|
2021-08-14 21:55:38 +03:00
|
|
|
if (!this.headTailLinks) return []
|
2026-01-06 16:22:52 +02:00
|
|
|
const writtenSet = new Set(
|
|
|
|
|
this.headTailLinks.writtenMentions.map((_) => _.url),
|
|
|
|
|
)
|
|
|
|
|
return this.status.attentions
|
|
|
|
|
.filter((attn) => {
|
|
|
|
|
// no reply user
|
|
|
|
|
return (
|
|
|
|
|
attn.id !== this.status.in_reply_to_user_id &&
|
|
|
|
|
// no self-replies
|
|
|
|
|
attn.statusnet_profile_url !==
|
|
|
|
|
this.status.user.statusnet_profile_url &&
|
|
|
|
|
// don't include if mentions is written
|
|
|
|
|
!writtenSet.has(attn.statusnet_profile_url)
|
|
|
|
|
)
|
|
|
|
|
})
|
|
|
|
|
.map((attn) => ({
|
|
|
|
|
url: attn.statusnet_profile_url,
|
|
|
|
|
content: attn.screen_name,
|
|
|
|
|
userId: attn.id,
|
|
|
|
|
}))
|
|
|
|
|
},
|
|
|
|
|
hasMentionsLine() {
|
2021-06-10 12:08:31 +03:00
|
|
|
return this.mentionsLine.length > 0
|
2021-06-08 11:38:44 +03:00
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
muteReasons() {
|
2025-01-02 22:47:53 +02:00
|
|
|
return [
|
|
|
|
|
this.userIsMuted ? 'user' : null,
|
2025-01-27 17:53:34 +02:00
|
|
|
this.status.thread_muted ? 'thread' : null,
|
2026-01-06 16:22:52 +02:00
|
|
|
this.muteFilterHits.length > 0 ? 'filtered' : null,
|
|
|
|
|
this.muteBotStatuses && this.botStatus ? 'bot' : null,
|
|
|
|
|
this.muteSensitiveStatuses && this.sensitiveStatus ? 'nsfw' : null,
|
|
|
|
|
].filter((_) => _)
|
2025-01-02 22:47:53 +02:00
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
muteLocalized() {
|
2025-01-02 22:47:53 +02:00
|
|
|
if (this.muteReasons.length === 0) return null
|
|
|
|
|
const mainReason = () => {
|
|
|
|
|
switch (this.muteReasons[0]) {
|
2026-01-06 16:22:52 +02:00
|
|
|
case 'user':
|
|
|
|
|
return this.$t('status.muted_user')
|
|
|
|
|
case 'thread':
|
|
|
|
|
return this.$t('status.thread_muted')
|
2025-03-25 19:48:12 +02:00
|
|
|
case 'filtered':
|
2025-01-02 22:47:53 +02:00
|
|
|
return this.$t(
|
2025-03-25 19:48:12 +02:00
|
|
|
'status.muted_filters',
|
2025-01-02 22:47:53 +02:00
|
|
|
{
|
2025-03-25 19:48:12 +02:00
|
|
|
name: this.muteFilterHits[0].name,
|
2026-01-06 16:22:52 +02:00
|
|
|
filterMore: this.muteFilterHits.length - 1,
|
2025-01-02 22:47:53 +02:00
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
this.muteFilterHits.length,
|
2025-01-02 22:47:53 +02:00
|
|
|
)
|
2026-01-06 16:22:52 +02:00
|
|
|
case 'bot':
|
|
|
|
|
return this.$t('status.bot_muted')
|
|
|
|
|
case 'nsfw':
|
|
|
|
|
return this.$t('status.sensitive_muted')
|
2025-01-02 22:47:53 +02:00
|
|
|
}
|
|
|
|
|
}
|
2025-01-27 17:53:34 +02:00
|
|
|
if (this.muteReasons.length > 1) {
|
|
|
|
|
return this.$t(
|
|
|
|
|
'status.multi_reason_mute',
|
|
|
|
|
{
|
|
|
|
|
main: mainReason(),
|
2026-01-06 16:22:52 +02:00
|
|
|
numReasonsMore: this.muteReasons.length - 1,
|
2025-01-27 17:53:34 +02:00
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
this.muteReasons.length - 1,
|
2025-01-27 17:53:34 +02:00
|
|
|
)
|
|
|
|
|
} else {
|
|
|
|
|
return mainReason()
|
|
|
|
|
}
|
2025-01-02 22:47:53 +02:00
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
muted() {
|
2021-06-08 16:14:01 +03:00
|
|
|
if (this.statusoid.user.id === this.currentUser.id) return false
|
2025-01-02 22:47:53 +02:00
|
|
|
return !this.unmuted && !this.shouldNotMute && this.muteReasons.length > 0
|
2021-06-08 16:14:01 +03:00
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
userIsMuted() {
|
2021-01-11 19:40:35 +02:00
|
|
|
if (this.statusoid.user.id === this.currentUser.id) return false
|
2020-05-25 23:38:31 +03:00
|
|
|
const { status } = this
|
|
|
|
|
const { reblog } = status
|
|
|
|
|
const relationship = this.$store.getters.relationship(status.user.id)
|
2026-01-06 16:22:52 +02:00
|
|
|
const relationshipReblog =
|
|
|
|
|
reblog && this.$store.getters.relationship(reblog.user.id)
|
|
|
|
|
return (
|
|
|
|
|
(status.muted && !status.thread_muted) ||
|
2020-05-25 23:38:31 +03:00
|
|
|
// Reprööt of a muted post according to BE
|
2025-01-28 16:28:23 +02:00
|
|
|
(reblog && reblog.muted && !reblog.thread_muted) ||
|
2020-05-25 23:38:31 +03:00
|
|
|
// Muted user
|
|
|
|
|
relationship.muting ||
|
|
|
|
|
// Muted user of a reprööt
|
2021-06-08 16:14:01 +03:00
|
|
|
(relationshipReblog && relationshipReblog.muting)
|
2026-01-06 16:22:52 +02:00
|
|
|
)
|
2021-06-08 16:14:01 +03:00
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
shouldNotMute() {
|
2025-05-13 17:53:32 +03:00
|
|
|
if (this.isFocused) return true
|
2021-06-08 16:14:01 +03:00
|
|
|
const { status } = this
|
|
|
|
|
const { reblog } = status
|
|
|
|
|
return (
|
2026-01-06 16:22:52 +02:00
|
|
|
((this.inProfile &&
|
|
|
|
|
// Don't mute user's posts on user timeline (except reblogs)
|
|
|
|
|
((!reblog && status.user.id === this.profileUserId) ||
|
2020-05-25 23:38:31 +03:00
|
|
|
// Same as above but also allow self-reblogs
|
2026-01-06 16:22:52 +02:00
|
|
|
(reblog && reblog.user.id === this.profileUserId))) ||
|
|
|
|
|
// Don't mute statuses in muted conversation when said conversation is opened
|
|
|
|
|
(this.inConversation && status.thread_muted)) &&
|
2020-05-25 23:38:31 +03:00
|
|
|
// No excuses if post has muted words
|
2026-01-06 16:22:52 +02:00
|
|
|
!this.muteFilterHits.length > 0
|
|
|
|
|
)
|
2021-06-08 16:14:01 +03:00
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
hideMutedUsers() {
|
2021-06-08 16:14:01 +03:00
|
|
|
return this.mergedConfig.hideMutedPosts
|
|
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
hideMutedThreads() {
|
2021-06-08 16:14:01 +03:00
|
|
|
return this.mergedConfig.hideMutedThreads
|
2020-04-21 23:27:51 +03:00
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
hideFilteredStatuses() {
|
2019-09-29 22:33:15 +03:00
|
|
|
return this.mergedConfig.hideFilteredStatuses
|
2019-02-06 10:18:13 -08:00
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
hideWordFilteredPosts() {
|
2021-06-08 16:14:01 +03:00
|
|
|
return this.mergedConfig.hideWordFilteredPosts
|
|
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
hideStatus() {
|
|
|
|
|
return (
|
|
|
|
|
!this.shouldNotMute &&
|
|
|
|
|
((this.muted && this.hideFilteredStatuses) ||
|
|
|
|
|
(this.userIsMuted && this.hideMutedUsers) ||
|
|
|
|
|
(this.status.thread_muted && this.hideMutedThreads) ||
|
|
|
|
|
(this.muteFilterHits.length > 0 && this.hideWordFilteredPosts) ||
|
|
|
|
|
this.muteFilterHits.some((x) => x.hide))
|
2021-06-08 16:14:01 +03:00
|
|
|
)
|
2019-02-08 04:25:56 -08:00
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
isFocused() {
|
2017-04-12 18:25:19 +03:00
|
|
|
// retweet or root of an expanded conversation
|
2017-04-12 19:07:55 +03:00
|
|
|
if (this.focused) {
|
2017-04-12 18:25:19 +03:00
|
|
|
return true
|
2017-04-12 19:07:55 +03:00
|
|
|
} else if (!this.inConversation) {
|
2017-04-12 18:25:19 +03:00
|
|
|
return false
|
2017-04-12 19:07:55 +03:00
|
|
|
}
|
|
|
|
|
// use conversation highlight only when in conversation
|
|
|
|
|
return this.status.id === this.highlight
|
2018-04-09 19:43:31 +03:00
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
isReply() {
|
|
|
|
|
return !!(
|
|
|
|
|
this.status.in_reply_to_status_id && this.status.in_reply_to_user_id
|
|
|
|
|
)
|
2018-08-24 20:04:26 +01:00
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
replyToName() {
|
2019-03-09 01:34:15 +02:00
|
|
|
if (this.status.in_reply_to_screen_name) {
|
2019-01-24 20:27:20 +03:00
|
|
|
return this.status.in_reply_to_screen_name
|
2019-03-09 01:34:15 +02:00
|
|
|
} else {
|
2026-01-06 16:22:52 +02:00
|
|
|
const user = this.$store.getters.findUser(
|
|
|
|
|
this.status.in_reply_to_user_id,
|
|
|
|
|
)
|
2021-02-26 16:23:11 +02:00
|
|
|
return user && user.screen_name_ui
|
2019-01-22 23:57:51 +03:00
|
|
|
}
|
|
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
replySubject() {
|
2018-09-25 15:21:47 +03:00
|
|
|
if (!this.status.summary) return ''
|
2026-01-06 17:32:22 +02:00
|
|
|
const decodedSummary = ldUnescape(this.status.summary)
|
2019-09-29 22:33:15 +03:00
|
|
|
const behavior = this.mergedConfig.subjectLineBehavior
|
2019-02-08 08:25:53 -08:00
|
|
|
const startsWithRe = decodedSummary.match(/^re[: ]/i)
|
2019-07-07 00:54:17 +03:00
|
|
|
if ((behavior !== 'noop' && startsWithRe) || behavior === 'masto') {
|
2019-02-08 08:25:53 -08:00
|
|
|
return decodedSummary
|
2018-09-25 15:16:26 +03:00
|
|
|
} else if (behavior === 'email') {
|
2019-02-08 08:25:53 -08:00
|
|
|
return 're: '.concat(decodedSummary)
|
2018-09-25 15:16:26 +03:00
|
|
|
} else if (behavior === 'noop') {
|
|
|
|
|
return ''
|
2018-08-26 01:50:11 +01:00
|
|
|
}
|
|
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
combinedFavsAndRepeatsUsers() {
|
2019-04-09 11:45:33 -04:00
|
|
|
// Use the status from the global status repository since favs and repeats are saved in it
|
2019-05-01 17:33:56 +03:00
|
|
|
const combinedUsers = [].concat(
|
2019-04-29 22:36:39 +03:00
|
|
|
this.statusFromGlobalRepository.favoritedBy,
|
2026-01-06 16:22:52 +02:00
|
|
|
this.statusFromGlobalRepository.rebloggedBy,
|
2019-04-29 22:36:39 +03:00
|
|
|
)
|
2019-05-01 17:33:56 +03:00
|
|
|
return uniqBy(combinedUsers, 'id')
|
2019-04-04 12:56:13 -04:00
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
tags() {
|
|
|
|
|
return this.status.tags
|
|
|
|
|
.filter((tagObj) => Object.hasOwn(tagObj, 'name'))
|
|
|
|
|
.map((tagObj) => tagObj.name)
|
|
|
|
|
.join(' ')
|
2019-07-09 16:50:23 +03:00
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
hidePostStats() {
|
2019-09-29 22:33:15 +03:00
|
|
|
return this.mergedConfig.hidePostStats
|
|
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
shouldDisplayFavsAndRepeats() {
|
|
|
|
|
return (
|
|
|
|
|
!this.hidePostStats &&
|
|
|
|
|
this.isFocused &&
|
|
|
|
|
(this.combinedFavsAndRepeatsUsers.length > 0 ||
|
|
|
|
|
this.statusFromGlobalRepository.quotes_count)
|
|
|
|
|
)
|
2024-01-19 19:01:11 +01:00
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
muteBotStatuses() {
|
2022-02-28 23:07:20 +03:00
|
|
|
return this.mergedConfig.muteBotStatuses
|
|
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
muteSensitiveStatuses() {
|
2024-02-21 21:27:12 +03:00
|
|
|
return this.mergedConfig.muteSensitiveStatuses
|
|
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
hideBotIndication() {
|
2022-03-01 00:35:00 +03:00
|
|
|
return this.mergedConfig.hideBotIndication
|
|
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
currentUser() {
|
2020-09-29 10:18:37 +00:00
|
|
|
return this.$store.state.users.currentUser
|
|
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
mergedConfig() {
|
2026-03-24 21:42:22 +02:00
|
|
|
return useMergedConfigStore().mergedConfig
|
2020-09-29 10:18:37 +00:00
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
isSuspendable() {
|
2020-09-29 10:18:37 +00:00
|
|
|
return !this.replying && this.mediaPlaying.length === 0
|
2021-08-07 00:33:06 -04:00
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
inThreadForest() {
|
2021-08-07 00:33:06 -04:00
|
|
|
return !!this.controlledThreadDisplayStatus
|
|
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
threadShowing() {
|
2021-08-07 00:33:06 -04:00
|
|
|
return this.controlledThreadDisplayStatus === 'showing'
|
2022-03-22 20:42:29 +02:00
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
visibilityLocalized() {
|
2022-03-22 20:42:29 +02:00
|
|
|
return this.$i18n.t('general.scope_in_timeline.' + this.status.visibility)
|
2022-06-22 16:05:27 -04:00
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
isEdited() {
|
2022-06-22 16:05:27 -04:00
|
|
|
return this.status.edited_at !== null
|
|
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
editingAvailable() {
|
2026-02-05 00:28:45 +02:00
|
|
|
return useInstanceCapabilitiesStore().editingAvailable
|
2023-07-12 20:45:44 -04:00
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
hasVisibleQuote() {
|
2023-07-13 00:37:57 -04:00
|
|
|
return this.status.quote_url && this.status.quote_visible
|
|
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
hasInvisibleQuote() {
|
2023-07-13 00:37:57 -04:00
|
|
|
return this.status.quote_url && !this.status.quote_visible
|
|
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
quotedStatus() {
|
|
|
|
|
return this.status.quote_id
|
|
|
|
|
? this.$store.state.statuses.allStatusesObject[this.status.quote_id]
|
|
|
|
|
: undefined
|
2023-07-13 00:37:57 -04:00
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
shouldDisplayQuote() {
|
2023-07-13 00:37:57 -04:00
|
|
|
return this.quotedStatus && this.displayQuote
|
2023-11-09 15:03:21 -07:00
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
scrobblePresent() {
|
2024-03-25 23:34:19 +02:00
|
|
|
if (this.mergedConfig.hideScrobbles) return false
|
2025-10-07 06:48:17 +00:00
|
|
|
if (!this.status.user?.latestScrobble) return false
|
2024-03-25 23:34:19 +02:00
|
|
|
const value = this.mergedConfig.hideScrobblesAfter.match(/\d+/gs)[0]
|
|
|
|
|
const unit = this.mergedConfig.hideScrobblesAfter.match(/\D+/gs)[0]
|
|
|
|
|
let multiplier = 60 * 1000 // minutes is smallest unit
|
|
|
|
|
switch (unit) {
|
|
|
|
|
case 'm':
|
2024-04-28 18:56:10 +00:00
|
|
|
break
|
|
|
|
|
case 'h':
|
2024-03-25 23:34:19 +02:00
|
|
|
multiplier *= 60 // hour
|
|
|
|
|
break
|
|
|
|
|
case 'd':
|
|
|
|
|
multiplier *= 60 // hour
|
|
|
|
|
multiplier *= 24 // day
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
const maxAge = Number(value) * multiplier
|
|
|
|
|
const createdAt = Date.parse(this.status.user.latestScrobble.created_at)
|
|
|
|
|
const age = Date.now() - createdAt
|
|
|
|
|
if (age > maxAge) return false
|
|
|
|
|
return this.status.user.latestScrobble.artist
|
2023-11-09 15:03:21 -07:00
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
scrobble() {
|
2025-10-07 06:48:17 +00:00
|
|
|
return this.status.user?.latestScrobble
|
2026-01-06 16:22:52 +02:00
|
|
|
},
|
2016-10-28 18:08:03 +02:00
|
|
|
},
|
2016-11-03 16:59:27 +01:00
|
|
|
methods: {
|
2026-01-06 16:22:52 +02:00
|
|
|
visibilityIcon(visibility) {
|
2018-05-21 23:01:33 +01:00
|
|
|
switch (visibility) {
|
|
|
|
|
case 'private':
|
2020-10-19 19:38:49 +03:00
|
|
|
return 'lock'
|
2018-05-21 23:01:33 +01:00
|
|
|
case 'unlisted':
|
2020-10-21 00:28:24 +03:00
|
|
|
return 'lock-open'
|
2018-05-21 23:01:33 +01:00
|
|
|
case 'direct':
|
2020-10-19 19:38:49 +03:00
|
|
|
return 'envelope'
|
2025-06-18 17:49:40 +03:00
|
|
|
case 'local':
|
|
|
|
|
return 'igloo'
|
2018-05-21 23:01:33 +01:00
|
|
|
default:
|
2020-10-21 00:25:59 +03:00
|
|
|
return 'globe'
|
2018-05-20 18:28:01 +02:00
|
|
|
}
|
|
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
showError(error) {
|
2019-04-12 15:35:29 -04:00
|
|
|
this.error = error
|
2019-04-27 09:36:10 -04:00
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
clearError() {
|
2023-11-13 17:29:25 +02:00
|
|
|
this.$emit('interacted')
|
2019-04-27 09:36:10 -04:00
|
|
|
this.error = undefined
|
2019-04-12 15:35:29 -04:00
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
toggleReplying() {
|
2023-11-13 17:29:25 +02:00
|
|
|
this.$emit('interacted')
|
2023-04-06 14:15:57 -04:00
|
|
|
if (this.replying) {
|
|
|
|
|
this.$refs.postStatusForm.requestClose()
|
|
|
|
|
} else {
|
|
|
|
|
this.doToggleReplying()
|
|
|
|
|
}
|
|
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
doToggleReplying() {
|
2021-09-16 00:29:14 -04:00
|
|
|
controlledOrUncontrolledToggle(this, 'replying')
|
2017-02-04 13:53:28 +01:00
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
gotoOriginal(id) {
|
2017-11-14 08:55:21 +02:00
|
|
|
if (this.inConversation) {
|
2017-11-13 16:33:54 +02:00
|
|
|
this.$emit('goto', id)
|
|
|
|
|
}
|
2017-04-12 18:25:19 +03:00
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
toggleExpanded() {
|
2017-02-04 13:53:28 +01:00
|
|
|
this.$emit('toggleExpanded')
|
2017-02-14 00:01:50 +01:00
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
toggleMute() {
|
2017-02-14 00:01:50 +01:00
|
|
|
this.unmuted = !this.unmuted
|
2017-02-16 15:58:49 +01:00
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
toggleUserExpanded() {
|
2017-02-16 15:58:49 +01:00
|
|
|
this.userExpanded = !this.userExpanded
|
2017-06-07 17:58:24 +03:00
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
generateUserProfileLink(id, name) {
|
|
|
|
|
return generateProfileLink(
|
|
|
|
|
id,
|
|
|
|
|
name,
|
2026-01-29 00:49:26 +02:00
|
|
|
useInstanceStore().restrictedNicknames,
|
2026-01-06 16:22:52 +02:00
|
|
|
)
|
2020-09-29 10:18:37 +00:00
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
addMediaPlaying(id) {
|
|
|
|
|
controlledOrUncontrolledSet(
|
|
|
|
|
this,
|
|
|
|
|
'mediaPlaying',
|
|
|
|
|
this.mediaPlaying.concat(id),
|
|
|
|
|
)
|
2020-09-29 10:18:37 +00:00
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
removeMediaPlaying(id) {
|
|
|
|
|
controlledOrUncontrolledSet(
|
|
|
|
|
this,
|
|
|
|
|
'mediaPlaying',
|
|
|
|
|
this.mediaPlaying.filter((mediaId) => mediaId !== id),
|
|
|
|
|
)
|
2021-06-11 03:11:58 +03:00
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
setHeadTailLinks(headTailLinks) {
|
2021-06-11 03:11:58 +03:00
|
|
|
this.headTailLinks = headTailLinks
|
2021-08-07 00:33:06 -04:00
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
toggleThreadDisplay() {
|
2021-08-07 00:33:06 -04:00
|
|
|
this.controlledToggleThreadDisplay()
|
2021-08-07 18:53:23 -04:00
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
scrollIfHighlighted(highlightId) {
|
2025-05-13 17:54:12 +03:00
|
|
|
if (this.$el.getBoundingClientRect == null) return
|
2021-08-07 18:53:23 -04:00
|
|
|
const id = highlightId
|
2017-04-12 19:07:55 +03:00
|
|
|
if (this.status.id === id) {
|
2022-07-31 12:35:48 +03:00
|
|
|
const rect = this.$el.getBoundingClientRect()
|
2017-04-12 19:07:55 +03:00
|
|
|
if (rect.top < 100) {
|
2019-01-30 16:38:28 +02:00
|
|
|
// Post is above screen, match its top to screen top
|
|
|
|
|
window.scrollBy(0, rect.top - 100)
|
2026-01-06 16:22:52 +02:00
|
|
|
} else if (rect.height >= window.innerHeight - 50) {
|
2019-01-30 16:38:28 +02:00
|
|
|
// Post we want to see is taller than screen so match its top to screen top
|
|
|
|
|
window.scrollBy(0, rect.top - 100)
|
2017-06-04 23:58:15 +03:00
|
|
|
} else if (rect.bottom > window.innerHeight - 50) {
|
2019-01-30 16:38:28 +02:00
|
|
|
// Post is below screen, match its bottom to screen bottom
|
2017-06-04 23:58:15 +03:00
|
|
|
window.scrollBy(0, rect.bottom - window.innerHeight + 50)
|
2017-04-12 19:07:55 +03:00
|
|
|
}
|
2017-04-12 18:25:19 +03:00
|
|
|
}
|
2023-07-13 00:37:57 -04:00
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
toggleDisplayQuote() {
|
2023-07-13 00:37:57 -04:00
|
|
|
if (this.shouldDisplayQuote) {
|
|
|
|
|
this.displayQuote = false
|
|
|
|
|
} else if (!this.quotedStatus) {
|
2026-01-06 16:22:52 +02:00
|
|
|
this.$store.dispatch('fetchStatus', this.status.quote_id).then(() => {
|
|
|
|
|
this.displayQuote = true
|
|
|
|
|
})
|
2023-07-13 00:37:57 -04:00
|
|
|
} else {
|
|
|
|
|
this.displayQuote = true
|
|
|
|
|
}
|
2026-01-06 16:22:52 +02:00
|
|
|
},
|
2021-08-07 18:53:23 -04:00
|
|
|
},
|
|
|
|
|
watch: {
|
2022-07-31 12:35:48 +03:00
|
|
|
highlight: function (id) {
|
2021-08-07 18:53:23 -04:00
|
|
|
this.scrollIfHighlighted(id)
|
2019-06-24 05:19:43 -04:00
|
|
|
},
|
|
|
|
|
'status.repeat_num': function (num) {
|
2019-06-27 08:19:35 -04:00
|
|
|
// refetch repeats when repeat_num is changed in any way
|
2026-01-06 16:22:52 +02:00
|
|
|
if (
|
|
|
|
|
this.isFocused &&
|
|
|
|
|
this.statusFromGlobalRepository.rebloggedBy &&
|
|
|
|
|
this.statusFromGlobalRepository.rebloggedBy.length !== num
|
|
|
|
|
) {
|
2019-06-27 08:14:54 -04:00
|
|
|
this.$store.dispatch('fetchRepeats', this.status.id)
|
2019-06-24 05:19:43 -04:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
'status.fave_num': function (num) {
|
2019-06-27 08:19:35 -04:00
|
|
|
// refetch favs when fave_num is changed in any way
|
2026-01-06 16:22:52 +02:00
|
|
|
if (
|
|
|
|
|
this.isFocused &&
|
|
|
|
|
this.statusFromGlobalRepository.favoritedBy &&
|
|
|
|
|
this.statusFromGlobalRepository.favoritedBy.length !== num
|
|
|
|
|
) {
|
2019-06-27 08:14:54 -04:00
|
|
|
this.$store.dispatch('fetchFavs', this.status.id)
|
2019-06-24 05:19:43 -04:00
|
|
|
}
|
2020-09-29 10:18:37 +00:00
|
|
|
},
|
2022-07-31 12:35:48 +03:00
|
|
|
isSuspendable: function (val) {
|
2020-09-29 10:18:37 +00:00
|
|
|
this.suspendable = val
|
2026-01-06 16:22:52 +02:00
|
|
|
},
|
|
|
|
|
},
|
2016-10-28 15:19:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default Status
|