chore: allow article to create without content (#14007)

This commit is contained in:
Sivin Varghese
2026-04-09 10:40:37 +05:30
committed by GitHub
parent 00837019b5
commit bd14e96ed9
5 changed files with 15 additions and 6 deletions

View File

@@ -62,7 +62,7 @@ class Public::Api::V1::Portals::ArticlesController < Public::Api::V1::Portals::B
def set_article
@article = @portal.articles.find_by(slug: permitted_params[:article_slug])
@parsed_content = render_article_content(@article.content)
@parsed_content = render_article_content(@article.content.to_s)
end
def set_category

View File

@@ -79,7 +79,7 @@ export default {
created() {
state = createState(
this.modelValue,
this.modelValue || '',
this.placeholder,
this.plugins,
{ onImageUpload: this.openFileBrowser },
@@ -170,7 +170,7 @@ export default {
},
reloadState() {
state = createState(
this.modelValue,
this.modelValue || '',
this.placeholder,
this.plugins,
{ onImageUpload: this.openFileBrowser },

View File

@@ -39,7 +39,7 @@ const createNewArticle = async ({ title, content }) => {
if (title) article.value.title = title;
if (content) article.value.content = content;
if (!article.value.title || !article.value.content) return;
if (!article.value.title) return;
isUpdating.value = true;
try {

View File

@@ -58,7 +58,7 @@ class Article < ApplicationRecord
validates :account_id, presence: true
validates :author_id, presence: true
validates :title, presence: true
validates :content, presence: true
validates :content, presence: true, if: :published?
# ensuring that the position is always set correctly
before_create :add_position_to_article