mirror of
https://github.com/vishalxl/nostr_console.git
synced 2025-04-02 17:08:12 +02:00
fixed two issues - gStore and getParent
initialized gStore for --request case And, fixed getParent for event, since otherwise it would return wrong parent. Now it would result in a dummy parent, as it should.
This commit is contained in:
parent
b30047baa9
commit
a32e68affd
@ -238,6 +238,7 @@ Future<void> main(List<String> arguments) async {
|
||||
|
||||
clearEvents();
|
||||
if( gDebug > 0) stdout.write("Total events of kind 1 in created tree: ${node.count()} events\n");
|
||||
gStore = node;
|
||||
mainMenuUi(node);
|
||||
});
|
||||
return;
|
||||
|
@ -65,6 +65,7 @@ class EventData {
|
||||
bool isHidden; // hidden by sending a reaction kind 7 event to this event, by the logged in user
|
||||
bool isDeleted; // deleted by kind 5 event
|
||||
|
||||
// returns the immediate kind 1 parent
|
||||
String getParent(Map<String, Tree> allEventsMap) {
|
||||
if( eTags.isNotEmpty) {
|
||||
for( int i = eTags.length - 1; i >= 0; i--) {
|
||||
@ -74,6 +75,10 @@ class EventData {
|
||||
if( parentId != null) {
|
||||
return parentId;
|
||||
}
|
||||
} else {
|
||||
// if first e tag ( from end, which is the immediate parent) does not exist in the store, then return empty.
|
||||
// This has the drawback that the child comment would get a dummy parent, and would get out of the thread TODO fix that later
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user