Insert mentions automatically into reply content
This commit is contained in:
parent
001a578eb9
commit
968ebe07b2
1 changed files with 13 additions and 2 deletions
|
@ -92,6 +92,7 @@ import { Prop } from "vue-property-decorator"
|
||||||
import {
|
import {
|
||||||
Visibility,
|
Visibility,
|
||||||
VISIBILITY_MAP,
|
VISIBILITY_MAP,
|
||||||
|
Mention,
|
||||||
Post,
|
Post,
|
||||||
createPost,
|
createPost,
|
||||||
Attachment,
|
Attachment,
|
||||||
|
@ -132,8 +133,8 @@ export default class PostEditor extends Vue {
|
||||||
|
|
||||||
private store = setup(() => {
|
private store = setup(() => {
|
||||||
const { currentUser, ensureAuthToken } = useCurrentUser()
|
const { currentUser, ensureAuthToken } = useCurrentUser()
|
||||||
const { instance } = useInstanceInfo()
|
const { instance, getActorAddress } = useInstanceInfo()
|
||||||
return { currentUser, ensureAuthToken, instance }
|
return { currentUser, ensureAuthToken, instance, getActorAddress }
|
||||||
})
|
})
|
||||||
|
|
||||||
get author(): User | null {
|
get author(): User | null {
|
||||||
|
@ -141,6 +142,16 @@ export default class PostEditor extends Vue {
|
||||||
}
|
}
|
||||||
|
|
||||||
created() {
|
created() {
|
||||||
|
if (this.inReplyTo) {
|
||||||
|
const mentions: Mention[] = [
|
||||||
|
this.inReplyTo.account,
|
||||||
|
...this.inReplyTo.mentions,
|
||||||
|
]
|
||||||
|
this.content = mentions
|
||||||
|
.filter(mention => mention.id !== this.store.currentUser?.id)
|
||||||
|
.map(mention => "@" + this.store.getActorAddress(mention))
|
||||||
|
.join(" ")
|
||||||
|
}
|
||||||
if (this.inReplyTo && this.inReplyTo.visibility !== Visibility.Public) {
|
if (this.inReplyTo && this.inReplyTo.visibility !== Visibility.Public) {
|
||||||
this.visibility = Visibility.Direct
|
this.visibility = Visibility.Direct
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue