unify logic of SkLatestNote.areEquivalent and SkLatestNote.keyFor
This commit is contained in:
@@ -87,11 +87,14 @@ export class SkLatestNote {
|
|||||||
* Checks if two notes would produce equivalent compound keys.
|
* Checks if two notes would produce equivalent compound keys.
|
||||||
*/
|
*/
|
||||||
static areEquivalent(first: MiNote, second: MiNote): boolean {
|
static areEquivalent(first: MiNote, second: MiNote): boolean {
|
||||||
|
const firstKey = SkLatestNote.keyFor(first);
|
||||||
|
const secondKey = SkLatestNote.keyFor(second);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
first.userId === second.userId &&
|
firstKey.userId === secondKey.userId &&
|
||||||
first.visibility === second.visibility &&
|
firstKey.isPublic === secondKey.isPublic &&
|
||||||
(first.replyId != null) === (second.replyId != null) &&
|
firstKey.isReply === secondKey.isReply &&
|
||||||
(isRenote(first) && isQuote(first)) === (isRenote(second) && isQuote(second))
|
firstKey.isQuote === secondKey.isQuote
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user