summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorZ.J. van de Weg <zegerjan@gitlab.com>2016-06-01 11:23:09 +0200
committerZ.J. van de Weg <zegerjan@gitlab.com>2016-06-01 12:10:08 +0200
commit91a7b9333b660abc866e52e1a614151cb529413d (patch)
treec7ee15fd37e703229f6f197207304479251b5856 /app
parentcbd7801b3d1d435a95ec70032c5acc9df33b0337 (diff)
downloadgitlab-ce-91a7b9333b660abc866e52e1a614151cb529413d.tar.gz
Incorportate feedback
Diffstat (limited to 'app')
-rw-r--r--app/models/concerns/issuable.rb4
-rw-r--r--app/models/legacy_diff_note.rb4
-rw-r--r--app/models/note.rb16
-rw-r--r--app/services/notes/post_process_service.rb2
-rw-r--r--app/services/notification_service.rb2
-rw-r--r--app/views/award_emoji/_awards_block.html.haml8
-rw-r--r--app/views/emoji_awards/_awards_block.html.haml18
7 files changed, 16 insertions, 38 deletions
diff --git a/app/models/concerns/issuable.rb b/app/models/concerns/issuable.rb
index 57ded0f91ad..1fc0e002f47 100644
--- a/app/models/concerns/issuable.rb
+++ b/app/models/concerns/issuable.rb
@@ -133,6 +133,10 @@ module Issuable
opened? || reopened?
end
+ def user_notes_count
+ notes.user.count
+ end
+
def subscribed_without_subscriptions?(user)
participants(user).include?(user)
end
diff --git a/app/models/legacy_diff_note.rb b/app/models/legacy_diff_note.rb
index bbefc911b29..95fd510eb3a 100644
--- a/app/models/legacy_diff_note.rb
+++ b/app/models/legacy_diff_note.rb
@@ -110,6 +110,10 @@ class LegacyDiffNote < Note
@active
end
+ def award_emoji_supported?
+ false
+ end
+
private
def find_diff
diff --git a/app/models/note.rb b/app/models/note.rb
index bbe5545dc80..f99d327a5b8 100644
--- a/app/models/note.rb
+++ b/app/models/note.rb
@@ -21,10 +21,8 @@ class Note < ActiveRecord::Base
delegate :name, :email, to: :author, prefix: true
delegate :title, to: :noteable, allow_nil: true
- before_validation :clear_blank_line_code!
-
validates :note, :project, presence: true
- validates :line_code, line_code: true, allow_blank: true
+
# Attachments are deprecated and are handled by Markdown uploader
validates :attachment, file_size: { maximum: :max_attachment_size }
@@ -173,10 +171,6 @@ class Note < ActiveRecord::Base
Event.reset_event_cache_for(self)
end
- def system?
- read_attribute(:system)
- end
-
def editable?
!system?
end
@@ -193,14 +187,8 @@ class Note < ActiveRecord::Base
self.line_code = nil if self.line_code.blank?
end
- # Find the diff on noteable that matches our own
- def find_noteable_diff
- diffs = noteable.diffs(Commit.max_diff_options)
- diffs.find { |d| d.new_path == self.diff.new_path }
- end
-
def award_emoji_supported?
- noteable.is_a?(Awardable) && !line_code.present?
+ noteable.is_a?(Awardable)
end
def contains_emoji_only?
diff --git a/app/services/notes/post_process_service.rb b/app/services/notes/post_process_service.rb
index c1bf46bdfb3..534c48aefff 100644
--- a/app/services/notes/post_process_service.rb
+++ b/app/services/notes/post_process_service.rb
@@ -8,7 +8,7 @@ module Notes
def execute
# Skip system notes, like status changes and cross-references and awards
- unless @note.system
+ unless @note.system?
EventCreateService.new.leave_note(@note, @note.author)
@note.create_cross_references!
execute_note_hooks
diff --git a/app/services/notification_service.rb b/app/services/notification_service.rb
index 703636658b7..91ca82ed3b7 100644
--- a/app/services/notification_service.rb
+++ b/app/services/notification_service.rb
@@ -130,7 +130,7 @@ class NotificationService
# ignore gitlab service messages
return true if note.note.start_with?('Status changed to closed')
- return true if note.cross_reference? && note.system == true
+ return true if note.cross_reference? && note.system?
target = note.noteable
diff --git a/app/views/award_emoji/_awards_block.html.haml b/app/views/award_emoji/_awards_block.html.haml
index 19d1275a926..f1f93c1375b 100644
--- a/app/views/award_emoji/_awards_block.html.haml
+++ b/app/views/award_emoji/_awards_block.html.haml
@@ -1,7 +1,7 @@
- grouped_emojis = awardable.grouped_awards(with_thumbs: inline)
-.awards.js-awards-block{ class: ("hidden" if !inline && grouped_emojis.size == 0), data: { award_url: url_for([:toggle_award_emoji, @project.namespace.becomes(Namespace), @project, awardable]) } }
+.awards.js-awards-block{ class: ("hidden" if !inline && grouped_emojis.empty?), data: { award_url: url_for([:toggle_award_emoji, @project.namespace.becomes(Namespace), @project, awardable]) } }
- awards_sort(grouped_emojis).each do |emoji, awards|
- %button.btn.award-control.js-emoji-btn.has-tooltip{ type: "button", class: (award_active_class(awards, current_user)),data: { placement: "bottom", title: award_user_list(awards, current_user) } }
+ %button.btn.award-control.js-emoji-btn.has-tooltip{ type: "button", class: (award_active_class(awards, current_user)), data: { placement: "bottom", title: award_user_list(awards, current_user) } }
= emoji_icon(emoji)
%span.award-control-text.js-counter
= awards.count
@@ -12,7 +12,7 @@
.award-menu-holder.js-award-holder
%button.btn.award-control.js-add-award{ type: "button", data: { award_menu_url: emojis_path } }
- = icon('smile-o', {class: "award-control-icon award-control-icon-normal"})
- = icon('spinner spin', {class: "award-control-icon award-control-icon-loading"})
+ = icon('smile-o', class: "award-control-icon award-control-icon-normal")
+ = icon('spinner spin', class: "award-control-icon award-control-icon-loading")
%span.award-control-text
Add
diff --git a/app/views/emoji_awards/_awards_block.html.haml b/app/views/emoji_awards/_awards_block.html.haml
deleted file mode 100644
index e9b286b7c3f..00000000000
--- a/app/views/emoji_awards/_awards_block.html.haml
+++ /dev/null
@@ -1,18 +0,0 @@
-- grouped_emojis = awardable.grouped_awards(inline)
-.awards.js-awards-block{ class: ("hidden" if !inline && grouped_emojis.size == 0), data: { award_url: url_for([:toggle_emoji_award, @project.namespace.becomes(Namespace), @project, awardable]) } }
- - awards_sort(grouped_emojis).each do |emoji, awards|
- %button.btn.award-control.js-emoji-btn.has-tooltip{ type: "button", class: (award_active_class(awards, current_user)), title: award_user_list(awards, current_user), data: { placement: "bottom" } }
- = emoji_icon(emoji)
- %span.award-control-text.js-counter
- = awards.count
-
- - if current_user
- :javascript
- gl.awardMenuUrl = emojis_path
-
- .award-menu-holder.js-award-holder
- %button.btn.award-control.js-add-award{ type: "button", data: { award_menu_url: emojis_path } }
- = icon('smile-o', {class: "award-control-icon award-control-icon-normal"})
- = icon('spinner spin', {class: "award-control-icon award-control-icon-loading"})
- %span.award-control-text
- Add