diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb index 43b24d1e0..64f139c31 100644 --- a/app/controllers/bids_controller.rb +++ b/app/controllers/bids_controller.rb @@ -107,7 +107,7 @@ class BidsController < ApplicationController if params[:bid_message][:message].size>0 if params[:reference_content] - message = params[:reference_content] + params[:bid_message][:message] + message = params[:bid_message][:message] + "\n" + params[:reference_content] else message = params[:bid_message][:message] end @@ -138,8 +138,10 @@ class BidsController < ApplicationController ##删除留言 def destroy - JournalsForMessage.delete_message(params[:object_id]) @user = @bid.author + if User.current.admin? || User.current.id == @user.id + JournalsForMessage.delete_message(params[:object_id]) + end @jours = @bid.journals_for_messages.reverse @limit = 10 @feedback_count = @jours.count diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb index ed14686b0..9a31927ce 100644 --- a/app/controllers/words_controller.rb +++ b/app/controllers/words_controller.rb @@ -6,7 +6,7 @@ class WordsController < ApplicationController if params[:new_form][:user_message].size>0 unless params[:user_id].nil? if params[:reference_content] - message = params[:reference_content] + params[:new_form][:user_message] + message = params[:new_form][:user_message] + "\n" + params[:reference_content] else message = params[:new_form][:user_message] end @@ -37,7 +37,9 @@ class WordsController < ApplicationController end def destroy - JournalsForMessage.delete_message(params[:object_id]) + if User.current.admin? || User.current.id == @user.id + JournalsForMessage.delete_message(params[:object_id]) + end @jours = @user.journals_for_messages.reverse @limit = 10 @feedback_count = @jours.count @@ -71,6 +73,10 @@ class WordsController < ApplicationController text = text.to_s.strip.gsub(%r{
((.|\s)*?)
}m, '[...]') @content = "> #{ll(Setting.default_language, :text_user_wrote, user)}\n> " @content << text.gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n" + + # @content << text.gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n" + # @content = "> #{ll(Setting.default_language, :text_user_wrote, user)}\n> " + @id = user.id rescue ActiveRecord::RecordNotFound render_404 diff --git a/app/models/user.rb b/app/models/user.rb index 7a6f52e57..978170017 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -202,7 +202,7 @@ class User < Principal user = find_by_login(login) if user # user is already in local database - return nil unless user.active? + #return nil unless user.active? return nil unless user.check_password?(password) else # user is not yet registered, try to authenticate with available sources diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index cfe367feb..a16ec0d86 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -34,9 +34,9 @@ <% when 'Journal' %> <% if e.user == User.current%> - <%= link_to("#{l(:label_i)}", user_path(e.user_id)) %><%= l(:label_new_activity) %> <%= link_to format_activity_title("#{act.issue.tracker} ##{act.issue.id}: #{act.issue.subject}"), {:controller => 'issues', :action => 'show', :id => act.issue.id, :anchor => "change-#{act.id}"} %> + <%= link_to("#{l(:label_i)}", user_path(e.user_id)) %><%= l(:label_new_activity) %><%= link_to("项目:"+act.issue.project.name, project_path(act.issue.project.identifier))%> <%= link_to format_activity_title("#{act.issue.tracker} ##{act.issue.id}: #{act.issue.subject}"), {:controller => 'issues', :action => 'show', :id => act.issue.id, :anchor => "change-#{act.id}"} %> <% else %> - <%= link_to(h(e.user), user_path(e.user_id)) %><%= l(:label_new_activity) %> <%= link_to format_activity_title("#{act.issue.tracker} ##{act.issue.id}: #{act.issue.subject}"), {:controller => 'issues', :action => 'show', :id => act.issue.id, :anchor => "change-#{act.id}"} %> + <%= link_to(h(e.user), user_path(e.user_id)) %><%= l(:label_new_activity) %><%= link_to("项目:"+act.issue.project.name, project_path(act.issue.project.identifier))%> <%= link_to format_activity_title("#{act.issue.tracker} ##{act.issue.id}: #{act.issue.subject}"), {:controller => 'issues', :action => 'show', :id => act.issue.id, :anchor => "change-#{act.id}"} %> <% end %> @@ -119,9 +119,9 @@ <% when 'Issue' %> <% if e.user == User.current%> - <%= link_to("#{l(:label_i)}", user_path(e.user_id)) %><%= l(:label_new_activity) %> <%= link_to format_activity_title("#{act.tracker.name} ##{act.id} (#{act.status}): #{act.subject}"), {:controller => 'issues', :action => 'show', :id => act.id} %> + <%= link_to("#{l(:label_i)}", user_path(e.user_id)) %><%= l(:label_new_activity) %><%= link_to("项目:"+act.project.name, project_path(act.project.identifier))%> <%= link_to format_activity_title("#{act.tracker.name} ##{act.id} (#{act.status}): #{act.subject}"), {:controller => 'issues', :action => 'show', :id => act.id} %> <% else %> - <%= link_to(h(e.user), user_path(e.user_id)) %><%= l(:label_new_activity) %> <%= link_to format_activity_title("#{act.tracker.name} ##{act.id} (#{act.status}): #{act.subject}"), {:controller => 'issues', :action => 'show', :id => act.id} %> + <%= link_to(h(e.user), user_path(e.user_id)) %><%= l(:label_new_activity) %><%= link_to("项目:"+act.project.name, project_path(act.project.identifier))%> <%= link_to format_activity_title("#{act.tracker.name} ##{act.id} (#{act.status}): #{act.subject}"), {:controller => 'issues', :action => 'show', :id => act.id} %> <% end %> diff --git a/app/views/welcome/index.html.erb b/app/views/welcome/index.html.erb index 738b0ef01..495282031 100644 --- a/app/views/welcome/index.html.erb +++ b/app/views/welcome/index.html.erb @@ -192,8 +192,8 @@ software development and software crowdsourcing. <%=link_to image_tag(url_to_avatar(User.current), :class => 'avatar'), user_path(User.current) %> - <%= l(:label_user_watcher) %> (<%= link_to User.watched_by(User.current).count, user_path(User.current) %>)  - <%= l(:label_user_fans) %>(<%=link_to User.current.watcher_users(User.current.id).count, user_path(User.current) %>) + <%= link_to l(:label_user_watcher)+"("+User.watched_by(User.current).count.to_s+")", user_path(User.current) %>  + <%=link_to l(:label_user_fans)+"("+User.current.watcher_users(User.current.id).count.to_s+")", user_path(User.current) %> <% unless User.current.memberships.empty? %>