improved reply tag logic.

issue 20c  on github.
This commit is contained in:
Vishal
2022-11-17 01:52:57 +05:30
parent e22ad99913
commit 00c990d395
2 changed files with 14 additions and 12 deletions

View File

@@ -9,9 +9,9 @@ WORKDIR /app
COPY pubspec.* ./
RUN dart pub get
#COPY . .
COPY . .
RUN dart pub get --offline
#RUN dart compile exe bin/nostr_console.dart -o bin/nostr_console
RUN dart compile exe bin/nostr_console.dart -o bin/nostr_console
FROM scratch
COPY --from=build /runtime/ /
@@ -32,13 +32,15 @@ RUN npm install node-pty dotenv
RUN git config --global core.autocrlf input
RUN git clone https://github.com/cmdruid/nostr-terminal.git
#COPY --from=build /app/bin/nostr_console /nostr-terminal/
RUN git clone https://github.com/vishalxl/nostr-terminal.git
COPY --from=build /app/bin/nostr_console /nostr-terminal/
RUN echo "/nostr-terminal/nostr_console --width=120 --align=left" >> /nostr-terminal/console.sh
RUN PATH=$PATH:/nostr-terminal/
#RUN chmod 755 /nostr-terminal/nostr_console
WORKDIR /nostr-terminal/nostr-terminal
RUN npm install
ENTRYPOINT ["yarn"]
#ENTRYPOINT ["/nostr-terminal/nostr_console"]
ENTRYPOINT [ "yarn" ]
#CMD [ "yarn" ]

View File

@@ -144,9 +144,8 @@ class EventData {
int numRoot = 0, numReply = 0;
String rootId = "", replyId = "";
for( int i = eTags.length - 1; i >= 0; i--) {
for( int i = 0; i < eTags.length; i++) {
String eventId = eTags[i][0];
//print(eTags);
if( eTags[i].length >= 3) {
if( eTags[i][2].toLowerCase() == "root") {
numRoot++;
@@ -164,11 +163,12 @@ class EventData {
if( numReply == 1) {
return replyId;
} else {
if( rootId.length > 0) {
return rootId;
} else {
// if there are multiply reply's we can't tell which is which, so we return the one at top
if( replyId.length > 0) {
return replyId;
} else {
if( rootId.length > 0) {
return rootId;
}
}
}