Commit b7a31a4b authored by Nicole Cordes's avatar Nicole Cordes

Generate valid json for hooks

It seems that ruby can handle 'nil' value but other json processors
(like PHP) throw an error. This is always generated for empty arrays.
parent e0caed91
......@@ -35,6 +35,7 @@ v 7.9.0 (unreleased)
- Move groups page from profile to dashboard
- Starred projects page at dashboard
- Blocking user does not remove him/her from project/groups but show blocked label
- Improve json validation in hook data
v 7.8.2
- Fix service migration issue when upgrading from versions prior to 7.3
......
......@@ -41,7 +41,7 @@ def build_event_data(model, event)
path_with_namespace: model.path_with_namespace,
project_id: model.id,
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
})
when User
......
......@@ -58,6 +58,7 @@ def build(project, user, oldrev, newrev, ref, commits = [])
data[:commits] << commit.hook_attrs(project)
end
data[:commits] = "" if data[:commits].count == 0
data
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