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

abuse_report_app.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: 3c46de7c2be228d6626df292092e57fd49ce705a (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
<script>
import { GlAlert } from '@gitlab/ui';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import ReportHeader from './report_header.vue';
import UserDetails from './user_details.vue';
import ReportDetails from './report_details.vue';
import ReportedContent from './reported_content.vue';
import ActivityEventsList from './activity_events_list.vue';
import ActivityHistoryItem from './activity_history_item.vue';

const alertDefaults = {
  visible: false,
  variant: '',
  message: '',
};

export default {
  name: 'AbuseReportApp',
  components: {
    GlAlert,
    ReportHeader,
    UserDetails,
    ReportDetails,
    ReportedContent,
    ActivityEventsList,
    ActivityHistoryItem,
  },
  mixins: [glFeatureFlagsMixin()],
  props: {
    abuseReport: {
      type: Object,
      required: true,
    },
  },
  data() {
    return {
      alert: { ...alertDefaults },
    };
  },
  computed: {
    similarOpenReports() {
      return this.abuseReport.user?.similarOpenReports || [];
    },
  },
  methods: {
    showAlert(variant, message) {
      this.alert.visible = true;
      this.alert.variant = variant;
      this.alert.message = message;
    },
    closeAlert() {
      this.alert = { ...alertDefaults };
    },
  },
};
</script>

<template>
  <section>
    <gl-alert v-if="alert.visible" :variant="alert.variant" class="gl-mt-4" @dismiss="closeAlert">{{
      alert.message
    }}</gl-alert>

    <report-header
      v-if="abuseReport.user"
      :user="abuseReport.user"
      :report="abuseReport.report"
      @showAlert="showAlert"
    />
    <user-details v-if="abuseReport.user" :user="abuseReport.user" />

    <report-details
      v-if="glFeatures.abuseReportLabels"
      :report-id="abuseReport.report.globalId"
      class="gl-mt-6"
    />

    <reported-content :report="abuseReport.report" data-testid="reported-content" />

    <div
      v-for="report in similarOpenReports"
      :key="report.id"
      data-testid="reported-content-similar-open-reports"
    >
      <reported-content :report="report" />
    </div>

    <activity-events-list>
      <template #history-items>
        <activity-history-item :report="abuseReport.report" data-testid="activity" />
        <activity-history-item
          v-for="report in similarOpenReports"
          :key="report.id"
          :report="report"
          data-testid="activity-similar-open-reports"
        />
      </template>
    </activity-events-list>
  </section>
</template>