summaryrefslogtreecommitdiff
path: root/lib/Travelynx/Helper
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2023-07-13 21:12:36 +0200
committerBirte Kristina Friesel <derf@finalrewind.org>2023-07-13 21:12:36 +0200
commit882d1fe16f26918c72898908d42ad2c017991a53 (patch)
tree985f739c05b11d3a2add66ebcf7fb6b5c3a647fd /lib/Travelynx/Helper
parent6c5caaf242dc5ff689773b1811083005fdb31d71 (diff)
parentee2d8bd014fdcb119db37c45671c1900ae10c21f (diff)
Merge branch 'networkException-träwelling-visibility'
Diffstat (limited to 'lib/Travelynx/Helper')
-rw-r--r--lib/Travelynx/Helper/Traewelling.pm30
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/Travelynx/Helper/Traewelling.pm b/lib/Travelynx/Helper/Traewelling.pm
index bcde1de..23170eb 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,33 @@ sub logout_p {
return $promise;
}
+sub convert_travelynx_to_traewelling_visibility {
+ my ($travelynx_visibility) = @_;
+
+ my %visibilities = (
+
+ # public => StatusVisibility::PUBLIC
+ 100 => 0,
+
+ # travelynx => StatusVisibility::AUTHENTICATED
+ # (only visible for logged in users)
+ 80 => 4,
+
+ # followers => StatusVisibility::FOLLOWERS
+ 60 => 2,
+
+ # unlisted => StatusVisibility::PRIVATE
+ # (there is no träwelling equivalent to unlisted, their
+ # StatusVisibility::UNLISTED shows the journey on the profile)
+ 30 => 3,
+
+ # private => StatusVisibility::PRIVATE
+ 10 => 3,
+ );
+
+ return $visibilities{$travelynx_visibility};
+}
+
sub checkin_p {
my ( $self, %opt ) = @_;
@@ -352,6 +380,8 @@ 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} ) {