Skip to content

Commit

Permalink
Make Topic.GetTitle public
Browse files Browse the repository at this point in the history
  • Loading branch information
WilStead committed Jan 3, 2023
1 parent 3b7440b commit 94a3b58
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: publish
env:
VERSION: '0.16.0-preview'
VERSION: '0.17.0-preview'
PRERELEASE: true
on:
push:
Expand Down
4 changes: 4 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 0.17.0-preview
### Changed
- Made `Topic.GetTitle` public

## 0.16.0-preview
### Changed
- Archive topics
Expand Down
16 changes: 12 additions & 4 deletions src/Models/Topic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,18 @@ public static string GetId(string title, string wikiNamespace, string? domain)
? $"{wikiNamespace}:{title}:messages"
: $"({domain}):{wikiNamespace}:{title}:messages";

/// <summary>
/// Gets the title of the wiki page associated with this <see cref="Topic"/>.
/// </summary>
/// <returns>
/// The title of the wiki page associated with this <see cref="Topic"/>, or an empty title if
/// this topic's <see cref="IdItem.Id"/> does not appear to refer to a wiki page.
/// </returns>
public PageTitle GetTitle() => string.IsNullOrEmpty(Id)
|| Id.Length <= TopicIdItemTypeName.Length
? new()
: PageTitle.Parse(Id[TopicIdItemTypeName.Length..]);

/// <summary>
/// Gets the <see cref="Topic"/> that fits the given parameters.
/// </summary>
Expand Down Expand Up @@ -137,8 +149,4 @@ await dataStore.StoreItemAsync(existing)
.ConfigureAwait(false);
}
}

private PageTitle GetTitle() => string.IsNullOrEmpty(Id)
? new()
: PageTitle.Parse(Id[TopicIdItemTypeName.Length..]);
}

0 comments on commit 94a3b58

Please sign in to comment.