@meltwater/conversations-api-services 1.0.9 → 1.0.10
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/package.json
CHANGED
|
@@ -330,7 +330,7 @@ export class TikTokApiClient {
|
|
|
330
330
|
}
|
|
331
331
|
}
|
|
332
332
|
|
|
333
|
-
async toggleHide(document) {
|
|
333
|
+
async toggleHide(document, parentDoc = undefined) {
|
|
334
334
|
const {
|
|
335
335
|
documentId,
|
|
336
336
|
appData: { hidden: hiddenOnNative },
|
|
@@ -339,9 +339,9 @@ export class TikTokApiClient {
|
|
|
339
339
|
let response;
|
|
340
340
|
try {
|
|
341
341
|
if (hiddenOnNative) {
|
|
342
|
-
response = await this.hide(document);
|
|
342
|
+
response = await this.hide(document, parentDoc);
|
|
343
343
|
} else {
|
|
344
|
-
response = await this.unhide(document);
|
|
344
|
+
response = await this.unhide(document, parentDoc);
|
|
345
345
|
}
|
|
346
346
|
logger.info(
|
|
347
347
|
`Native Tiktok API Hide Response for documentId ${documentId}`,
|
|
@@ -406,14 +406,21 @@ export class TikTokApiClient {
|
|
|
406
406
|
return publishedMessage;
|
|
407
407
|
}
|
|
408
408
|
|
|
409
|
-
async hide(document) {
|
|
409
|
+
async hide(document, parentDoc = undefined) {
|
|
410
410
|
const {
|
|
411
411
|
metaData: {
|
|
412
412
|
externalId: comment_id,
|
|
413
413
|
source: { id: sourceId },
|
|
414
|
-
|
|
414
|
+
discussionType,
|
|
415
415
|
},
|
|
416
416
|
} = document;
|
|
417
|
+
|
|
418
|
+
//very small chance we get externalid instead of id
|
|
419
|
+
const video_id =
|
|
420
|
+
discussionType === 're'
|
|
421
|
+
? (parentDoc.metaData.inReplyTo.id ? parentDoc.metaData.inReplyTo.id : parentDoc.metaData.inReplyTo.externalId)
|
|
422
|
+
: (document.metaData.inReplyTo.id ? document.metaData.inReplyTo.id : document.metaData.inReplyTo.externalId);
|
|
423
|
+
|
|
417
424
|
const { body: publishedMessage } =
|
|
418
425
|
(await this.sendPost({
|
|
419
426
|
paramString: 'comment/hide/',
|
|
@@ -428,14 +435,20 @@ export class TikTokApiClient {
|
|
|
428
435
|
return publishedMessage;
|
|
429
436
|
}
|
|
430
437
|
|
|
431
|
-
async unhide(document) {
|
|
438
|
+
async unhide(document, parentDoc = undefined) {
|
|
432
439
|
const {
|
|
433
440
|
metaData: {
|
|
434
441
|
externalId: comment_id,
|
|
435
442
|
source: { id: sourceId },
|
|
436
|
-
|
|
443
|
+
discussionType,
|
|
437
444
|
},
|
|
438
445
|
} = document;
|
|
446
|
+
|
|
447
|
+
const video_id =
|
|
448
|
+
discussionType === 're'
|
|
449
|
+
? parentDoc.metaData.inReplyTo.id
|
|
450
|
+
: document.metaData.inReplyTo.id;
|
|
451
|
+
|
|
439
452
|
const { body: publishedMessage } =
|
|
440
453
|
(await this.sendPost({
|
|
441
454
|
paramString: 'comment/hide/',
|