Class UserNoticeType
- Namespace
- Tharga.Team
- Assembly
- Tharga.Team.dll
One kind of automatic notice in the host's catalogue: who may receive it, how it is delivered by default, which mail category it belongs to and how one occurrence reads.
public sealed record UserNoticeType : IEquatable<UserNoticeType>
- Inheritance
-
UserNoticeType
- Implements
- Inherited Members
Remarks
The key is stored on every choice, team default and occurrence, so it never changes once a notice has been raised. Every text has a key a translation is registered under and the English used when there is none.
The subject and body are templates: {name} is replaced by the occurrence's value for a declared
Placeholders entry, {subject} by the occurrence's subject text, and {{ and }} write
a brace. Values are HTML-encoded in the body, which is HTML, and inserted as they are in the subject line.
Fields
SubjectPlaceholder
The placeholder every template may use for the occurrence's subject text.
public const string SubjectPlaceholder = "subject"
Field Value
Properties
Audience
Who may receive the notice, required when the catalogue is registered; host-side only and never serialized.
[JsonIgnore]
public UserNoticeAudience Audience { get; init; }
Property Value
Body
The HTML body template, in English, or null for a mail carrying only its subject and link.
public string Body { get; init; }
Property Value
BodyKey
The text key the body template is translated under; userNotice.{Key}.body unless set.
public string BodyKey { get; init; }
Property Value
Category
The key of the registered mail category the notice is sent in, so a user who turns that category off receives none of it.
public required string Category { get; init; }
Property Value
Composer
Writes the mail from the host's current state when it is due, instead of replaying the occurrences that led there; host-side only and never serialized. Return null to send nothing.
[JsonIgnore]
public Func<UserNoticeComposition, IServiceProvider, CancellationToken, Task<UserNoticeComposed>> Composer { get; init; }
Property Value
Remarks
An occurrence then means "this user may have something to hear about". The callback runs in a scope of the host's services, once per user's mail, and is given the user, the teams concerned, the occurrences waiting and what the last mail covered. A callback that throws leaves the occurrences waiting, to be tried again later.
DefaultDelivery
The delivery used when neither the user nor their team chose; one of Deliveries, default at once.
public UserNoticeDelivery DefaultDelivery { get; init; }
Property Value
Deliveries
The deliveries a user may choose between, at least one, default at once only.
public UserNoticeDelivery[] Deliveries { get; init; }
Property Value
Description
One sentence on when the notice is sent, in English.
public string Description { get; init; }
Property Value
DescriptionKey
The text key the description is translated under; userNotice.{Key}.description unless set.
public string DescriptionKey { get; init; }
Property Value
IsStateful
Whether the notice is held to an interval or composed from state, and so is delivered at once only.
[JsonIgnore]
public bool IsStateful { get; }
Property Value
Key
The stable key: lowercase letters, digits, dots, dashes and underscores, starting with a letter or digit.
public required string Key { get; init; }
Property Value
MinimumInterval
At most one mail of this notice to a user per this interval; null, the default, mails as often as occurrences arrive.
public TimeSpan? MinimumInterval { get; init; }
Property Value
Remarks
Per user, not per team, so a person in two teams gets one mail covering both. Occurrences that arrive while the interval holds wait and go together when it is over. A notice with an interval, or a Composer, is delivered at once only: Deliveries may not allow the daily summary.
Name
The name shown to users, in English.
public required string Name { get; init; }
Property Value
NameKey
The text key the name is translated under; userNotice.{Key}.name unless set.
public string NameKey { get; init; }
Property Value
OnByDefault
Whether a user receives it when neither they nor their team chose, default true; ignored for a Required notice.
public bool OnByDefault { get; init; }
Property Value
Placeholders
The names of the values every occurrence supplies, which the templates may use as {name}.
public string[] Placeholders { get; init; }
Property Value
- string[]
Required
Whether every recipient receives it whatever they or their team chose, as a notice of a change to the terms must. Only the delivery stays a choice, where the notice allows more than one. The notice must be sent in a required mail category, so turning the category off cannot stop it either.
public bool Required { get; init; }
Property Value
Subject
The subject line template, in English.
public required string Subject { get; init; }
Property Value
SubjectKey
The text key the subject template is translated under; userNotice.{Key}.subject unless set.
public string SubjectKey { get; init; }
Property Value
Methods
Allows(UserNoticeDelivery)
Whether a user may choose delivery for this notice.
public bool Allows(UserNoticeDelivery delivery)
Parameters
deliveryUserNoticeDelivery