Skip to content

Commit

Permalink
Allow fetching post in empty range which means returning unlimited re…
Browse files Browse the repository at this point in the history
…sult
  • Loading branch information
crazytonyli committed Oct 18, 2023
1 parent 4f8178a commit fa641ec
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions WordPress/Classes/Services/PostRepository.swift
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ extension PostRepository {
type: type,
statuses: statuses,
authorUserID: authorUserID,
range: offset...(offset + max(number - 1, 0)),
range: offset..<(offset + max(number, 0)),
orderBy: .byDate,
descending: true,
// Only delete other local posts if the current call is the first pagination request.
Expand Down Expand Up @@ -355,7 +355,7 @@ extension PostRepository {
searchInput: input,
statuses: statuses,
authorUserID: authorUserID,
range: 0...max(limit - 1, 0),
range: 0..<max(limit, 0),
orderBy: orderBy,
descending: descending,
deleteOtherLocalPosts: false,
Expand All @@ -368,7 +368,7 @@ extension PostRepository {
searchInput: String? = nil,
statuses: [BasePost.Status]?,
authorUserID: NSNumber?,
range: ClosedRange<Int>,
range: Range<Int>,
orderBy: PostServiceResultsOrdering = .byDate,
descending: Bool = true,
deleteOtherLocalPosts: Bool,
Expand Down

0 comments on commit fa641ec

Please sign in to comment.