Merge branch 'dev_newproject' into 'develop'
版本库文件历史变更显示(行数、变更内容等)、pull request的一些该井 See merge request !27
This commit is contained in:
commit
494e581beb
4
Gemfile
4
Gemfile
|
@ -50,10 +50,10 @@ gem 'elasticsearch-model'
|
||||||
gem 'elasticsearch-rails'
|
gem 'elasticsearch-rails'
|
||||||
|
|
||||||
#rails 3.2.22.2 bug
|
#rails 3.2.22.2 bug
|
||||||
gem "test-unit", "~>3.0"
|
# gem "test-unit", "~>3.0"
|
||||||
|
|
||||||
### profile
|
### profile
|
||||||
gem 'oneapm_rpm'
|
# gem 'oneapm_rpm'
|
||||||
|
|
||||||
group :development do
|
group :development do
|
||||||
gem 'grape-swagger'
|
gem 'grape-swagger'
|
||||||
|
|
|
@ -1,15 +1,19 @@
|
||||||
|
# encoding: utf-8
|
||||||
# 如果你对改模块任何功能不清楚,请不要随便改
|
# 如果你对改模块任何功能不清楚,请不要随便改
|
||||||
# @Hjqreturn
|
# @Hjqreturn
|
||||||
class PullRequestsController < ApplicationController
|
class PullRequestsController < ApplicationController
|
||||||
before_filter :authorize_logged
|
before_filter :authorize_logged
|
||||||
before_filter :find_project_and_repository
|
before_filter :find_project_and_repository
|
||||||
before_filter :connect_gitlab, :only => [:index, :show, :create, :accept_pull_request, :pull_request_commits, :pull_request_changes, :new,
|
before_filter :connect_gitlab, :only => [:index, :show, :create, :accept_pull_request, :pull_request_commits, :pull_request_changes, :new, :update_pull_request, :pull_request_comments, :create_pull_request_comment, :compare_pull_request]
|
||||||
:update_pull_request, :pull_request_comments, :create_pull_request_comment, :compare_pull_request]
|
before_filter :member_allowed, :only => [:new, :create]
|
||||||
|
before_filter :manager_allowed, :only => [:accept_pull_request]
|
||||||
|
|
||||||
layout "base_projects"
|
layout "base_projects"
|
||||||
include PullRequestsHelper
|
include PullRequestsHelper
|
||||||
include ApplicationHelper
|
include ApplicationHelper
|
||||||
|
|
||||||
|
require 'ostruct'
|
||||||
|
|
||||||
# 返回json格式
|
# 返回json格式
|
||||||
def index
|
def index
|
||||||
# project_menu_type 为了控制base顶部导航
|
# project_menu_type 为了控制base顶部导航
|
||||||
|
@ -92,7 +96,7 @@ class PullRequestsController < ApplicationController
|
||||||
if compare_pull_request(source_branch, target_project_id, target_branch)
|
if compare_pull_request(source_branch, target_project_id, target_branch)
|
||||||
# 如果传送了目标项目ID即向fork源项目发送请求
|
# 如果传送了目标项目ID即向fork源项目发送请求
|
||||||
# if params[:forked_project_id] && params[:source_project] == "forked_project_name"
|
# if params[:forked_project_id] && params[:source_project] == "forked_project_name"
|
||||||
if !params[:target_project_id].blank?
|
if !params[:target_project_id].blank? && params[:target_project_id].to_i != @project.id
|
||||||
target_project_id = params[:forked_project_id].to_i
|
target_project_id = params[:forked_project_id].to_i
|
||||||
request = @g.create_merge_request(@project.gpid, title, User.current.gid, :description => description, :source_branch => source_branch, :target_branch => target_branch, :target_project_id => target_project_id)
|
request = @g.create_merge_request(@project.gpid, title, User.current.gid, :description => description, :source_branch => source_branch, :target_branch => target_branch, :target_project_id => target_project_id)
|
||||||
@fork_project_name = Project.find(params[:target_project_id]).try(:name)
|
@fork_project_name = Project.find(params[:target_project_id]).try(:name)
|
||||||
|
@ -117,8 +121,14 @@ class PullRequestsController < ApplicationController
|
||||||
format.js{redirect_to new_project_pull_request_path(:show_tip => tip)}
|
format.js{redirect_to new_project_pull_request_path(:show_tip => tip)}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
rescue Gitlab::Error::Forbidden => e
|
||||||
|
@message = l(:label_pull_request_forbidden)
|
||||||
rescue Gitlab::Error::Conflict => e
|
rescue Gitlab::Error::Conflict => e
|
||||||
@message = e.message
|
@message = l(:label_pull_request_conflic)
|
||||||
|
rescue Gitlab::Error::NotFound => e
|
||||||
|
@message = l(:label_pull_request_notfound)
|
||||||
|
rescue Exception => e
|
||||||
|
puts e
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -278,23 +288,38 @@ class PullRequestsController < ApplicationController
|
||||||
# id (required) - The ID of a project
|
# id (required) - The ID of a project
|
||||||
# merge_request_id (required) - The ID of MR
|
# merge_request_id (required) - The ID of MR
|
||||||
def pull_request_changes
|
def pull_request_changes
|
||||||
begin
|
|
||||||
@type = params[:type]
|
@type = params[:type]
|
||||||
@changes = @g.merge_request_changes(@project.gpid, params[:id]).try(:changes)
|
@changes = @g.merge_request_changes(@project.gpid, params[:id]).try(:changes)
|
||||||
@changes_count = @changes.count
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@changes_count = @changes.count
|
||||||
@limit = 10
|
@limit = 10
|
||||||
@is_remote = true
|
@is_remote = true
|
||||||
@count = @changes_count
|
@count = @changes_count
|
||||||
@pages = Paginator.new @count, @limit, params['page'] || 1
|
@pages = Paginator.new @count, @limit, params['page'] || 1
|
||||||
@offset ||= @pages.offset
|
@offset ||= @pages.offset
|
||||||
@changes = paginateHelper @changes, 10
|
@changes = paginateHelper @changes, 10
|
||||||
rescue Exception => e
|
|
||||||
@message = e.message
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
# post 相关操作权限控制
|
||||||
|
# 项目管理员可操作
|
||||||
|
def manager_allowed
|
||||||
|
unless is_project_manager?(User.current.id, @project.id)
|
||||||
|
return render_403
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# 项目成员可操作
|
||||||
|
def member_allowed
|
||||||
|
unless User.current.member_of?(@project)
|
||||||
|
return render_403
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def send_message user_id, project_id, title
|
def send_message user_id, project_id, title
|
||||||
self.forge_acts << ForgeMessage.new(:user_id => user_id, :project_id => project_id, :title => title)
|
self.forge_acts << ForgeMessage.new(:user_id => user_id, :project_id => project_id, :title => title)
|
||||||
end
|
end
|
||||||
|
|
|
@ -49,6 +49,7 @@ class RepositoriesController < ApplicationController
|
||||||
helper :repositories
|
helper :repositories
|
||||||
include RepositoriesHelper
|
include RepositoriesHelper
|
||||||
helper :project_score
|
helper :project_score
|
||||||
|
require 'ostruct'
|
||||||
#@root_path = RepositoriesHelper::ROOT_PATH
|
#@root_path = RepositoriesHelper::ROOT_PATH
|
||||||
# require 'net/ssh'
|
# require 'net/ssh'
|
||||||
|
|
||||||
|
@ -580,8 +581,12 @@ update
|
||||||
def commit_diff
|
def commit_diff
|
||||||
# 顶部导航
|
# 顶部导航
|
||||||
@project_menu_type = 5
|
@project_menu_type = 5
|
||||||
|
|
||||||
@commit_diff = @g.commit_diff(@project.gpid, params[:changeset])
|
@commit_diff = @g.commit_diff(@project.gpid, params[:changeset])
|
||||||
|
diff = ActiveSupport::JSON.decode(@commit_diff.to_json).first
|
||||||
|
diff = OpenStruct.new(diff)
|
||||||
|
@diff_file = Trustie::Gitlab::Diff::File.new(diff)
|
||||||
|
|
||||||
|
|
||||||
@commit_details = @g.commit(@project.gpid, params[:changeset])
|
@commit_details = @g.commit(@project.gpid, params[:changeset])
|
||||||
render :layout => 'base_projects'
|
render :layout => 'base_projects'
|
||||||
end
|
end
|
||||||
|
|
|
@ -19,6 +19,11 @@ module PullRequestsHelper
|
||||||
PullRequest.where(:pull_request_id => pull_request_id).first
|
PullRequest.where(:pull_request_id => pull_request_id).first
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# 通过gitlab项目id获取Trustie项目的用户名
|
||||||
|
def find_gitlab_project gitlab_project_id
|
||||||
|
Project.find_by_gpid(gitlab_project_id).owner.try(:show_name)
|
||||||
|
end
|
||||||
|
|
||||||
def get_state state
|
def get_state state
|
||||||
case state
|
case state
|
||||||
when "open","reopened"
|
when "open","reopened"
|
||||||
|
|
|
@ -40,7 +40,7 @@ class Comment < ActiveRecord::Base
|
||||||
belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
|
belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
|
||||||
validates_presence_of :commented, :author, :comments
|
validates_presence_of :commented, :author, :comments
|
||||||
safe_attributes 'comments','parent_id','reply_id','comments_count'
|
safe_attributes 'comments','parent_id','reply_id','comments_count'
|
||||||
after_create :send_mail, :act_as_system_message, :act_as_student_score
|
after_create :act_as_system_message, :act_as_student_score #:send_mail,
|
||||||
after_destroy :down_course_score
|
after_destroy :down_course_score
|
||||||
|
|
||||||
def act_as_system_message
|
def act_as_system_message
|
||||||
|
@ -55,11 +55,11 @@ class Comment < ActiveRecord::Base
|
||||||
# end
|
# end
|
||||||
end
|
end
|
||||||
else # 项目相关
|
else # 项目相关
|
||||||
if self.author_id != self.commented.author_id
|
# if self.author_id != self.commented.author_id
|
||||||
self.forge_messages << ForgeMessage.new(:user_id => self.commented.author_id, :project_id => self.commented.project.id, :viewed => false)
|
# self.forge_messages << ForgeMessage.new(:user_id => self.commented.author_id, :project_id => self.commented.project.id, :viewed => false)
|
||||||
#content = strip_html self.comments.html_safe, 200
|
# #content = strip_html self.comments.html_safe, 200
|
||||||
#ws.comment_template self.commented.author_id, "blog_comment", self.id, "#{l(:label_news_comment_template)}", self.author.try(:realname), format_time(self.created_on), content
|
# #ws.comment_template self.commented.author_id, "blog_comment", self.id, "#{l(:label_news_comment_template)}", self.author.try(:realname), format_time(self.created_on), content
|
||||||
end
|
# end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Added by young
|
# Added by young
|
||||||
class JournalsForMessageObserver < ActiveRecord::Observer
|
class JournalsForMessageObserver < ActiveRecord::Observer
|
||||||
def after_create(journals_for_message)
|
def after_create(journals_for_message)
|
||||||
Mailer.run.journals_for_message_add(User.current, journals_for_message)
|
# Mailer.run.journals_for_message_add(User.current, journals_for_message)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -109,40 +109,40 @@ class Mailer < ActionMailer::Base
|
||||||
# 邀请未注册用户加入项目
|
# 邀请未注册用户加入项目
|
||||||
# 功能: 在加入项目的同时自动注册用户
|
# 功能: 在加入项目的同时自动注册用户
|
||||||
def send_invite_in_project(email, project, invitor, first_name, last_name, gender)
|
def send_invite_in_project(email, project, invitor, first_name, last_name, gender)
|
||||||
@email = email
|
# @email = email
|
||||||
@subject = "#{invitor.name} #{l(:label_invite_project)} #{project.name} "
|
# @subject = "#{invitor.name} #{l(:label_invite_project)} #{project.name} "
|
||||||
@password = newpass(6)
|
# @password = newpass(6)
|
||||||
|
#
|
||||||
login = email
|
# login = email
|
||||||
login = login.sub(/%40/,'@')
|
# login = login.sub(/%40/,'@')
|
||||||
us = UsersService.new
|
# us = UsersService.new
|
||||||
# 自动激活用户
|
# # 自动激活用户
|
||||||
user = us.register_auto(login, email, @password, first_name, last_name, gender)
|
# user = us.register_auto(login, email, @password, first_name, last_name, gender)
|
||||||
InviteList.create(:user_id => user.id, :project_id => project.id, :mail =>email)
|
# InviteList.create(:user_id => user.id, :project_id => project.id, :mail =>email)
|
||||||
User.current = user unless User.current.nil?
|
# User.current = user unless User.current.nil?
|
||||||
@user = user
|
# @user = user
|
||||||
@token = Token.get_token_from_user(user, 'autologin')
|
# @token = Token.get_token_from_user(user, 'autologin')
|
||||||
@project_url = url_for(:controller => 'projects', :action => 'member', :id => project.id, :mail => true, :token => @token.value)
|
# @project_url = url_for(:controller => 'projects', :action => 'member', :id => project.id, :mail => true, :token => @token.value)
|
||||||
mail :to => email, :subject => @subject
|
# mail :to => email, :subject => @subject
|
||||||
end
|
end
|
||||||
|
|
||||||
# 邀请已注册的用户加入项目
|
# 邀请已注册的用户加入项目
|
||||||
def request_member_to_project(email, project, invitor)
|
def request_member_to_project(email, project, invitor)
|
||||||
@subject = "#{invitor.name} #{l(:label_invite_project)}: #{project.name} "
|
# @subject = "#{invitor.name} #{l(:label_invite_project)}: #{project.name} "
|
||||||
user = User.find_by_mail(email.to_s)
|
# user = User.find_by_mail(email.to_s)
|
||||||
@invitor_name = "#{invitor.name}"
|
# @invitor_name = "#{invitor.name}"
|
||||||
@project_name = "#{project.name}"
|
# @project_name = "#{project.name}"
|
||||||
@user = user
|
# @user = user
|
||||||
@project = project
|
# @project = project
|
||||||
if InviteList.where("project_id= ? and user_id =? and mail =?", project.id, @user.id, email).first.nil?
|
# if InviteList.where("project_id= ? and user_id =? and mail =?", project.id, @user.id, email).first.nil?
|
||||||
InviteList.create(:user_id => user.id, :project_id => project.id, :mail => email)
|
# InviteList.create(:user_id => user.id, :project_id => project.id, :mail => email)
|
||||||
end
|
|
||||||
@token = Token.get_token_from_user(user, 'autologin')
|
|
||||||
@project_url = url_for(:controller => 'projects', :action => 'member', :id => project.id, :user_id => user.id, :mail => true, :token => @token.value)
|
|
||||||
# 发送消息邀请
|
|
||||||
send_message_request_member(user,project)
|
|
||||||
# end
|
# end
|
||||||
mail :to => email, :subject => @subject
|
# @token = Token.get_token_from_user(user, 'autologin')
|
||||||
|
# @project_url = url_for(:controller => 'projects', :action => 'member', :id => project.id, :user_id => user.id, :mail => true, :token => @token.value)
|
||||||
|
# # 发送消息邀请
|
||||||
|
# send_message_request_member(user,project)
|
||||||
|
# # end
|
||||||
|
# mail :to => email, :subject => @subject
|
||||||
end
|
end
|
||||||
|
|
||||||
# 邀请信息消息 注:forge_message_id 为邀请人ID(特殊情况)
|
# 邀请信息消息 注:forge_message_id 为邀请人ID(特殊情况)
|
||||||
|
@ -293,23 +293,23 @@ class Mailer < ActionMailer::Base
|
||||||
|
|
||||||
# 公共讨论区发帖、回帖添加邮件发送信息
|
# 公共讨论区发帖、回帖添加邮件发送信息
|
||||||
def forum_message_added(memo)
|
def forum_message_added(memo)
|
||||||
@memo = memo
|
# @memo = memo
|
||||||
redmine_headers 'Memo' => memo.id
|
# redmine_headers 'Memo' => memo.id
|
||||||
@forum = memo.forum
|
# @forum = memo.forum
|
||||||
@author = memo.author
|
# @author = memo.author
|
||||||
@forum_url = url_for(:controller => 'forums', :action => 'show', :id => @forum.id)
|
# @forum_url = url_for(:controller => 'forums', :action => 'show', :id => @forum.id)
|
||||||
@issue_author_url = url_for(user_activities_url(@author))
|
# @issue_author_url = url_for(user_activities_url(@author))
|
||||||
recipients ||= []
|
# recipients ||= []
|
||||||
#将帖子创建者邮箱地址加入数组
|
# #将帖子创建者邮箱地址加入数组
|
||||||
recipients << @forum.creator.mail
|
# recipients << @forum.creator.mail
|
||||||
#回复人邮箱地址加入数组
|
# #回复人邮箱地址加入数组
|
||||||
recipients << @author.mail
|
# recipients << @author.mail
|
||||||
# cc = wiki_content.page.wiki.watcher_recipients - recipients
|
# # cc = wiki_content.page.wiki.watcher_recipients - recipients
|
||||||
|
#
|
||||||
@memo_url = url_for(forum_memo_url(@forum, (@memo.parent_id.nil? ? @memo : @memo.parent_id)))
|
# @memo_url = url_for(forum_memo_url(@forum, (@memo.parent_id.nil? ? @memo : @memo.parent_id)))
|
||||||
mail :to => recipients,
|
# mail :to => recipients,
|
||||||
:subject => "[ #{l(:label_message_plural)} : #{memo.subject} #{l(:label_memo_create_succ)}]",
|
# :subject => "[ #{l(:label_message_plural)} : #{memo.subject} #{l(:label_memo_create_succ)}]",
|
||||||
:filter => true
|
# :filter => true
|
||||||
end
|
end
|
||||||
# Builds a Mail::Message object used to email recipients of the added journals for message.
|
# Builds a Mail::Message object used to email recipients of the added journals for message.
|
||||||
|
|
||||||
|
@ -318,64 +318,64 @@ class Mailer < ActionMailer::Base
|
||||||
# 直接留言后 reply_id,m_parent_id 为空,相对应的at_user取值为nil
|
# 直接留言后 reply_id,m_parent_id 为空,相对应的at_user取值为nil
|
||||||
|
|
||||||
def journals_for_message_add(user, journals_for_message)
|
def journals_for_message_add(user, journals_for_message)
|
||||||
@user = journals_for_message.user # 留言人
|
# @user = journals_for_message.user # 留言人
|
||||||
@mail = journals_for_message.jour if journals_for_message.at_user.nil? # 留言
|
# @mail = journals_for_message.jour if journals_for_message.at_user.nil? # 留言
|
||||||
@mail = journals_for_message.at_user if journals_for_message.at_user
|
# @mail = journals_for_message.at_user if journals_for_message.at_user
|
||||||
@message = journals_for_message.notes
|
# @message = journals_for_message.notes
|
||||||
@title = "#@user #{t(:label_leave_your_message, :locale => 'zh')}"
|
# @title = "#@user #{t(:label_leave_your_message, :locale => 'zh')}"
|
||||||
@issue_author_url = url_for(user_activities_url(@user))
|
# @issue_author_url = url_for(user_activities_url(@user))
|
||||||
@url = case journals_for_message.jour.class.to_s.to_sym # 判断留言的对象所属类型
|
# @url = case journals_for_message.jour.class.to_s.to_sym # 判断留言的对象所属类型
|
||||||
# when :Bid
|
# # when :Bid
|
||||||
# course_for_bid_url(journals_for_message.jour, anchor: "word_li_#{journals_for_message.id}")
|
# # course_for_bid_url(journals_for_message.jour, anchor: "word_li_#{journals_for_message.id}")
|
||||||
when :Project
|
# when :Project
|
||||||
return -1 if journals_for_message.jour.project_type == Project::ProjectType_project
|
# return -1 if journals_for_message.jour.project_type == Project::ProjectType_project
|
||||||
project_feedback_url(journals_for_message.jour, anchor: "word_li_#{journals_for_message.id}")
|
# project_feedback_url(journals_for_message.jour, anchor: "word_li_#{journals_for_message.id}")
|
||||||
when :Course
|
# when :Course
|
||||||
course_feedback_url(journals_for_message.jour, anchor: "word_li_#{journals_for_message.id}")
|
# course_feedback_url(journals_for_message.jour, anchor: "word_li_#{journals_for_message.id}")
|
||||||
when :Contest
|
# when :Contest
|
||||||
show_contest_contest_url(journals_for_message.jour, anchor: "word_li_#{journals_for_message.id}")
|
# show_contest_contest_url(journals_for_message.jour, anchor: "word_li_#{journals_for_message.id}")
|
||||||
when :User
|
# when :User
|
||||||
user_newfeedback_user_url(journals_for_message.jour, anchor: "word_li_#{journals_for_message.id}")
|
# user_newfeedback_user_url(journals_for_message.jour, anchor: "word_li_#{journals_for_message.id}")
|
||||||
else
|
# else
|
||||||
Rails.logger.error "[Builds a Mail::Message ERROR] journalsForMessage's jour is unkown type, journalsForMessage.id = #{journals_for_message.id}"
|
# Rails.logger.error "[Builds a Mail::Message ERROR] journalsForMessage's jour is unkown type, journalsForMessage.id = #{journals_for_message.id}"
|
||||||
return -1
|
# return -1
|
||||||
end
|
# end
|
||||||
|
#
|
||||||
# 验证用户的收取邮件的方式
|
# # 验证用户的收取邮件的方式
|
||||||
recipients ||= []
|
# recipients ||= []
|
||||||
recipients1 ||= []
|
# recipients1 ||= []
|
||||||
recipients1 = @mail.mail
|
# recipients1 = @mail.mail
|
||||||
recipients = journals_for_message.jour.author.mail
|
# recipients = journals_for_message.jour.author.mail
|
||||||
|
#
|
||||||
# modify by nwb
|
# # modify by nwb
|
||||||
#如果是直接留言并且留言对象是课程
|
# #如果是直接留言并且留言对象是课程
|
||||||
if !journals_for_message.at_user && journals_for_message.jour.class.to_s.to_sym == :Course
|
# if !journals_for_message.at_user && journals_for_message.jour.class.to_s.to_sym == :Course
|
||||||
course = journals_for_message.jour
|
# course = journals_for_message.jour
|
||||||
@author = journals_for_message.user
|
# @author = journals_for_message.user
|
||||||
#课程的教师
|
# #课程的教师
|
||||||
@members = course_all_member journals_for_message.jour
|
# @members = course_all_member journals_for_message.jour
|
||||||
#收件人邮箱
|
# #收件人邮箱
|
||||||
@recipients ||= []
|
# @recipients ||= []
|
||||||
@members.each do |teacher|
|
# @members.each do |teacher|
|
||||||
@recipients << teacher.user.mail
|
# @recipients << teacher.user.mail
|
||||||
end
|
# end
|
||||||
mail :to => @recipients,
|
# mail :to => @recipients,
|
||||||
:subject => "#{l(:label_your_course)}#{journals_for_message.jour.name}#{l(:label_have_message)} ",
|
# :subject => "#{l(:label_your_course)}#{journals_for_message.jour.name}#{l(:label_have_message)} ",
|
||||||
:filter => true
|
# :filter => true
|
||||||
# elsif journals_for_message.jour.class.to_s.to_sym == :Bid
|
# # elsif journals_for_message.jour.class.to_s.to_sym == :Bid
|
||||||
|
# # if !journals_for_message.jour.author.notify_about? journals_for_message
|
||||||
|
# # return -1
|
||||||
|
# # end
|
||||||
|
# #
|
||||||
|
# # mail :to => recipients, :subject => @title,:filter => true
|
||||||
|
# elsif journals_for_message.jour.class.to_s.to_sym == :Contest
|
||||||
# if !journals_for_message.jour.author.notify_about? journals_for_message
|
# if !journals_for_message.jour.author.notify_about? journals_for_message
|
||||||
# return -1
|
# return -1
|
||||||
# end
|
# end
|
||||||
#
|
|
||||||
# mail :to => recipients, :subject => @title,:filter => true
|
# mail :to => recipients, :subject => @title,:filter => true
|
||||||
elsif journals_for_message.jour.class.to_s.to_sym == :Contest
|
# else
|
||||||
if !journals_for_message.jour.author.notify_about? journals_for_message
|
# mail :to => recipients1, :subject => @title,:filter => true
|
||||||
return -1
|
# end
|
||||||
end
|
|
||||||
mail :to => recipients, :subject => @title,:filter => true
|
|
||||||
else
|
|
||||||
mail :to => recipients1, :subject => @title,:filter => true
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -485,16 +485,16 @@ class Mailer < ActionMailer::Base
|
||||||
|
|
||||||
# 用户申请加入项目邮件通知
|
# 用户申请加入项目邮件通知
|
||||||
def applied_project(applied)
|
def applied_project(applied)
|
||||||
@project =applied.project
|
# @project =applied.project
|
||||||
redmine_headers 'Project' => @project,
|
# redmine_headers 'Project' => @project,
|
||||||
'User' => applied.user
|
# 'User' => applied.user
|
||||||
@user = applied.user
|
# @user = applied.user
|
||||||
recipients = @project.manager_recipients
|
# recipients = @project.manager_recipients
|
||||||
s = l(:text_applied_project, :id => "##{@user.show_name}", :project => @project.name)
|
# s = l(:text_applied_project, :id => "##{@user.show_name}", :project => @project.name)
|
||||||
@token = Token.get_token_from_user(@user, 'autologin')
|
# @token = Token.get_token_from_user(@user, 'autologin')
|
||||||
@applied_url = url_for(:controller => 'projects', :action => 'settings', :id => @project.id,:tab=>'members')
|
# @applied_url = url_for(:controller => 'projects', :action => 'settings', :id => @project.id,:tab=>'members')
|
||||||
mail :to => recipients,
|
# mail :to => recipients,
|
||||||
:subject => s
|
# :subject => s
|
||||||
end
|
end
|
||||||
|
|
||||||
def reminder(user, issues, days)
|
def reminder(user, issues, days)
|
||||||
|
@ -555,14 +555,14 @@ class Mailer < ActionMailer::Base
|
||||||
# document_added(document) => Mail::Message object
|
# document_added(document) => Mail::Message object
|
||||||
# Mailer.document_added(document).deliver => sends an email to the document's project recipients
|
# Mailer.document_added(document).deliver => sends an email to the document's project recipients
|
||||||
def document_added(document)
|
def document_added(document)
|
||||||
redmine_headers 'Project' => document.project.identifier
|
# redmine_headers 'Project' => document.project.identifier
|
||||||
@author = User.current
|
# @author = User.current
|
||||||
@document = document
|
# @document = document
|
||||||
@issue_author_url = url_for(user_activities_url(@author))
|
# @issue_author_url = url_for(user_activities_url(@author))
|
||||||
@document_url = url_for(:controller => 'documents', :action => 'show', :id => document)
|
# @document_url = url_for(:controller => 'documents', :action => 'show', :id => document)
|
||||||
mail :to => document.recipients,
|
# mail :to => document.recipients,
|
||||||
:subject => "[#{document.project.name}] #{l(:label_document_new)}: #{document.title}",
|
# :subject => "[#{document.project.name}] #{l(:label_document_new)}: #{document.title}",
|
||||||
:filter => true
|
# :filter => true
|
||||||
end
|
end
|
||||||
|
|
||||||
# Builds a Mail::Message object used to email recipients of a project when an attachements are added.
|
# Builds a Mail::Message object used to email recipients of a project when an attachements are added.
|
||||||
|
@ -571,54 +571,54 @@ class Mailer < ActionMailer::Base
|
||||||
# attachments_added(attachments) => Mail::Message object
|
# attachments_added(attachments) => Mail::Message object
|
||||||
# Mailer.attachments_added(attachments).deliver => sends an email to the project's recipients
|
# Mailer.attachments_added(attachments).deliver => sends an email to the project's recipients
|
||||||
def attachments_added(attachments)
|
def attachments_added(attachments)
|
||||||
container = attachments.first.container
|
# container = attachments.first.container
|
||||||
added_to = ''
|
# added_to = ''
|
||||||
added_to_url = ''
|
# added_to_url = ''
|
||||||
@author = attachments.first.author
|
# @author = attachments.first.author
|
||||||
@issue_author_url = url_for(user_activities_url(@author))
|
# @issue_author_url = url_for(user_activities_url(@author))
|
||||||
case container.class.name
|
# case container.class.name
|
||||||
when 'Project'
|
# when 'Project'
|
||||||
added_to_url = url_for(:controller => 'files', :action => 'index', :project_id => container)
|
# added_to_url = url_for(:controller => 'files', :action => 'index', :project_id => container)
|
||||||
added_to = "#{l(:label_project)}: #{container}"
|
# added_to = "#{l(:label_project)}: #{container}"
|
||||||
recipients = container.notified_users.select { |user| user.allowed_to?(:view_files, container) }.collect { |u| u.mail }
|
# recipients = container.notified_users.select { |user| user.allowed_to?(:view_files, container) }.collect { |u| u.mail }
|
||||||
when 'Course'
|
# when 'Course'
|
||||||
added_to_url = url_for(:controller => 'files', :action => 'index', :course_id => container)
|
# added_to_url = url_for(:controller => 'files', :action => 'index', :course_id => container)
|
||||||
added_to = "#{l(:label_course)}: #{container.name}"
|
# added_to = "#{l(:label_course)}: #{container.name}"
|
||||||
recipients = container.notified_users.select { |user| user.allowed_to?(:view_files, container) }.collect { |u| u.mail }
|
# recipients = container.notified_users.select { |user| user.allowed_to?(:view_files, container) }.collect { |u| u.mail }
|
||||||
when 'Version'
|
# when 'Version'
|
||||||
added_to_url = url_for(:controller => 'files', :action => 'index', :project_id => container.project)
|
# added_to_url = url_for(:controller => 'files', :action => 'index', :project_id => container.project)
|
||||||
added_to = "#{l(:label_version)}: #{container.name}"
|
# added_to = "#{l(:label_version)}: #{container.name}"
|
||||||
recipients = container.project.notified_users.select { |user| user.allowed_to?(:view_files, container.project) }.collect { |u| u.mail }
|
# recipients = container.project.notified_users.select { |user| user.allowed_to?(:view_files, container.project) }.collect { |u| u.mail }
|
||||||
when 'Document'
|
# when 'Document'
|
||||||
added_to_url = url_for(:controller => 'documents', :action => 'show', :id => container.id)
|
# added_to_url = url_for(:controller => 'documents', :action => 'show', :id => container.id)
|
||||||
added_to = "#{l(:label_document)}: #{container.title}"
|
# added_to = "#{l(:label_document)}: #{container.title}"
|
||||||
recipients = container.recipients
|
# recipients = container.recipients
|
||||||
end
|
# end
|
||||||
if container.class.name == 'Course'
|
# if container.class.name == 'Course'
|
||||||
redmine_headers 'Course' => container.id
|
# redmine_headers 'Course' => container.id
|
||||||
@attachments = attachments
|
# @attachments = attachments
|
||||||
@added_to = added_to
|
# @added_to = added_to
|
||||||
@added_to_url = added_to_url
|
# @added_to_url = added_to_url
|
||||||
mail :to => recipients,
|
# mail :to => recipients,
|
||||||
:subject => "[#{container.name}] #{l(:label_attachment_new)}",
|
# :subject => "[#{container.name}] #{l(:label_attachment_new)}",
|
||||||
:filter => true
|
# :filter => true
|
||||||
elsif container.class.name == 'Project'
|
# elsif container.class.name == 'Project'
|
||||||
redmine_headers 'Project' => container.id
|
# redmine_headers 'Project' => container.id
|
||||||
@attachments = attachments
|
# @attachments = attachments
|
||||||
@added_to = added_to
|
# @added_to = added_to
|
||||||
@added_to_url = added_to_url
|
# @added_to_url = added_to_url
|
||||||
mail :to => recipients,
|
# mail :to => recipients,
|
||||||
:subject => "[#{container.name}] #{l(:label_attachment_new)}",
|
# :subject => "[#{container.name}] #{l(:label_attachment_new)}",
|
||||||
:filter => true
|
# :filter => true
|
||||||
else
|
# else
|
||||||
redmine_headers 'Project' => container.project.identifier
|
# redmine_headers 'Project' => container.project.identifier
|
||||||
@attachments = attachments
|
# @attachments = attachments
|
||||||
@added_to = added_to
|
# @added_to = added_to
|
||||||
@added_to_url = added_to_url
|
# @added_to_url = added_to_url
|
||||||
mail :to => recipients,
|
# mail :to => recipients,
|
||||||
:subject => "[#{container.project.name}] #{l(:label_attachment_new)}",
|
# :subject => "[#{container.project.name}] #{l(:label_attachment_new)}",
|
||||||
:filter => true
|
# :filter => true
|
||||||
end
|
# end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Builds a Mail::Message object used to email recipients of a course when an homework are posted.
|
# Builds a Mail::Message object used to email recipients of a course when an homework are posted.
|
||||||
|
@ -650,15 +650,15 @@ class Mailer < ActionMailer::Base
|
||||||
def news_added(news)
|
def news_added(news)
|
||||||
|
|
||||||
if news.project
|
if news.project
|
||||||
redmine_headers 'Project' => news.project.identifier
|
# redmine_headers 'Project' => news.project.identifier
|
||||||
@author = news.author
|
# @author = news.author
|
||||||
@issue_author_url = url_for(user_activities_url(@author))
|
# @issue_author_url = url_for(user_activities_url(@author))
|
||||||
message_id news
|
# message_id news
|
||||||
@news = news
|
# @news = news
|
||||||
@news_url = url_for(:controller => 'news', :action => 'show', :id => news)
|
# @news_url = url_for(:controller => 'news', :action => 'show', :id => news)
|
||||||
mail :to => news.recipients,
|
# mail :to => news.recipients,
|
||||||
:subject => "[#{news.project.name}] #{l(:label_news)}: #{news.title}",
|
# :subject => "[#{news.project.name}] #{l(:label_news)}: #{news.title}",
|
||||||
:filter => true
|
# :filter => true
|
||||||
elsif news.course
|
elsif news.course
|
||||||
redmine_headers 'Course' => news.course.id
|
redmine_headers 'Course' => news.course.id
|
||||||
@author = news.author
|
@author = news.author
|
||||||
|
@ -681,17 +681,17 @@ class Mailer < ActionMailer::Base
|
||||||
def news_comment_added(comment)
|
def news_comment_added(comment)
|
||||||
news = comment.commented
|
news = comment.commented
|
||||||
if news.project
|
if news.project
|
||||||
redmine_headers 'Project' => news.project.identifier
|
# redmine_headers 'Project' => news.project.identifier
|
||||||
@author = comment.author
|
# @author = comment.author
|
||||||
@issue_author_url = url_for(user_activities_url(@author))
|
# @issue_author_url = url_for(user_activities_url(@author))
|
||||||
message_id comment
|
# message_id comment
|
||||||
@news = news
|
# @news = news
|
||||||
@comment = comment
|
# @comment = comment
|
||||||
@news_url = url_for(:controller => 'news', :action => 'show', :id => news)
|
# @news_url = url_for(:controller => 'news', :action => 'show', :id => news)
|
||||||
mail :to => news.recipients,
|
# mail :to => news.recipients,
|
||||||
:cc => news.watcher_recipients,
|
# :cc => news.watcher_recipients,
|
||||||
:subject => "Re: [#{news.project.name}] #{l(:label_news)}: #{news.title}",
|
# :subject => "Re: [#{news.project.name}] #{l(:label_news)}: #{news.title}",
|
||||||
:filter => true
|
# :filter => true
|
||||||
elsif news.course
|
elsif news.course
|
||||||
redmine_headers 'Course' => news.course.id
|
redmine_headers 'Course' => news.course.id
|
||||||
@author = comment.author
|
@author = comment.author
|
||||||
|
@ -714,37 +714,37 @@ class Mailer < ActionMailer::Base
|
||||||
# message_posted(message) => Mail::Message object
|
# message_posted(message) => Mail::Message object
|
||||||
# Mailer.message_posted(message).deliver => sends an email to the recipients
|
# Mailer.message_posted(message).deliver => sends an email to the recipients
|
||||||
def message_posted(message)
|
def message_posted(message)
|
||||||
if message.project
|
# if message.project
|
||||||
redmine_headers 'Project' => message.project.identifier,
|
# redmine_headers 'Project' => message.project.identifier,
|
||||||
'Topic-Id' => (message.parent_id || message.id)
|
# 'Topic-Id' => (message.parent_id || message.id)
|
||||||
@author = message.author
|
# @author = message.author
|
||||||
@issue_author_url = url_for(user_activities_url(@author))
|
# @issue_author_url = url_for(user_activities_url(@author))
|
||||||
message_id message
|
# message_id message
|
||||||
references message.parent unless message.parent.nil?
|
# references message.parent unless message.parent.nil?
|
||||||
recipients = message.recipients
|
# recipients = message.recipients
|
||||||
cc = ((message.root.watcher_recipients + message.board.watcher_recipients).uniq - recipients)
|
# cc = ((message.root.watcher_recipients + message.board.watcher_recipients).uniq - recipients)
|
||||||
@message = message
|
# @message = message
|
||||||
@message_url = url_for(message.event_url)
|
# @message_url = url_for(message.event_url)
|
||||||
mail :to => recipients,
|
# mail :to => recipients,
|
||||||
:cc => cc,
|
# :cc => cc,
|
||||||
:subject => "[#{message.board.project.name} - #{message.board.name} - msg#{message.root.id}] #{message.subject}",
|
# :subject => "[#{message.board.project.name} - #{message.board.name} - msg#{message.root.id}] #{message.subject}",
|
||||||
:filter => true
|
# :filter => true
|
||||||
elsif message.course
|
# elsif message.course
|
||||||
redmine_headers 'Course' => message.course.id,
|
# redmine_headers 'Course' => message.course.id,
|
||||||
'Topic-Id' => (message.parent_id || message.id)
|
# 'Topic-Id' => (message.parent_id || message.id)
|
||||||
@author = message.author
|
# @author = message.author
|
||||||
@issue_author_url = url_for(user_activities_url(@author))
|
# @issue_author_url = url_for(user_activities_url(@author))
|
||||||
message_id message
|
# message_id message
|
||||||
references message.parent unless message.parent.nil?
|
# references message.parent unless message.parent.nil?
|
||||||
recipients = message.course.notified_users.select { |user| user.allowed_to?(:view_files, message.course) }.collect { |u| u.mail }
|
# recipients = message.course.notified_users.select { |user| user.allowed_to?(:view_files, message.course) }.collect { |u| u.mail }
|
||||||
cc = ((message.root.watcher_recipients + message.board.watcher_recipients).uniq - recipients)
|
# cc = ((message.root.watcher_recipients + message.board.watcher_recipients).uniq - recipients)
|
||||||
@message = message
|
# @message = message
|
||||||
@message_url = url_for(message.event_url)
|
# @message_url = url_for(message.event_url)
|
||||||
mail :to => recipients,
|
# mail :to => recipients,
|
||||||
:cc => cc,
|
# :cc => cc,
|
||||||
:subject => "[#{message.board.course.name} - #{message.board.name} - msg#{message.root.id}] #{message.subject}",
|
# :subject => "[#{message.board.course.name} - #{message.board.name} - msg#{message.root.id}] #{message.subject}",
|
||||||
:filter => true
|
# :filter => true
|
||||||
end
|
# end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Builds a Mail::Message object used to email the recipients of a project of the specified wiki content was added.
|
# Builds a Mail::Message object used to email the recipients of a project of the specified wiki content was added.
|
||||||
|
@ -753,20 +753,20 @@ class Mailer < ActionMailer::Base
|
||||||
# wiki_content_added(wiki_content) => Mail::Message object
|
# wiki_content_added(wiki_content) => Mail::Message object
|
||||||
# Mailer.wiki_content_added(wiki_content).deliver => sends an email to the project's recipients
|
# Mailer.wiki_content_added(wiki_content).deliver => sends an email to the project's recipients
|
||||||
def wiki_content_added(wiki_content)
|
def wiki_content_added(wiki_content)
|
||||||
redmine_headers 'Project' => wiki_content.project.identifier,
|
# redmine_headers 'Project' => wiki_content.project.identifier,
|
||||||
'Wiki-Page-Id' => wiki_content.page.id
|
# 'Wiki-Page-Id' => wiki_content.page.id
|
||||||
@author = wiki_content.author
|
# @author = wiki_content.author
|
||||||
message_id wiki_content
|
# message_id wiki_content
|
||||||
recipients = wiki_content.recipients
|
# recipients = wiki_content.recipients
|
||||||
cc = wiki_content.page.wiki.watcher_recipients - recipients
|
# cc = wiki_content.page.wiki.watcher_recipients - recipients
|
||||||
@wiki_content = wiki_content
|
# @wiki_content = wiki_content
|
||||||
@wiki_content_url = url_for(:controller => 'wiki', :action => 'show',
|
# @wiki_content_url = url_for(:controller => 'wiki', :action => 'show',
|
||||||
:project_id => wiki_content.project,
|
# :project_id => wiki_content.project,
|
||||||
:id => wiki_content.page.title)
|
# :id => wiki_content.page.title)
|
||||||
mail :to => recipients,
|
# mail :to => recipients,
|
||||||
:cc => cc,
|
# :cc => cc,
|
||||||
:subject => "[#{wiki_content.project.name}] #{l(:mail_subject_wiki_content_added, :id => wiki_content.page.pretty_title)}",
|
# :subject => "[#{wiki_content.project.name}] #{l(:mail_subject_wiki_content_added, :id => wiki_content.page.pretty_title)}",
|
||||||
:filter => true
|
# :filter => true
|
||||||
end
|
end
|
||||||
|
|
||||||
# Builds a Mail::Message object used to email the recipients of a project of the specified wiki content was updated.
|
# Builds a Mail::Message object used to email the recipients of a project of the specified wiki content was updated.
|
||||||
|
@ -775,23 +775,23 @@ class Mailer < ActionMailer::Base
|
||||||
# wiki_content_updated(wiki_content) => Mail::Message object
|
# wiki_content_updated(wiki_content) => Mail::Message object
|
||||||
# Mailer.wiki_content_updated(wiki_content).deliver => sends an email to the project's recipients
|
# Mailer.wiki_content_updated(wiki_content).deliver => sends an email to the project's recipients
|
||||||
def wiki_content_updated(wiki_content)
|
def wiki_content_updated(wiki_content)
|
||||||
redmine_headers 'Project' => wiki_content.project.identifier,
|
# redmine_headers 'Project' => wiki_content.project.identifier,
|
||||||
'Wiki-Page-Id' => wiki_content.page.id
|
# 'Wiki-Page-Id' => wiki_content.page.id
|
||||||
@author = wiki_content.author
|
# @author = wiki_content.author
|
||||||
message_id wiki_content
|
# message_id wiki_content
|
||||||
recipients = wiki_content.recipients
|
# recipients = wiki_content.recipients
|
||||||
cc = wiki_content.page.wiki.watcher_recipients + wiki_content.page.watcher_recipients - recipients
|
# cc = wiki_content.page.wiki.watcher_recipients + wiki_content.page.watcher_recipients - recipients
|
||||||
@wiki_content = wiki_content
|
# @wiki_content = wiki_content
|
||||||
@wiki_content_url = url_for(:controller => 'wiki', :action => 'show',
|
# @wiki_content_url = url_for(:controller => 'wiki', :action => 'show',
|
||||||
:project_id => wiki_content.project,
|
# :project_id => wiki_content.project,
|
||||||
:id => wiki_content.page.title)
|
# :id => wiki_content.page.title)
|
||||||
@wiki_diff_url = url_for(:controller => 'wiki', :action => 'diff',
|
# @wiki_diff_url = url_for(:controller => 'wiki', :action => 'diff',
|
||||||
:project_id => wiki_content.project, :id => wiki_content.page.title,
|
# :project_id => wiki_content.project, :id => wiki_content.page.title,
|
||||||
:version => wiki_content.version)
|
# :version => wiki_content.version)
|
||||||
mail :to => recipients,
|
# mail :to => recipients,
|
||||||
:cc => cc,
|
# :cc => cc,
|
||||||
:subject => "[#{wiki_content.project.name}] #{l(:mail_subject_wiki_content_updated, :id => wiki_content.page.pretty_title)}",
|
# :subject => "[#{wiki_content.project.name}] #{l(:mail_subject_wiki_content_updated, :id => wiki_content.page.pretty_title)}",
|
||||||
:filter => true
|
# :filter => true
|
||||||
end
|
end
|
||||||
|
|
||||||
# Builds a Mail::Message object used to email the specified user their account information.
|
# Builds a Mail::Message object used to email the specified user their account information.
|
||||||
|
|
|
@ -81,7 +81,7 @@ class Memo < ActiveRecord::Base
|
||||||
"parent_id",
|
"parent_id",
|
||||||
"replies_count"
|
"replies_count"
|
||||||
|
|
||||||
after_create :add_author_as_watcher, :reset_counters!, :send_mail, :send_message,:create_memo_ealasticsearch_index
|
after_create :add_author_as_watcher, :reset_counters!, :send_message,:create_memo_ealasticsearch_index
|
||||||
after_update :update_memo_ealasticsearch_index
|
after_update :update_memo_ealasticsearch_index
|
||||||
after_destroy :reset_counters!,:delete_kindeditor_assets,:delete_memo_ealasticsearch_index#,:down_user_score -- 公共区发帖暂不计入得分,
|
after_destroy :reset_counters!,:delete_kindeditor_assets,:delete_memo_ealasticsearch_index#,:down_user_score -- 公共区发帖暂不计入得分,
|
||||||
# after_create :send_notification
|
# after_create :send_notification
|
||||||
|
|
|
@ -65,7 +65,7 @@ class News < ActiveRecord::Base
|
||||||
:author_key => :author_id
|
:author_key => :author_id
|
||||||
acts_as_watchable
|
acts_as_watchable
|
||||||
|
|
||||||
after_create :act_as_forge_activity, :act_as_course_activity, :add_author_as_watcher, :send_mail, :add_news_count, :act_as_student_score, :act_as_system_message,:delay_news_wechat_send,:delay_news_send
|
after_create :act_as_course_activity, :add_author_as_watcher, :send_mail, :add_news_count, :act_as_student_score,:delay_news_wechat_send, :delay_news_send
|
||||||
after_update :update_activity
|
after_update :update_activity
|
||||||
after_destroy :delete_kindeditor_assets, :decrease_news_count, :delete_org_activities, :down_course_score
|
after_destroy :delete_kindeditor_assets, :decrease_news_count, :delete_org_activities, :down_course_score
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,7 @@ class User < Principal
|
||||||
#每日一报、一事一报、不报
|
#每日一报、一事一报、不报
|
||||||
MAIL_NOTIFICATION_OPTIONS = [
|
MAIL_NOTIFICATION_OPTIONS = [
|
||||||
#['week', :label_user_mail_option_week],
|
#['week', :label_user_mail_option_week],
|
||||||
['day', :label_user_mail_option_day],
|
# ['day', :label_user_mail_option_day],
|
||||||
['all', :label_user_mail_option_all],
|
['all', :label_user_mail_option_all],
|
||||||
['none', :label_user_mail_option_none]
|
['none', :label_user_mail_option_none]
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,51 +1,31 @@
|
||||||
<% if !@changes.blank? && @type == "3" %>
|
<% if !@changes.blank? && @type == "3" %>
|
||||||
<div class="pullreques_change_box">
|
<div class="pullreques_change_box">
|
||||||
<div class="pullreques_pull_top clear">
|
<div class="pullreques_pull_top clear">
|
||||||
<p class="fl c_grey ml15">改动了<span class="fontBlue"> <%= @changes_count %></span> 个文件</p>
|
<p class="fl c_grey ml15">改动了<span class="fontBlue"> <%= @changes_count %></span> 个文件</p>
|
||||||
</div>
|
</div>
|
||||||
<ul class="pullreques_change_list">
|
<ul class="pullreques_change_list">
|
||||||
<% @changes.each do |change| %>
|
<% @changes.each do |change| %>
|
||||||
<li><span class="fl ml15 mt12 <%= get_type_of_file(change) %>"></span><p class="pullreques_pull_txt ml5 fl"><%= change['new_path'] %></p></li>
|
<li><span class="fl ml15 mt12 <%= get_type_of_file(change) %>"></span><p class="pullreques_pull_txt ml5 fl"><%= change['new_path'] %></p></li>
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<% @changes.each do |change| %>
|
<% @changes.each do |change| %>
|
||||||
<div class="showing-changes-row fontGrey2">
|
<div class="showing-changes-row fontGrey2">
|
||||||
<a class="linkGrey3" id="changed-files">
|
<a class="linkGrey3" id="changed-files">
|
||||||
<img src="/images/vlicon/file.png" width="18" height="20" style="vertical-align:middle;" class="mr5" /><%= change['new_path'] %>
|
<img src="/images/vlicon/file.png" width="18" height="20" style="vertical-align:middle;" class="mr5" /><%= change['new_path'] %>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="autoscroll">
|
<div class="autoscroll">
|
||||||
<table class="filecontent syntaxhl" style="width:100%;" >
|
<%= render :partial => 'repositories/change_diff', :locals => {:change => change} %>
|
||||||
<tbody>
|
</div>
|
||||||
<% line_num = diff_line_num(change['diff']) %>
|
<% end %>
|
||||||
<% diff_content = diff_content(change['diff']) %>
|
|
||||||
<% syntax_highlight_lines('new_path', Redmine::CodesetUtil.to_utf8_by_setting(diff_content)).each do |line| %>
|
<div style="text-align:center;">
|
||||||
<tr>
|
<div class="pages" style="width:auto; display:inline-block;">
|
||||||
<th class="line-num" id="L<%= line_num %>" style="vertical-align: top;">
|
<ul id="homework_pository_ref_pages">
|
||||||
<a href="#L<%= line_num %>" style="padding-top: 0px;"><%= line_num %></a>
|
<%= pagination_links_full @pages, @count, :per_page_links => false, :remote => @is_remote, :flag => true, :is_new => true%>
|
||||||
</th>
|
</ul>
|
||||||
<% if line[0,1] == "-" %>
|
<div class="cl"></div>
|
||||||
<td class="line-code diff_out"><pre style="white-space:pre;"><%= line.html_safe %></pre></td>
|
</div>
|
||||||
<% elsif line[0,1] == "+" %>
|
</div>
|
||||||
<td class="line-code diff_in"><pre style="white-space:pre;"><%= line.html_safe %></pre></td>
|
<% end %>
|
||||||
<% else%>
|
|
||||||
<td class="line-code"><pre style="white-space:pre;"><%= line.html_safe %></pre></td>
|
|
||||||
<% end %>
|
|
||||||
</tr>
|
|
||||||
<% line_num += 1 %>
|
|
||||||
<% end %>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<div style="text-align:center;">
|
|
||||||
<div class="pages" style="width:auto; display:inline-block;">
|
|
||||||
<ul id="homework_pository_ref_pages">
|
|
||||||
<%= pagination_links_full @pages, @count, :per_page_links => false, :remote => @is_remote, :flag => true, :is_new => true%>
|
|
||||||
</ul>
|
|
||||||
<div class="cl"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
|
|
|
@ -14,10 +14,8 @@
|
||||||
<div class="c_grey clear mt5">
|
<div class="c_grey clear mt5">
|
||||||
<p class="fl">由 <%= link_to get_user_by_login_and(request.author.try(:username)).try(:show_name), user_path(get_user_by_login_and(request.author.try(:username))), :class => "linkBlue2" %> 创建于<%= time_tag(request.created_at) %>前</p>
|
<p class="fl">由 <%= link_to get_user_by_login_and(request.author.try(:username)).try(:show_name), user_path(get_user_by_login_and(request.author.try(:username))), :class => "linkBlue2" %> 创建于<%= time_tag(request.created_at) %>前</p>
|
||||||
<span class="fl ml10"><%= time_tag(request.updated_at) %>前更新</span>
|
<span class="fl ml10"><%= time_tag(request.updated_at) %>前更新</span>
|
||||||
<p class="fr"><%= @project.name+"/"+request.source_branch %><span class="c_grey02 ml10 mr10">合并到</span><%= request.target_branch %></p>
|
<p class="fr"><%= find_gitlab_project(request.source_project_id)+"/"+request.source_branch %><span class="c_grey02 ml10 mr10">合并到</span><%= find_gitlab_project(request.target_project_id)+"/"+request.target_branch %></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
|
@ -1 +1,2 @@
|
||||||
|
|
||||||
$("#merge_record_3").html('<%= escape_javascript( render :partial => "pull_requests/pull_request_changes") %>');
|
$("#merge_record_3").html('<%= escape_javascript( render :partial => "pull_requests/pull_request_changes") %>');
|
|
@ -0,0 +1,50 @@
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
<table class="filecontent syntaxhl">
|
||||||
|
<tbody>
|
||||||
|
<% diff = ActiveSupport::JSON.decode(change.to_json) %>
|
||||||
|
<% diff = OpenStruct.new(diff) %>
|
||||||
|
<% @diff_file = Trustie::Gitlab::Diff::File.new(diff) %>
|
||||||
|
<% @diff_file.diff_lines.each_with_index do |line, index| %>
|
||||||
|
<% type = line.type %>
|
||||||
|
<% last_line = line.new_pos.to_s %>
|
||||||
|
<% line_old = line.old_pos.to_s %>
|
||||||
|
|
||||||
|
<% if type.nil? || type == "match" %>
|
||||||
|
<tr class="line_holder" >
|
||||||
|
<td class="old_line">
|
||||||
|
<a><%= type == "match" ? "..." : line_old.center(4) %></a>
|
||||||
|
</td>
|
||||||
|
<td class="new_line" >
|
||||||
|
<a><%= type == "match" ? "..." : last_line.center(4) %></a>
|
||||||
|
</td>
|
||||||
|
<td class="line_content noteable_line <%= 'c_grey' if type == "match" %>" >
|
||||||
|
<pre style="width:auto;overflow: auto; "><%= Redmine::CodesetUtil.replace_invalid_utf8(line.text).html_safe %></pre>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<% else %>
|
||||||
|
<% old_line = type == 'new' ? ' '*4: line_old %>
|
||||||
|
<% new_line = type == 'old' ? ' '*4: last_line %>
|
||||||
|
<tr class="<%= type == 'old' ? 'line_holder old' : 'line_holder new' %>" >
|
||||||
|
<td class="old_line">
|
||||||
|
<a><%= old_line.to_s.center(4) %></a>
|
||||||
|
</td>
|
||||||
|
<td class="new_line" data-linenumber="2">
|
||||||
|
<a><%= new_line.to_s.center(4) %></a>
|
||||||
|
</td>
|
||||||
|
<td class="<%= type == 'old' ? 'line_content noteable_line old' : 'line_content new noteable_line' %> " >
|
||||||
|
<pre style="width:auto;overflow: auto; "><%= Redmine::CodesetUtil.replace_invalid_utf8(line.text).html_safe %></pre>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
<tr>
|
||||||
|
<td class=" old_line " data-linenumber="5">
|
||||||
|
...
|
||||||
|
</td>
|
||||||
|
<td class="new_line " data-linenumber="5">
|
||||||
|
...
|
||||||
|
</td>
|
||||||
|
<td class="line_content "></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
|
@ -9,42 +9,14 @@
|
||||||
</li>
|
</li>
|
||||||
</div>
|
</div>
|
||||||
<div class="showing-changes-project f14"><%= @commit_details.message %></div>
|
<div class="showing-changes-project f14"><%= @commit_details.message %></div>
|
||||||
<!--<div class="showing-changes-row fontGrey2">Showing <a href="javascript:void()" class="linkGrey3" id="changed-files">3 changed files</a> with <span class="c_green">3 additions</span> and <span class="c_red">3 deletions</span>-->
|
<% @commit_diff.each do |commit_diff| %>
|
||||||
<!--<ol class="mt10" id="changed-files-detail">-->
|
|
||||||
<!--<li><a href="javascript:void()" class="linkGrey3" id="changed-files">app/views/organizations/_org_course_homework.html.erb</a> </li>-->
|
|
||||||
<!--<li><a href="javascript:void()" class="linkGrey3" id="changed-files">app/views/users/_course_homework.html.erb</a> </li>-->
|
|
||||||
<!--<li><a href="javascript:void()" class="linkGrey3" id="changed-files">app/views/users/_user_homework_detail.html.erb</a> </li>-->
|
|
||||||
<!--</ol>-->
|
|
||||||
<!--</div>-->
|
|
||||||
|
|
||||||
<% @commit_diff.each do |cd| %>
|
|
||||||
<div class="showing-changes-row fontGrey2">
|
<div class="showing-changes-row fontGrey2">
|
||||||
<a href="javascript:void(0);" class="linkGrey3" id="changed-files">
|
<a href="javascript:void(0);" class="linkGrey3" id="changed-files">
|
||||||
<img src="/images/vlicon/file.png" width="18" height="20" style="vertical-align:middle;" class="mr5" /><%= cd.new_path %>
|
<img src="/images/vlicon/file.png" width="18" height="20" style="vertical-align:middle;" class="mr5" /><%= commit_diff.new_path %>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="autoscroll">
|
<div class="autoscroll">
|
||||||
<table class="filecontent syntaxhl" style="width:100%;" >
|
<%= render :partial => 'repositories/change_diff', :locals => {:change => commit_diff} %>
|
||||||
<tbody>
|
|
||||||
<% line_num = diff_line_num(cd.diff) %>
|
|
||||||
<% diff_content = diff_content(cd.diff) %>
|
|
||||||
<% syntax_highlight_lines(cd.new_path, Redmine::CodesetUtil.to_utf8_by_setting(diff_content)).each do |line| %>
|
|
||||||
<tr>
|
|
||||||
<th class="line-num" id="L<%= line_num %>" style="vertical-align: top;">
|
|
||||||
<a href="#L<%= line_num %>" style="padding-top: 0px;"><%= line_num %></a>
|
|
||||||
</th>
|
|
||||||
<% if line[0,1] == "-" %>
|
|
||||||
<td class="line-code diff_out"><pre style="width:auto;white-space: nowrap; "><%= line.html_safe %></pre></td>
|
|
||||||
<% elsif line[0,1] == "+" %>
|
|
||||||
<td class="line-code diff_in"><pre style="width:auto;white-space: nowrap; "><%= line.html_safe %></pre></td>
|
|
||||||
<% else%>
|
|
||||||
<td class="line-code"><pre style="width:auto;white-space: nowrap; "><%= line.html_safe %></pre></td>
|
|
||||||
<% end %>
|
|
||||||
</tr>
|
|
||||||
<% line_num += 1 %>
|
|
||||||
<% end %>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -507,3 +507,7 @@ zh:
|
||||||
|
|
||||||
label_done_ratio_endding: 已完成
|
label_done_ratio_endding: 已完成
|
||||||
label_done_ratio_doing: 未完成
|
label_done_ratio_doing: 未完成
|
||||||
|
|
||||||
|
label_pull_request_conflic: 您创建的Pull Request尚未被管理员接受或者关闭,不能重新创建
|
||||||
|
label_pull_request_forbidden: 您没有权限进行该操作
|
||||||
|
label_pull_request_notfound: 您操作的页面不存在或者已被删除
|
|
@ -1,41 +0,0 @@
|
||||||
default: &default
|
|
||||||
# corpid: "corpid"
|
|
||||||
# corpsecret: "corpsecret"
|
|
||||||
# agentid: 1
|
|
||||||
|
|
||||||
#production
|
|
||||||
appid: "wx8e1ab05163a28e37"
|
|
||||||
secret: "beb4d3bc4b32b3557811680835357841"
|
|
||||||
|
|
||||||
token: "123456"
|
|
||||||
access_token: "1234567"
|
|
||||||
encrypt_mode: false # if true must fill encoding_aes_key
|
|
||||||
|
|
||||||
#production
|
|
||||||
encoding_aes_key: "QGfP13YP4BbQGkkrlYuxpn4ZIDXpBJww4fxl8CObvNw"
|
|
||||||
jsapi_ticket: "C:/Users/[user_name]/wechat_jsapi_ticket"
|
|
||||||
|
|
||||||
#template
|
|
||||||
binding_succ_notice: "jjpDrgFErnmkrE9tf2M3o0t31ZrJ7mr0YtuE_wyLaMc"
|
|
||||||
journal_notice: "uC1zAw4F2q6HTA3Pcj8VUO6wKKKiYFwnPJB4iXxpdoM"
|
|
||||||
homework_message_notice: "tCf7teCVqc2vl2LZ_hppIdWmpg8yLcrI8XifxYePjps"
|
|
||||||
class_notice: "MQ_mFupbXP-9jWbeHT3C5xqNBvPo8EIlNv4ULakSpJA"
|
|
||||||
create_class_notice: "2GtJJGzzNlNy2i0UrsjEDlvfSVIUXQfSo47stpcQAVw"
|
|
||||||
create_project_notice: "jYu0iimbDpgWYZaTLXioZe2lvqoWTdKnUPyphTJ1mxs"
|
|
||||||
project_review_notice: "kdb-8UlMjTc3z51Qcf8g2vY4i_nE4OGKZAucdQma_2E"
|
|
||||||
join_project_notice: "TtXvy0XMIQyCgpnXHhoB8t-x0QIfy-78gAJXsGf9afg"
|
|
||||||
project_issue_notice: "HP8JejOnkzmvFopTarc0l1Tp4bU9qnxzdH27x3186lI"
|
|
||||||
at_notice: "U3kqzgriCaqkPI9qX0NDQOInJ5hiwHCz6wgTsPysSx4"
|
|
||||||
rebind_notice: "OYsiECfqUlHKlzF_X-pz_xsGh_vAAUunX0jYRdHlyFU"
|
|
||||||
|
|
||||||
auto_openid_url_1: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx8e1ab05163a28e37&redirect_uri=https://www.trustie.net/wechat/user_activities"
|
|
||||||
auto_openid_url_2: "&response_type=code&scope=snsapi_base&state="
|
|
||||||
auto_openid_url_3: "&connect_redirect=1#wechat_redirect"
|
|
||||||
production:
|
|
||||||
<<: *default
|
|
||||||
|
|
||||||
development:
|
|
||||||
<<: *default
|
|
||||||
|
|
||||||
test:
|
|
||||||
<<: *default
|
|
|
@ -197,10 +197,10 @@ END_DESC
|
||||||
|
|
||||||
desc "send a email for day"
|
desc "send a email for day"
|
||||||
task :day => :environment do
|
task :day => :environment do
|
||||||
users = User.where(mail_notification: 'day')
|
# users = User.where(mail_notification: 'day')
|
||||||
users.each do |user|
|
# users.each do |user|
|
||||||
Mailer.run.send_for_user_activities(user, Date.today, 1)
|
# Mailer.run.send_for_user_activities(user, Date.today, 1)
|
||||||
end
|
# end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,21 +7,21 @@ module Trustie
|
||||||
FINISH = "#!idiff-finish!#"
|
FINISH = "#!idiff-finish!#"
|
||||||
|
|
||||||
def processing(diff_arr)
|
def processing(diff_arr)
|
||||||
indexes = _indexes_of_changed_lines diff_arr
|
# indexes = _indexes_of_changed_lines diff_arr
|
||||||
|
#
|
||||||
indexes.each do |index|
|
# indexes.each do |index|
|
||||||
first_line = diff_arr[index+1]
|
# first_line = diff_arr[index+1]
|
||||||
second_line = diff_arr[index+2]
|
# second_line = diff_arr[index+2]
|
||||||
|
#
|
||||||
# Skip inline diff if empty line was replaced with content
|
# # Skip inline diff if empty line was replaced with content
|
||||||
next if first_line == "-\n"
|
# next if first_line == "-\n"
|
||||||
|
#
|
||||||
first_token = find_first_token(first_line, second_line)
|
# first_token = find_first_token(first_line, second_line)
|
||||||
apply_first_token(diff_arr, index, first_token)
|
# apply_first_token(diff_arr, index, first_token)
|
||||||
|
#
|
||||||
last_token = find_last_token(first_line, second_line, first_token)
|
# last_token = find_last_token(first_line, second_line, first_token)
|
||||||
apply_last_token(diff_arr, index, last_token)
|
# apply_last_token(diff_arr, index, last_token)
|
||||||
end
|
# end
|
||||||
|
|
||||||
diff_arr
|
diff_arr
|
||||||
end
|
end
|
||||||
|
|
|
@ -1043,3 +1043,14 @@ table.quality_list tbody td, table.quality_list tbody tr td {
|
||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
padding: 4px 10px 4px 3px;
|
padding: 4px 10px 4px 3px;
|
||||||
}
|
}
|
||||||
|
/* 文本变更样式 */
|
||||||
|
.autoscroll {overflow-x: auto; margin-bottom: 0.2em;}
|
||||||
|
table.filecontent { border: 1px solid #e2e2e2; border-collapse: collapse; width: 100%;background-color: #fafafa;}
|
||||||
|
table.text-file{}
|
||||||
|
.old_line,.new_line,.diff_line {margin: 0px; padding: 0px;border: none; background: #f7f8fa;color: rgba(0,0,0,0.3); padding: 0px 5px; border-right: 1px solid #dce0e6;text-align: right; min-width: 35px; max-width: 50px; width: 35px; -webkit-user-select: none;}
|
||||||
|
.old_line a,.new_line a,.diff_line a { float: left;width: 35px; font-weight: normal; color: rgba(0,0,0,0.3);}
|
||||||
|
.line_content{padding: 0px 5px;}
|
||||||
|
.old{ background:#ffecec; }
|
||||||
|
.old:hover{ background:#fffaf1; }
|
||||||
|
.new{ background: #eaffea;}
|
||||||
|
.new:hover{ background:#fffaf1; }
|
Loading…
Reference in New Issue