Skip to content

FEATURE: Can edit category/host relationships for embedding#10

Open
everettbu wants to merge 1 commit into
rest-serializer-enhancement-prefrom
rest-serializer-enhancement-post
Open

FEATURE: Can edit category/host relationships for embedding#10
everettbu wants to merge 1 commit into
rest-serializer-enhancement-prefrom
rest-serializer-enhancement-post

Conversation

@everettbu

Copy link
Copy Markdown
Contributor

Test 10

@lizard-boy

Copy link
Copy Markdown

cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bug: Nil Handling Error in Callback

The before_validation callback calls sub! on self.host without a nil check. If self.host is nil, this raises a NoMethodError.

Locations (1)
Fix in Cursor Fix in Web


if category_id == 0
category_id = execute("SELECT value FROM site_settings WHERE name = 'uncategorized_category_id'")[0]['value'].to_i
end

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Locations (1)
Fix in Cursor Fix in Web

end
Fabricator(:embeddable_host) do
host "eviltrout.com"
category

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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)
Fix in Cursor Fix in Web

host = EmbeddableHost.where(id: params[:id]).first
host.destroy
render json: success_json
end

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Locations (1)
Fix in Cursor Fix in Web

const hydrated = obj[k].map(function(id) {
return self._lookupSubType(subType, type, id, root);
});
obj[self.pluralize(subType)] = hydrated || [];

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bug: Map Error on Non-Array Values

Calling obj[k].map() without ensuring obj[k] is an array results in a TypeError. This occurs when processing plural _ids (e.g., post_ids), if obj[k] is null, undefined, or a non-array value.

Locations (1)
Fix in Cursor Fix in Web

@github-actions

Copy link
Copy Markdown

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants