FEATURE: Can edit category/host relationships for embedding#10
FEATURE: Can edit category/host relationships for embedding#10everettbu wants to merge 1 commit into
Conversation
|
cursor review |
There was a problem hiding this comment.
Bugbot free trial expires on August 11, 2025
Learn more in the Cursor dashboard.
| before_validation do | ||
| self.host.sub!(/^https?:\/\//, '') | ||
| self.host.sub!(/\/.*$/, '') | ||
| end |
|
|
||
| if category_id == 0 | ||
| category_id = execute("SELECT value FROM site_settings WHERE name = 'uncategorized_category_id'")[0]['value'].to_i | ||
| end |
There was a problem hiding this comment.
Bug: Migration Fails on Empty Query Results
The migration assumes SQL queries for embed_category and uncategorized_category_id site settings will always return a result. It directly accesses [0]['id'] or [0]['value'] without checking if a result exists. If a query returns no rows, this will cause a NoMethodError when attempting to access a key on nil.
| end | ||
| Fabricator(:embeddable_host) do | ||
| host "eviltrout.com" | ||
| category |
There was a problem hiding this comment.
Bug: Fabricator Files Swapped, Causing Test Failures
The contents of category_fabricator.rb and embeddable_host_fabricator.rb were accidentally swapped. category_fabricator.rb now incorrectly defines only the embeddable_host fabricator, while the original category fabricators (e.g., category) were moved to embeddable_host_fabricator.rb. This breaks tests that rely on category fabricators.
Locations (1)
| host = EmbeddableHost.where(id: params[:id]).first | ||
| host.destroy | ||
| render json: success_json | ||
| end |
There was a problem hiding this comment.
Bug: Controller Methods Lack Existence Validation
The update and destroy methods in Admin::EmbeddableHostsController do not validate the existence of the EmbeddableHost record retrieved by ID. If EmbeddableHost.where(id: params[:id]).first returns nil (i.e., the host does not exist), attempting to call methods on the nil object (e.g., save_host or destroy) will result in a NoMethodError.
| const hydrated = obj[k].map(function(id) { | ||
| return self._lookupSubType(subType, type, id, root); | ||
| }); | ||
| obj[self.pluralize(subType)] = hydrated || []; |
|
This pull request has been automatically marked as stale because it has been open for 60 days with no activity. To keep it open, remove the stale tag, push code, or add a comment. Otherwise, it will be closed in 14 days. |
Test 10