Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

add saved search visibility, draft, and timestamps#63909

Merged
sqs merged 3 commits into
mainfrom
sqs/saved-searches-more
Jul 18, 2024
Merged

add saved search visibility, draft, and timestamps#63909
sqs merged 3 commits into
mainfrom
sqs/saved-searches-more

Conversation

@sqs

@sqs sqs commented Jul 18, 2024

Copy link
Copy Markdown
Member

Public saved searches will let us make global saved searches for dotcom and for customers to help them discover and share awesome search queries!

Saved searches now have:

  • Visibility (public vs. secret). Only site admins may make a saved search public. Secret saved searches are visible only to their owners (either a user, or all members of the owning org). A public saved search can be viewed by everyone on the instance.
  • Draft status: If a saved search's "draft" checkbox is checked, that means that other people shouldn't use that saved search yet. You're still working on it.
  • Timestamps: The last user to update a saved search and the creator of the saved search are now recorded.

Also adds a lot more tests for saved search UI and backend code.

image
image
image

Test plan

Create a saved search. Ensure it's in secret visibility to begin with. As a site admin, make it public. Ensure other users can view it, and no edit buttons are shown. Try changing visibility back and forth.

Changelog

  • Saved searches can now be made public (by site admins), which means all users can view them. This is a great way to share useful search queries with all users of a Sourcegraph instance.
  • Saved searches can be marked as a "draft", which is a gentle indicator that other people shouldn't use it yet.

@sqs sqs requested a review from a team July 18, 2024 10:33
@cla-bot cla-bot Bot added the cla-signed label Jul 18, 2024
@sqs sqs force-pushed the sqs/saved-searches-more branch from f358dbb to 86889de Compare July 18, 2024 10:33
Comment thread cmd/frontend/graphqlbackend/viewer.go Outdated
Comment on lines 48 to 55

Check notice

Code scanning / Semgrep OSS

Semgrep Finding: security-semgrep-rules.semgrep-rules.golang.unauthorized-graphql-resolver-rule

The graphql resolver function may not contain authorization check, please review for authorization bugs
Comment thread cmd/frontend/graphqlbackend/viewer.go Outdated
Comment on lines 60 to 64

Check notice

Code scanning / Semgrep OSS

Semgrep Finding: security-semgrep-rules.semgrep-rules.generic.comment-tagging-rule

Code that highlight SECURITY in comment has changed. Please review the code for changes. The changes might be sensitive.
Comment on lines 67 to 71

Check notice

Code scanning / Semgrep OSS

Semgrep Finding: security-semgrep-rules.semgrep-rules.generic.comment-tagging-rule

Code that highlight SECURITY in comment has changed. Please review the code for changes. The changes might be sensitive.
Comment on lines 163 to 166

Check notice

Code scanning / Semgrep OSS

Semgrep Finding: security-semgrep-rules.semgrep-rules.generic.comment-tagging-rule

Code that highlight SECURITY in comment has changed. Please review the code for changes. The changes might be sensitive.
@sqs sqs force-pushed the sqs/saved-searches-more branch 3 times, most recently from d5ab3c2 to 9a20e45 Compare July 18, 2024 11:24

@camdencheek camdencheek left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great -- thanks!

Comment thread internal/database/saved_searches.go Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we passing in the actorUID rather than using the actor from the context? This is a bit of a departure from the pattern used elsewhere in the database package.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, that felt implicit to me and I didn't think that it should be done in this layer. But you are 100% right and I see a lot of prior uses here: https://sourcegraph.sourcegraph.com/search?q=context:sourcegraph+f%3Ainternal%2Fdatabase+actor.FromContext&patternType=literal. So I will change it. Thanks!

@sqs sqs force-pushed the sqs/saved-searches-more branch 2 times, most recently from 9d8861b to eac5f3f Compare July 18, 2024 20:21
sqs added 3 commits July 18, 2024 13:23
Saved searches now have:

- Visibility (public vs. secret). Only site admins may make a saved search public. Secret saved searches are visible only to their owners (either a user, or all members of the owning org). A public saved search can be viewed by everyone on the instance.
- Draft: If a saved search's "draft" checkbox is checked, that means that other people shouldn't use that saved search yet. You're still working on it.
- Timestamps: The last user to update a saved search and the creator of the saved search are now recorded.

**Visibility will let us make global saved searches for dotcom and for customers to help them discover and share awesome search queries!**
@sqs sqs force-pushed the sqs/saved-searches-more branch from eac5f3f to 58306ca Compare July 18, 2024 20:23
@sqs sqs merged commit fcdcfef into main Jul 18, 2024
@sqs sqs deleted the sqs/saved-searches-more branch July 18, 2024 20:37
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants