File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,12 @@ export type Msg<C = Content> = {
4040 timestamp : number ;
4141} ;
4242
43+ export type MsgInThread = Msg < {
44+ root ?: MsgId ;
45+ fork ?: MsgId ;
46+ branch ?: MsgId ;
47+ } >
48+
4349export type UnboxedMsg < C = Content > = Msg < C > & {
4450 value : Msg < C > [ 'value' ] & {
4551 cyphertext : string ;
Original file line number Diff line number Diff line change 66 VoteContent ,
77 UnboxedMsg ,
88 MsgId ,
9+ MsgInThread ,
910} from './readme' ;
1011
1112export function isMsg ( msg : any ) : msg is Msg < any > {
@@ -17,7 +18,14 @@ export function isRootMsg(msg: Msg<any>): boolean {
1718}
1819
1920export function isReplyMsgToRoot ( rootKey : MsgId ) {
20- return ( msg : Msg < { root ?: MsgId } > ) => msg ?. value ?. content ?. root === rootKey ;
21+ return ( msg : MsgInThread ) => msg ?. value ?. content ?. root === rootKey ;
22+ }
23+
24+ export function isIndirectReplyMsgToRoot ( rootKey : MsgId ) {
25+ return ( msg : MsgInThread ) =>
26+ msg ?. value ?. content ?. root === rootKey ||
27+ msg ?. value ?. content ?. branch === rootKey ||
28+ msg ?. value ?. content ?. fork === rootKey ;
2129}
2230
2331export function isPostMsg ( msg : Msg < any > ) : msg is Msg < PostContent > {
You can’t perform that action at this time.
0 commit comments