aboutsummaryrefslogtreecommitdiff
path: root/src/components/mention_link/mention_link.vue
blob: 686ad27f9aa2805747828b6473823c519dc64f73 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<template>
  <span
    class="MentionLink"
  >
    <!-- eslint-disable vue/no-v-html -->
    <a
      v-if="!user"
      :href="url"
      class="original"
      target="_blank"
      v-html="content"
    /><!-- eslint-enable vue/no-v-html -->
    <Popover
      trigger="click"
      :bound-to="{ x: 'container'}"
      bound-to-selector=".column"
      popover-class="popover-default mention-popover"
      :disabled="!shouldShowTooltip"
    >
      <template v-slot:trigger>
        <span
          v-if="user"
          class="new"
          :style="style"
          :class="classnames"
        >
          <a
            class="short button-unstyled"
            :class="{ '-with-tooltip': shouldShowTooltip }"
            :href="url"
            @click.prevent="onClick"
          >
            <!-- eslint-disable vue/no-v-html -->
            <UserAvatar
              v-if="shouldShowAvatar"
              class="mention-avatar"
              :user="user"
            /><span
              class="shortName"
            ><FAIcon
              v-if="useAtIcon"
              size="sm"
              icon="at"
              class="at"
            />{{ !useAtIcon ? '@' : '' }}<span
              class="userName"
              v-html="userName"
            /><span
              v-if="shouldShowFullUserName"
              class="serverName"
              :class="{ '-faded': shouldFadeDomain }"
              v-html="'@' + serverName"
            />
            </span>
            <span
              v-if="isYou && shouldShowYous"
              :class="{ '-you': shouldBoldenYou }"
            > {{ ' ' + $t('status.you') }}</span>
            <!-- eslint-enable vue/no-v-html -->
          </a><span
            v-if="shouldShowTooltip"
            class="full"
          >
            <span
              class="userNameFull"
            >
              <!-- eslint-disable vue/no-v-html -->
              @<span
                class="userName"
                v-html="userName"
              /><span
                class="serverName"
                :class="{ '-faded': shouldFadeDomain }"
                v-html="'@' + serverName"
              />
              <!-- eslint-enable vue/no-v-html -->
            </span>
          </span>
        </span></template>
      <template v-slot:content>
        <UserCard
          class="mention-link-popover"
          :user-id="user.id"
          :hide-bio="true"
          :bordered="false"
          :allow-zooming-avatar="true"
          :rounded="true"
        />
      </template>
    </Popover>
  </span>
</template>

<script src="./mention_link.js"/>

<style lang="scss" src="./mention_link.scss"/>