Template:UI/recent activity feed/row

From Miniscope
Jump to: navigation, search

Per-row renderer for Template:UI/recent_activity_feed. Do not transclude directly outside the feed.

Invoked via SMW format=template with named args=yes and link=none, so page-typed projections arrive as bare strings and we link them ourselves.

Named-arg params (from the outer #ask):

  • Page — bare full title of the page (mainlabel=Page).
 Linked manually below.
  • Description — ?Has description=Description.
 Optional; suppressed when empty so untyped pages don't reserve a
 blank meta line.
  • Category — ?Categories#-=Category. The
 #- formatter strips the Category:
 namespace from the projected value, so we get "Guide" not
 "Category:Guide". Multi-category pages come through as a
 comma-joined string (e.g. "Guide, Documentation"); the chip-color
 #switch below matches single-category cases exactly and falls
 through to is-type-other (neutral gray) on
 multi-category — acceptable for a first cut.
  • LastActivity — ?Modification date#LOCL=LastActivity,
 pre-formatted localized date.
  • Editor — ?Last editor is=Editor, the user
 who last touched the page (SESP-style; comes through as a User: page
 name with link=none).

Chip color mapping uses an explicit per-category #switch rather than the first-letter hash used by Template:Category/Forum/post_row/render. The hash collides badly on the common category set (Guide/Workshop both → G/W bucket; Document/Training both → D/T bucket), and these types are stable enough that an explicit mapping reads as intentional identity. Adding a new category type means adding one #switch arm plus one CSS rule in styles.css — see .wiki-activity-row.is-type-*.

Title fallback: when the page has no Has description (the typical "first cut" state for newly-stubbed content), the row collapses the description line but still shows title + meta — never an empty row.

Main-namespace filtering: SMW doesn't expose a clean pre-query main-namespace condition (the Namespace:+ idiom works for named namespaces only — there's no name to plug in for the main namespace), so we suppress non-main rows here: returns the page's namespace prefix as a string, empty for main and e.g. "User"/"Template"/"Help" otherwise; we render the row only when that's empty. The parent template gates this with userparam= — when the caller sets include_non_main=1 the userparam string is non-empty and we skip the filter, letting every namespace through.

Cost of suppressing here rather than filtering pre-query: the outer

  1. ask fetches up to limit rows and the visible count

drops by however many non-main pages land in that window. For the typical case (curated content lives in main namespace) the suppression is rare and the visible count matches limit; if a caller routinely loses too many rows, bumping limit at the call site is the workaround.

Drafts: a page whose Property:Has post status is Draft (a draft post or newsletter issue) renders no row, so it doesn't appear in "What's new" until it is published. Pages with no status (guides, FAQs, workshops) are unaffected. Like the namespace filter, this can leave the feed a row short of limit.