Unverified Commit 1cca278b authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

add timeline / current checkins

parent bee67f09
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -2201,6 +2201,7 @@ sub startup {
	$authed_r->post('/delete')->to('account#delete');
	$authed_r->post('/logout')->to('account#do_logout');
	$authed_r->post('/set_token')->to('api#set_token');
	$authed_r->get('/timeline/in-transit')->to('profile#checked_in');

}

+24 −0
Original line number Diff line number Diff line
@@ -546,4 +546,28 @@ sub status_card {
	);
}

sub checked_in {
	my ($self) = @_;

	my $uid      = $self->current_user->{id};
	my @journeys = $self->in_transit->get_timeline(
		uid       => $uid,
		with_data => 1
	);

	if ( $self->param('ajax') ) {
		delete $self->stash->{layout};
		$self->render(
			'_timeline-checked-in',
			journeys => [@journeys],
		);
	}
	else {
		$self->render(
			'timeline-checked-in',
			journeys => [@journeys],
		);
	}
}

1;
+13 −1
Original line number Diff line number Diff line
@@ -382,7 +382,13 @@ sub compute_effective_visibility {
sub homepage {
	my ($self) = @_;
	if ( $self->is_user_authenticated ) {
		my $uid      = $self->current_user->{id};
		my $status   = $self->get_user_status;
		my @timeline = $self->in_transit->get_timeline(
			uid   => $uid,
			short => 1
		);
		$self->stash( timeline => [@timeline] );
		my @recent_targets;
		if ( $status->{checked_in} ) {
			my $journey_visibility
@@ -457,6 +463,12 @@ sub status_card {

	delete $self->stash->{layout};

	my @timeline = $self->in_transit->get_timeline(
		uid   => $self->current_user->{id},
		short => 1
	);
	$self->stash( timeline => [@timeline] );

	if ( $status->{checked_in} ) {
		my $journey_visibility
		  = $self->compute_effective_visibility(
+3 −0
Original line number Diff line number Diff line
% my $user = current_user();
% if (@{stash('timeline') // []}) {
	%= include '_timeline_link', timeline => stash('timeline')
% }
<div class="autorefresh">
	<div class="card">
		<div class="card-content">
+4 −1
Original line number Diff line number Diff line
@@ -7,6 +7,9 @@
				% if (stash('from_profile')) {
					Unterwegs mit <%= include '_format_train', journey => $journey %>
				% }
				% elsif (stash('from_timeline')) {
					<a href="/p/<%= $name %>"><%= $name %></a>: <%= include '_format_train', journey => $journey %>
				% }
				% else {
					<a href="/p/<%= $name %>"><%= $name %></a> ist unterwegs
				% }
@@ -16,7 +19,7 @@
				<p>„<%= $journey->{comment} %>“</p>
			% }
			<p>
				% if (not stash('from_profile')) {
				% if (not stash('from_profile') and not stash('from_timeline')) {
					<div class="center-align">
						%= include '_format_train', journey => $journey
					</div>
Loading