added root tag for replies from chat room for kind 1

This commit is contained in:
Vishal 2022-12-05 20:48:52 +05:30
parent 777de50812
commit cf8c6a9ff1
3 changed files with 20 additions and 4 deletions

View File

@ -150,6 +150,7 @@ class EventData {
if( replyId.length > 0) {
return replyId;
} else {
// this is case when there is no reply id . should not actually happen given if conditions
if( rootId.length > 0) {
return rootId;
}

View File

@ -1157,13 +1157,18 @@ class Store {
return;
}
if( eKind == 42 || eKind == 40
|| (eKind == 1 && tree.event.eventData.getSpecificTag("location") != null )
|| (eKind == 1 && tree.event.eventData.getTTags() != null)){
if( eKind == 42 || eKind == 40 ){
handleChannelEvents(channels, tempChildEventsMap, tree.event);
return;
}
if( (eKind == 1 && tree.event.eventData.getSpecificTag("location") != null )
|| (eKind == 1 && tree.event.eventData.getTTags() != null)){
handleChannelEvents(channels, tempChildEventsMap, tree.event);
// same as above but no return cause these are processed as kind 1 too
}
if( eKind == 4) {
handleDirectMessage(tempDirectRooms, tempChildEventsMap, tree.event);
return;
@ -2168,6 +2173,16 @@ class Store {
if( pTagPubkey != null) {
strTags += ',["p","$pTagPubkey"]';
}
// add root for kind 1 in rooms
if( [enumRoomType.RoomLocationTag, enumRoomType.RoomTTag].contains( channel.roomType) ) {
Tree? replyTree = allChildEventsMap[latestEventId]??null;
if( replyTree != null) {
Tree rootTree = getTopTree(replyTree);
String rootEventId = rootTree.event.eventData.id;
strTags += ',["e","$rootEventId","","root"]';
}
}
}
return strTags;

View File

@ -5,7 +5,7 @@ homepage: https://github.com/vishalxl/nostr_console
# crated location and t rooms
# t tags added for all tags
# t tags added for all tags
environment:
sdk: '>=2.17.3 <3.0.0'