Outbound data restrictions after searching data sources (#1106)

This commit is contained in:
Thorsten Sommer authored and GitHub committed 2026-10-23 09:27:22 +02:00
1 parent 7ba5f01388
commit 8c5cfa78b6
61 files changed
+1389 -143

No files matched your search

@@ -5,12 +5,12 @@ namespace AIStudio.Settings.DataModel;
/// </summary>
/// <remarks>
/// The source travels along so a tool which is kept from running can name it, and the user
/// learns what stands in the way. For a mailbox, the reference is its id rather than its name,
/// because a mailbox may be renamed after a chat read from it.
/// learns what stands in the way. For a mailbox or a data source, the reference is its id rather
/// than its name, because either may be renamed after a chat read from it.
/// </remarks>
/// <param name="Restriction">Where the chat may still send data.</param>
/// <param name="Origin">What kind of source demands the restriction, or NONE when nothing restricts the chat.</param>
/// <param name="Reference">Which source of its kind demands the restriction: the id of a mailbox, or the host of a private web page. An empty text when the kind says it all, as for the wiki, or when nothing restricts the chat.</param>
/// <param name="Reference">Which source of its kind demands the restriction: the id of a mailbox or of a data source, or the host of a private web page. An empty text when the kind says it all, as for the wiki, or when nothing restricts the chat.</param>
public sealed record OutboundDataRequirement(OutboundDataRestriction Restriction, OutboundDataOrigin Origin, string Reference)
{
/// <summary>
@@ -25,9 +25,15 @@ public sealed record OutboundDataRequirement(OutboundDataRestriction Restriction
/// <remarks>
/// On a tie, this one is kept, whatever the origin of either, so the source which set a level
/// first stays the one which is named, and a chat does not name another source with every
/// search.
/// search. A restriction this version does not know counts as the strictest one, and the
/// requirement which wins carries that one instead.
/// </remarks>
/// <param name="other">The other requirement.</param>
/// <returns>The requirement whose restriction is the stricter one.</returns>
public OutboundDataRequirement StricterOf(OutboundDataRequirement other) => other.Restriction < this.Restriction ? other : this;
public OutboundDataRequirement StricterOf(OutboundDataRequirement other)
{
var stricter = other.Restriction.OrStrictestWhenUnknown() < this.Restriction.OrStrictestWhenUnknown() ? other : this;
var knownRestriction = stricter.Restriction.OrStrictestWhenUnknown();
return knownRestriction == stricter.Restriction ? stricter : stricter with { Restriction = knownRestriction };
}
}