Skip to content
This repository was archived by the owner on Jul 22, 2025. It is now read-only.

Commit 1742f42

Browse files
committed
DEV: Cannot access seeded model edit page
You currently cannot access the seeded model edit page, so there's no need to conditionally show certain elements based on if it's seeded. This commit removes those conditional checks. Additionally, it redirects the route if the model is seeded to avoid accessing it via the url.
1 parent 3440395 commit 1742f42

File tree

2 files changed

+225
-234
lines changed

2 files changed

+225
-234
lines changed

admin/assets/javascripts/discourse/routes/admin-plugins-show-discourse-ai-llms-edit.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,17 @@ import DiscourseRoute from "discourse/routes/discourse";
22

33
export default class AdminPluginsShowDiscourseAiLlmsEdit extends DiscourseRoute {
44
async model(params) {
5-
const allLlms = this.modelFor("adminPlugins.show.discourse-ai-llms");
65
const id = parseInt(params.id, 10);
6+
7+
if (id < 0) {
8+
// You shouldn't be able to access the edit page
9+
// if the model is seeded
10+
return this.router.transitionTo(
11+
"adminPlugins.show.discourse-ai-llms.index"
12+
);
13+
}
14+
15+
const allLlms = this.modelFor("adminPlugins.show.discourse-ai-llms");
716
const record = allLlms.findBy("id", id);
817
record.provider_params = record.provider_params || {};
918
return record;

0 commit comments

Comments
 (0)