gitea icon indicating copy to clipboard operation
gitea copied to clipboard

Saved replies to issues and PRs (Canned/Templated Responses)

Open techknowlogick opened this issue 2 years ago • 7 comments

Feature Description

canned responses would allow faster responses to common queries.

I currently use them for pasting a closing an issues as a dupe, or direction questions to the chatroom. GitHub currently has them on a per user basis.

Instead of how GitHub does it, this could be done on a per-repo basis, and just like with issue templates they could be saved in the .gitea directory as yaml config.

What would need to be done:

  • create yaml schema
    • schema version
    • snippet title/description to show in dropdown list
    • the actual body of the response to be pasted in
  • parse/validate yaml
  • show dropdown in issue/pr comment box

In the future, we could leverage the .gitea repo, and save org/user scoped yaml.

Screenshots

screenshot of canned response dropdown in GitHub

techknowlogick avatar Feb 06 '23 18:02 techknowlogick

Why canned? Wouldn't that be saved?

Also, I see a huge benefit with your proposed approach: We can even allow for inserting variables, i.e. the issue open date, its title, its description, … For that to be efficient, however, there is only one possible approach: First, define a query that simply lists the available saved replies. It doesn't query their contents, only their names. (Then, display these results in the UI/ offer an API endpoint to show these names) Then, simply offer a route that takes a named reply, and use the response of querying for this named reply as output for whatever you want to write.

(To be fair, I haven't used that feature on GitHub yet, so I don't know how they implemented it. Those are simply the thoughts at the top of my head)

delvh avatar Feb 06 '23 19:02 delvh

Here on GH they are called "Saved Replies" because a user makes them and saves them. In this case they are more like "templates".

fsiddi avatar Feb 06 '23 20:02 fsiddi

Why canned? Wouldn't that be saved?

Here on GH they are called "Saved Replies" because a user makes them and saves them. In this case they are more like "templates".

Yeah, I also used snippet, canned response, and perhaps another in my initial description. I've updated title to cover all the possible names.

techknowlogick avatar Feb 06 '23 22:02 techknowlogick

I have a WIP branch of this right now. Right now, it is an API endpoint that fetches the config file from the repo, and returns the config to be used by the issue/PR comment area.

The file name is: .gitea/comment_snippets.yml (not sure about this filename, but figured rather than yakshaving it, I'd working on the PR is better)

The yaml schema I'm working with is:

version: 1.0 # schema version, in case it needs to be updated
snippets: # array of all snippets
  - title: Snippet Title, short description
    description: description of snippet to provide more details about what snippet is
    body: |
      Full snippet body
      with multiple lines.
      This full body will be inserted into the editor.

techknowlogick avatar Mar 29 '23 03:03 techknowlogick

Alternatively, what we could as well would be something like .gitea/replies/<saved response name>.yaml. I'm not sure which one would be better, the one saving one reply per file, or the one saving all replies in the same file?

delvh avatar Mar 29 '23 09:03 delvh

I wasn't aware of this PR, but I created an extension that basically does what is proposed here.

Since it is an extension, the "canned responses" are individual for each user. https://chrome.google.com/webstore/detail/canned-responses-for-blen/ofenfmlpeilfjabiakajogfjjbhlpden?hl=pt-BR&authuser=0

I would be glad to see something like this in gitea.

Mano-Wii avatar Aug 16 '23 13:08 Mano-Wii

Saving replies would be really helpful, especially if there is an option to add variables like the username of the person who opened the issue/PR, your own username and potentially quite a few more variables.

BlenderDefender avatar May 24 '24 15:05 BlenderDefender