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.* ./ COPY pubspec.* ./
RUN dart pub get RUN dart pub get
#COPY . . COPY . .
RUN dart pub get --offline 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 FROM scratch
COPY --from=build /runtime/ / COPY --from=build /runtime/ /
@@ -32,13 +32,15 @@ RUN npm install node-pty dotenv
RUN git config --global core.autocrlf input RUN git config --global core.autocrlf input
RUN git clone https://github.com/cmdruid/nostr-terminal.git RUN git clone https://github.com/vishalxl/nostr-terminal.git
#COPY --from=build /app/bin/nostr_console /nostr-terminal/
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 #RUN chmod 755 /nostr-terminal/nostr_console
WORKDIR /nostr-terminal/nostr-terminal WORKDIR /nostr-terminal/nostr-terminal
RUN npm install RUN npm install
#ENTRYPOINT ["/nostr-terminal/nostr_console"]
ENTRYPOINT [ "yarn" ] ENTRYPOINT [ "yarn" ]
#CMD [ "yarn" ] #CMD [ "yarn" ]

View File

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