From 2d52f7e2baf6e4bdf71f9e324a8e9bcd46c1afb4 Mon Sep 17 00:00:00 2001
From: Oleg Valter <o.a.philippov@gmail.com>
Date: Mon, 3 Feb 2025 00:50:32 +0300
Subject: [PATCH] UsersController#update_profile should allow partial updates

---
 app/controllers/users_controller.rb | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index 6a579b55e..1b4aec6f0 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -388,8 +388,14 @@ class UsersController < ApplicationController
       end
     end
 
-    profile_rendered = helpers.post_markdown(:user, :profile_markdown)
-    if @user.update(profile_params.merge(profile: profile_rendered))
+    if params[:user][:profile_markdown].present?
+      profile_rendered = helpers.post_markdown(:user, :profile_markdown)
+      profile_params = profile_params.merge(profile: profile_rendered)
+    end
+
+    status = @user.update(profile_params)
+
+    if status
       flash[:success] = 'Your profile details were updated.'
       redirect_to user_path(current_user)
     else
-- 
GitLab