Welcome to mirror list, hosted at ThFree Co, Russian Federation.

user_details.vue « components « abuse_report « admin « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 0c32341652bc78e59993202ea651f4490f1f3899 (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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<script>
import { GlLink, GlSprintf } from '@gitlab/ui';
import { formatNumber } from '~/locale';
import TimeAgoTooltip from '~/vue_shared/components/time_ago_tooltip.vue';
import { USER_DETAILS_I18N } from '../constants';
import UserDetail from './user_detail.vue';

export default {
  name: 'UserDetails',
  components: {
    GlLink,
    GlSprintf,
    TimeAgoTooltip,
    UserDetail,
  },
  props: {
    user: {
      type: Object,
      required: true,
    },
  },
  computed: {
    verificationState() {
      return Object.entries(this.user.verificationState)
        .filter(([, v]) => v)
        .map(([k]) => this.$options.i18n.verificationMethods[k])
        .join(', ');
    },
    showSimilarRecords() {
      return this.user.creditCard.similarRecordsCount > 1;
    },
    similarRecordsCount() {
      return formatNumber(this.user.creditCard.similarRecordsCount);
    },
  },
  i18n: USER_DETAILS_I18N,
};
</script>

<template>
  <div class="gl-mt-6">
    <user-detail data-testid="created-at" :label="$options.i18n.createdAt">
      <time-ago-tooltip :time="user.createdAt" />
    </user-detail>

    <user-detail data-testid="email" :label="$options.i18n.email">
      <gl-link :href="`mailto:${user.email}`">{{ user.email }}</gl-link>
    </user-detail>

    <user-detail data-testid="plan" :label="$options.i18n.plan" :value="user.plan" />

    <user-detail
      data-testid="verification"
      :label="$options.i18n.verification"
      :value="verificationState"
    />

    <user-detail
      v-if="user.creditCard"
      data-testid="credit-card-verification"
      :label="$options.i18n.creditCard"
    >
      <gl-sprintf v-if="showSimilarRecords" :message="$options.i18n.similarRecords">
        <template #cardMatchesLink="{ content }">
          <gl-link :href="user.creditCard.cardMatchesLink">
            <gl-sprintf :message="content">
              <template #count>{{ similarRecordsCount }}</template>
            </gl-sprintf>
          </gl-link>
        </template>
      </gl-sprintf>
    </user-detail>

    <user-detail
      v-if="user.pastClosedReports.length"
      data-testid="past-closed-reports"
      :label="$options.i18n.pastReports"
    >
      <div
        v-for="(report, index) in user.pastClosedReports"
        :key="index"
        :data-testid="`past-report-${index}`"
      >
        <gl-sprintf :message="$options.i18n.reportedFor">
          <template #reportLink="{ content }">
            <gl-link :href="report.reportPath">{{ content }}</gl-link>
          </template>
          <template #category>{{ report.category }}</template>
          <template #timeAgo>
            <time-ago-tooltip :time="report.createdAt" />
          </template>
        </gl-sprintf>
      </div>
    </user-detail>

    <user-detail
      data-testid="normal-location"
      :label="$options.i18n.normalLocation"
      :value="user.mostUsedIp || user.lastSignInIp"
    />

    <user-detail
      data-testid="last-sign-in-ip"
      :label="$options.i18n.lastSignInIp"
      :value="user.lastSignInIp"
    />

    <user-detail
      data-testid="user-snippets-count"
      :label="$options.i18n.snippets"
      :value="$options.i18n.snippetsCount(user.snippetsCount)"
    />

    <user-detail
      data-testid="user-groups-count"
      :label="$options.i18n.groups"
      :value="$options.i18n.groupsCount(user.groupsCount)"
    />

    <user-detail
      data-testid="user-notes-count"
      :label="$options.i18n.notes"
      :value="$options.i18n.notesCount(user.notesCount)"
    />
  </div>
</template>