mirror of
https://github.com/outline/outline.git
synced 2026-06-13 03:14:59 +03:00
50fe0bb746
- Add 'oauth' to SearchQuery enum in server and client models - Add database migration to include 'oauth' in enum_search_queries_source - Fixes 400 validation error when OAuth users search with parameters 🤖 Generated with [Claude Code](https://claude.ai/code) Co-authored-by: Claude <noreply@anthropic.com>
37 lines
740 B
TypeScript
37 lines
740 B
TypeScript
import { client } from "~/utils/ApiClient";
|
|
import Model from "./base/Model";
|
|
|
|
class SearchQuery extends Model {
|
|
static modelName = "Search";
|
|
|
|
/**
|
|
* The query string, automatically truncated to 255 characters.
|
|
*/
|
|
query: string;
|
|
|
|
/**
|
|
* Where the query originated.
|
|
*/
|
|
source: "api" | "app" | "slack" | "oauth";
|
|
|
|
delete = async () => {
|
|
this.isSaving = true;
|
|
|
|
try {
|
|
await client.post(`/searches.delete`, {
|
|
query: this.query,
|
|
});
|
|
|
|
this.store.data.forEach((searchQuery: SearchQuery) => {
|
|
if (searchQuery.query === this.query) {
|
|
this.store.remove(searchQuery.id);
|
|
}
|
|
});
|
|
} finally {
|
|
this.isSaving = false;
|
|
}
|
|
};
|
|
}
|
|
|
|
export default SearchQuery;
|