修复资源上传人不能下载项目讨论区非公开资源的问题

This commit is contained in:
chenmin 2014-08-20 11:39:41 +08:00
parent 80bd535b4f
commit 73537a30cb
3 changed files with 9 additions and 9 deletions

View File

@ -79,7 +79,7 @@ class AttachmentsController < ApplicationController
else else
candown = @attachment.is_public == 1 candown = @attachment.is_public == 1
end end
if candown || User.current.admin? if candown || User.current.admin? || User.current.id == @attachment.author_id
@attachment.increment_download @attachment.increment_download
if stale?(:etag => @attachment.digest) if stale?(:etag => @attachment.digest)

View File

@ -156,10 +156,10 @@
:data => {:confirm => l(:text_are_you_sure)}, :data => {:confirm => l(:text_are_you_sure)},
:title => l(:button_delete) :title => l(:button_delete)
) if message.destroyable_by?(User.current) %> ) if message.destroyable_by?(User.current) %>
</div></td> </div>
</td>
</tr> </tr>
<tr> <tr>
<td class="comments"> <td class="comments">
<div class="wiki" style="width: 100%;word-break: break-all;"> <div class="wiki" style="width: 100%;word-break: break-all;">
<%= textAreailizable message,:content,:attachments => message.attachments %> <%= textAreailizable message,:content,:attachments => message.attachments %>

View File

@ -11,7 +11,7 @@
# #
# It's strongly recommended to check this file into your version control system. # It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20140814062455) do ActiveRecord::Schema.define(:version => 20140812065417) do
create_table "activities", :force => true do |t| create_table "activities", :force => true do |t|
t.integer "act_id", :null => false t.integer "act_id", :null => false
@ -448,14 +448,14 @@ ActiveRecord::Schema.define(:version => 20140814062455) do
end end
create_table "forums", :force => true do |t| create_table "forums", :force => true do |t|
t.string "name", :null => false t.string "name", :null => false
t.text "description" t.string "description", :default => ""
t.integer "topic_count", :default => 0 t.integer "topic_count", :default => 0
t.integer "memo_count", :default => 0 t.integer "memo_count", :default => 0
t.integer "last_memo_id", :default => 0 t.integer "last_memo_id", :default => 0
t.integer "creator_id", :null => false t.integer "creator_id", :null => false
t.datetime "created_at", :null => false t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false t.datetime "updated_at", :null => false
end end
create_table "groups_users", :id => false, :force => true do |t| create_table "groups_users", :id => false, :force => true do |t|