From b4b4956ab70efc386211332bb8e975cb90658dc8 Mon Sep 17 00:00:00 2001 From: fanqiang <316257774@qq.com> Date: Wed, 28 Aug 2013 15:29:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=95=99=E8=A8=80=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E5=89=8D=E8=BA=AB=E4=BB=BD=E7=A1=AE=E8=AE=A4=EF=BC=8C?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=B4=BB=E5=8A=A8=E5=88=97=E8=A1=A8=E4=B8=AD?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E9=83=A8=E5=88=86=E7=9A=84=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=EF=BC=8C=E6=B7=BB=E5=8A=A0=E4=BA=86=E9=A1=B9=E7=9B=AE=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/bids_controller.rb | 6 ++++-- app/controllers/words_controller.rb | 10 ++++++++-- app/models/user.rb | 2 +- app/views/users/show.html.erb | 8 ++++---- app/views/welcome/index.html.erb | 4 ++-- 5 files changed, 19 insertions(+), 11 deletions(-) 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' %>