Commit b0c1bc66 authored by Hannes Rosenögger's avatar Hannes Rosenögger

Merge branch 'generate-valid-json' into 'master'

Generate valid json

This patch helps to be compatible to other programing languages as it improves the validation of hook data. It seems only ruby can handle 'nil' as value while other json decode function will fatal.

See merge request !182
parents 94affe6d b7a31a4b
...@@ -49,6 +49,7 @@ v 7.9.0 (unreleased) ...@@ -49,6 +49,7 @@ v 7.9.0 (unreleased)
- Add database migration to clean group duplicates with same path and name (Make sure you have a backup before update) - Add database migration to clean group duplicates with same path and name (Make sure you have a backup before update)
- Starred projects page at dashboard - Starred projects page at dashboard
- Make email display name configurable - Make email display name configurable
- Improve json validation in hook data
v 7.8.2 v 7.8.2
- Fix service migration issue when upgrading from versions prior to 7.3 - Fix service migration issue when upgrading from versions prior to 7.3
......
...@@ -41,7 +41,7 @@ class SystemHooksService ...@@ -41,7 +41,7 @@ class SystemHooksService
path_with_namespace: model.path_with_namespace, path_with_namespace: model.path_with_namespace,
project_id: model.id, project_id: model.id,
owner_name: owner.name, owner_name: owner.name,
owner_email: owner.respond_to?(:email) ? owner.email : nil, owner_email: owner.respond_to?(:email) ? owner.email : "",
project_visibility: Project.visibility_levels.key(model.visibility_level_field).downcase project_visibility: Project.visibility_levels.key(model.visibility_level_field).downcase
}) })
when User when User
......
...@@ -58,6 +58,7 @@ module Gitlab ...@@ -58,6 +58,7 @@ module Gitlab
data[:commits] << commit.hook_attrs(project) data[:commits] << commit.hook_attrs(project)
end end
data[:commits] = "" if data[:commits].count == 0
data data
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment