Skip to content

Commit

Permalink
fix feed pagination error
Browse files Browse the repository at this point in the history
  • Loading branch information
GitHub committed Nov 9, 2023
1 parent 754dafe commit a113aad
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 14 deletions.
12 changes: 6 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 10 additions & 6 deletions src/controller/feed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,17 +218,21 @@ pub(crate) async fn feed(
let out_feed = OutFeed::new(&DB, feed.feed_id, feed.is_public)?;
e.push(out_feed);

if let Some(active_feed) = params.active_feed {
if active_feed != feed.feed_id {
continue;
}
active_folder = Some(feed.folder)
} else if let Some(ref active_folder) = active_folder {
if let Some(ref active_folder) = active_folder {
if active_folder != &feed.folder && !active_folder.is_empty() {
continue;
}
}

if let Some(active_feed) = params.active_feed {
if active_feed != 0 {
if active_feed != feed.feed_id {
continue;
}
active_folder = Some(feed.folder)
}
}

feed_ids.push(feed.feed_id);
}

Expand Down
4 changes: 2 additions & 2 deletions templates/feed.html
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
{% match filter %} {% when Some with (val) %}
<a class="pagination-previous" href="/feed/{{uid}}?anchor={{anchor - n}}&is_desc={{is_desc}}&filter={{val}}&active_folder={{active_folder}}&active_feed={{active_feed}}">Prev</a>
{% else %}
<a class="pagination-previous" href="/feed/{{uid}}?anchor={{anchor - n}}&is_desc={{is_desc}}">Prev</a>
<a class="pagination-previous" href="/feed/{{uid}}?anchor={{anchor - n}}&is_desc={{is_desc}}&active_folder={{active_folder}}&active_feed={{active_feed}}">Prev</a>
{% endmatch %}
{% endif %}

Expand All @@ -82,7 +82,7 @@
{% match filter %} {% when Some with (val) %}
<a class="pagination-next" href="/feed/{{uid}}?anchor={{anchor + n}}&is_desc={{is_desc}}&filter={{val}}&active_folder={{active_folder}}&active_feed={{active_feed}}">Next</a>
{% else %}
<a class="pagination-next" href="/feed/{{uid}}?anchor={{anchor + n}}&is_desc={{is_desc}}">Next</a>
<a class="pagination-next" href="/feed/{{uid}}?anchor={{anchor + n}}&is_desc={{is_desc}}&active_folder={{active_folder}}&active_feed={{active_feed}}">Next</a>
{% endmatch %}
{% endif %}
</nav>
Expand Down

0 comments on commit a113aad

Please sign in to comment.