Skip to content

Commit

Permalink
fix: Add FilterResult interface and Status.filtered optional prop
Browse files Browse the repository at this point in the history
* update Filter interface

* fix: wholeWord type to boolean

* feat: FilterResult interface; filtered optional status prop

* chore(release): 4.7.3 [skip ci]

## [4.7.3](v4.7.2...v4.7.3) (2022-12-02)

### Bug Fixes

* Use builtin Object.fromEntries ([6a64264](6a64264))

* chore: add eslintcache (#737)

* update Filter interface

* fix: wholeWord type to boolean

* fix: import type

* refactor: fix imports

* refactor: fix linting complaints

* fix: wrong property casing

Co-authored-by: semantic-release-bot <semantic-release-bot@martynus.net>
Co-authored-by: Simon He <57086651+Simon-He95@users.noreply.github.com>
  • Loading branch information
3 people committed Dec 3, 2022
1 parent 52f8419 commit 581d4f9
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/entities/filter-result.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import type { Filter } from '.';

/**
* Represents a filter whose keywords matched a given status.
* @see https://docs.joinmastodon.org/entities/filter-result/
*/
export interface FilterResult {
/** The filter that was matched. */
filter: Filter;
/** The keyword within the filter that was matched. */
keywordMatches: string[] | null;
/** The status ID within the filter that was matched. */
statusMatches: string[] | null;
}
1 change: 1 addition & 0 deletions src/entities/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export * from './conversation';
export * from './emoji';
export * from './featured-tags';
export * from './filter';
export * from './filter-result';
export * from './history';
export * from './identity-proof';
export * from './instance';
Expand Down
3 changes: 3 additions & 0 deletions src/entities/status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import type {
Attachment,
Card,
Emoji,
FilterResult,
Mention,
Poll,
Tag,
Expand Down Expand Up @@ -50,6 +51,8 @@ export interface Status {
reblogsCount: number;
/** How many favourites this status has received. */
favouritesCount: number;
/** If the current token has an authorized user: The filter and keywords that matched this status. */
filtered?: FilterResult[];
/** How many replies this status has received. */
repliesCount: number;

Expand Down

0 comments on commit 581d4f9

Please sign in to comment.