Allow instance-wide disabling of forking #2445

Merged
earl-warren merged 1 commit from algernon/forgejo:f/disable-forks into forgejo 2024-02-25 16:13:17 +01:00
Member

For small, personal self-hosted instances with no user signups, the fork button is just a noise. This patch allows disabling them like stars can be disabled too.

Disabling forks does not only remove the buttons from the web UI, it also disables the routes that could be used to create forks.

Fixes #2441.

For small, personal self-hosted instances with no user signups, the fork button is just a noise. This patch allows disabling them like stars can be disabled too. Disabling forks does not only remove the buttons from the web UI, it also disables the routes that could be used to create forks. Fixes #2441.
algernon force-pushed f/disable-forks from bbb9efdbed
Some checks failed
testing / backend-checks (pull_request) Failing after 2m9s
testing / test-unit (pull_request) Has been skipped
testing / test-mysql (pull_request) Has been skipped
testing / test-pgsql (pull_request) Has been skipped
testing / test-sqlite (pull_request) Has been skipped
to 4d8b45879c
All checks were successful
testing / backend-checks (pull_request) Successful in 3m46s
testing / test-unit (pull_request) Successful in 6m12s
testing / test-mysql (pull_request) Successful in 14m47s
testing / test-sqlite (pull_request) Successful in 15m14s
testing / test-pgsql (pull_request) Successful in 17m59s
2024-02-23 09:17:31 +01:00
Compare
Gusted left a comment
Owner

You're likely already aware, but the checks for the backend are missing.

