Whether an existing queue task is still permitted under the per-platform rules. Used to prune tasks that were queued before the Friday-only filter existed (or added by hand): the drain tool submits whatever is in the queue, so a disallowed task left here would still reach moderation. A t
(task: dict, dates_by_slug: dict[str, dt.date])
| 68 | |
| 69 | |
| 70 | def _task_is_allowed(task: dict, dates_by_slug: dict[str, dt.date]) -> bool: |
| 71 | """Whether an existing queue task is still permitted under the per-platform |
| 72 | rules. Used to prune tasks that were queued before the Friday-only filter |
| 73 | existed (or added by hand): the drain tool submits whatever is in the |
| 74 | queue, so a disallowed task left here would still reach moderation. A task |
| 75 | whose post date is unknown is kept — we never silently drop something we |
| 76 | cannot evaluate.""" |
| 77 | platform = task.get("site") |
| 78 | if platform not in WEEKLY_FRIDAY_PLATFORMS: |
| 79 | return True |
| 80 | post_date = dates_by_slug.get(task.get("slug")) |
| 81 | if post_date is None: |
| 82 | return True |
| 83 | return post_date.weekday() == 4 |
| 84 | |
| 85 | |
| 86 | def _markdown_to_html(text: str) -> str: |