You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
forgejo/models/migrations
mrsdizzie 8d99ee2773
Add Organization Wide Labels (#10814)
* Add organization wide labels

Implement organization wide labels similar to organization wide
webhooks. This lets you create individual labels for organizations that can be used
for all repos under that organization (so being able to reuse the same
label across multiple repos).

This makes it possible for small organizations with many repos to use
labels effectively.

Fixes #7406

* Add migration

* remove comments

* fix tests

* Update options/locale/locale_en-US.ini

Removed unused translation string

* show org labels in issue search label filter

* Use more clear var name

* rename migration after merge from master

* comment typo

* update migration again after rebase with master

* check for orgID <=0 per guillep2k review

* fmt

* Apply suggestions from code review

Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com>

* remove unused code

* Make sure RepoID is 0 when searching orgID per code review

* more changes/code review requests

* More descriptive translation var per code review

* func description/delete comment when issue label deleted instead of hiding it

* remove comment

* only use issues in that repo when calculating number of open issues for org label on repo label page

* Add integration test for IssuesSearch API with labels

* remove unused function

* Update models/issue_label.go

Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com>

* Use subquery in GetLabelIDsInReposByNames

* Fix tests to use correct orgID

* fix more tests

* IssuesSearch api now uses new BuildLabelNamesIssueIDsCondition. Add a few more tests as well

* update comment for clarity

* Revert previous code change now that we can use the new BuildLabelNamesIssueIDsCondition

* Don't sort repos by date in IssuesSearch API

After much debugging I've found a strange issue where in some cases MySQL will return a different result than other enigines if a query is sorted by a null collumn. For example with our integration test data where we don't set updated_unix in repository fixtures:

SELECT `id`, `owner_id`, `owner_name`, `lower_name`, `name`, `description`, `website`, `original_service_type`, `original_url`, `default_branch`, `num_watches`, `num_stars`, `num_forks`, `num_issues`, `num_closed_issues`, `num_pulls`, `num_closed_pulls`, `num_milestones`, `num_closed_milestones`, `is_private`, `is_empty`, `is_archived`, `is_mirror`, `status`, `is_fork`, `fork_id`, `is_template`, `template_id`, `size`, `is_fsck_enabled`, `close_issues_via_commit_in_any_branch`, `topics`, `avatar`, `created_unix`, `updated_unix` FROM `repository` ORDER BY updated_unix DESC LIMIT 15 OFFSET 45

Returns different results for MySQL than other engines. However, the similar query:

SELECT `id`, `owner_id`, `owner_name`, `lower_name`, `name`, `description`, `website`, `original_service_type`, `original_url`, `default_branch`, `num_watches`, `num_stars`, `num_forks`, `num_issues`, `num_closed_issues`, `num_pulls`, `num_closed_pulls`, `num_milestones`, `num_closed_milestones`, `is_private`, `is_empty`, `is_archived`, `is_mirror`, `status`, `is_fork`, `fork_id`, `is_template`, `template_id`, `size`, `is_fsck_enabled`, `close_issues_via_commit_in_any_branch`, `topics`, `avatar`, `created_unix`, `updated_unix` FROM `repository` ORDER BY updated_unix DESC LIMIT 15 OFFSET 30

Returns the same results.

This causes integration tests to fail on MySQL in certain cases but would never show up in a real installation. Since this API call always returns issues based on the optionally provided repo_priority_id or the issueID itself, there is no change to results by changing the repo sorting method used to get ids earlier in the function.

* linter is back!

* code review

* remove now unused option

* Fix newline at end of files

* more unused code

* update to master

* check for matching ids before query

* Update models/issue_label.go

Co-Authored-By: 6543 <6543@obermui.de>

* Update models/issue_label.go

* update comments

* Update routers/org/setting.go

Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
Co-authored-by: 6543 <6543@obermui.de>
4 years ago
..
migrations.go Add Organization Wide Labels (#10814) 4 years ago
v70.go Remove migration support from versions earlier than 1.6.0 (#10026) 4 years ago
v71.go Upgrade xorm to v0.8.0 (#8536) 5 years ago
v72.go Upgrade xorm to v0.8.0 (#8536) 5 years ago
v73.go Upgrade xorm to v0.8.0 (#8536) 5 years ago
v74.go Upgrade xorm to v0.8.0 (#8536) 5 years ago
v75.go Upgrade xorm to v0.8.0 (#8536) 5 years ago
v76.go Remove migration support from versions earlier than 1.6.0 (#10026) 4 years ago
v77.go Upgrade xorm to v0.8.0 (#8536) 5 years ago
v78.go Upgrade xorm to v0.8.0 (#8536) 5 years ago
v79.go Upgrade xorm to v0.8.0 (#8536) 5 years ago
v80.go Upgrade xorm to v0.8.0 (#8536) 5 years ago
v81.go Upgrade xorm to v1.0.0 (#10646) 4 years ago
v82.go Add Close() method to gogitRepository (#8901) 5 years ago
v83.go Upgrade xorm to v0.8.0 (#8536) 5 years ago
v84.go Upgrade xorm to v0.8.0 (#8536) 5 years ago
v85.go Upgrade xorm to v0.8.0 (#8536) 5 years ago
v86.go Upgrade xorm to v0.8.0 (#8536) 5 years ago
v87.go Upgrade xorm to v0.8.0 (#8536) 5 years ago
v88.go Upgrade xorm to v0.8.0 (#8536) 5 years ago
v89.go Upgrade xorm to v0.8.0 (#8536) 5 years ago
v90.go Upgrade xorm to v0.8.0 (#8536) 5 years ago
v91.go Upgrade xorm to v0.8.0 (#8536) 5 years ago
v92.go Upgrade xorm to v0.8.0 (#8536) 5 years ago
v93.go Upgrade xorm to v0.8.0 (#8536) 5 years ago
v94.go Upgrade xorm to v0.8.0 (#8536) 5 years ago
v95.go Upgrade xorm to v0.8.0 (#8536) 5 years ago
v96.go Fix migration bug on v96.go (#10572) 4 years ago
v97.go Upgrade xorm to v0.8.0 (#8536) 5 years ago
v98.go Upgrade xorm to v0.8.0 (#8536) 5 years ago
v99.go Upgrade xorm to v0.8.0 (#8536) 5 years ago
v100.go Upgrade xorm to v0.8.0 (#8536) 5 years ago
v101.go Allow more than 255 characters for tokens in external_login_user table (#8554) 5 years ago
v102.go Fix bug on pull requests when transfer head repository (#8564) 5 years ago
v103.go Allow Protected Branches to Whitelist Deploy Keys (#8483) 5 years ago
v104.go Fix extra columns from `label` table (#8633) 5 years ago
v105.go Add team option to grant rights for all organization repositories (#8688) 5 years ago
v106.go Auto-subscribe user to repository when they commit/tag to it (#7657) 5 years ago
v107.go Template Repositories (#8768) 5 years ago
v108.go Improve notification (#8835) 5 years ago
v109.go Team permission to create repository in organization (#8312) 5 years ago
v110.go Upgrade xorm to v1.0.0 (#10646) 4 years ago
v111.go Issue with Migration rule v111 (#9449) 5 years ago
v112.go fix wrong migration (#9381) 5 years ago
v113.go Change target branch for pull request (#6488) 5 years ago
v114.go Add migration to sanitize repository original_url (#9423) 5 years ago
v115.go Ignore empty avatars in v115.go (#9520) 5 years ago
v116.go [API] Extend times API (#9200) 5 years ago
v117.go Add branch protection option to block merge on requested changes. (#9592) 5 years ago
v118.go Mark PR reviews as stale at push and allow to dismiss stale approvals (#9532) 5 years ago
v119.go Fix wrong original git service type on a migrated repository (#9693) 5 years ago
v120.go Add owner_name column for table repository for maintaince reason (#9717) 5 years ago
v121.go Restricted users (#6274) 5 years ago
v122.go Add require signed commit for protected branch (#9708) 5 years ago
v123.go Migrate reactions when migrating repository from github (#9599) 5 years ago
v124.go Add missing columns to repository and user (#9861) 5 years ago
v125.go Migrate reviews when migrating repository from github (#9463) 5 years ago
v126.go Update topics repo count when deleting repository (#10051) 4 years ago
v127.go Language statistics bar for repositories (#8037) 4 years ago
v128.go Various Merge Base fixes (#10786) 4 years ago
v129.go Migration for deleting orphaned dependencies (#10617) 4 years ago
v130.go Fix migration (#10641) 4 years ago
v131.go System-wide webhooks (#10546) 4 years ago
v132.go Allow to set protected file patterns that can not be changed under no conditions (#10806) 4 years ago
v133.go make avatar lookup occur at image request (#10540) 4 years ago
v134.go Various Merge Base fixes (#10786) 4 years ago
v135.go Add Organization Wide Labels (#10814) 4 years ago