decaporg / decap-cms

A Git-based CMS for Static Site Generators
https://decapcms.org
MIT License
17.65k stars 3.02k forks source link

Bitbucket workflow maxes out at 50 drafts #7144

Open twocs opened 3 months ago

twocs commented 3 months ago

Describe the bug Using Bitbucket as a backend, only 50 pull requests are loaded for Workflow. As a result, once they created more than 50 draft articles, it no longer loads them all.

The pagelen is hard coded to 50 for pull requests (and only first page loaded) here: https://github.com/decaporg/decap-cms/blob/84ec574bb9526973627950b09c249634e7a811e3/packages/decap-cms-backend-bitbucket/src/API.ts#L656

In comparison with the Github Backend (which has 100 pull requests hard coded), we can see that Bitbucket Backend simply requests the first page of pull requests, while the Github Backend requests all pages of pull requests. https://github.com/decaporg/decap-cms/blob/84ec574bb9526973627950b09c249634e7a811e3/packages/decap-cms-backend-github/src/API.ts#L503

Therefore, I suggest that Bitbucket's backend should be updated to use a new function like the one that Github Backend uses this.requestAllPages https://github.com/decaporg/decap-cms/blob/84ec574bb9526973627950b09c249634e7a811e3/packages/decap-cms-backend-github/src/API.ts#L338

Should it look similar to listAllFiles? https://github.com/decaporg/decap-cms/blob/84ec574bb9526973627950b09c249634e7a811e3/packages/decap-cms-backend-bitbucket/src/API.ts#L408

To Reproduce Steps to reproduce the behavior. For example:

  1. Create 51 drafts in Workflow for Bitbucket
  2. You can only see 50.
  3. Seems that you also can't edit number 51 (is it not in memory?)

Expected behavior Match other environments, which load all pages of pull requests, not simply the first one.

Screenshots image Inspecting the network requests, I can see that pagelen=50 is hard coded, and only one page is loaded. (Note that the screenshot is from https://github.com/decaporg/decap-cms/issues/7025, completely different image but the relevant thing is that pagelen=50)

Applicable Versions:

CMS configuration

baseURL = "<base_URL>"
languageCode = "en-us"
title = "rougon"

timeZone = "UTC"

enableGitInfo = true
[frontmatter]
date = ["date", "publishDate", "lastmod"]
lastmod = ["lastmod", ":git", "date", "publishDate"]

[module]
  [[module.mounts]]
    source = "assets"
    target = "assets"
  [[module.mounts]]
    source = "static"
    target = "static"
  [[module.mounts]]
    source = "node_modules"
    target = "assets/node_modules"
  [[module.mounts]]
    source = "assets/uploads"
    target = "static/uploads"

[server]
[[server.headers]]
  for = '/**'
  [server.headers.values]
    Access-Control-Allow-Origin = "*"

[outputs]
  page = ["html","json"]
  home = ["html","json"]
  section = ["html","json"]
  term = ["json"]

[mediaTypes."text/netlify"]
  suffixes = ["txt"]
  delimiters = ["txt"]

[outputFormats.players]
  baseName = "players"
  mediatype ="application/json"
[outputFormats.redirect]
  mediatype = "text/netlify"
  baseName = "_redirects"

[taxonomies]
  sport = "sports"
  training = "trainings"

[permalinks]
  page = "/:section/:title/"

  [deployment]
# By default, files are uploaded in an arbitrary order.
# Files that match the regular expressions in the "Order" list
# will be uploaded first, in the listed order.
order = [".jpg$", ".gif$"]

[[deployment.targets]]
# An arbitrary name for this target.
name = "deployment-target"
# The Go Cloud Development Kit URL to deploy to. Examples:
# GCS; see https://gocloud.dev/howto/blob/#gcs
URL = "<gs url>"

[[deployment.matchers]]
# Cache static assets for 1 year.
pattern = "^.+\\.(js|css|svg|ttf)$"
cacheControl = "max-age=31536000, no-transform, public"
gzip = true

[[deployment.matchers]]
pattern = "^.+\\.(png|jpg)$"
cacheControl = "max-age=31536000, no-transform, public"
gzip = false

[[deployment.matchers]]
# Set custom content type for /sitemap.xml
pattern = "^sitemap\\.xml$"
contentType = "application/xml"