( control: FeedControl<Mode> | undefined, isPlus: boolean, modeMeta: Partial<Record<string, SignalMeta>> = topicModeMeta, )
| 368 | * exact boost only counts while the reader has Plus. |
| 369 | */ |
| 370 | export const getControlMeta = <Mode extends string>( |
| 371 | control: FeedControl<Mode> | undefined, |
| 372 | isPlus: boolean, |
| 373 | modeMeta: Partial<Record<string, SignalMeta>> = topicModeMeta, |
| 374 | ): SignalMeta | undefined => { |
| 375 | if (!control) { |
| 376 | return undefined; |
| 377 | } |
| 378 | if (!control.mode && !isPlus) { |
| 379 | return pausedWeightMeta; |
| 380 | } |
| 381 | const meta = (control.mode && modeMeta[control.mode]) || exactWeightMeta; |
| 382 | return control.expiresAt |
| 383 | ? { ...meta, text: `${meta.text} ${formatUntil(control.expiresAt)}` } |
| 384 | : meta; |
| 385 | }; |
| 386 | |
| 387 | const getSideFactor = ( |
| 388 | explain: FeedItemExplain | null | undefined, |
no test coverage detected