@mikitasazan/notify 1.12.1 → 1.13.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.
Files changed (2) hide show
  1. package/dist/render.js +22 -14
  2. package/package.json +1 -1
package/dist/render.js CHANGED
@@ -252,13 +252,18 @@ const groupItem = (it, index, numbered) => {
252
252
  // part of the heading. Longer than ~400 characters and the quote collapses
253
253
  // on its own (`expandable`, Bot API), otherwise a stack trace or a log dump
254
254
  // stretches the card across the whole screen.
255
+ // A quote collapses when it would take more than a screenful — by length OR
256
+ // by line count, because five short lines eat as much screen as one long
257
+ // paragraph and the old length-only rule let them through (v2.1).
255
258
  const EXPAND_AT = 400;
259
+ const EXPAND_LINES = 5;
256
260
  const note = (text) => {
257
261
  if (!text) {
258
262
  return null;
259
263
  }
260
264
  const body = esc(text);
261
- return body.length > EXPAND_AT ? `<blockquote expandable>${body}</blockquote>` : `<blockquote>${body}</blockquote>`;
265
+ const long = body.length > EXPAND_AT || body.split('\n').length > EXPAND_LINES;
266
+ return long ? `<blockquote expandable>${body}</blockquote>` : `<blockquote>${body}</blockquote>`;
262
267
  };
263
268
  /**
264
269
  * A quote with a caption. A bare quote reads as a continuation of the
@@ -636,8 +641,13 @@ const named = (number, title) => title ? `#${number} ${title}` : `#${number}`;
636
641
  // REVIEWER'S OWN comment there, which is new text he has not seen. "Verdict:
637
642
  // changes_requested, then nothing" was the owner's complaint: a verdict with
638
643
  // no comment attached said less than the review itself did.
644
+ // Same rule as the issue card since 31.08.2026: the body prints on every
645
+ // action, collapsed when long. `VERDICT` stays because it changes what the
646
+ // body MEANS — on approved/changes_requested the sender puts the reviewer's
647
+ // own comment there, not the PR description — and that is what the caption
648
+ // has to say.
639
649
  const VERDICT = new Set(['approved', 'changes_requested']);
640
- const opening = (action, body) => action === 'opened' || VERDICT.has(action) ? bodyQuote(body) : null;
650
+ const prBody = (action, body) => VERDICT.has(action) ? quoted('Review', body) : bodyQuote(body);
641
651
  // The body is what the title stands for — it sits directly under the name,
642
652
  // with nothing between them. The people come after, consolidated in one
643
653
  // place, never splitting the title from what it names: the owner on the
@@ -645,23 +655,21 @@ const opening = (action, body) => action === 'opened' || VERDICT.has(action) ? b
645
655
  // does the assignee cut apart what should be inseparable?"
646
656
  const renderPr = (e) => join([
647
657
  typeLine(iconFor(e), 'PR', named(e.number, e.title)),
648
- opening(e.action, e.body),
649
- (e.action === 'opened' || VERDICT.has(e.action)) && e.body ? '' : null,
658
+ prBody(e.action, e.body),
659
+ e.body ? '' : null,
650
660
  fieldPerson('Author', e.author),
651
661
  fieldPerson('Reviewer', e.reviewer)
652
662
  ]);
653
- // The issue's body prints ONLY on `opened` the same law the PR card
654
- // follows. History of this line: hidden shown everywhere (the owner's call
655
- // of 26.08.2026, "inconsistent with the same card showing it moments
656
- // earlier") hidden again on 31.08.2026, when the owner, shown the live
657
- // duplicate ("the full body arrives a second time in one day"), delegated
658
- // the call ("сделай как лучше по оптимизации и простоте") and approved the
659
- // short assigned card in the v2.1 mockups. On assigned/closed the card is
660
- // the one new fact plus the `Source:` link to the full text.
663
+ // The body prints on EVERY action, as a quote that collapses when it is
664
+ // long. The owner settled this on 31.08.2026, after the short assigned card
665
+ // shipped: "если это ишью, то видеть тело ишью… везде, где это может быть
666
+ // полезно, не переходя по ссылке на источник." A collapsed quote costs four
667
+ // lines, which is what the earlier "he already saw it" reasoning was trying
668
+ // to save the expandable quote buys the context back without the cost.
661
669
  const renderIssue = (e) => join([
662
670
  typeLine(iconFor(e), 'Issue', named(e.number, e.title)),
663
- e.action === 'opened' ? bodyQuote(e.body) : null,
664
- e.action === 'opened' && e.body ? '' : null,
671
+ bodyQuote(e.body),
672
+ e.body ? '' : null,
665
673
  fieldPerson('Author', e.author),
666
674
  fieldPerson('Assignee', e.assignee)
667
675
  ]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikitasazan/notify",
3
- "version": "1.12.1",
3
+ "version": "1.13.0",
4
4
  "description": "Единая типизированная отправка Telegram-уведомлений (форум-темы, маршрутизация, ретраи) для всех проектов",
5
5
  "type": "module",
6
6
  "license": "MIT",