-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Allow setting wiki writeable for all users on an instance #6312
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -259,17 +259,27 @@ | |
{{else}} | ||
<div class="ui radio checkbox"> | ||
{{end}} | ||
<input class="hidden enable-system-radio" tabindex="0" name="enable_external_wiki" type="radio" value="false" data-target="#external_wiki_box" {{if not (.Repository.UnitEnabled $.UnitTypeExternalWiki)}}checked{{end}}/> | ||
<input class="hidden enable-system-radio" tabindex="0" name="enable_external_wiki" type="radio" value="false" data-target="#external_wiki_box" data-context="#internal_wiki_box" {{if not (.Repository.UnitEnabled $.UnitTypeExternalWiki)}}checked{{end}}/> | ||
<label>{{.i18n.Tr "repo.settings.use_internal_wiki"}}</label> | ||
</div> | ||
</div> | ||
{{if .Repository.Owner.IsOrganization}} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Setting should only be available for public repositories? |
||
<div class="field {{if (.Repository.UnitEnabled $.UnitTypeExternalWiki)}}disabled{{end}}" id="internal_wiki_box"> | ||
<div class="field"> | ||
<div class="ui checkbox"> | ||
<input name="allow_wiki_edit_all" type="checkbox" {{if .Permission.AllowWriteAll $.UnitTypeWiki}}checked{{end}}> | ||
<label>{{.i18n.Tr "repo.settings.allow_wiki_edit_all"}}</label> | ||
</div> | ||
</div> | ||
</div> | ||
{{end}} | ||
<div class="field"> | ||
{{if .UnitTypeExternalWiki.UnitGlobalDisabled}} | ||
<div class="ui radio checkbox poping up disabled" data-content="{{.i18n.Tr "repo.unit_disabled"}}"> | ||
{{else}} | ||
<div class="ui radio checkbox"> | ||
{{end}} | ||
<input class="hidden enable-system-radio" tabindex="0" name="enable_external_wiki" type="radio" value="true" data-target="#external_wiki_box" {{if .Repository.UnitEnabled $.UnitTypeExternalWiki}}checked{{end}}/> | ||
<input class="hidden enable-system-radio" tabindex="0" name="enable_external_wiki" type="radio" value="true" data-target="#external_wiki_box" data-context="#internal_wiki_box" {{if .Repository.UnitEnabled $.UnitTypeExternalWiki}}checked{{end}}/> | ||
<label>{{.i18n.Tr "repo.settings.use_external_wiki"}}</label> | ||
</div> | ||
</div> | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need a migration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought false is the default, then we would still need it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All database structure changes should have a migration. You can find many example on
models/migration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I see, I somehow thought that there was some magic invovled which inserts missing columns automagically.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is some magic involved, and you've probably got your column migrated automagically.
There are two stages to Gitea migration:
models/migration
), that update the internal version and change data as needed.The problem comes when you rely on the 2nd stage to do your migration. It will work the first time, but in the future (e.g. Gitea 12.2) some manual steps can be added in the first stage of the migration that will need the structure that is not there yet (as it is created in the 2nd stage). If some user attempts to migrate from 1.10 to 12.2, all the steps on stage 1 will be executed, and that particular step will fail because of the missing column.
That's why we don't rely on the 2nd stage and make all migration steps explicit, so any upcoming step can count on the previous steps to upgrade the database to the expected state.
I hope this makes sense!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for a great explanation! Understood and I am convinced ;)