module

Ktistec::ViewHelper::ClassMethods

Constants

PUBLIC = "https://www.w3.org/ns/activitystreams#Public"

Instance methods

activity_status(activity_at : Time | Nil) : Symbol

Classifies an activity time into a liveness signal.

Source
activity_type_class(activity)
Source
actor_background_style(actor) : Ktistec::SafeAttrValue | Nil
Source
actor_icon(actor, classes = nil, *, include_actor_id = true) : Ktistec::SafeHTML
Source
actor_panel_partial(env, actor, content_io)
Source
actor_states(object, author, actor, followed_actors)
Source
actor_type(actor) : Ktistec::SafeHTML
Source
actor_type_class(actor)
Source
addressing(params, actor)

Derives visibility and to/cc addressing from the "visibility" param.

Source
body_partial(env, object, with_detail, show_quote, timezone, scope, content_io)
Source
collection_json_partial(env, collection)
Source
cursor_paginate_with_pins(actor, limit : Int32, &)
Source
cursor_paginated?(query)

Returns true if the query carries any cursor pagination parameters.

Source
cursor_pagination_params(env)
Source
cursor_param(query, name)

Returns the cursor value (max or min) from the query.

Accepts both the underscore and hyphen spellings.

Source
depth(object)
Source
emoji_html(content, subject, *, emojis = nil) : Ktistec::SafeHTML

Renders arbitrary text or HTML with the subject's custom emojis interpolated and the result sanitized.

Pass emojis: to reuse a pre-fetched emoji set.

Source
emoji_name(subject, *, emojis = nil) : Ktistec::SafeHTML

Renders subject.display_name with the subject's custom emojis interpolated and the result sanitized.

Pass emojis: to reuse a pre-fetched emoji set.

Source
mention_page_mention_banner(env, mention, follow, count, content_io)
Source
mention_states(object, actor)
Source
name_and_summary(object, translation = object.translations.first?)

Returns the name and summary to display for an object.

Long content that has no summary of its own gets a generated one -- the beginning of the content -- so that the body is collapsed when the object is rendered in a feed.

Source
normalize_params(params : URI::Params) : Hash(String, String | Array(String))

Normalizes params into a consistent hash format.

Source
normalize_params(params : Hash(String, JSON::Any::Type)) : Hash(String, String | Array(String))

Normalizes params into a consistent hash format.

Source
notification_count_and_color(actor, since : Time | Nil)

Returns a tuple of {count, color, tooltip} for actor notifications.

Source
object_content_partial(env, object, author, actor, with_detail, as_context, show_quote, for_thread, for_actor, scope, content_io)
Source
object_data_attributes(object, author, actor, followed_hashtags, followed_mentions)
Source
object_partial(env, object, actor = object.attributed_to(include_deleted: true), author = actor, *, activity = nil, with_detail = false, as_context = false, show_quote = true, for_thread = nil, for_actor = nil, highlight = false, themed = true, scope = nil, content_io)

Renders an ActivityPub object.

Parameters:

  • env: HTTP request environment.
  • object: The ActivityPub object to render.
  • actor: The actor who performed the activity (defaults to object's attributed_to). May differ from author.
  • author: The original author of the object (defaults to actor).
  • activity: Optional activity containing this object (e.g., Like, Announce).
  • with_detail: Renders expanded view with additional metadata.
  • as_context: Indicates this object is being shown to provide context for (or is part of) the main content, not as the primary interactive element.
  • show_quote: Whether or not to render quoted content (defaults to true).
  • for_thread: Collection of objects in thread; enables thread view rendering.
  • for_actor: Actor for whom view is being rendered.
  • highlight: Whether or not to highlight this object in the feed.
  • themed: Whether or not to emit custom-theme metadata (feed rendering only; ignored when for_thread/with_detail is set).
  • scope: Prefix for the element's id.
Source
object_states(object, author = nil, actor = nil)
Source
object_type_class(object)
Source
paginate(env, collection, content_io)
Source
quote_states(object, actor)
Source
scoped_id(scope : String | Nil, id : String) : String

Prefixes a DOM id with a scope, when one is given.

Source
tag_page_tag_controls(env, hashtag, task, follow, count, content_io)
Source
thread_page_thread_controls(env, thread, task, follow, content_io)
Source
visibility(actor, object)

Derives visibility from to/cc addressing.

If the object has explicit addressing, uses that. Otherwise, if the object is a reply, inherits from the parent: public posts are public, everything else is direct. Otherwise, defaults to public.

Source
wrap_filter_term(str) : Ktistec::SafeHTML
Source