logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe

direct_conversation_timeline_item.js (2389B)


      1 import DirectConversationAvatar from '../direct_conversation_avatar/direct_conversation_avatar.vue'
      2 import AvatarList from '../avatar_list/avatar_list.vue'
      3 import Timeago from '../timeago/timeago.vue'
      4 import DirectConversationTitle from '../direct_conversation_title/direct_conversation_title.vue'
      5 import fileType from 'src/services/file_type/file_type.service'
      6 
      7 const DirectConversationTimelineItem = {
      8   name: 'DirectConversationTimelineItem',
      9   props: [
     10     'statusoid',
     11     'conversation_recipients',
     12     'conversation_id',
     13     'unread'
     14   ],
     15   components: {
     16     DirectConversationAvatar,
     17     AvatarList,
     18     Timeago,
     19     DirectConversationTitle
     20   },
     21   data () {
     22     return {
     23       betterShadow: this.$store.state.interface.browserSupport.cssFilter
     24     }
     25   },
     26   computed: {
     27     author () {
     28       if (this.otherParticipants.length > 1) {
     29         return this.status.user.name_html
     30       }
     31     },
     32     otherParticipants () {
     33       if (this.conversation_recipients) {
     34         const currentUser = this.$store.state.users.currentUser
     35         const other = this.conversation_recipients.filter(recipient => recipient.id !== currentUser.id)
     36 
     37         return other
     38       } else {
     39         return []
     40       }
     41     },
     42     deleted () {
     43       return this.statusoid.deleted
     44     },
     45     currentUser () {
     46       return this.$store.state.users.currentUser
     47     },
     48     status () {
     49       return this.statusoid
     50     },
     51     attachmentInfo () {
     52       let types = this.status.attachments.map(file => fileType.fileType(file.mimetype))
     53       if (types.length === 0) { return }
     54       if (types.includes('video')) {
     55         return this.$t('direct_conversations.video')
     56       } else if (types.includes('audio')) {
     57         return this.$t('direct_conversations.audio')
     58       } else if (types.includes('image')) {
     59         return this.$t('direct_conversations.image')
     60       } else {
     61         return this.$t('direct_conversations.file')
     62       }
     63     },
     64     contentHtml () {
     65       if (!this.status.summary_html) {
     66         return this.status.statusnet_html
     67       }
     68       return this.status.summary_html + '<br />' + this.status.statusnet_html
     69     }
     70   },
     71   methods: {
     72     openConversation (_e) {
     73       if (this.conversation_id) {
     74         this.$router.push({ name: 'direct-conversation', params: { username: this.currentUser.screen_name, id: this.conversation_id } })
     75       }
     76     }
     77   }
     78 }
     79 
     80 export default DirectConversationTimelineItem