factor out latest_note logic into LatestNoteService
This commit is contained in:
parent
c55af9c3b3
commit
93cf2f9045
5 changed files with 167 additions and 115 deletions
|
|
@ -82,4 +82,16 @@ export class SkLatestNote {
|
|||
isQuote: isRenote(note) && isQuote(note),
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if two notes would produce equivalent compound keys.
|
||||
*/
|
||||
static areEquivalent(first: MiNote, second: MiNote): boolean {
|
||||
return (
|
||||
first.userId === second.userId &&
|
||||
first.visibility === second.visibility &&
|
||||
(first.replyId != null) === (second.replyId != null) &&
|
||||
(isRenote(first) && isQuote(first)) === (isRenote(second) && isQuote(second))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue