Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import get from 'lodash/get';
import partition from 'lodash/partition';
import chunk from 'lodash/chunk';
import uniq from 'lodash/uniq';
import uniqBy from 'lodash/uniqBy';
import defer from 'lodash/defer';
Expand Down Expand Up @@ -83,12 +84,20 @@ export function loadClipboardNodes(context, { parent }) {
const legacyNodeIds = legacyNodes.map(n => n.id);

return Promise.all([
context.dispatch(
'contentNode/loadContentNodes',
{ '[node_id+channel_id]__in': nodeIdChannelIdPairs },
{ root }
// To avoid error code 414 URI Too Long errors, we chunk the pairs
// Given URI limit is 2000 chars:
// base URL at 100 chars + each pair at 70 chars = max 27 pairs
...chunk(nodeIdChannelIdPairs, 25).map(chunkPairs =>
context.dispatch(
'contentNode/loadContentNodes',
{ '[node_id+channel_id]__in': chunkPairs },
{ root }
)
),
// Chunk legacy nodes, double the size since not pairs
...chunk(legacyNodeIds, 50).map(legacyChunk =>
context.dispatch('contentNode/loadContentNodes', { id__in: legacyChunk }, { root })
),
context.dispatch('contentNode/loadContentNodes', { id__in: legacyNodeIds }, { root }),
]).then(() => {
return context.dispatch('addClipboardNodes', {
nodes: clipboardNodes,
Expand Down
2 changes: 1 addition & 1 deletion contentcuration/contentcuration/frontend/shared/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ client.interceptors.response.use(
}
}

message = message ? `${message}: ${url}` : `Network Error: ${url}`;
message = message ? `${message}: [${status}] ${url}` : `Network Error: [${status}] ${url}`;

if (process.env.NODE_ENV !== 'production') {
// In dev build log warnings to console for developer use
Expand Down
15 changes: 15 additions & 0 deletions contentcuration/contentcuration/frontend/shared/data/serverSync.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import * as Sentry from '@sentry/vue';
import debounce from 'lodash/debounce';
import findLastIndex from 'lodash/findLastIndex';
import get from 'lodash/get';
Expand Down Expand Up @@ -99,6 +100,20 @@ function handleDisallowed(response) {
// that were rejected.
const disallowed = get(response, ['data', 'disallowed'], []);
if (disallowed.length) {
// Capture occurrences of the api disallowing changes
if (process.env.NODE_ENV === 'production') {
Sentry.withScope(function(scope) {
scope.addAttachment({
filename: 'disallowed.json',
data: JSON.stringify(disallowed),
contentType: 'application/json',
});
Sentry.captureException(new Error('/api/sync returned disallowed changes'));
});
} else {
console.warn('/api/sync returned disallowed changes:', disallowed); // eslint-disable-line no-console
}

// Collect all disallowed
const disallowedRevs = disallowed.map(d => Number(d.rev));
// Set the return error data onto the changes - this will update the change
Expand Down