@saooti/octopus-sdk 31.0.11 → 31.0.12
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
CHANGED
package/package.json
CHANGED
|
@@ -267,18 +267,22 @@ export default defineComponent({
|
|
|
267
267
|
}
|
|
268
268
|
this.$emit('update:comment', updatedComment);
|
|
269
269
|
},
|
|
270
|
-
receiveCommentEvent(event: {type
|
|
270
|
+
receiveCommentEvent(event: {type: string; comment: CommentPodcast; oldStatus?:string }): void {
|
|
271
271
|
switch (event.type) {
|
|
272
272
|
case 'Create':this.newComment(event.comment, true);break;
|
|
273
273
|
case 'Update':
|
|
274
274
|
if (this.$refs.commentList) {
|
|
275
|
-
(this.$refs.commentList as InstanceType<typeof CommentList>).updateComment(
|
|
275
|
+
(this.$refs.commentList as InstanceType<typeof CommentList>).updateComment(event);
|
|
276
276
|
} else {
|
|
277
277
|
const updatedComment = this.comment;
|
|
278
|
+
let updatedStatus = "";
|
|
279
|
+
if (event.comment.status && event.comment.status !== event.oldStatus) {
|
|
280
|
+
updatedStatus = event.comment.status;
|
|
281
|
+
}
|
|
278
282
|
if(undefined !== updatedComment.relatedValidComments){
|
|
279
|
-
if ('Invalid' ===
|
|
283
|
+
if ('Invalid' ===updatedStatus) {
|
|
280
284
|
updatedComment.relatedValidComments -= 1;
|
|
281
|
-
} else if ('Valid' ===
|
|
285
|
+
} else if ('Valid' === updatedStatus) {
|
|
282
286
|
updatedComment.relatedValidComments += 1;
|
|
283
287
|
}
|
|
284
288
|
}
|
|
@@ -179,49 +179,37 @@ export default defineComponent({
|
|
|
179
179
|
}
|
|
180
180
|
this.comments.splice(index, 1);
|
|
181
181
|
},
|
|
182
|
-
updateComment(data: {type
|
|
182
|
+
updateComment(data: {type: string; comment: CommentPodcast; oldStatus?:string }): void {
|
|
183
183
|
if (this.commentIsNotInList(data.comment.commentIdReferer)){
|
|
184
184
|
const comItem = (this.$refs['comItem' + data.comment.commentIdReferer] as Array<InstanceType<typeof CommentItem>>)[0];
|
|
185
|
-
comItem.receiveCommentEvent(
|
|
185
|
+
comItem.receiveCommentEvent(data);
|
|
186
186
|
return;
|
|
187
187
|
}
|
|
188
|
+
const updatedStatus = data.comment.status;
|
|
188
189
|
const index = this.findCommentIndex(data.comment.comId);
|
|
189
190
|
if (-1 !== index) {
|
|
190
|
-
if ('Valid' !== data.status
|
|
191
|
-
(
|
|
192
|
-
) {
|
|
191
|
+
if ((!this.editRight && 'Valid' !== data.comment.status) ||
|
|
192
|
+
(this.editRight && this.status && this.status !== data.comment.status)) {
|
|
193
193
|
this.comments.splice(index, 1);
|
|
194
194
|
} else {
|
|
195
195
|
this.comments.splice(index, 1, data.comment);
|
|
196
196
|
}
|
|
197
|
-
}else if
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
break;
|
|
208
|
-
}
|
|
197
|
+
}else if((!this.editRight && 'Valid' === data.comment.status) ||
|
|
198
|
+
(this.editRight && !this.status) ||
|
|
199
|
+
(this.editRight && this.status && this.status === data.comment.status)){
|
|
200
|
+
let indexNewComment = 0;
|
|
201
|
+
for (let i = 0, len = this.comments.length; i < len; i++) {
|
|
202
|
+
if (
|
|
203
|
+
moment(this.comments[i].date).isBefore(moment(data.comment.date))
|
|
204
|
+
) {
|
|
205
|
+
indexNewComment = i;
|
|
206
|
+
break;
|
|
209
207
|
}
|
|
210
|
-
if (-1 !== indexNewComment) {
|
|
211
|
-
if (!this.status || this.status === data.status) {
|
|
212
|
-
this.comments.splice(indexNewComment, 0, data.comment);
|
|
213
|
-
} /* else {
|
|
214
|
-
this.comments.splice(indexNewComment, 1);
|
|
215
|
-
} */
|
|
216
|
-
} else if (!this.status || this.status === data.status) {
|
|
217
|
-
this.comments.push(data.comment);
|
|
218
|
-
}
|
|
219
|
-
} else if (!this.status || this.status === data.status) {
|
|
220
|
-
this.comments.unshift(data.comment);
|
|
221
208
|
}
|
|
209
|
+
this.comments.splice(indexNewComment, 0, data.comment);
|
|
222
210
|
}
|
|
223
|
-
if (this.comId && data.status) {
|
|
224
|
-
this.$emit('updateStatus', data.status);
|
|
211
|
+
if (this.comId && data.oldStatus!==data.comment.status) {
|
|
212
|
+
this.$emit('updateStatus', data.comment.status);
|
|
225
213
|
}
|
|
226
214
|
},
|
|
227
215
|
addNewComment(comment: CommentPodcast, myself = false): void {
|
|
@@ -129,20 +129,11 @@ export default defineComponent({
|
|
|
129
129
|
newComment(comment: CommentPodcast): void {
|
|
130
130
|
(this.$refs.commentList as InstanceType<typeof CommentListVue>).addNewComment(comment, true);
|
|
131
131
|
},
|
|
132
|
-
receiveCommentEvent(event: {type
|
|
132
|
+
receiveCommentEvent(event: {type: string; comment: CommentPodcast; oldStatus?:string }): void {
|
|
133
133
|
const commentList = (this.$refs.commentList as InstanceType<typeof CommentListVue>);
|
|
134
|
-
let statusUpdated = undefined;
|
|
135
134
|
switch (event.type) {
|
|
136
135
|
case 'Create':commentList.addNewComment(event.comment);break;
|
|
137
|
-
case 'Update':
|
|
138
|
-
if (event.comment.status !== event.oldStatus) {
|
|
139
|
-
statusUpdated = event.comment.status;
|
|
140
|
-
}
|
|
141
|
-
commentList.updateComment({
|
|
142
|
-
comment: event.comment,
|
|
143
|
-
status: statusUpdated,
|
|
144
|
-
});
|
|
145
|
-
break;
|
|
136
|
+
case 'Update':commentList.updateComment(event);break;
|
|
146
137
|
case 'Delete':commentList.deleteComment(event.comment);break;
|
|
147
138
|
default:break;
|
|
148
139
|
}
|
|
@@ -376,7 +376,7 @@ export default defineComponent({
|
|
|
376
376
|
this.$router.push('/');
|
|
377
377
|
}
|
|
378
378
|
},
|
|
379
|
-
receiveCommentEvent(event:{type
|
|
379
|
+
receiveCommentEvent(event:{type: string; comment: CommentPodcast; oldStatus?:string } ): void {
|
|
380
380
|
(this.$refs.commentSection as InstanceType<typeof CommentSectionVue>).receiveCommentEvent(event);
|
|
381
381
|
},
|
|
382
382
|
},
|