@saooti/octopus-sdk 30.0.16 → 30.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -1
- package/package.json +2 -2
- package/src/assets/bootstrap-diff.scss +1 -1
- package/src/assets/form.scss +3 -0
- package/src/assets/share.scss +17 -37
- package/src/components/display/comments/AddCommentModal.vue +35 -50
- package/src/components/display/comments/CommentBasicView.vue +96 -0
- package/src/components/display/comments/CommentInput.vue +22 -28
- package/src/components/display/comments/CommentItem.vue +56 -148
- package/src/components/display/comments/CommentList.vue +56 -112
- package/src/components/display/comments/CommentParentInfo.vue +17 -57
- package/src/components/display/comments/CommentPlayer.vue +2 -7
- package/src/components/display/comments/CommentSection.vue +9 -24
- package/src/components/display/edit/EditCommentBox.vue +123 -23
- package/src/components/display/filter/AdvancedSearch.vue +1 -1
- package/src/components/display/live/LiveList.vue +3 -3
- package/src/components/display/podcasts/PodcastImage.vue +1 -1
|
@@ -1,78 +1,27 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="d-flex flex-column mt-2 mb-1 item-comment">
|
|
3
|
-
<
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
"
|
|
10
|
-
class="recording-bg me-1 text-light p-1"
|
|
11
|
-
>{{ $t('Live') }}</b>
|
|
12
|
-
<b
|
|
13
|
-
v-if="editRight || comment.status == 'Valid'"
|
|
14
|
-
class="me-2"
|
|
15
|
-
>{{
|
|
16
|
-
comment.name
|
|
17
|
-
}}</b>
|
|
18
|
-
<template v-else>
|
|
19
|
-
<b
|
|
20
|
-
:id="'popover-comment' + comment.comId"
|
|
21
|
-
tabindex="-1"
|
|
22
|
-
class="mr-2 text-danger"
|
|
23
|
-
>{{
|
|
24
|
-
comment.name
|
|
25
|
-
}}</b>
|
|
26
|
-
<Popover
|
|
27
|
-
:target="'popover-comment' + comment.comId"
|
|
28
|
-
>
|
|
29
|
-
{{ $t('Comment waiting') }}
|
|
30
|
-
</Popover>
|
|
31
|
-
</template>
|
|
32
|
-
</template>
|
|
33
|
-
<template v-else>
|
|
34
|
-
<input
|
|
35
|
-
v-model="temporaryName"
|
|
36
|
-
class="form-input me-2 mb-2 width-auto"
|
|
37
|
-
type="text"
|
|
38
|
-
:class="{ 'border border-danger': temporaryName.length < 2 }"
|
|
39
|
-
>
|
|
40
|
-
</template>
|
|
41
|
-
<img
|
|
42
|
-
v-if="comment.certified"
|
|
43
|
-
class="icon-certified"
|
|
44
|
-
src="/img/certified.png"
|
|
45
|
-
:data-selenium="'certified-icon-' + seleniumFormat(comment.name)"
|
|
46
|
-
:title="$t('Certified account')"
|
|
47
|
-
>
|
|
48
|
-
<div class="me-2">
|
|
49
|
-
{{ date }}
|
|
50
|
-
</div>
|
|
51
|
-
<span
|
|
52
|
-
v-if="editRight"
|
|
53
|
-
:class="'status-' + comment.status"
|
|
54
|
-
:data-selenium="'status-comment-' + seleniumFormat(comment.name)"
|
|
55
|
-
/>
|
|
56
|
-
</div>
|
|
57
|
-
<template v-if="!isEditing">
|
|
58
|
-
<!-- eslint-disable vue/no-v-html -->
|
|
59
|
-
<div v-html="urlify(contentDisplay)" />
|
|
60
|
-
<!-- eslint-enable -->
|
|
61
|
-
<a
|
|
62
|
-
v-if="comment.content.length > 300"
|
|
63
|
-
class="c-hand font-italic"
|
|
64
|
-
@click="summary = !summary"
|
|
65
|
-
>{{ readMore }}</a>
|
|
66
|
-
</template>
|
|
3
|
+
<CommentBasicView
|
|
4
|
+
v-if="!isEditing"
|
|
5
|
+
:comment="comment"
|
|
6
|
+
:edit-right="editRight"
|
|
7
|
+
:recording-in-live="recordingInLive"
|
|
8
|
+
/>
|
|
67
9
|
<template v-else>
|
|
10
|
+
<input
|
|
11
|
+
v-model="temporaryName"
|
|
12
|
+
class="form-input me-2 mb-2 width-auto"
|
|
13
|
+
type="text"
|
|
14
|
+
:class="{ 'border border-danger': temporaryName.length < 2 }"
|
|
15
|
+
>
|
|
68
16
|
<textarea
|
|
69
17
|
v-model="temporaryContent"
|
|
18
|
+
:class="{ 'border border-danger': 0===temporaryContent.length }"
|
|
70
19
|
class="form-input"
|
|
71
20
|
type="text"
|
|
72
21
|
/>
|
|
73
22
|
<div class="d-flex justify-content-end">
|
|
74
23
|
<button
|
|
75
|
-
class="btn
|
|
24
|
+
class="btn m-1"
|
|
76
25
|
@click="isEditing = false"
|
|
77
26
|
>
|
|
78
27
|
{{ $t('Cancel') }}
|
|
@@ -86,12 +35,10 @@
|
|
|
86
35
|
</button>
|
|
87
36
|
</div>
|
|
88
37
|
</template>
|
|
89
|
-
<div
|
|
90
|
-
class="mb-0 d-flex align-items-center mt-1"
|
|
91
|
-
>
|
|
38
|
+
<div class="d-flex align-items-center mt-1">
|
|
92
39
|
<button
|
|
93
|
-
v-if="null === comment.commentIdReferer && 'Valid'
|
|
94
|
-
class="btn py-1 px-3
|
|
40
|
+
v-if="null === comment.commentIdReferer && 'Valid'=== comment.status"
|
|
41
|
+
class="btn primary-color py-1 px-3 me-2"
|
|
95
42
|
:data-selenium="'answer-button-comment-' + seleniumFormat(comment.name)"
|
|
96
43
|
@click="answerComment"
|
|
97
44
|
>
|
|
@@ -102,40 +49,29 @@
|
|
|
102
49
|
(!isFlat && comment.relatedComments) ||
|
|
103
50
|
(isFlat && comment.commentIdReferer)
|
|
104
51
|
"
|
|
105
|
-
|
|
106
|
-
class="primary-color c-hand d-flex align-items-center small-text input-no-outline"
|
|
107
|
-
type="button"
|
|
108
|
-
data-bs-toggle="collapse"
|
|
109
|
-
:data-bs-target="'#commentItemDetail'+comment.comId"
|
|
110
|
-
aria-expanded="false"
|
|
111
|
-
:aria-controls="'commentItemDetail'+comment.comId"
|
|
52
|
+
class="d-flex align-items-center small-text primary-color c-hand"
|
|
112
53
|
@click="collapseVisible=!collapseVisible"
|
|
113
54
|
>
|
|
114
|
-
<div
|
|
115
|
-
<
|
|
55
|
+
<div v-if="comment.relatedComments">
|
|
56
|
+
<template v-if="!collapseVisible">
|
|
116
57
|
{{ $t('Display answers', { nb: comment.relatedComments }) }}
|
|
117
58
|
<i v-if="editRight">{{
|
|
118
59
|
$t('(nb valid comment answers)', {
|
|
119
60
|
nb: comment.relatedValidComments,
|
|
120
61
|
})
|
|
121
62
|
}}</i>
|
|
122
|
-
</
|
|
123
|
-
<
|
|
124
|
-
{{ $t('In response to') }}
|
|
125
|
-
</div>
|
|
126
|
-
<span class="saooti-arrow_down" />
|
|
127
|
-
</div>
|
|
128
|
-
<div class="d-flex align-items-center when-opened">
|
|
129
|
-
<div v-if="comment.relatedComments">
|
|
63
|
+
</template>
|
|
64
|
+
<template v-else>
|
|
130
65
|
{{ $t('Hide answers') }}
|
|
131
|
-
</
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
<span
|
|
136
|
-
class="saooti-arrow_down arrow-transform me-2"
|
|
137
|
-
/>
|
|
66
|
+
</template>
|
|
67
|
+
</div>
|
|
68
|
+
<div v-else>
|
|
69
|
+
{{ $t('In response to') }}
|
|
138
70
|
</div>
|
|
71
|
+
<span
|
|
72
|
+
:class="collapseVisible? 'arrow-transform': ''"
|
|
73
|
+
class="saooti-arrow_down"
|
|
74
|
+
/>
|
|
139
75
|
</div>
|
|
140
76
|
<EditCommentBox
|
|
141
77
|
v-if="editRight"
|
|
@@ -148,11 +84,11 @@
|
|
|
148
84
|
/>
|
|
149
85
|
</div>
|
|
150
86
|
<div
|
|
151
|
-
|
|
152
|
-
|
|
87
|
+
v-if="collapseVisible"
|
|
88
|
+
class="ms-4"
|
|
153
89
|
>
|
|
154
90
|
<CommentInput
|
|
155
|
-
v-if="!isFlat || (isFlat && !comment.commentIdReferer)
|
|
91
|
+
v-if="!isFlat || (isFlat && !comment.commentIdReferer)"
|
|
156
92
|
v-model:knownIdentity="knownIdentity"
|
|
157
93
|
:focus="focus"
|
|
158
94
|
:podcast="podcast"
|
|
@@ -162,11 +98,12 @@
|
|
|
162
98
|
@newComment="newComment"
|
|
163
99
|
/>
|
|
164
100
|
<CommentParentInfo
|
|
165
|
-
v-if="isFlat && comment.commentIdReferer
|
|
101
|
+
v-if="isFlat && comment.commentIdReferer"
|
|
166
102
|
:com-id="comment.commentIdReferer"
|
|
103
|
+
:edit-right="editRight"
|
|
167
104
|
/>
|
|
168
105
|
<CommentList
|
|
169
|
-
v-if="comment.relatedComments
|
|
106
|
+
v-if="!isFlat && comment.relatedComments"
|
|
170
107
|
ref="commentList"
|
|
171
108
|
:podcast="podcast"
|
|
172
109
|
:fetch-conference="fetchConference"
|
|
@@ -184,10 +121,8 @@ import { displayMethods, selenium } from '../../mixins/functions';
|
|
|
184
121
|
import { CommentPodcast } from '@/store/class/general/comment';
|
|
185
122
|
import { Podcast } from '@/store/class/general/podcast';
|
|
186
123
|
import { Conference } from '@/store/class/conference/conference';
|
|
187
|
-
import
|
|
188
|
-
import Popover from '../../misc/Popover.vue';
|
|
124
|
+
import CommentBasicView from './CommentBasicView.vue';
|
|
189
125
|
import { defineComponent, defineAsyncComponent } from 'vue';
|
|
190
|
-
import EditBoxVue from '../edit/EditBox.vue';
|
|
191
126
|
const CommentInput = defineAsyncComponent(() => import('./CommentInput.vue'));
|
|
192
127
|
const CommentParentInfo = defineAsyncComponent(() => import('./CommentParentInfo.vue'));
|
|
193
128
|
const EditCommentBox = defineAsyncComponent(() => import('@/components/display/edit/EditCommentBox.vue'));
|
|
@@ -200,10 +135,11 @@ export default defineComponent({
|
|
|
200
135
|
CommentParentInfo,
|
|
201
136
|
EditCommentBox,
|
|
202
137
|
CommentList,
|
|
203
|
-
|
|
138
|
+
CommentBasicView
|
|
204
139
|
},
|
|
205
140
|
|
|
206
141
|
mixins:[displayMethods, selenium],
|
|
142
|
+
|
|
207
143
|
props: {
|
|
208
144
|
comment: { default: ()=>({}), type: Object as ()=>CommentPodcast },
|
|
209
145
|
podcast: { default: undefined, type: Object as ()=>Podcast },
|
|
@@ -211,11 +147,11 @@ export default defineComponent({
|
|
|
211
147
|
organisation: { default: undefined, type: String},
|
|
212
148
|
isFlat: { default: false, type: Boolean },
|
|
213
149
|
},
|
|
150
|
+
|
|
214
151
|
emits: ['deleteComment', 'updateComment', 'update:comment'],
|
|
215
152
|
|
|
216
153
|
data() {
|
|
217
154
|
return {
|
|
218
|
-
summary: true as boolean,
|
|
219
155
|
collapseVisible: false as boolean,
|
|
220
156
|
focus: false as boolean,
|
|
221
157
|
isEditing: false as boolean,
|
|
@@ -224,36 +160,19 @@ export default defineComponent({
|
|
|
224
160
|
};
|
|
225
161
|
},
|
|
226
162
|
computed: {
|
|
227
|
-
|
|
228
|
-
if (this.comment.date)
|
|
229
|
-
return moment(this.comment.date).format('D MMMM YYYY HH[h]mm');
|
|
230
|
-
return '';
|
|
231
|
-
},
|
|
232
|
-
limitContent(): string {
|
|
233
|
-
if (!this.comment.content) return '';
|
|
234
|
-
if (this.comment.content.length <= 300) return this.comment.content;
|
|
235
|
-
return this.comment.content.substring(0, 300) + '...';
|
|
236
|
-
},
|
|
237
|
-
readMore(): string {
|
|
238
|
-
if (this.summary) return this.$t('Read more').toString();
|
|
239
|
-
return this.$t('Read less').toString();
|
|
240
|
-
},
|
|
241
|
-
contentDisplay(): string {
|
|
242
|
-
if (this.summary) return this.limitContent;
|
|
243
|
-
return this.comment.content;
|
|
244
|
-
},
|
|
245
|
-
organisationId(): string|undefined {
|
|
163
|
+
myOrganisationId(): string|undefined {
|
|
246
164
|
return state.generalParameters.organisationId;
|
|
247
165
|
},
|
|
248
166
|
editRight(): boolean {
|
|
249
167
|
if (
|
|
250
168
|
(state.generalParameters.isCommments &&
|
|
251
169
|
((this.podcast &&
|
|
252
|
-
this.
|
|
253
|
-
this.
|
|
170
|
+
this.myOrganisationId === this.podcast.organisation.id) ||
|
|
171
|
+
this.myOrganisationId === this.organisation)) ||
|
|
254
172
|
state.generalParameters.isAdmin
|
|
255
|
-
)
|
|
173
|
+
){
|
|
256
174
|
return true;
|
|
175
|
+
}
|
|
257
176
|
return false;
|
|
258
177
|
},
|
|
259
178
|
knownIdentity: {
|
|
@@ -301,25 +220,19 @@ export default defineComponent({
|
|
|
301
220
|
}
|
|
302
221
|
},
|
|
303
222
|
editComment(): void {
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
}
|
|
307
|
-
if (this.comment.content && null !== this.comment.content) {
|
|
308
|
-
this.temporaryContent = this.comment.content;
|
|
309
|
-
}
|
|
223
|
+
this.temporaryName = this.comment.name && null !== this.comment.name ? this.comment.name : '';
|
|
224
|
+
this.temporaryContent = this.comment.content && null !== this.comment.content ? this.comment.content : '';
|
|
310
225
|
this.isEditing = true;
|
|
311
226
|
},
|
|
312
227
|
validEdit(): void {
|
|
313
228
|
const comment = this.comment;
|
|
314
229
|
comment.content = this.temporaryContent;
|
|
315
230
|
comment.name = this.temporaryName;
|
|
316
|
-
(this.$refs.editBox as InstanceType<typeof
|
|
231
|
+
(this.$refs.editBox as InstanceType<typeof EditCommentBox>).updateComment(comment);
|
|
317
232
|
},
|
|
318
233
|
updateStatus(data: string): void {
|
|
319
234
|
const updatedComment = this.comment;
|
|
320
|
-
if(undefined === updatedComment.relatedValidComments){
|
|
321
|
-
return;
|
|
322
|
-
}
|
|
235
|
+
if(undefined === updatedComment.relatedValidComments){return;}
|
|
323
236
|
if ('Valid' === data) {
|
|
324
237
|
updatedComment.relatedValidComments += 1;
|
|
325
238
|
} else {
|
|
@@ -329,9 +242,7 @@ export default defineComponent({
|
|
|
329
242
|
},
|
|
330
243
|
receiveCommentEvent(event: {type?: string; comment: CommentPodcast; status?: string; oldStatus?:string }): void {
|
|
331
244
|
switch (event.type) {
|
|
332
|
-
case 'Create':
|
|
333
|
-
this.newComment(event.comment, true);
|
|
334
|
-
break;
|
|
245
|
+
case 'Create':this.newComment(event.comment, true);break;
|
|
335
246
|
case 'Update':
|
|
336
247
|
if (this.$refs.commentList) {
|
|
337
248
|
(this.$refs.commentList as InstanceType<typeof CommentList>).updateComment({ comment: event.comment });
|
|
@@ -344,7 +255,6 @@ export default defineComponent({
|
|
|
344
255
|
updatedComment.relatedValidComments += 1;
|
|
345
256
|
}
|
|
346
257
|
}
|
|
347
|
-
|
|
348
258
|
this.$emit('update:comment', updatedComment);
|
|
349
259
|
}
|
|
350
260
|
break;
|
|
@@ -352,14 +262,14 @@ export default defineComponent({
|
|
|
352
262
|
if (this.$refs.commentList) {
|
|
353
263
|
(this.$refs.commentList as InstanceType<typeof CommentList>).deleteComment(event.comment);
|
|
354
264
|
} else {
|
|
355
|
-
const
|
|
356
|
-
if(undefined !==
|
|
357
|
-
|
|
265
|
+
const deletedComment = this.comment;
|
|
266
|
+
if(undefined !== deletedComment.relatedComments){
|
|
267
|
+
deletedComment.relatedComments -= 1;
|
|
358
268
|
}
|
|
359
|
-
if (undefined !==
|
|
360
|
-
|
|
269
|
+
if (undefined !== deletedComment.relatedValidComments && 'Valid' === event.comment.status) {
|
|
270
|
+
deletedComment.relatedValidComments -= 1;
|
|
361
271
|
}
|
|
362
|
-
this.$emit('update:comment',
|
|
272
|
+
this.$emit('update:comment', deletedComment);
|
|
363
273
|
}
|
|
364
274
|
break;
|
|
365
275
|
default:
|
|
@@ -369,5 +279,3 @@ export default defineComponent({
|
|
|
369
279
|
},
|
|
370
280
|
})
|
|
371
281
|
</script>
|
|
372
|
-
|
|
373
|
-
<style lang="scss"></style>
|
|
@@ -1,25 +1,14 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="d-flex flex-column mt-3">
|
|
3
|
-
<
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
<div class="spinner-border me-3" />
|
|
8
|
-
<h3 class="mt-2">
|
|
9
|
-
{{ $t('Loading content ...') }}
|
|
10
|
-
</h3>
|
|
11
|
-
</div>
|
|
12
|
-
<div
|
|
13
|
-
v-if="error"
|
|
14
|
-
class="text-danger align-self-center"
|
|
15
|
-
>
|
|
16
|
-
{{ $t('Comments loading error') }}
|
|
17
|
-
</div>
|
|
3
|
+
<ClassicLoading
|
|
4
|
+
:loading-text="loading?$t('Loading content ...'):undefined"
|
|
5
|
+
:error-text="error?$t(`Comments loading error`):undefined"
|
|
6
|
+
/>
|
|
18
7
|
<transition-group
|
|
19
|
-
v-show="
|
|
8
|
+
v-show="!loading"
|
|
20
9
|
tag="div"
|
|
21
10
|
name="comment-list"
|
|
22
|
-
class="
|
|
11
|
+
class="my-transition-list-comments"
|
|
23
12
|
>
|
|
24
13
|
<CommentItem
|
|
25
14
|
v-for="(c, indexCom) in comments"
|
|
@@ -35,12 +24,12 @@
|
|
|
35
24
|
/>
|
|
36
25
|
</transition-group>
|
|
37
26
|
<button
|
|
38
|
-
v-show="!allFetched &&
|
|
27
|
+
v-show="!allFetched && (!loading || 0!==first)"
|
|
39
28
|
class="btn btn-primary mt-2"
|
|
40
29
|
:class="comId ? 'align-self-start' : 'align-self-center'"
|
|
41
|
-
:disabled="
|
|
30
|
+
:disabled="loading"
|
|
42
31
|
:title="$t('See more comments')"
|
|
43
|
-
@click="
|
|
32
|
+
@click="fetchContent(false)"
|
|
44
33
|
>
|
|
45
34
|
{{ $t('See more comments') }}
|
|
46
35
|
</button>
|
|
@@ -48,10 +37,10 @@
|
|
|
48
37
|
</template>
|
|
49
38
|
|
|
50
39
|
<script lang="ts">
|
|
40
|
+
import ClassicLoading from '../../form/ClassicLoading.vue';
|
|
51
41
|
import { state } from '../../../store/paramStore';
|
|
52
42
|
import octopusApi from '@saooti/octopus-api';
|
|
53
43
|
import moment from 'moment';
|
|
54
|
-
|
|
55
44
|
import { Podcast } from '@/store/class/general/podcast';
|
|
56
45
|
import { Conference } from '@/store/class/conference/conference';
|
|
57
46
|
import { CommentPodcast } from '@/store/class/general/comment';
|
|
@@ -65,11 +54,10 @@ export default defineComponent({
|
|
|
65
54
|
|
|
66
55
|
components: {
|
|
67
56
|
CommentItem,
|
|
57
|
+
ClassicLoading
|
|
68
58
|
},
|
|
69
59
|
|
|
70
60
|
props: {
|
|
71
|
-
first: { default: 0, type: Number },
|
|
72
|
-
size: { default: 50, type: Number },
|
|
73
61
|
podcast: { default: undefined, type: Object as ()=>Podcast},
|
|
74
62
|
comId: { default: undefined, type: Number },
|
|
75
63
|
reload: { default: false, type: Boolean},
|
|
@@ -83,21 +71,19 @@ export default defineComponent({
|
|
|
83
71
|
data() {
|
|
84
72
|
return {
|
|
85
73
|
loading: true as boolean,
|
|
86
|
-
loaded: false as boolean,
|
|
87
74
|
error: false as boolean,
|
|
88
|
-
|
|
89
|
-
|
|
75
|
+
first:0 as number,
|
|
76
|
+
size: 20 as number,
|
|
90
77
|
totalCount: 0 as number,
|
|
91
78
|
comments: [] as Array<CommentPodcast>,
|
|
92
|
-
inFetching: false as boolean,
|
|
93
79
|
};
|
|
94
80
|
},
|
|
95
81
|
|
|
96
82
|
computed: {
|
|
97
83
|
allFetched(): boolean {
|
|
98
|
-
return this.
|
|
84
|
+
return this.first >= this.totalCount;
|
|
99
85
|
},
|
|
100
|
-
|
|
86
|
+
myOrganisationId(): string|undefined {
|
|
101
87
|
return state.generalParameters.organisationId;
|
|
102
88
|
},
|
|
103
89
|
podcastId(): number|undefined {
|
|
@@ -108,8 +94,8 @@ export default defineComponent({
|
|
|
108
94
|
if (
|
|
109
95
|
(state.generalParameters.isCommments &&
|
|
110
96
|
((this.podcast &&
|
|
111
|
-
this.
|
|
112
|
-
this.
|
|
97
|
+
this.myOrganisationId === this.podcast.organisation.id) ||
|
|
98
|
+
this.myOrganisationId === this.organisation)) ||
|
|
113
99
|
state.generalParameters.isAdmin
|
|
114
100
|
)
|
|
115
101
|
return true;
|
|
@@ -118,10 +104,10 @@ export default defineComponent({
|
|
|
118
104
|
},
|
|
119
105
|
watch: {
|
|
120
106
|
reload(): void {
|
|
121
|
-
this.fetchContent(
|
|
107
|
+
this.fetchContent();
|
|
122
108
|
},
|
|
123
109
|
status(): void {
|
|
124
|
-
this.fetchContent(
|
|
110
|
+
this.fetchContent();
|
|
125
111
|
},
|
|
126
112
|
comments: {
|
|
127
113
|
deep: true,
|
|
@@ -131,121 +117,85 @@ export default defineComponent({
|
|
|
131
117
|
},
|
|
132
118
|
},
|
|
133
119
|
created() {
|
|
134
|
-
this.fetchContent(
|
|
120
|
+
this.fetchContent();
|
|
135
121
|
},
|
|
136
122
|
methods: {
|
|
137
|
-
async fetchContent(reset
|
|
138
|
-
this.
|
|
139
|
-
|
|
123
|
+
async fetchContent(reset=true): Promise<void> {
|
|
124
|
+
this.loading = true;
|
|
125
|
+
if(reset){
|
|
126
|
+
this.first = 0;
|
|
127
|
+
}
|
|
140
128
|
let data;
|
|
141
129
|
try {
|
|
142
|
-
const param: FetchParam = {
|
|
143
|
-
first: this.dfirst,
|
|
144
|
-
size: this.dsize,
|
|
145
|
-
podcastId: this.podcastId,
|
|
146
|
-
};
|
|
147
|
-
if (!this.editRight) {
|
|
148
|
-
param.status = ['Valid'];
|
|
149
|
-
}else if(this.status){
|
|
150
|
-
param.status = [this.status];
|
|
151
|
-
}
|
|
152
|
-
if (undefined === this.podcastId) {
|
|
153
|
-
param.organisationId = this.organisation;
|
|
154
|
-
}
|
|
155
130
|
if (this.comId) {
|
|
156
|
-
data = await octopusApi.fetchCommentAnswers(this.comId, {first: this.
|
|
157
|
-
}
|
|
158
|
-
data = await octopusApi.fetchRootComments(param);
|
|
159
|
-
} else {
|
|
131
|
+
data = await octopusApi.fetchCommentAnswers(this.comId, {first: this.first,size: this.size});
|
|
132
|
+
}else{
|
|
160
133
|
const param: FetchParam = {
|
|
161
|
-
first: this.
|
|
162
|
-
size: this.
|
|
134
|
+
first: this.first,
|
|
135
|
+
size: this.size,
|
|
163
136
|
podcastId: this.podcastId,
|
|
137
|
+
status:this.editRight && this.status?[this.status]:['Valid'],
|
|
138
|
+
organisationId: undefined === this.podcastId? this.organisation: undefined,
|
|
164
139
|
};
|
|
165
|
-
if (!this.editRight) {
|
|
166
|
-
param.status = ['Valid'];
|
|
167
|
-
}else if(this.status){
|
|
168
|
-
param.status = [this.status];
|
|
169
|
-
}
|
|
170
|
-
if (undefined === this.podcastId) {
|
|
171
|
-
param.organisationId = this.organisation;
|
|
172
|
-
}
|
|
173
140
|
if (!this.isFlat) {
|
|
174
141
|
data = await octopusApi.fetchRootComments(param);
|
|
175
142
|
} else {
|
|
176
143
|
data = await octopusApi.fetchComments(param);
|
|
177
144
|
}
|
|
178
145
|
}
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
146
|
+
if(reset){
|
|
147
|
+
this.comments.length = 0;
|
|
148
|
+
}
|
|
182
149
|
this.totalCount = data.totalElements;
|
|
183
150
|
this.comments = this.comments.concat(data.content).filter((c: CommentPodcast) => {
|
|
184
151
|
return null !== c;
|
|
185
152
|
});
|
|
186
|
-
this.
|
|
187
|
-
} catch
|
|
188
|
-
this.loading = false;
|
|
153
|
+
this.first += this.size;
|
|
154
|
+
} catch {
|
|
189
155
|
this.error = true;
|
|
190
156
|
}
|
|
191
|
-
this.
|
|
157
|
+
this.loading = false;
|
|
192
158
|
},
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
this.loading = true;
|
|
198
|
-
this.loaded = false;
|
|
159
|
+
findCommentIndex(comId: number|undefined): number{
|
|
160
|
+
return this.comments.findIndex(
|
|
161
|
+
(element: CommentPodcast) => element.comId === comId
|
|
162
|
+
);
|
|
199
163
|
},
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
this.fetchContent(false);
|
|
164
|
+
commentIsNotInList(commentIdReferer:undefined|number):boolean{
|
|
165
|
+
return !this.isFlat && undefined!==commentIdReferer && this.comId !==commentIdReferer;
|
|
203
166
|
},
|
|
204
167
|
deleteComment(comment: CommentPodcast): void {
|
|
205
|
-
if (
|
|
206
|
-
!this.isFlat &&
|
|
207
|
-
comment.commentIdReferer &&
|
|
208
|
-
this.comId !== comment.commentIdReferer
|
|
209
|
-
) {
|
|
168
|
+
if (this.commentIsNotInList(comment.commentIdReferer)){
|
|
210
169
|
const comItem = (this.$refs['comItem' + comment.commentIdReferer] as InstanceType<typeof CommentItem>);
|
|
211
170
|
comItem.receiveCommentEvent({ type: 'Delete', comment: comment });
|
|
212
171
|
return;
|
|
213
172
|
}
|
|
214
|
-
const index = this.
|
|
215
|
-
(element: CommentPodcast) => element.comId === comment.comId
|
|
216
|
-
);
|
|
173
|
+
const index = this.findCommentIndex(comment.comId);
|
|
217
174
|
if (-1 === index) return;
|
|
218
175
|
this.totalCount -= 1;
|
|
219
|
-
if (0 !== this.
|
|
220
|
-
this.
|
|
221
|
-
}
|
|
176
|
+
/* if (0 !== this.first) {
|
|
177
|
+
this.first -= 1;
|
|
178
|
+
} */
|
|
222
179
|
this.comments.splice(index, 1);
|
|
223
180
|
},
|
|
224
181
|
updateComment(data: {type?: string; comment: CommentPodcast; status?: string; oldStatus?:string }): void {
|
|
225
|
-
if (
|
|
226
|
-
!this.isFlat &&
|
|
227
|
-
data.comment.commentIdReferer &&
|
|
228
|
-
this.comId !== data.comment.commentIdReferer
|
|
229
|
-
) {
|
|
182
|
+
if (this.commentIsNotInList(data.comment.commentIdReferer)){
|
|
230
183
|
const comItem = (this.$refs['comItem' + data.comment.commentIdReferer] as InstanceType<typeof CommentItem>);
|
|
231
184
|
comItem.receiveCommentEvent({ ...data, type: 'Update' });
|
|
232
185
|
return;
|
|
233
186
|
}
|
|
234
|
-
const index = this.
|
|
235
|
-
(element: CommentPodcast) => element.comId === data.comment.comId
|
|
236
|
-
);
|
|
187
|
+
const index = this.findCommentIndex(data.comment.comId);
|
|
237
188
|
if (-1 !== index) {
|
|
238
|
-
if (
|
|
239
|
-
'Valid' !== data.status &&
|
|
189
|
+
if ('Valid' !== data.status &&
|
|
240
190
|
(!this.editRight || (this.status && this.status !== data.status))
|
|
241
191
|
) {
|
|
242
192
|
this.comments.splice(index, 1);
|
|
243
193
|
} else {
|
|
244
194
|
this.comments.splice(index, 1, data.comment);
|
|
245
195
|
}
|
|
246
|
-
}
|
|
196
|
+
}else if (this.status === data.comment.status) {
|
|
247
197
|
this.comments.unshift(data.comment);
|
|
248
|
-
} else if ('Valid' === data.status
|
|
198
|
+
} else if ('Valid' === data.status) {
|
|
249
199
|
if (this.comments.length > 0) {
|
|
250
200
|
let indexNewComment = -1;
|
|
251
201
|
for (let i = 0, len = this.comments.length; i < len; i++) {
|
|
@@ -277,21 +227,15 @@ export default defineComponent({
|
|
|
277
227
|
if (!myself && !this.editRight && 'Valid' !== comment.status) {
|
|
278
228
|
return;
|
|
279
229
|
}
|
|
280
|
-
if (
|
|
281
|
-
!this.isFlat &&
|
|
282
|
-
comment.commentIdReferer &&
|
|
283
|
-
this.comId !== comment.commentIdReferer
|
|
284
|
-
) {
|
|
230
|
+
if (this.commentIsNotInList(comment.commentIdReferer)){
|
|
285
231
|
const comItem = (this.$refs['comItem' + comment.commentIdReferer] as InstanceType<typeof CommentItem>);
|
|
286
232
|
comItem.receiveCommentEvent({ type: 'Create', comment: comment });
|
|
287
233
|
return;
|
|
288
234
|
}
|
|
289
|
-
const index = this.
|
|
290
|
-
(element: CommentPodcast) => element.comId === comment.comId
|
|
291
|
-
);
|
|
235
|
+
const index = this.findCommentIndex(comment.comId);
|
|
292
236
|
if (-1 === index) {
|
|
293
237
|
this.totalCount += 1;
|
|
294
|
-
this.
|
|
238
|
+
/* this.first += 1; */
|
|
295
239
|
if (!this.status || this.status === comment.status) {
|
|
296
240
|
this.comments.unshift(comment);
|
|
297
241
|
}
|