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/modules/structs
JakobDev aaa1094663
Add the ability to pin Issues (#24406)
This adds the ability to pin important Issues and Pull Requests. You can
also move pinned Issues around to change their Position. Resolves #2175.

## Screenshots

![grafik](https://user-images.githubusercontent.com/15185051/235123207-0aa39869-bb48-45c3-abe2-ba1e836046ec.png)

![grafik](https://user-images.githubusercontent.com/15185051/235123297-152a16ea-a857-451d-9a42-61f2cd54dd75.png)

![grafik](https://user-images.githubusercontent.com/15185051/235640782-cbfe25ec-6254-479a-a3de-133e585d7a2d.png)

The Design was mostly copied from the Projects Board.

## Implementation
This uses a new `pin_order` Column in the `issue` table. If the value is
set to 0, the Issue is not pinned. If it's set to a bigger value, the
value is the Position. 1 means it's the first pinned Issue, 2 means it's
the second one etc. This is dived into Issues and Pull requests for each
Repo.

## TODO
- [x] You can currently pin as many Issues as you want. Maybe we should
add a Limit, which is configurable. GitHub uses 3, but I prefer 6, as
this is better for bigger Projects, but I'm open for suggestions.
- [x] Pin and Unpin events need to be added to the Issue history.
- [x] Tests
- [x] Migration

**The feature itself is currently fully working, so tester who may find
weird edge cases are very welcome!**

---------

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Giteabot <teabot@gitea.io>
1 year ago
..
activity.go Add activity feeds API (#23494) 1 year ago
activitypub.go Implement FSFE REUSE for golang files (#21840) 2 years ago
admin_user.go Allow custom "created" timestamps in user creation API (#22549) 1 year ago
attachment.go Implement FSFE REUSE for golang files (#21840) 2 years ago
commit_status.go Implement actions (#21937) 2 years ago
cron.go Implement FSFE REUSE for golang files (#21840) 2 years ago
doc.go Implement FSFE REUSE for golang files (#21840) 2 years ago
fork.go Implement FSFE REUSE for golang files (#21840) 2 years ago
git_blob.go Implement FSFE REUSE for golang files (#21840) 2 years ago
git_hook.go Implement FSFE REUSE for golang files (#21840) 2 years ago
hook.go New webhook trigger for receiving Pull Request review requests (#24481) 1 year ago
issue.go Add the ability to pin Issues (#24406) 1 year ago
issue_comment.go Add API management for issue/pull and comment attachments (#21783) 2 years ago
issue_label.go Add API for Label templates (#24602) 1 year ago
issue_milestone.go Implement FSFE REUSE for golang files (#21840) 2 years ago
issue_reaction.go Implement FSFE REUSE for golang files (#21840) 2 years ago
issue_stopwatch.go Implement FSFE REUSE for golang files (#21840) 2 years ago
issue_test.go Implement FSFE REUSE for golang files (#21840) 2 years ago
issue_tracked_time.go Implement FSFE REUSE for golang files (#21840) 2 years ago
lfs_lock.go Implement FSFE REUSE for golang files (#21840) 2 years ago
mirror.go Add `sync_on_commit` option for push mirrors api (#22271) 2 years ago
miscellaneous.go Add API for gitignore templates (#22783) 1 year ago
nodeinfo.go Implement FSFE REUSE for golang files (#21840) 2 years ago
notifications.go Implement FSFE REUSE for golang files (#21840) 2 years ago
org.go Fix Org edit page bugs: renaming detection, maxlength (#24161) 1 year ago
org_member.go Implement FSFE REUSE for golang files (#21840) 2 years ago
org_team.go Implement FSFE REUSE for golang files (#21840) 2 years ago
package.go Implement FSFE REUSE for golang files (#21840) 2 years ago
pull.go Add the ability to pin Issues (#24406) 1 year ago
pull_review.go Implement FSFE REUSE for golang files (#21840) 2 years ago
release.go Implement FSFE REUSE for golang files (#21840) 2 years ago
repo.go Add the ability to pin Issues (#24406) 1 year ago
repo_branch.go Supports wildcard protected branch (#20825) 2 years ago
repo_collaborator.go Implement FSFE REUSE for golang files (#21840) 2 years ago
repo_commit.go Implement FSFE REUSE for golang files (#21840) 2 years ago
repo_file.go Implement FSFE REUSE for golang files (#21840) 2 years ago
repo_key.go Implement FSFE REUSE for golang files (#21840) 2 years ago
repo_note.go Implement FSFE REUSE for golang files (#21840) 2 years ago
repo_refs.go Implement FSFE REUSE for golang files (#21840) 2 years ago
repo_tag.go Implement FSFE REUSE for golang files (#21840) 2 years ago
repo_topic.go Implement FSFE REUSE for golang files (#21840) 2 years ago
repo_tree.go Implement FSFE REUSE for golang files (#21840) 2 years ago
repo_watch.go Implement FSFE REUSE for golang files (#21840) 2 years ago
repo_wiki.go Implement FSFE REUSE for golang files (#21840) 2 years ago
settings.go Implement FSFE REUSE for golang files (#21840) 2 years ago
status.go Implement FSFE REUSE for golang files (#21840) 2 years ago
task.go Make repo migration cancelable and fix various bugs (#24605) 1 year ago
user.go add user rename endpoint to admin api (#22789) 1 year ago
user_app.go Add scopes to API to create token and display them (#22989) 1 year ago
user_email.go add admin API email endpoints (#22792) 1 year ago
user_gpgkey.go Implement FSFE REUSE for golang files (#21840) 2 years ago
user_key.go Implement FSFE REUSE for golang files (#21840) 2 years ago
visible_type.go change org_type.go to visible_type.go and fix the notes (#22752) 1 year ago