summaryrefslogtreecommitdiff
path: root/lib/Travelynx/Helper
diff options
context:
space:
mode:
authornetworkException <git@nwex.de>2023-07-13 20:17:51 +0200
committernetworkException <git@nwex.de>2023-07-13 20:17:51 +0200
commit0c1993f28ec78b80887c4780a432b070bc441ab1 (patch)
tree72640ed73ee63e2127b9b753c9937ae912b3d5f9 /lib/Travelynx/Helper
parenta28db4a4a968b9a40ed01e090367ea81a08b25b1 (diff)
Checkin: Use correct visibility when pushing to Träwelling
Diffstat (limited to 'lib/Travelynx/Helper')
-rw-r--r--lib/Travelynx/Helper/Traewelling.pm16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/Travelynx/Helper/Traewelling.pm b/lib/Travelynx/Helper/Traewelling.pm
index bcde1de..f216263 100644
--- a/lib/Travelynx/Helper/Traewelling.pm
+++ b/lib/Travelynx/Helper/Traewelling.pm
@@ -1,6 +1,7 @@
package Travelynx::Helper::Traewelling;
# Copyright (C) 2020-2023 Birte Kristina Friesel
+# Copyright (C) 2023 networkException <git@nwex.de>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
@@ -322,6 +323,20 @@ sub logout_p {
return $promise;
}
+sub convert_travelynx_to_traewelling_visibility {
+ my ( $travelynx_visibility ) = @_;
+
+ my %visibilities = (
+ 100 => 0, # public => StatusVisibility::PUBLIC
+ 80 => 4, # travelynx => StatusVisibility::AUTHENTICATED (only visible for logged in users)
+ 60 => 2, # followers => StatusVisibility::FOLLOWERS
+ 30 => 3, # unlisted => StatusVisibility::PRIVATE (there is no träwelling equivalent to unlisted, their StatusVisibility::UNLISTED shows the journey on the profile)
+ 10 => 3, # private => StatusVisibility::PRIVATE
+ );
+
+ return $visibilities{$travelynx_visibility};
+}
+
sub checkin_p {
my ( $self, %opt ) = @_;
@@ -352,6 +367,7 @@ sub checkin_p {
arrival => $arrival_ts,
toot => $opt{data}{toot} ? \1 : \0,
tweet => $opt{data}{tweet} ? \1 : \0,
+ visibility => convert_travelynx_to_traewelling_visibility($opt{visibility})
};
if ( $opt{user_data}{comment} ) {