ctucx.git: travelynx2fedi

Automaticly post travelynx checkins on the fediverse

commit f01c9f9c2ee4a7f0a65e23d731a1b9b186f8744d
parent 862af0f1de3e7eb2a2224c3561ddaddaade13fa6
Author: Leah (ctucx) <git@ctu.cx>
Date: Fri, 1 Sep 2023 07:47:53 +0200

requestHandler: private visibility always has the highest priority
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/requestHandler.nim b/src/requestHandler.nim
@@ -112,7 +112,10 @@ proc requestHandler* (req: Request) {.async.} =
             statusText = entityBodyJson["status"]["comment"].getStr & " (" & vehicle & " → " & entityBodyJson["status"]["toStation"]["name"].getStr & " " & statusUrl & ")"
 
         if config.FediVisibility.isSome:
-          statusVisibility = config.FediVisibility.get
+          if (entityBodyJson["status"]["visibility"]["level"].getInt <= 10):
+            statusVisibility = PostDirect
+          else:
+            statusVisibility = config.FediVisibility.get
         else:
           if (entityBodyJson["status"]["visibility"]["level"].getInt <= 10):  statusVisibility = PostDirect
           if (entityBodyJson["status"]["visibility"]["level"].getInt <= 60):  statusVisibility = PostPrivate