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

Freegle / iznik-nuxt3 / 99e3f760-c611-4bfd-88c0-b43b43faaba6

05 Dec 2025 11:02PM UTC coverage: 42.545% (+0.4%) from 42.1%
99e3f760-c611-4bfd-88c0-b43b43faaba6

push

circleci

actions-user
Auto-merge production to app-ci-fd (daily scheduled)

Automated merge from production branch after successful tests.

🤖 Automated by GitHub Actions

1890 of 4798 branches covered (39.39%)

Branch coverage included in aggregate %.

1 of 3 new or added lines in 1 file covered. (33.33%)

305 existing lines in 20 files now uncovered.

2376 of 5229 relevant lines covered (45.44%)

31.51 hits per line

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

32.14
/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)"
20✔
9
      >
10
        <v-icon v-if="showIcon" icon="comments" />
10!
11
        <span v-if="title" :class="titleClass">
10!
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✔
20
      >
21
        <v-icon v-if="showIcon" icon="comments" />
10!
22
        <span v-if="title" :class="titleClass">
10!
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({
20✔
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'])
20✔
85
const chatStore = useChatStore()
20✔
86
const messageStore = useMessageStore()
20✔
87
const miscStore = useMiscStore()
20✔
88
const router = useRouter()
20✔
89

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

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

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

UNCOV
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)
×
UNCOV
114
  } else if (props.userid > 0) {
×
UNCOV
115
    const chatid = await chatStore.openChatToUser({
×
116
      userid: props.userid,
117
      chattype: props.chattype,
118
    })
119

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

UNCOV
125
        console.log('Sent')
×
126

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

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

UNCOV
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
UNCOV
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.
UNCOV
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({
20✔
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