You're likely already aware, but the checks for the backend are missing.
@ -50,6 +50,7 @@ var (
PrefixArchiveFiles bool
DisableMigrations bool
DisableStars bool `ini:"DISABLE_STARS"`
DisableForks bool `ini:"DISABLE_FORKS"`
Owner

I don't see why the ini key should be set for DisableStars or DisableForks. They will be automatically converted to the correct value.

I don't see why the `ini` key should be set for `DisableStars` or `DisableForks`. They will be automatically converted to the correct value.
Author
Member

I'll remove the ini key for DisableForks, but I'd rather remove the one for DisableStars in a separate pull request, because doing that in this one would be touching code that's unrelated to what the PR does.

I think there are a couple of other changes that can be made around the DisableStars parts of the code, so I'll submit a separate PR to address those, including removing the ini key here.

I'll remove the `ini` key for `DisableForks`, but I'd rather remove the one for `DisableStars` in a separate pull request, because doing that in this one would be touching code that's unrelated to what the PR does. I think there are a couple of other changes that can be made around the `DisableStars` parts of the code, so I'll submit a separate PR to address those, including removing the `ini` key here.
algernon marked this conversation as resolved
First-time contributor

I'd love to have some feedback meanwhile about whether a feature like this is worth doing in the first place.

Definitely! We modify the templates in our own instance just to prevent this from being possible.

BTW, our main rationale for doing it is that we forking our main repository, which takes several GBs, would eat all of the available disk space pretty quickly if everyone did it.

> I'd love to have some feedback meanwhile about whether a feature like this is worth doing in the first place. Definitely! We modify the templates in our own instance just to prevent this from being possible. BTW, our main rationale for doing it is that we forking our main repository, which takes several GBs, would eat all of the available disk space pretty quickly if everyone did it.
First-time contributor

I'd love to have some feedback meanwhile about whether a feature like this is worth doing in the first place.

Yes. I would like this on my server which has single-user repositories. If we can disable stars, there is no reason to not be able to disable forks, too. Cleaning up the UI of a never-used and can't-be-used feature is essential to comfortable workflow for many people, including myself.

> I'd love to have some feedback meanwhile about whether a feature like this is worth doing in the first place. Yes. I would like this on my server which has single-user repositories. If we can disable stars, there is no reason to not be able to disable forks, too. Cleaning up the UI of a never-used and can't-be-used feature is essential to comfortable workflow for many people, including myself.
algernon force-pushed f/disable-forks from 4d8b45879c
All checks were successful
testing / backend-checks (pull_request) Successful in 3m46s
testing / test-unit (pull_request) Successful in 6m12s
testing / test-mysql (pull_request) Successful in 14m47s
testing / test-sqlite (pull_request) Successful in 15m14s
testing / test-pgsql (pull_request) Successful in 17m59s
to 0ea021c8c9
All checks were successful
testing / backend-checks (pull_request) Successful in 5m4s
testing / test-unit (pull_request) Successful in 8m11s
testing / test-mysql (pull_request) Successful in 16m35s
testing / test-sqlite (pull_request) Successful in 15m32s
testing / test-pgsql (pull_request) Successful in 18m1s
2024-02-25 12:00:28 +01:00
Compare
algernon changed title from WIP: Allow instance-wide disabling of forking to Allow instance-wide disabling of forking 2024-02-25 12:00:34 +01:00
Author
Member

Updated the PR:

  • Increased the scope of DISABLE_FORKS = true: it will now disable the routes that can create forks, rather than just hiding buttons from the UI.
  • Removed the ini key from the setting struct.
  • Wrote tests that exercise the disabling functionality:
    • Check that the fork button isn't present
    • Check that fork-related routes (including listing forks) return 404.

This is ready for review now.

Updated the PR: - Increased the scope of `DISABLE_FORKS = true`: it will now disable the routes that can create forks, rather than just hiding buttons from the UI. - Removed the `ini` key from the setting struct. - Wrote tests that exercise the disabling functionality: - Check that the fork button isn't present - Check that fork-related routes (including listing forks) return 404. This is ready for review now.
algernon deleted branch f/disable-forks 2024-02-26 09:26:36 +01:00
Sign in to join this conversation.
No labels
arch
riscv64
backport/v1.19
backport/v1.20
backport/v1.21/forgejo
backport/v10.0/forgejo
backport/v11.0/forgejo
backport/v12.0/forgejo
backport/v13.0/forgejo
backport/v14.0/forgejo
backport/v7.0/forgejo
backport/v8.0/forgejo
backport/v9.0/forgejo
breaking
bug
bug
confirmed
bug
duplicate
bug
needs-more-info
bug
new-report
bug
reported-upstream
code/actions
code/api
code/auth
code/auth/faidp
code/auth/farp
code/email
code/federation
code/git
code/migrations
code/packages
code/wiki
database
MySQL
database
PostgreSQL
database
SQLite
dependency-upgrade
dependency
certmagic
dependency
chart.js
dependency
Chi
dependency
Chroma
dependency
citation.js
dependency
codespell
dependency
css-loader
dependency
devcontainers
dependency
dropzone
dependency
editorconfig-checker
dependency
elasticsearch
dependency
enmime
dependency
F3
dependency
ForgeFed
dependency
garage
dependency
Git
dependency
git-backporting
dependency
Gitea
dependency
gitignore
dependency
go-ap
dependency
go-enry
dependency
go-gitlab
dependency
Go-org
dependency
go-rpmutils
dependency
go-sql-driver mysql
dependency
go-swagger
dependency
go-version
dependency
go-webauthn
dependency
gocron
dependency
Golang
dependency
goldmark
dependency
goquery
dependency
Goth
dependency
grpc-go
dependency
happy-dom
dependency
Helm
dependency
image-spec
dependency
jsonschema
dependency
KaTeX
dependency
lint
dependency
MariaDB
dependency
Mermaid
dependency
minio-go
dependency
misspell
dependency
Monaco
dependency
PDFobject
dependency
playwright
dependency
postcss
dependency
postcss-plugins
dependency
pprof
dependency
prometheus client_golang
dependency
protobuf
dependency
relative-time-element
dependency
renovate
dependency
reply
dependency
ssh
dependency
swagger-ui
dependency
tailwind
dependency
temporal-polyfill
dependency
terminal-to-html
dependency
tests-only
dependency
text-expander-element
dependency
urfave
dependency
vfsgen
dependency
vite
dependency
Woodpecker CI
dependency
x tools
dependency
XORM
Discussion
duplicate
enhancement/feature
forgejo/accessibility
forgejo/branding
forgejo/ci
forgejo/commit-graph
forgejo/documentation
forgejo/furnace cleanup
forgejo/i18n
forgejo/interop
forgejo/moderation
forgejo/privacy
forgejo/release
forgejo/scaling
forgejo/security
forgejo/ui
Gain
High
Gain
Nice to have
Gain
Undefined
Gain
Very High
good first issue
i18n/backport-stable
impact
large
impact
medium
impact
small
impact
unknown
Incompatible license
issue
closed
issue
do-not-exist-yet
issue
open
manual test
Manually tested during feature freeze
OS
FreeBSD
OS
Linux
OS
macOS
OS
Windows
problem
QA
regression
release blocker
Release Cycle
Feature Freeze
release-blocker
v7.0
release-blocker
v7.0.1
release-blocker
v7.0.2
release-blocker
v7.0.3
release-blocker
v7.0.4
release-blocker
v8.0.0
release-blocker/v9.0.0
run-all-playwright-tests
run-end-to-end-tests
test
manual
test
needed
test
needs-help
test
not-needed
test
present
untested
User research - time-tracker
valuable code
worth a release-note
User research - Accessibility
User research - Blocked
User research - Community
User research - Config (instance)
User research - Errors
User research - Filters
User research - Future backlog
User research - Git workflow
User research - Labels
User research - Moderation
User research - Needs input
User research - Notifications/Dashboard
User research - Rendering
User research - Repo creation
User research - Repo units
User research - Security
User research - Settings (in-app)
No milestone
No project
No assignees
5 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
forgejo/forgejo!2445
No description provided.