sourcegraph / sourcegraph-public-snapshot

Code AI platform with Code Search & Cody
https://sourcegraph.com
Other
10.1k stars 1.27k forks source link

Set default search snippets in user accounts #22771

Open rrhyne opened 3 years ago

rrhyne commented 3 years ago

Currently, we ship default snippets to all users through the global settings. These defaults cannot be removed and will therefore appear in user accounts whether they want them to or not.

To improve this experience and allow users to customize these items, update the default site configuration to include these two default snippets.

Suggested snippets:


   "search.scopes":[
          {
            "name":"repo has license",
            "value":"repo:contains.file(LICENSE)"
          },
          {
            "name":"search all branches",
            "value": "rev:*refs/heads/"
          }
        ],

To reduce the scope of work, I suggest we do nothing for existing users.

When this is complete, the scopes listed here should be removed.

limitedmage commented 3 years ago

@sourcegraph/core-application is there a way to initialize a new user's settings in this way?

unknwon commented 3 years ago

@limitedmage I think you may call this method to set the initial setting for a new user: https://sourcegraph.com/github.com/sourcegraph/sourcegraph/-/blob/internal/database/settings.go#L44:36