[PR #2035] [MERGED] Pagination on releases page #16191

Closed
opened 2025-11-02 12:04:21 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/go-gitea/gitea/pull/2035
Author: @iszla
Created: 6/22/2017
Status: Merged
Merged: 6/28/2017
Merged by: @lunny

Base: masterHead: PaginationReleases


📝 Commits (10+)

  • 3cbc3e2 Added count to GetReleasesByRepoID so pagination will work
  • 2046b2a Separated it out to a new function, can then also leave the API part unaffected
  • 686ce04 Remove extra whitespace added in untouched function
  • 58e90fb Added comment and corrected name in error handler
  • 3d6fa22 Account for if the user is owner or not in the count
  • db54407 Also check if repo is draft
  • 608579e revert back to the correct count in the ReleasesToDisplay loop
  • 1f627f7 Fixed lint error regarding else with return statement
  • cd8fc18 Use Cond struct instead of string, corrected name in error handler
  • 9fbeb76 Removed unused return variable names

📊 Changes

2 files changed (+22 additions, -2 deletions)

View changed files

📝 models/release.go (+14 -0)
📝 routers/repo/release.go (+8 -2)

📄 Description

Reason for why the pagination did not work, was because the paginater was never given a higher count than the amount of releases to display (which is max 10)
Added GetReleaseCountByRepoID function to get count of releases so pagination will work on releases page.
Count also checks if user is owner, so if there are many prereleases and/or drafts the page count should not be off.

Tested by being logged in as owner, and not logged in.

Fixes https://github.com/go-gitea/gitea/issues/1863


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/go-gitea/gitea/pull/2035 **Author:** [@iszla](https://github.com/iszla) **Created:** 6/22/2017 **Status:** ✅ Merged **Merged:** 6/28/2017 **Merged by:** [@lunny](https://github.com/lunny) **Base:** `master` ← **Head:** `PaginationReleases` --- ### 📝 Commits (10+) - [`3cbc3e2`](https://github.com/go-gitea/gitea/commit/3cbc3e299324adf92f4023a2b6676071f6be8863) Added count to GetReleasesByRepoID so pagination will work - [`2046b2a`](https://github.com/go-gitea/gitea/commit/2046b2a190c04312956a8127857f87b329488b69) Separated it out to a new function, can then also leave the API part unaffected - [`686ce04`](https://github.com/go-gitea/gitea/commit/686ce047bba587951f5505d4f74ec7dc9eadac67) Remove extra whitespace added in untouched function - [`58e90fb`](https://github.com/go-gitea/gitea/commit/58e90fb2cce9bf7d39242baf9e0f486304bff082) Added comment and corrected name in error handler - [`3d6fa22`](https://github.com/go-gitea/gitea/commit/3d6fa2286d0486266a9c482ddae822be1a067a36) Account for if the user is owner or not in the count - [`db54407`](https://github.com/go-gitea/gitea/commit/db54407efab6a143eceb4be678706bc1516b0493) Also check if repo is draft - [`608579e`](https://github.com/go-gitea/gitea/commit/608579e6bef723dde84c701a0f2216621b85ba2a) revert back to the correct count in the ReleasesToDisplay loop - [`1f627f7`](https://github.com/go-gitea/gitea/commit/1f627f7f22b7ecfe83ad067f81a0f2f2f819f120) Fixed lint error regarding else with return statement - [`cd8fc18`](https://github.com/go-gitea/gitea/commit/cd8fc18ce9dc22e6ab9ed9940c740df40b77cfaa) Use Cond struct instead of string, corrected name in error handler - [`9fbeb76`](https://github.com/go-gitea/gitea/commit/9fbeb769a6d2ca7ff4efeca503dd5c5e94994cf3) Removed unused return variable names ### 📊 Changes **2 files changed** (+22 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `models/release.go` (+14 -0) 📝 `routers/repo/release.go` (+8 -2) </details> ### 📄 Description Reason for why the pagination did not work, was because the paginater was never given a higher count than the amount of releases to display (which is max 10) Added `GetReleaseCountByRepoID` function to get count of releases so pagination will work on releases page. Count also checks if user is owner, so if there are many prereleases and/or drafts the page count should not be off. Tested by being logged in as owner, and not logged in. Fixes https://github.com/go-gitea/gitea/issues/1863 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2025-11-02 12:04:21 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#16191