Skip to content

Commit

Permalink
No double message on end of stream (#105)
Browse files Browse the repository at this point in the history
  • Loading branch information
tclaus committed May 20, 2023
1 parent 0c5aa9f commit 81ecad2
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions app/assets/stylesheets/stream.scss
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@
}
}

.stream_pagination_controls {
display: none;
}

.opengraph-container {
width: 100%;
background-color: #f0f0f0;
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/streams_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def local_public; end

private

def stream_responder(stream_builder=nil)
def stream_responder(stream_builder)
@stream_builder_object = stream_builder.new(current_user)
@pagy, @stream = pagy_countless(@stream_builder_object.stream_posts)
respond_to do |format|
Expand Down
4 changes: 1 addition & 3 deletions app/views/streams/_stream_elements.html.haml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
= turbo_stream_from :posts
- @stream.each do |post|
= render partial: "streams/stream_element_container", locals: {post: PostPresenter.new(post, current_user)}
- if @stream.empty?
= render "streams/end_of_stream"
= render partial: "streams/stream_element_container", locals: {post: PostPresenter.new(post, current_user)}
4 changes: 3 additions & 1 deletion app/views/streams/_stream_flow.html.haml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
%div{data: {controller: "infinite-scroll"}}
%div{data: {infinite_scroll_target: "entries"}}
= render partial: "streams/stream_elements", locals:{stream: stream}
%div{data:{infinite_scroll_target: "pagination"}}
- if stream.empty?
= render "streams/end_of_stream"
%div{data:{infinite_scroll_target: "pagination"}, class: "stream_pagination_controls"}
- if @pagy.vars[:items]>= @stream.size
= countless_stream_next_tag(@pagy)

0 comments on commit 81ecad2

Please sign in to comment.