Skip to content
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

Allow setting notes in commit_options from session data #1907

Merged
merged 2 commits into from
Dec 21, 2022

Conversation

dometto
Copy link
Member

@dometto dometto commented Dec 9, 2022

Resolves #1766

  • Renames the #commit_message method to the more accurate #commit_options (since it already returns author data in addition to the message)
  • Adds a :notes key to the hash returned by #commit_options, the value of which is sourced from the session
    • the relevant session key (gollum.notes) can be set by a piece of middleware, analogous to the way this works for author info

Possible use cases are e.g. getting the client IP and using this info in the :post_commit Hook. In the future, we could provide a feature to actually store the contents of the :notes field in a git note. For now, this only passes the info on to the Committer object. gollum/gollum-lib#431 ensures the note is stored in the Committer object, where it can be accessed from the Hook.

lib/gollum/app.rb Outdated Show resolved Hide resolved
lib/gollum/app.rb Outdated Show resolved Hide resolved
@dometto dometto merged commit 8f3016d into gollum:master Dec 21, 2022
@dometto dometto deleted the add_commit_extra branch December 21, 2022 11:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Question: getting the IP address of the Client which performed the change on the page in the Hook
2 participants