@amityco/ts-sdk 7.32.1-fb2e7c05.0 → 7.32.1-fb6342dc.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/index.cjs.js
CHANGED
|
@@ -30525,8 +30525,7 @@ const createPost = async (bundle) => {
|
|
|
30525
30525
|
*
|
|
30526
30526
|
* Updates an {@link Amity.Post}. `attachments` is the full list to keep: a GIF is matched by its
|
|
30527
30527
|
* `url`, so send each kept GIF back with its link and size as read from `childrenPosts`; an
|
|
30528
|
-
* attachment left out is deleted, `[]` removes them all
|
|
30529
|
-
* returns as a `text` post), and leaving `attachments` out keeps them.
|
|
30528
|
+
* attachment left out is deleted, `[]` removes them all, and leaving `attachments` out keeps them.
|
|
30530
30529
|
*
|
|
30531
30530
|
* @param postId The ID of the {@link Amity.Post} to edit
|
|
30532
30531
|
* @param patch The patch data to apply
|
|
@@ -30540,20 +30539,7 @@ const editPost = async (postId, patch) => {
|
|
|
30540
30539
|
client.log('user/editPost', patch);
|
|
30541
30540
|
const { attachments } = patch;
|
|
30542
30541
|
const processedAttachments = preparePostAttachments(attachments, patch.attachmentProductTags);
|
|
30543
|
-
const { data:
|
|
30544
|
-
// After `attachments: []` the edit response keeps the old structureType (e.g. `gif`); a new read
|
|
30545
|
-
// says `text`, so the post is read again, as on iOS and Android (Plan 43 Q27). The edit has
|
|
30546
|
-
// already succeeded, so a failed read keeps the edit response.
|
|
30547
|
-
let payload = editPayload;
|
|
30548
|
-
if (Array.isArray(attachments) && attachments.length === 0) {
|
|
30549
|
-
try {
|
|
30550
|
-
const { data: readPayload } = await client.http.get(`/api/v3/posts/${encodeURIComponent(postId)}`);
|
|
30551
|
-
payload = readPayload;
|
|
30552
|
-
}
|
|
30553
|
-
catch (error) {
|
|
30554
|
-
client.log('post/editPost: read after removing every attachment failed', error);
|
|
30555
|
-
}
|
|
30556
|
-
}
|
|
30542
|
+
const { data: payload } = await client.http.put(`/api/v4/posts/${encodeURIComponent(postId)}`, Object.assign(Object.assign({}, patch), { attachments: processedAttachments }));
|
|
30557
30543
|
const data = prepareMembershipPayload(payload, 'communityUsers');
|
|
30558
30544
|
const cachedAt = client.cache && Date.now();
|
|
30559
30545
|
if (client.cache)
|
package/dist/index.esm.js
CHANGED
|
@@ -30525,8 +30525,7 @@ const createPost = async (bundle) => {
|
|
|
30525
30525
|
*
|
|
30526
30526
|
* Updates an {@link Amity.Post}. `attachments` is the full list to keep: a GIF is matched by its
|
|
30527
30527
|
* `url`, so send each kept GIF back with its link and size as read from `childrenPosts`; an
|
|
30528
|
-
* attachment left out is deleted, `[]` removes them all
|
|
30529
|
-
* returns as a `text` post), and leaving `attachments` out keeps them.
|
|
30528
|
+
* attachment left out is deleted, `[]` removes them all, and leaving `attachments` out keeps them.
|
|
30530
30529
|
*
|
|
30531
30530
|
* @param postId The ID of the {@link Amity.Post} to edit
|
|
30532
30531
|
* @param patch The patch data to apply
|
|
@@ -30540,20 +30539,7 @@ const editPost = async (postId, patch) => {
|
|
|
30540
30539
|
client.log('user/editPost', patch);
|
|
30541
30540
|
const { attachments } = patch;
|
|
30542
30541
|
const processedAttachments = preparePostAttachments(attachments, patch.attachmentProductTags);
|
|
30543
|
-
const { data:
|
|
30544
|
-
// After `attachments: []` the edit response keeps the old structureType (e.g. `gif`); a new read
|
|
30545
|
-
// says `text`, so the post is read again, as on iOS and Android (Plan 43 Q27). The edit has
|
|
30546
|
-
// already succeeded, so a failed read keeps the edit response.
|
|
30547
|
-
let payload = editPayload;
|
|
30548
|
-
if (Array.isArray(attachments) && attachments.length === 0) {
|
|
30549
|
-
try {
|
|
30550
|
-
const { data: readPayload } = await client.http.get(`/api/v3/posts/${encodeURIComponent(postId)}`);
|
|
30551
|
-
payload = readPayload;
|
|
30552
|
-
}
|
|
30553
|
-
catch (error) {
|
|
30554
|
-
client.log('post/editPost: read after removing every attachment failed', error);
|
|
30555
|
-
}
|
|
30556
|
-
}
|
|
30542
|
+
const { data: payload } = await client.http.put(`/api/v4/posts/${encodeURIComponent(postId)}`, Object.assign(Object.assign({}, patch), { attachments: processedAttachments }));
|
|
30557
30543
|
const data = prepareMembershipPayload(payload, 'communityUsers');
|
|
30558
30544
|
const cachedAt = client.cache && Date.now();
|
|
30559
30545
|
if (client.cache)
|