• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Freegle / iznik-nuxt3 / 6bd7579a-30c4-40ea-9a8a-1291e094e81e

01 Oct 2025 01:42PM UTC coverage: 34.694% (-9.9%) from 44.618%
6bd7579a-30c4-40ea-9a8a-1291e094e81e

push

circleci

edwh
MT: In /map, don't show the centre points for groups which are not supposed to show on the map.

1053 of 3928 branches covered (26.81%)

Branch coverage included in aggregate %.

2722 of 6953 relevant lines covered (39.15%)

37.76 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/components/ChatButton.vue
1
<template>
2
  <div v-if="userid !== myid" class="d-inline clickme">
3
    <slot>
4
      <b-button
5
        :size="size"
6
        :variant="variant"
7
        :class="btnClass + ' d-none d-sm-inline'"
8
        @click="gotoChat(true)"
9
      >
10
        <v-icon v-if="showIcon" icon="comments" />
11
        <span v-if="title" :class="titleClass">
12
          {{ title }}
13
        </span>
14
      </b-button>
15
      <b-button
16
        :size="size"
17
        :variant="variant"
18
        :class="btnClass + ' d-inline-block d-sm-none'"
19
        @click="gotoChat(false)"
20
      >
21
        <v-icon v-if="showIcon" icon="comments" />
22
        <span v-if="title" :class="titleClass">
23
          {{ title }}
24
        </span>
25
      </b-button>
26
    </slot>
27
  </div>
28
</template>
29
<script setup>
30
import { useChatStore } from '../stores/chat'
31
import { useMessageStore } from '../stores/message'
32
import { useMiscStore } from '~/stores/misc'
33
import { useRouter } from '#imports'
34
import { useMe } from '~/composables/useMe'
35

36
const props = defineProps({
×
37
  size: {
38
    type: String,
39
    required: false,
40
    default: null,
41
  },
42
  title: {
43
    type: String,
44
    required: false,
45
    default: null,
46
  },
47
  variant: {
48
    type: String,
49
    required: false,
50
    default: 'primary',
51
  },
52
  groupid: {
53
    type: Number,
54
    required: false,
55
    default: null,
56
  },
57
  userid: {
58
    type: Number,
59
    required: false,
60
    default: null,
61
  },
62
  chattype: {
63
    type: String,
64
    required: false,
65
    default: null,
66
  },
67
  showIcon: {
68
    type: Boolean,
69
    required: false,
70
    default: true,
71
  },
72
  btnClass: {
73
    type: String,
74
    required: false,
75
    default: null,
76
  },
77
  titleClass: {
78
    type: String,
79
    required: false,
80
    default: 'ml-1',
81
  },
82
})
83

84
const emit = defineEmits(['click', 'sent'])
×
85
const chatStore = useChatStore()
×
86
const messageStore = useMessageStore()
×
87
const miscStore = useMiscStore()
×
88
const router = useRouter()
×
89

90
// Use me and myid computed properties from useMe composable for consistency
91
const { me, myid } = useMe()
×
92

93
const gotoChat = () => {
×
94
  openChat(null, null, null)
×
95
}
96

97
const openChat = async (event, firstmessage, firstmsgid) => {
×
98
  emit('click')
×
99
  console.log(
×
100
    'Open chat',
101
    firstmessage,
102
    firstmsgid,
103
    props.groupid,
104
    props.userid
105
  )
106

107
  if (props.groupid > 0) {
×
108
    // Open a chat to the mods. If we are in FD then we just pass the group id and the chat opens from us to the
109
    // mods; if we're in MT we pass the groupid and userid and it opens from us mods to the user.
110
    const chatuserid = miscStore.modtools ? props.userid : 0
×
111
    const chatid = await chatStore.openChatToMods(props.groupid, chatuserid)
×
112

113
    router.push('/chats/' + chatid)
×
114
  } else if (props.userid > 0) {
×
115
    const chatid = await chatStore.openChatToUser({
×
116
      userid: props.userid,
117
      chattype: props.chattype,
118
    })
119

120
    if (chatid) {
×
121
      if (firstmessage) {
×
122
        console.log('First message to send', firstmessage)
×
123
        await chatStore.send(chatid, firstmessage, null, null, firstmsgid)
×
124

125
        console.log('Sent')
×
126

127
        if (firstmsgid) {
×
128
          // Update the message so that the reply count is updated. No need to wait.
129
          messageStore.fetch(firstmsgid, true)
×
130
        }
131

132
        // Refresh the message so that our reply will show.
133
        await chatStore.fetchMessages(chatid, true)
×
134

135
        emit('sent')
×
136
      }
137

138
      // set the flag on the store to let the chat know that a modal asking for
139
      // contact details should be opened as soon as the chat's loaded
140
      chatStore.showContactDetailsAskModal =
×
141
        me.value && !me.value.settings.mylocation
×
142

143
      // We may be called from within a profile modal. We want to skip the navigation guard which would otherwise
144
      // close the modal.
145
      router.push({
×
146
        name: 'chats-id',
147
        query: {
148
          noguard: true,
149
        },
150
        params: {
151
          id: chatid,
152
        },
153
      })
154
    }
155
  }
156
}
157

×
158
// Expose the openChat method so it can be called from parent components
159
defineExpose({
160
  openChat,
161
})
162
</script>
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc