Commit 32811d98 authored by Felipe Artur's avatar Felipe Artur

Make model sanitization methods one liners

parent d028863e
...@@ -10,6 +10,7 @@ v 8.8.0 (unreleased) ...@@ -10,6 +10,7 @@ v 8.8.0 (unreleased)
- Add 'l' shortcut to open Label dropdown on issuables and 'i' to create new issue on a project - Add 'l' shortcut to open Label dropdown on issuables and 'i' to create new issue on a project
- Updated search UI - Updated search UI
- Display informative message when new milestone is created - Display informative message when new milestone is created
- Sanitize milestones and labels titles
- Allow "NEWS" and "CHANGES" as alternative names for CHANGELOG. !3768 (Connor Shea) - Allow "NEWS" and "CHANGES" as alternative names for CHANGELOG. !3768 (Connor Shea)
- Added button to toggle whitespaces changes on diff view - Added button to toggle whitespaces changes on diff view
- Backport GitLab Enterprise support from EE - Backport GitLab Enterprise support from EE
......
...@@ -117,9 +117,8 @@ class Label < ActiveRecord::Base ...@@ -117,9 +117,8 @@ class Label < ActiveRecord::Base
LabelsHelper::text_color_for_bg(self.color) LabelsHelper::text_color_for_bg(self.color)
end end
def title= value def title=(value)
value = Sanitize.clean(value.to_s) if value write_attribute(:title, Sanitize.clean(value.to_s)) if value.present?
write_attribute(:title, Sanitize.clean(value))
end end
private private
......
...@@ -129,9 +129,8 @@ class Milestone < ActiveRecord::Base ...@@ -129,9 +129,8 @@ class Milestone < ActiveRecord::Base
nil nil
end end
def title= value def title=(value)
value = Sanitize.clean(value.to_s) if value write_attribute(:title, Sanitize.clean(value.to_s)) if value.present?
write_attribute(:title, value)
end end
# Sorts the issues for the given IDs. # Sorts the issues for the given IDs.
......
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