@amityco/ts-sdk 7.3.1-27a784d.0 → 7.3.1-3ec5a73.0
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/dist/commentRepository/api/flagComment.d.ts +1 -1
- package/dist/commentRepository/api/flagComment.d.ts.map +1 -1
- package/dist/index.cjs.js +8 -6
- package/dist/index.esm.js +8 -6
- package/dist/index.umd.js +1 -1
- package/dist/postRepository/api/flagPost.d.ts +1 -1
- package/dist/postRepository/api/flagPost.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/commentRepository/api/flagComment.ts +8 -6
- package/src/postRepository/api/flagPost.ts +8 -6
|
@@ -11,5 +11,5 @@
|
|
|
11
11
|
* @category Comment API
|
|
12
12
|
* @async
|
|
13
13
|
* */
|
|
14
|
-
export declare const flagComment: (commentId: Amity.Comment['commentId'], reason
|
|
14
|
+
export declare const flagComment: (commentId: Amity.Comment['commentId'], reason?: Amity.ContentFlagReason) => Promise<boolean>;
|
|
15
15
|
//# sourceMappingURL=flagComment.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flagComment.d.ts","sourceRoot":"","sources":["../../../src/commentRepository/api/flagComment.ts"],"names":[],"mappings":"AASA;;;;;;;;;;;;KAYK;AACL,eAAO,MAAM,WAAW,cACX,aAAa,CAAC,WAAW,CAAC,
|
|
1
|
+
{"version":3,"file":"flagComment.d.ts","sourceRoot":"","sources":["../../../src/commentRepository/api/flagComment.ts"],"names":[],"mappings":"AASA;;;;;;;;;;;;KAYK;AACL,eAAO,MAAM,WAAW,cACX,aAAa,CAAC,WAAW,CAAC,WAC5B,MAAM,iBAAiB,KAC/B,QAAQ,OAAO,CA2BjB,CAAC"}
|
package/dist/index.cjs.js
CHANGED
|
@@ -21679,10 +21679,11 @@ const declinePost = async (postId) => {
|
|
|
21679
21679
|
const flagPost = async (postId, reason) => {
|
|
21680
21680
|
const client = getActiveClient();
|
|
21681
21681
|
client.log('post/flagPost', postId);
|
|
21682
|
-
const isPredefinedReason =
|
|
21682
|
+
const isPredefinedReason = reason &&
|
|
21683
|
+
Object.entries(exports.ContentFlagReasonEnum).some(([key, value]) => key !== exports.ContentFlagReasonEnum.Others && value === reason);
|
|
21683
21684
|
const body = {
|
|
21684
|
-
reason: isPredefinedReason ? reason : exports.ContentFlagReasonEnum.Others,
|
|
21685
|
-
detail: isPredefinedReason ?
|
|
21685
|
+
reason: reason && isPredefinedReason ? reason : exports.ContentFlagReasonEnum.Others,
|
|
21686
|
+
detail: reason && !isPredefinedReason ? reason : '',
|
|
21686
21687
|
};
|
|
21687
21688
|
const { data: payload } = await client.http.post(`/api/v3/posts/${encodeURIComponent(postId)}/flag`, body);
|
|
21688
21689
|
if (client.cache) {
|
|
@@ -22160,10 +22161,11 @@ const hardDeleteComment = async (commentId) => {
|
|
|
22160
22161
|
const flagComment = async (commentId, reason) => {
|
|
22161
22162
|
const client = getActiveClient();
|
|
22162
22163
|
client.log('comment/flagComment', commentId);
|
|
22163
|
-
const isPredefinedReason =
|
|
22164
|
+
const isPredefinedReason = reason &&
|
|
22165
|
+
Object.entries(exports.ContentFlagReasonEnum).some(([key, value]) => key !== exports.ContentFlagReasonEnum.Others && value === reason);
|
|
22164
22166
|
const body = {
|
|
22165
|
-
reason: isPredefinedReason ? reason : exports.ContentFlagReasonEnum.Others,
|
|
22166
|
-
detail: isPredefinedReason ?
|
|
22167
|
+
reason: reason && isPredefinedReason ? reason : exports.ContentFlagReasonEnum.Others,
|
|
22168
|
+
detail: reason && !isPredefinedReason ? reason : '',
|
|
22167
22169
|
};
|
|
22168
22170
|
const { data: payload } = await client.http.post(`/api/v3/comments/${encodeURIComponent(commentId)}/flag`, body);
|
|
22169
22171
|
if (client.cache) {
|
package/dist/index.esm.js
CHANGED
|
@@ -37771,10 +37771,11 @@ const declinePost = async (postId) => {
|
|
|
37771
37771
|
const flagPost = async (postId, reason) => {
|
|
37772
37772
|
const client = getActiveClient();
|
|
37773
37773
|
client.log('post/flagPost', postId);
|
|
37774
|
-
const isPredefinedReason =
|
|
37774
|
+
const isPredefinedReason = reason &&
|
|
37775
|
+
Object.entries(ContentFlagReasonEnum).some(([key, value]) => key !== ContentFlagReasonEnum.Others && value === reason);
|
|
37775
37776
|
const body = {
|
|
37776
|
-
reason: isPredefinedReason ? reason : ContentFlagReasonEnum.Others,
|
|
37777
|
-
detail: isPredefinedReason ?
|
|
37777
|
+
reason: reason && isPredefinedReason ? reason : ContentFlagReasonEnum.Others,
|
|
37778
|
+
detail: reason && !isPredefinedReason ? reason : '',
|
|
37778
37779
|
};
|
|
37779
37780
|
const { data: payload } = await client.http.post(`/api/v3/posts/${encodeURIComponent(postId)}/flag`, body);
|
|
37780
37781
|
if (client.cache) {
|
|
@@ -38252,10 +38253,11 @@ const hardDeleteComment = async (commentId) => {
|
|
|
38252
38253
|
const flagComment = async (commentId, reason) => {
|
|
38253
38254
|
const client = getActiveClient();
|
|
38254
38255
|
client.log('comment/flagComment', commentId);
|
|
38255
|
-
const isPredefinedReason =
|
|
38256
|
+
const isPredefinedReason = reason &&
|
|
38257
|
+
Object.entries(ContentFlagReasonEnum).some(([key, value]) => key !== ContentFlagReasonEnum.Others && value === reason);
|
|
38256
38258
|
const body = {
|
|
38257
|
-
reason: isPredefinedReason ? reason : ContentFlagReasonEnum.Others,
|
|
38258
|
-
detail: isPredefinedReason ?
|
|
38259
|
+
reason: reason && isPredefinedReason ? reason : ContentFlagReasonEnum.Others,
|
|
38260
|
+
detail: reason && !isPredefinedReason ? reason : '',
|
|
38259
38261
|
};
|
|
38260
38262
|
const { data: payload } = await client.http.post(`/api/v3/comments/${encodeURIComponent(commentId)}/flag`, body);
|
|
38261
38263
|
if (client.cache) {
|