From 149e06acf38ab8d99f42ce74ee569df49c26efe2 Mon Sep 17 00:00:00 2001 From: Vishal <64505169+vishalxl@users.noreply.github.com> Date: Wed, 14 Sep 2022 23:57:38 +0530 Subject: [PATCH] fixed get channel fetch so channels get printed replies not supported yet --- lib/console_ui.dart | 10 +++++----- lib/event_ds.dart | 12 ++++++++++-- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/lib/console_ui.dart b/lib/console_ui.dart index 3156bd7..b50c74c 100644 --- a/lib/console_ui.dart +++ b/lib/console_ui.dart @@ -686,7 +686,7 @@ Future mainMenuUi(Store node) async { // the main menu int option = showMenu(['Display feed', // 1 'Post/Reply/Like', // 2 - // 'Public Channels', // 3 + 'Public Channels', // 3 'Private Messages', // 4 'Other Options', // 5 'Quit'], // 6 @@ -730,19 +730,19 @@ Future mainMenuUi(Store node) async { await sendReplyPostLike(node, replyToId, replyKind, content); break; - case 9: + case 3: await channelMenuUI(node); break; - case 3: + case 4: await PrivateMenuUI(node); break; - case 4: + case 5: await otherMenuUi(node); break; - case 5: + case 6: default: userContinue = false; String authorName = getAuthorName(userPublicKey); diff --git a/lib/event_ds.dart b/lib/event_ds.dart index b478c0d..45717a5 100644 --- a/lib/event_ds.dart +++ b/lib/event_ds.dart @@ -255,12 +255,20 @@ class EventData { return decrypted; } - // only applicable for kind 42 event + // only applicable for kind 42 event; returns the channel 40 id of which the event is part of String getChannelIdForMessage() { if( kind != 42) { return ""; } - return getParent(); + + // get first e tag, which should be the channel of which this is part of + for( int i = 0; i < tags.length; i++) { + List tag = tags[i]; + if( tag[0] == 'e') { + return tag[1]; + } + } + return ''; } // prints event data in the format that allows it to be shown in tree form by the Tree class