Merge branch 'hjq_beidou' into develop

This commit is contained in:
huang 2016-04-22 12:45:05 +08:00
commit 17b5832df0
3 changed files with 10 additions and 27 deletions

View File

@ -325,27 +325,11 @@ update
end
end
# unless @repository.gitlab?
# # redirect_to to_gitlab_project_repository_path(@project, @repository)
# render :to_gitlab
# return
# end
#if( !User.current.member_of?(@project) || @project.hidden_repo)
# @repository.fetch_changesets if Setting.autofetch_changesets? && @path.empty?
# :name, :path, :kind, :size, :lastrev, :changeset
@entries = @repository.entries(@path, @rev)
# @trees = g.trees(project, @path)
@changeset = @repository.find_changeset_by_name(@rev)
#@project_path_cut = RepositoriesHelper::PROJECT_PATH_CUT
#@ip = RepositoriesHelper::REPO_IP_ADDRESS
if request.xhr?
@entries ? render(:partial => 'dir_list_content') : render(:nothing => true)
else
#Modified by young
# (show_error_not_found; return) unless @entries
g = Gitlab.client
@changesets = g.commits(@project.gpid, :ref_name => @rev)
g_project = g.project(@project.gpid)
@ -360,17 +344,16 @@ update
if @changesets_all_count != @project.project_score.changeset_num && @changesets_all_count != 0
update_commits_count(@project, @changesets_all_count)
end
# end
# 最近一次提交
@changesets_latest_coimmit = @changesets[0]
unless @changesets[0].blank?
update_commits_date(@project, @changesets_latest_coimmit)
end
@creator = User.where("id =?", @project.user_id).first.try(:login)
@properties = @repository.properties(@path, @rev)
@repositories = @project.repositories
project_path_cut = RepositoriesHelper::PROJECT_PATH_CUT
ip = RepositoriesHelper::REPO_IP_ADDRESS
# @properties = @repository.properties(@path, @rev)
# @repositories = @project.repositories
# project_path_cut = RepositoriesHelper::PROJECT_PATH_CUT
# ip = RepositoriesHelper::REPO_IP_ADDRESS
gitlab_address = Redmine::Configuration['gitlab_address']
if @repository.type.to_s == "Repository::Gitlab"
@repos_url = gitlab_address.to_s+"/"+@project.owner.to_s+"/"+@repository.identifier+"."+"git"

View File

@ -83,7 +83,7 @@ class Message < ActiveRecord::Base
# after_create :add_author_as_watcher, :reset_counters!, :add_boards_count
after_update :update_messages_board, :update_activity
after_destroy :reset_counters!,:down_user_score,:delete_kindeditor_assets, :decrease_boards_count, :down_course_score
after_create :act_as_course_activity, :act_as_forge_activity, :act_as_student_score, act_as_at_message(:content, :author_id), :add_author_as_watcher, :reset_counters!, :add_boards_count
after_create :act_as_course_activity, :act_as_forge_activity, :act_as_system_message, :send_mail, :act_as_student_score, act_as_at_message(:content, :author_id), :add_author_as_watcher, :reset_counters!, :add_boards_count
#before_save :be_user_score
scope :visible, lambda {|*args|
@ -261,7 +261,7 @@ class Message < ActiveRecord::Base
ws = WechatService.new
if self.course
if self.parent_id.nil? # 主贴
self.course.members.each do |m|
self.course.members.includes(:user).each do |m|
if self.author.allowed_to?(:as_teacher, self.course) && m.user_id != self.author_id # 老师 自己的帖子不给自己发送消息
self.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => self.board.course_id, :viewed => false)
content = strip_html self.subject, 200
@ -269,7 +269,7 @@ class Message < ActiveRecord::Base
end
end
else # 回帖
self.course.members.each do |m|
self.course.members.includes(:user).each do |m|
if m.user_id == Message.find(self.parent_id).author_id && m.user_id != self.author_id # 只针对主贴回复,回复自己的帖子不发消息
self.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => self.board.course_id, :viewed => false)
content = strip_html self.content.html_safe, 200
@ -279,7 +279,7 @@ class Message < ActiveRecord::Base
end
elsif self.project # 项目相关
if self.parent_id.nil? # 主贴
self.project.members.each do |m|
self.project.members.includes(:user).each do |m|
if m.user_id != self.author_id
self.forge_messages << ForgeMessage.new(:user_id => m.user_id, :project_id => self.board.project_id, :viewed => false)
content = strip_html self.subject, 200
@ -287,7 +287,7 @@ class Message < ActiveRecord::Base
end
end
else # 回帖
self.project.members.each do |m|
self.project.members.includes(:user).each do |m|
if m.user_id == Message.find(self.parent_id).author_id && m.user_id != self.author_id # 只针对主贴回复,回复自己的帖子不发消息
self.forge_messages << ForgeMessage.new(:user_id => m.user_id, :project_id => self.board.project_id, :viewed => false)
content = strip_html self.content.html_safe, 200

View File

@ -44,7 +44,7 @@ class Repository < ActiveRecord::Base
# validates_uniqueness_of :identifier, :allow_blank => true
validates_exclusion_of :identifier, :in => %w(show entry raw changes annotate diff show stats graph)
# donwcase letters, digits, dashes, underscores but not digits only
validates_format_of :identifier, :with => /^[a-z0-9_\-]+$/, :allow_blank => true
validates_format_of :identifier, :with => /^[a-zA-Z0-9_\-]*[a-zA-Z_\-]+[a-zA-Z0-9_\-]*$/, :allow_blank => true
# Checks if the SCM is enabled when creating a repository
validate :repo_create_validation, :on => :create