@astrosheep/square 0.3.51 → 0.3.52
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.
|
@@ -36,10 +36,6 @@ function frameBoundary(lines) {
|
|
|
36
36
|
return `\n${lines.join('\n')}\n`;
|
|
37
37
|
}
|
|
38
38
|
function renderBoundary(inbox) {
|
|
39
|
-
const count = pendingCount(inbox);
|
|
40
|
-
const noun = count === 1 ? 'notification' : 'notifications';
|
|
41
|
-
const header = `<system-reminder source="square">You have ${count} Square ${noun}.`;
|
|
42
|
-
const footer = ['</system-reminder>'];
|
|
43
39
|
const queued = inbox.flatMap((membership) => membership.notifications.map((notification) => ({ membership, notification })));
|
|
44
40
|
const blocks = [];
|
|
45
41
|
const complete = [];
|
|
@@ -57,15 +53,7 @@ function renderBoundary(inbox) {
|
|
|
57
53
|
}),
|
|
58
54
|
].join('\n');
|
|
59
55
|
const omittedAfter = omitted + queued.length - index - 1;
|
|
60
|
-
const prospective = frameBoundary([
|
|
61
|
-
header,
|
|
62
|
-
...blocks,
|
|
63
|
-
block,
|
|
64
|
-
...(omittedAfter > 0
|
|
65
|
-
? [`… ${omittedAfter} ${omittedAfter === 1 ? 'notification' : 'notifications'} omitted.`]
|
|
66
|
-
: []),
|
|
67
|
-
...footer,
|
|
68
|
-
]);
|
|
56
|
+
const prospective = frameBoundary([...blocks, block, ...(omittedAfter > 0 ? [`… ${omittedAfter} ${omittedAfter === 1 ? 'notification' : 'notifications'} omitted.`] : [])]);
|
|
69
57
|
if (prospective.length > CONTEXT_MAX) {
|
|
70
58
|
omitted += 1;
|
|
71
59
|
continue;
|
|
@@ -78,14 +66,7 @@ function renderBoundary(inbox) {
|
|
|
78
66
|
});
|
|
79
67
|
}
|
|
80
68
|
return {
|
|
81
|
-
context: frameBoundary([
|
|
82
|
-
header,
|
|
83
|
-
...blocks,
|
|
84
|
-
...(omitted > 0
|
|
85
|
-
? [`… ${omitted} ${omitted === 1 ? 'notification' : 'notifications'} omitted.`]
|
|
86
|
-
: []),
|
|
87
|
-
...footer,
|
|
88
|
-
]),
|
|
69
|
+
context: frameBoundary([...blocks, ...(omitted > 0 ? [`… ${omitted} ${omitted === 1 ? 'notification' : 'notifications'} omitted.`] : [])]),
|
|
89
70
|
complete,
|
|
90
71
|
};
|
|
91
72
|
}
|