diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 544ed7bf5..055955e04 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -170,6 +170,7 @@ class UsersController < ApplicationController render_404 return end + @message_alls = paginateHelper @message_alls,25 respond_to do |format| format.html{render :layout=>'new_base_user'} end diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb index a26d2661a..412c3f889 100644 --- a/app/helpers/issues_helper.rb +++ b/app/helpers/issues_helper.rb @@ -380,6 +380,22 @@ module IssuesHelper value = content_tag("i", h(value)) if value end end + # 缺陷更新结果在消息中显示样式 + if no_html == "message" + label = content_tag(:span, label, :class => "issue_update_message") + old_value = content_tag("span", h(old_value)) if detail.old_value + old_value = content_tag("del", old_value) if detail.old_value and detail.value.blank? + if detail.property == 'attachment' && !value.blank? && atta = Attachment.find_by_id(detail.prop_key) + # Link to the attachment if it has not been removed + if options[:token].nil? + value = atta.filename + else + value = atta.filename + end + else + value = content_tag(:span, h(value), :class => "issue_update_message_value") if value + end + end if detail.property == 'attr' && detail.prop_key == 'description' s = l(:text_journal_changed_no_detail, :label => label) diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index ebfd9f881..e7ab001da 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -425,9 +425,13 @@ module UsersHelper return str.html_safe end + # journal.details 记录每个动作的新旧值 def get_issue_des_update(journal) - arr = details_to_strings(journal.details,true) - arr << journal.notes + no_html = "message" + arr = details_to_strings(journal.details, no_html) + unless journal.notes.empty? + arr << "留言内容:" + journal.notes + end str = '' arr.each { |item| str = str+item } return str diff --git a/app/models/journal.rb b/app/models/journal.rb index 3a9f5a89d..0d86d12ff 100644 --- a/app/models/journal.rb +++ b/app/models/journal.rb @@ -174,7 +174,7 @@ class Journal < ActiveRecord::Base if self.user_id != self.issue.author_id self.forge_messages << ForgeMessage.new(:user_id => self.issue.author_id, :project_id => self.issue.project_id, :viewed => false) end - if self.user_id != self.issue.assigned_to_id # 指派人不是自己的话,则给指派人发送 + if self.user_id != self.issue.assigned_to_id && self.issue.assigned_to_id != self.issue.author_id # 指派人不是自己的话,则给指派人发送 self.forge_messages << ForgeMessage.new(:user_id => self.issue.assigned_to_id, :project_id => self.issue.project_id, :viewed => false) end end diff --git a/app/models/journals_for_message.rb b/app/models/journals_for_message.rb index 1f5f2e1a6..6f775e7a2 100644 --- a/app/models/journals_for_message.rb +++ b/app/models/journals_for_message.rb @@ -212,33 +212,11 @@ class JournalsForMessage < ActiveRecord::Base if self.user_id != self.reply_id # 添加我回复的那个人 receivers << reply_to end - if self.user_id != self.parent.jour_id # 给东家发信息 + if self.user_id != self.parent.jour_id && self.reply_id != self.parent.jour_id # 给东家发信息,如果回复的对象是东家则不发 receivers << self.parent.jour end - # if self.user_id != self.parent.user_id - # receivers << reply_to - # if self.reply_id != self.parent.user_id - # receivers << self.parent.user - # end - # else - # receivers << reply_to - # end - - # 添加留言回复人 - #reply_to = User.find(self.reply_id) - #if self.user_id != self.parent.user_id && self.user_id != self.parent.jour_id # 如果回帖人不是用户自己 - # receivers << self.parent.user - # if self.reply_id != self.parent.user_id - # receivers << reply_to - # end - #else # 用户自己回复别人的,别人收到消息通知 - # if self.user_id != self.reply_id # 过滤掉自己回复自己的 - # receivers << reply_to - # end - #end end if self.jour_type == 'Principal' - receivers.each do |r| self.user_feedback_messages << UserFeedbackMessage.new(:user_id => r.id, :journals_for_message_id => self.id, :journals_for_message_type => "Principal", :viewed => false) end diff --git a/app/models/user.rb b/app/models/user.rb index 61dd60eec..b08b29981 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -263,6 +263,7 @@ class User < Principal user_memo_count = MemoMessage.where("user_id =? and viewed =?", User.current.id, 0).count messages_count = course_count + forge_count + user_feedback_count + user_memo_count end + # 查询指派给我的缺陷记录 def issue_status_update self.status_updates diff --git a/app/views/mailer/send_for_user_activities.html.erb b/app/views/mailer/send_for_user_activities.html.erb index 7bd1b0bc2..0233f7a42 100644 --- a/app/views/mailer/send_for_user_activities.html.erb +++ b/app/views/mailer/send_for_user_activities.html.erb @@ -327,6 +327,7 @@ <% end %>
+ <% @project_news_comments.each do |project_news_comment|%>