ouyangxuhua 9 years ago
commit d818e1774b

@ -67,8 +67,9 @@ class CourseActivity < ActiveRecord::Base
# 导语 # 导语
def add_course_lead def add_course_lead
if self.course_act_type == "Course" if self.course_act_type == "Course"
name = Redmine::Configuration['course_message_lead_subject'] lead_message = Message.find(12440)
content = Redmine::Configuration['course_message_lead_content'] name = lead_message.subject
content = lead_message.content
# message的status状态为0为正常为1表示创建课程时发送的message # message的status状态为0为正常为1表示创建课程时发送的message
message = Message.create(:subject => name, :content => content, :board_id => self.course.boards.first.id, :author_id => self.course.tea_id , :sticky => true, :status => true ) message = Message.create(:subject => name, :content => content, :board_id => self.course.boards.first.id, :author_id => self.course.tea_id , :sticky => true, :status => true )
# 更新的目的是为了排序,因为该条动态的时间可能与课程创建的动态创建时间一直 # 更新的目的是为了排序,因为该条动态的时间可能与课程创建的动态创建时间一直

@ -52,6 +52,7 @@ class Journal < ActiveRecord::Base
# fq # fq
after_save :act_as_activity,:be_user_score, :act_as_forge_message, :act_as_at_message after_save :act_as_activity,:be_user_score, :act_as_forge_message, :act_as_at_message
after_create :update_issue_time
# end # end
#after_destroy :down_user_score #after_destroy :down_user_score
#before_save :be_user_score #before_save :be_user_score
@ -230,4 +231,12 @@ class Journal < ActiveRecord::Base
project.project_score.update_attribute(:issue_journal_num, project.project_score.issue_journal_num + 1) project.project_score.update_attribute(:issue_journal_num, project.project_score.issue_journal_num + 1)
end end
end end
# 回复issue的时候更新issue的时候
def update_issue_time
if self.journalized_type == "Issue"
forge_activity = ForgeActivity.where("forge_act_id =? and forge_act_type =?", self.issue, "Issue").first
forge_activity.update_attribute(:created_at, self.created_on) unless forge_activity.nil?
end
end
end end

@ -36,12 +36,12 @@
<% if @changesets && !@changesets.empty? %> <% if @changesets && !@changesets.empty? %>
<% if !user_commit_rep(@changesets_latest_coimmit.author_email).nil? %> <% if !user_commit_rep(@changesets_latest_coimmit.author_email).nil? %>
<%= image_tag(url_to_avatar(user_commit_rep(@changesets_latest_coimmit.author_email)), :width => "25", :height => "25", :class => "fl portraitRadius mt2 ml4 mr5") %> <%= image_tag(url_to_avatar(user_commit_rep(@changesets_latest_coimmit.author_email)), :width => "25", :height => "25", :class => "fl portraitRadius mt2 ml4 mr5") %>
<span class="fl"><div class="fb fontGrey3 mr5 fl"><%=link_to user_commit_rep(@changesets_latest_coimmit.author_email), user_path(user_commit_rep(@changesets_latest_coimmit.author_email)) %></div> <span class="fl"><div class="fb fontGrey3 mr5 fl hidden maxwidth150"><%=link_to user_commit_rep(@changesets_latest_coimmit.author_email), user_path(user_commit_rep(@changesets_latest_coimmit.author_email)) %></div>
<div class="fl">提交于<%= time_tag(@changesets_latest_coimmit.created_at) %></div> <div class="fl">提交于<%= time_tag(@changesets_latest_coimmit.created_at) %></div>
<div class="commit_content_dec fl" title="<%= @changesets_latest_coimmit.comments %>"><%= @changesets_latest_coimmit.message %></div> <div class="commit_content_dec fl" title="<%= @changesets_latest_coimmit.comments %>"><%= @changesets_latest_coimmit.message %></div>
</span> </span>
<% else %> <% else %>
<span class="fl"><div class="fb fontGrey3 rep_mail_name mr5 fl"><%=@changesets_latest_coimmit.author_email %></div> <span class="fl"><div class="fb fontGrey3 mr5 fl hidden maxwidth150"><%=@changesets_latest_coimmit.author_email %></div>
<div class="fl">提交于<%= time_tag(@changesets_latest_coimmit.created_at) %></div> <div class="fl">提交于<%= time_tag(@changesets_latest_coimmit.created_at) %></div>
<div class="commit_content_dec fl" title="<%= @changesets_latest_coimmit.comments %>"><%= @changesets_latest_coimmit.message %></div> <div class="commit_content_dec fl" title="<%= @changesets_latest_coimmit.comments %>"><%= @changesets_latest_coimmit.message %></div>
</span> </span>

