Repository navigation
fix(framework): digest filter renders "and 0 others" when maxNames covers all items - #11984
Merged
scopsy merged 1 commit intoJul 19, 2026
Merged
Conversation
…vers all items
The digest Liquid filter only listed every name for the special case of
exactly three items. For four or more items it always fell through to the
overflow branch, so when maxNames was greater than or equal to the number
of items it appended a redundant "and 0 others" (or a negative count when
maxNames exceeded the item count), e.g. {{ actors | digest: 5 }} on four
actors produced "A, B, C, D and 0 others".
Show all items whenever maxNames covers them, mirroring the toSentence
filter, and reserve the overflow suffix for when maxNames is actually
smaller than the list.
👷 Deploy request for dashboard-v2-novu-staging pending review.Visit the deploys page to approve it
|
Contributor
|
Thank you 🙏 |
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
digestLiquid filter only listed all names for exactly 3 items; for 4+ items wheremaxNames >= values.lengthit fell through to the overflow branch and appended a redundant "and 0 others" — or a negative count whenmaxNames > length.Since
maxNamesis set by the template author while the digested item count is variable at runtime, any digest that yields<= maxNamesitems (4+ total) renders broken copy to subscribers.Generalized the "show all names" guard to
maxNames >= values.length, mirroring the siblingtoSentencefilter which already guardslimit >= wordsLength. This subsumes and preserves the existing 3-item behavior. Added regression tests (equal-to, exceeds, no "0 others", no negative count, custom separator). Swept the class:digestandtoSentenceare the only overflow-suffix filters, andtoSentencewas already correct.Greptile Summary
This PR fixes the
digestfilter boundary case for covered item counts. The main changes are:maxNamesis equal to or greater than the number of values.0 othersor negative “others” counts.maxNamesvalues, custom separators, and overflow copy checks.Confidence Score: 5/5
Safe to merge with minimal risk.
The change is narrow, preserves existing short-array behavior, and tests the reported boundary cases.
No files require special attention.
What T-Rex did
Important Files Changed
digestlists every value whenevermaxNamescovers the array.maxNames, zero or negative overflow copy, and custom separators.Sequence Diagram
%%{init: {'theme': 'neutral'}}%% sequenceDiagram participant Template as Liquid template participant Digest as digest filter participant Values as values array Template->>Digest: "actors | digest: maxNames" Digest->>Values: extract values/keyPath alt "values.length <= 2" Digest-->>Template: return simple name(s) else "maxNames >= values.length" Digest-->>Template: join all names with separator + "and" else "maxNames < values.length" Digest-->>Template: join shown names + "and N others" end%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%% sequenceDiagram participant Template as Liquid template participant Digest as digest filter participant Values as values array Template->>Digest: "actors | digest: maxNames" Digest->>Values: extract values/keyPath alt "values.length <= 2" Digest-->>Template: return simple name(s) else "maxNames >= values.length" Digest-->>Template: join all names with separator + "and" else "maxNames < values.length" Digest-->>Template: join shown names + "and N others" endReviews (1): Last reviewed commit: "fix(framework): digest filter renders 'a..." | Re-trigger Greptile