@ -93,6 +93,11 @@ class UsersController < ApplicationController
end
end
# 更新issue状态
def user_act_issue_assign_to
end
# 用户消息
# 说明: homework 发布作业; message: 讨论区; news: 新闻; poll: 问卷; works_reviewers: 作品评阅; works_reply:作品回复,exercise:课程测验
# issue: 问题; journal: 缺陷状态更新; forum: 公共贴吧: user_feedback: 用户留言; new_reply:新闻回复( comment)
@ -1791,13 +1796,24 @@ class UsersController < ApplicationController
def share_news_to_project
news = News . find ( params [ :send_id ] )
project_ids = params [ :project_ids ]
# project_ids.each do |project_id|
# if Project.find(project_id).news.map(&:id).exclude?(news.id)
# project_news = News.create(:project_id => project_id.to_i, :title => news.title, :summary => news.summary, :description => news.description,:author_id => User.current.id, :created_on => Time.now)
# news.attachments.each do |attach|
# project_news.attachments << Attachment.new(:filename => attach.filename, :disk_filename => attach.disk_filename, :filesize => attach.filesize, :content_type => attach.content_type, :digest => attach.digest,
# :downloads => 0, :author_id => User.current.id, :created_on => Time.now, :description => attach.description, :disk_directory => attach.disk_directory, :attachtype => attach.attachtype,
# :is_public => attach.is_public, :quotes => 0)
# end
# end
# end
project_ids . each do | project_id |
if Project . find ( project_id ) . news . map ( & :id ) . exclude? ( news . id )
project_news = News . create ( :project_id = > project_id . to_i , :title = > news . title , :summary = > news . summary , :description = > news . description , :author_id = > User . current . id , :created_on = > Time . now )
project = Project . find ( project_id )
if project . news . map ( & :id ) . exclude? ( news . id )
message = Message . create ( :board_id = > project . boards . first . id , :subject = > news . title , :content = > news . description , :author_id = > User . current . id )
news . attachments . each do | attach |
project_news . attachments << Attachment . new ( :filename = > attach . filename , :disk_filename = > attach . disk_filename , :filesize = > attach . filesize , :content_type = > attach . content_type , :digest = > attach . digest ,
:downloads = > 0 , :author_id = > User . current . id , :created_on = > Time . now , :description = > attach . description , :disk_directory = > attach . disk_directory , :attachtype = > attach . attachtype ,
:is_public = > attach . is_public , :quotes = > 0 )
message . attachments << Attachment . new ( :filename = > attach . filename , :disk_filename = > attach . disk_filename , :filesize = > attach . filesize , :content_type = > attach . content_type , :digest = > attach . digest ,
:downloads = > 0 , :author_id = > User . current . id , :created_on = > Time . now , :description = > attach . description , :disk_directory = > attach . disk_directory , :attachtype = > attach . attachtype ,
:is_public = > attach . is_public , :quotes = > 0 )
end
end
end