@ -0,0 +1,6 @@
class AddPublishToAttachmentHistories < ActiveRecord::Migration
def change
add_column :attachment_histories, :is_publish, :integer, :default => 1
add_column :attachment_histories, :publish_time, :date
end
end

@ -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 => 20160220100507) do ActiveRecord::Schema.define(:version => 20160223073859) 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
@ -99,6 +99,8 @@ ActiveRecord::Schema.define(:version => 20160220100507) do
t.integer "quotes" t.integer "quotes"
t.integer "version" t.integer "version"
t.integer "attachment_id" t.integer "attachment_id"
t.integer "is_publish", :default => 1
t.date "publish_time"
end end
create_table "attachments", :force => true do |t| create_table "attachments", :force => true do |t|
@ -118,6 +120,8 @@ ActiveRecord::Schema.define(:version => 20160220100507) do
t.integer "is_public", :default => 1 t.integer "is_public", :default => 1
t.integer "copy_from" t.integer "copy_from"
t.integer "quotes" t.integer "quotes"
t.integer "is_publish", :default => 1
t.date "publish_time"
end end
add_index "attachments", ["author_id"], :name => "index_attachments_on_author_id" add_index "attachments", ["author_id"], :name => "index_attachments_on_author_id"
@ -1373,7 +1377,6 @@ ActiveRecord::Schema.define(:version => 20160220100507) do
t.integer "changeset_num", :default => 0 t.integer "changeset_num", :default => 0
t.integer "board_message_num", :default => 0 t.integer "board_message_num", :default => 0
t.integer "board_num", :default => 0 t.integer "board_num", :default => 0
t.integer "act_num", :default => 0
t.integer "attach_num", :default => 0 t.integer "attach_num", :default => 0
t.datetime "commit_time" t.datetime "commit_time"
end end

@ -3,6 +3,15 @@
module Trustie module Trustie
module Gitlab module Gitlab
module Helper module Helper
GUEST = 10
REPORTER = 20
DEVELOPER = 30
MASTER = 40
OWNER = 50
# 项目公开和私有
PUBLIC = 20
PRIVATE = 0
def change_password(uid, en_pwd, salt) def change_password(uid, en_pwd, salt)
return unless uid return unless uid
options = {:encrypted_password=>en_pwd, :password_salt=>salt} options = {:encrypted_password=>en_pwd, :password_salt=>salt}
@ -44,6 +53,21 @@ module Trustie
self.g.delete_user(user.gid) self.g.delete_user(user.gid)
end end
def get_gitlab_role m
case m.roles.first.position
when 1,2
GUEST
when 5
REPORTER
when 4
DEVELOPER
when 3
MASTER
else
GUEST
end
end
end end
end end
end end

@ -61,7 +61,7 @@ module Trustie
unless gid unless gid
gid = sync_user(m.user).id gid = sync_user(m.user).id
end end
self.g.add_team_member(gproject.id, gid, UserLevel::DEVELOPER) self.g.add_team_member(gproject.id, gid, get_gitlab_role(m))
rescue => e rescue => e
puts e puts e
end end
@ -111,7 +111,7 @@ module Trustie
unless gid unless gid
gid = sync_user(m.user).id gid = sync_user(m.user).id
end end
self.g.add_team_member(gproject.id, gid, UserLevel::DEVELOPER) self.g.add_team_member(gproject.id, gid, get_gitlab_role(m))
rescue => e rescue => e
puts e puts e
end end
@ -125,7 +125,7 @@ module Trustie
unless gid unless gid
gid = sync_user(m.user).id gid = sync_user(m.user).id
end end
self.g.add_team_member(project.gpid, gid, UserLevel::DEVELOPER) self.g.add_team_member(project.gpid, gid, get_gitlab_role(m))
rescue => e rescue => e
puts e puts e
end end
@ -134,6 +134,8 @@ module Trustie
def remove_project def remove_project
end end
end end
end end

@ -1168,3 +1168,4 @@ div.disable_link {background-color: #c1c1c1 !important;}
/*问题跟踪局部修改属性*/ /*问题跟踪局部修改属性*/
.proInfoBox2{ border:1px solid #dddddd; height:45px; padding:10px 0; background-color:#f1f1f1;} .proInfoBox2{ border:1px solid #dddddd; height:45px; padding:10px 0; background-color:#f1f1f1;}
.proInfoBox2 ul li{ height:24px; position:relative;} .proInfoBox2 ul li{ height:24px; position:relative;}
.maxwidth150{max-width: 150px;}

Loading…
Cancel
Save