From 6261b92c7f75386c965757bd4e62cdc4142fa3a3 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Mon, 14 Nov 2016 17:04:26 +0800 Subject: [PATCH 01/20] =?UTF-8?q?=E5=BF=BD=E7=95=A5oneapm?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 9d33b264c..601f691a1 100644 --- a/.gitignore +++ b/.gitignore @@ -39,3 +39,4 @@ public/javascripts/wechat/node_modules/ .access_token tmux*.log config/wechat.yml +config/oneapm.yml From e33146813d260db65ddfd1a985ed31562e43a283 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Tue, 15 Nov 2016 09:25:58 +0800 Subject: [PATCH 02/20] =?UTF-8?q?=E5=8A=A0=E6=97=A5=E5=BF=97=E6=B5=8B?= =?UTF-8?q?=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/message.rb | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/app/models/message.rb b/app/models/message.rb index 1d76c8ef6..6b2e29428 100644 --- a/app/models/message.rb +++ b/app/models/message.rb @@ -147,6 +147,7 @@ class Message < ActiveRecord::Base # 删除帖子的时候更新帖子总数, 删除回复的时候总数不减少 def decrease_boards_count + tStarttime = Time.now if self.project && !project.project_score.nil? # 讨论区 if self.parent_id.nil? @@ -157,13 +158,22 @@ class Message < ActiveRecord::Base self.project.project_score.update_attribute(:board_message_num, count < 0 ? 0 : count) end end + + tEndtime = Time.now + tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000 + logger.info "message_time decrease_boards_count! user wait time = #{tUsedtime} ms" end def reset_counters! + tStarttime = Time.now if parent && parent.id Message.update_all({:last_reply_id => parent.children.maximum(:id)}, {:id => parent.id}) end board.reset_counters! + + tEndtime = Time.now + tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000 + logger.info "message_time reset_counters! user wait time = #{tUsedtime} ms" end def sticky=(arg) @@ -358,6 +368,7 @@ class Message < ActiveRecord::Base #减少用户分数 def down_user_score + tStarttime = Time.now if self.parent_id.nil? && !self.board.project.nil? UserScore.joint(:delete_message, self.author,nil,self, { message_id: self.id }) update_memo_number(User.current,1) @@ -371,6 +382,10 @@ class Message < ActiveRecord::Base update_replay_for_memo(self.author,2,self.board.project) end end + + tEndtime = Time.now + tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000 + logger.info "message_time down_user_score! user wait time = #{tUsedtime} ms" end def send_mail @@ -381,7 +396,13 @@ class Message < ActiveRecord::Base # Author lizanle # Description 删除对应消息的图片资源 def delete_kindeditor_assets + tStarttime = Time.now + delete_kindeditor_assets_from_disk self.id,OwnerTypeHelper::MESSAGE + + tEndtime = Time.now + tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000 + logger.info "message_time delete_kindeditor_assets! user wait time = #{tUsedtime} ms" end # 课程成员得分(活跃度) @@ -399,6 +420,7 @@ class Message < ActiveRecord::Base # 删除帖子的时候更新课程帖子总数, 删除回复的时候减少总数 def down_course_score + tStarttime = Time.now if self.course if self.parent_id.nil? # 发帖 down_course_score_num(self.course.id, self.author_id, "Message") @@ -407,6 +429,9 @@ class Message < ActiveRecord::Base down_course_score_num(self.course.id, self.author_id, "MessageReply") end end + tEndtime = Time.now + tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000 + logger.info "message_time down_course_score! user wait time = #{tUsedtime} ms" end def delete_org_activities From 85938bf3f1fb2ff069ea5ee24b44a2fa0e12e2a2 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Tue, 15 Nov 2016 09:28:42 +0800 Subject: [PATCH 03/20] =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/message.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/models/message.rb b/app/models/message.rb index 6b2e29428..0ae8d442b 100644 --- a/app/models/message.rb +++ b/app/models/message.rb @@ -147,6 +147,7 @@ class Message < ActiveRecord::Base # 删除帖子的时候更新帖子总数, 删除回复的时候总数不减少 def decrease_boards_count + logger.info 'decrease_boards_count! start' tStarttime = Time.now if self.project && !project.project_score.nil? # 讨论区 @@ -165,6 +166,7 @@ class Message < ActiveRecord::Base end def reset_counters! + logger.info 'reset_counters! start' tStarttime = Time.now if parent && parent.id Message.update_all({:last_reply_id => parent.children.maximum(:id)}, {:id => parent.id}) @@ -368,6 +370,7 @@ class Message < ActiveRecord::Base #减少用户分数 def down_user_score + logger.info 'down_user_score start' tStarttime = Time.now if self.parent_id.nil? && !self.board.project.nil? UserScore.joint(:delete_message, self.author,nil,self, { message_id: self.id }) @@ -396,6 +399,7 @@ class Message < ActiveRecord::Base # Author lizanle # Description 删除对应消息的图片资源 def delete_kindeditor_assets + logger.info 'delete_kindeditor_assets start' tStarttime = Time.now delete_kindeditor_assets_from_disk self.id,OwnerTypeHelper::MESSAGE @@ -420,6 +424,7 @@ class Message < ActiveRecord::Base # 删除帖子的时候更新课程帖子总数, 删除回复的时候减少总数 def down_course_score + logger.info 'down_course_score start' tStarttime = Time.now if self.course if self.parent_id.nil? # 发帖 From 19e2c349177e6334be556c63f35f7c0bf230fd49 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Tue, 15 Nov 2016 10:33:28 +0800 Subject: [PATCH 04/20] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E8=BF=98=E5=8E=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/message.rb | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/app/models/message.rb b/app/models/message.rb index 0ae8d442b..1d76c8ef6 100644 --- a/app/models/message.rb +++ b/app/models/message.rb @@ -147,8 +147,6 @@ class Message < ActiveRecord::Base # 删除帖子的时候更新帖子总数, 删除回复的时候总数不减少 def decrease_boards_count - logger.info 'decrease_boards_count! start' - tStarttime = Time.now if self.project && !project.project_score.nil? # 讨论区 if self.parent_id.nil? @@ -159,23 +157,13 @@ class Message < ActiveRecord::Base self.project.project_score.update_attribute(:board_message_num, count < 0 ? 0 : count) end end - - tEndtime = Time.now - tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000 - logger.info "message_time decrease_boards_count! user wait time = #{tUsedtime} ms" end def reset_counters! - logger.info 'reset_counters! start' - tStarttime = Time.now if parent && parent.id Message.update_all({:last_reply_id => parent.children.maximum(:id)}, {:id => parent.id}) end board.reset_counters! - - tEndtime = Time.now - tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000 - logger.info "message_time reset_counters! user wait time = #{tUsedtime} ms" end def sticky=(arg) @@ -370,8 +358,6 @@ class Message < ActiveRecord::Base #减少用户分数 def down_user_score - logger.info 'down_user_score start' - tStarttime = Time.now if self.parent_id.nil? && !self.board.project.nil? UserScore.joint(:delete_message, self.author,nil,self, { message_id: self.id }) update_memo_number(User.current,1) @@ -385,10 +371,6 @@ class Message < ActiveRecord::Base update_replay_for_memo(self.author,2,self.board.project) end end - - tEndtime = Time.now - tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000 - logger.info "message_time down_user_score! user wait time = #{tUsedtime} ms" end def send_mail @@ -399,14 +381,7 @@ class Message < ActiveRecord::Base # Author lizanle # Description 删除对应消息的图片资源 def delete_kindeditor_assets - logger.info 'delete_kindeditor_assets start' - tStarttime = Time.now - delete_kindeditor_assets_from_disk self.id,OwnerTypeHelper::MESSAGE - - tEndtime = Time.now - tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000 - logger.info "message_time delete_kindeditor_assets! user wait time = #{tUsedtime} ms" end # 课程成员得分(活跃度) @@ -424,8 +399,6 @@ class Message < ActiveRecord::Base # 删除帖子的时候更新课程帖子总数, 删除回复的时候减少总数 def down_course_score - logger.info 'down_course_score start' - tStarttime = Time.now if self.course if self.parent_id.nil? # 发帖 down_course_score_num(self.course.id, self.author_id, "Message") @@ -434,9 +407,6 @@ class Message < ActiveRecord::Base down_course_score_num(self.course.id, self.author_id, "MessageReply") end end - tEndtime = Time.now - tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000 - logger.info "message_time down_course_score! user wait time = #{tUsedtime} ms" end def delete_org_activities From 14552abd5611e6cc00c07946c67b67cbd856375c Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Mon, 21 Nov 2016 10:08:27 +0800 Subject: [PATCH 05/20] =?UTF-8?q?=E5=8D=9A=E5=AE=A2=E4=BA=BA=E6=B0=94?= =?UTF-8?q?=E6=8E=92=E5=BA=8F=E4=BF=AE=E6=94=B9=EF=BC=8C=E4=B8=AA=E4=BA=BA?= =?UTF-8?q?=E4=B8=BB=E9=A1=B5=E5=85=B3=E6=B3=A8BUG=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/blogs_controller.rb | 2 +- app/controllers/watchers_controller.rb | 7 ++++++- app/views/layouts/new_base_user.html.erb | 2 +- app/views/users/_user_fans_item.html.erb | 12 +++++++++++- app/views/users/user_fanslist.html.erb | 9 --------- app/views/watchers/_set_watcher.js.erb | 4 +++- 6 files changed, 22 insertions(+), 14 deletions(-) diff --git a/app/controllers/blogs_controller.rb b/app/controllers/blogs_controller.rb index eeea2d01a..8c6cc4f0c 100644 --- a/app/controllers/blogs_controller.rb +++ b/app/controllers/blogs_controller.rb @@ -26,7 +26,7 @@ class BlogsController < ApplicationController @type = 2 @topics.each do |topic| - topic[:infocount] = get_praise_num(topic) + (topic.parent ? topic.parent.children.count : topic.children.count) + topic[:infocount] = get_praise_num(topic) + BlogComment.where("root_id = #{topic.id}").count if topic[:infocount] < 0 topic[:infocount] = 0 end diff --git a/app/controllers/watchers_controller.rb b/app/controllers/watchers_controller.rb index da0c5733a..6f0d96dfa 100644 --- a/app/controllers/watchers_controller.rb +++ b/app/controllers/watchers_controller.rb @@ -37,7 +37,9 @@ class WatchersController < ApplicationController @list = query.order("#{Watcher.table_name}.id desc").limit(limit).offset(@obj_pages.offset).all(); @action = 'fans' else - + if params[:target_id] + @user = User.find(params[:target_id]) + end end if params[:object_type] == 'project' @@ -78,6 +80,9 @@ class WatchersController < ApplicationController @list = query.order("#{Watcher.table_name}.id desc").limit(limit).offset(@obj_pages.offset).all(); @action = 'fans' else + if params[:target_id] + @user = User.find(params[:target_id]) + end end if params[:object_type] == 'project' @project = Project.find(params[:object_id]) diff --git a/app/views/layouts/new_base_user.html.erb b/app/views/layouts/new_base_user.html.erb index 783aade75..b27f144e9 100644 --- a/app/views/layouts/new_base_user.html.erb +++ b/app/views/layouts/new_base_user.html.erb @@ -148,7 +148,7 @@
  • 粉丝
    - <%= @user.watcher_users.count %> + <%= @user.watcher_users.count %>
  • diff --git a/app/views/users/_user_fans_item.html.erb b/app/views/users/_user_fans_item.html.erb index b3fc7905c..8614e0b61 100644 --- a/app/views/users/_user_fans_item.html.erb +++ b/app/views/users/_user_fans_item.html.erb @@ -52,4 +52,14 @@
    <% end %> -<% end %> \ No newline at end of file +
    +
    + +
    +
    +
    +<% else %> +

    <%= l(:label_no_data) %>

    +<% end %> diff --git a/app/views/users/user_fanslist.html.erb b/app/views/users/user_fanslist.html.erb index 47bdc9126..77d85565e 100644 --- a/app/views/users/user_fanslist.html.erb +++ b/app/views/users/user_fanslist.html.erb @@ -26,16 +26,7 @@ <%= render :partial => 'users/user_fans_item', :locals => {:list => @list,:target=>@user,:action_name=>@action,:page=>params[:page]} %> <%# end %> -

    <%= l(:label_no_data) %>

    -
    -
    - -
    -
    -
    diff --git a/app/views/watchers/_set_watcher.js.erb b/app/views/watchers/_set_watcher.js.erb index fee58c15c..83358b049 100644 --- a/app/views/watchers/_set_watcher.js.erb +++ b/app/views/watchers/_set_watcher.js.erb @@ -1,7 +1,9 @@ <% if( params[:object_type] == 'user') %> //点击头像下面的添加关注按钮 <% if( params[:target_id] == params[:object_id] ) %> - $("#watch_user_btn_div").html("<%= escape_javascript render(:partial => "layouts/user_watch_btn", :locals => {:target => watched.first}) %>"); + <% if @user %> + $("#watch_user_btn_div").html("<%= escape_javascript render(:partial => "layouts/user_watch_btn", :locals => {:target => watched.first}) %>"); + <% end %> $("#user_fans_number").html("<%= watched.first.watcher_users.count.to_s%>"); $(".add_cancel_watch_<%= watched.first.id %>").html("<%= escape_javascript (render :partial => 'users/watch_btn_for_picture', :locals => {:user => watched.first}) %>"); $(".fans_count_<%= watched.first.id %>").text("<%= watched.first.watcher_users.count.to_s %>"); From 3099b37f5eeae84c6bdf5163e2adea3c82fd0082 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Mon, 21 Nov 2016 12:07:14 +0800 Subject: [PATCH 06/20] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=B8=BB=E9=A1=B5?= =?UTF-8?q?=E5=85=B3=E6=B3=A8BUG=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_user_fans_item.html.erb | 114 +++++++++++------------ app/views/users/user_fanslist.html.erb | 43 +++++---- 2 files changed, 78 insertions(+), 79 deletions(-) diff --git a/app/views/users/_user_fans_item.html.erb b/app/views/users/_user_fans_item.html.erb index 8614e0b61..36d1b1b73 100644 --- a/app/views/users/_user_fans_item.html.erb +++ b/app/views/users/_user_fans_item.html.erb @@ -1,65 +1,55 @@ <% unless list.nil?%> -<% for item in list %> -
    -
    - - <%= image_tag(url_to_avatar(item), :style=>"width:64px;height:64px;",:alt=>"头像") %> - -
    -
    - <%= item.show_name %> -
    -
    - <% if item.user_extensions && !item.user_extensions.brief_introduction.nil? && !item.user_extensions.brief_introduction.empty? %> -

    个性签名:<%= item.user_extensions.brief_introduction %>

    + <% for item in list %> +
    + +
    + <%= item.show_name %> +
    +
    + <% if item.user_extensions && !item.user_extensions.brief_introduction.nil? && !item.user_extensions.brief_introduction.empty? %> +

    个性签名:<%= item.user_extensions.brief_introduction %>

    + <% end %> + + + + <% if (item.user_extensions.identity == 0 || item.user_extensions.identity == 1) && !item.user_extensions.school.nil? %> + + + <% elsif item.user_extensions.identity == 3 && !item.user_extensions.occupation.nil? && !item.user_extensions.occupation.empty? %> + + + <% elsif item.user_extensions.identity == 2 %> + + + <% end %> +
    加入时间:<%= format_date(item.created_on) %>工作单位: +
  • + <%= item.user_extensions.school.name %> +
  • +
    工作单位: +
  • + <%= item.user_extensions.occupation %> +
  • +
    工作单位: +
  • + <%= item.show_name %> +
  • +
    +
    +
    + + <% if(User.current.logged? && User.current != item )%> + <%if(item.watched_by?(User.current))%> + 取消关注 + <% else %> + 添加关注 + <% end %> <% end %> - - - - <% if (item.user_extensions.identity == 0 || item.user_extensions.identity == 1) && !item.user_extensions.school.nil? %> - - - <% elsif item.user_extensions.identity == 3 && !item.user_extensions.occupation.nil? && !item.user_extensions.occupation.empty? %> - - - <% elsif item.user_extensions.identity == 2 %> - - - <% end %> -
    加入时间:<%= format_date(item.created_on) %>工作单位: -
  • - <%= item.user_extensions.school.name %> -
  • -
    工作单位: -
  • - <%= item.user_extensions.occupation %> -
  • -
    工作单位: -
  • - <%= item.show_name %> -
  • -
    +
    -
    - - <% if(User.current.logged? && User.current != item )%> - <%if(item.watched_by?(User.current))%> - 取消关注 - <% else %> - 添加关注 - <% end %> - <% end %> -
    -
    -<% end %> -
    -
    -
      - <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => true, :flag => true, :is_new => true%> -
    -
    -
    -
    -<% else %> -

    <%= l(:label_no_data) %>

    -<% end %> + <% end %> +<% end %> \ No newline at end of file diff --git a/app/views/users/user_fanslist.html.erb b/app/views/users/user_fanslist.html.erb index 77d85565e..041dabd03 100644 --- a/app/views/users/user_fanslist.html.erb +++ b/app/views/users/user_fanslist.html.erb @@ -7,30 +7,39 @@ } -
    -
    - <% if @action == 'fans' %> +
    +
    + <% if @action == 'fans' %>

    粉丝

    共有<%=@obj_count%>名粉丝
    - <% elsif @action == 'visitor' %> + <% elsif @action == 'visitor' %>

    访客

    共有<%=@obj_count%>访客
    - <% else %> + <% else %>

    关注

    一共关注<%=@obj_count%>
    - <% end %> + <% end %> +
    +
    +
    + <%# for item in @list %> + <%= render :partial => 'users/user_fans_item', :locals => {:list => @list,:target=>@user,:action_name=>@action,:page=>params[:page]} %> + <%# end %> +
    +

    <%= l(:label_no_data) %>

    + +
    +
    +
      + <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true, :is_new => true%> +
    -
    - <%# for item in @list %> - <%= render :partial => 'users/user_fans_item', :locals => {:list => @list,:target=>@user,:action_name=>@action,:page=>params[:page]} %> - <%# end %> -
    - - - - - -
    + + + + + +
    From c40288b8c39ca307f3de3056260d96bebbbcabeb Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Mon, 21 Nov 2016 16:26:14 +0800 Subject: [PATCH 07/20] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AF=86=E7=A0=81?= =?UTF-8?q?=EF=BC=8C=E8=BE=93=E5=85=A5=E5=8E=9F=E5=AF=86=E7=A0=81=E6=97=B6?= =?UTF-8?q?=E7=9A=84=E4=B8=8B=E6=8B=89=E6=A1=86=E8=A6=81=E5=8E=BB=E6=8E=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/my/account.html.erb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/views/my/account.html.erb b/app/views/my/account.html.erb index 2a4b3b480..fd7425aab 100644 --- a/app/views/my/account.html.erb +++ b/app/views/my/account.html.erb @@ -214,7 +214,8 @@
  • 确认密码 : 
    • -
    • + +
    • 请输入8-12个字符
    • From f1ad70bb335fbf4e21695a9fe8d48fc62726b1ea Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Tue, 22 Nov 2016 08:52:19 +0800 Subject: [PATCH 08/20] =?UTF-8?q?=E5=85=B3=E6=B3=A8BUG=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E6=94=B9=E5=AF=86=E7=A0=81BUG=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/my/account.html.erb | 3 +- app/views/users/_user_fans_item.html.erb | 114 +++++++++++------------ app/views/users/user_fanslist.html.erb | 43 +++++---- 3 files changed, 80 insertions(+), 80 deletions(-) diff --git a/app/views/my/account.html.erb b/app/views/my/account.html.erb index 2a4b3b480..fd7425aab 100644 --- a/app/views/my/account.html.erb +++ b/app/views/my/account.html.erb @@ -214,7 +214,8 @@
    • 确认密码 : 
      -
    • + +
    • 请输入8-12个字符
    • diff --git a/app/views/users/_user_fans_item.html.erb b/app/views/users/_user_fans_item.html.erb index 8614e0b61..36d1b1b73 100644 --- a/app/views/users/_user_fans_item.html.erb +++ b/app/views/users/_user_fans_item.html.erb @@ -1,65 +1,55 @@ <% unless list.nil?%> -<% for item in list %> -
      - -
      - <%= item.show_name %> -
      -
      - <% if item.user_extensions && !item.user_extensions.brief_introduction.nil? && !item.user_extensions.brief_introduction.empty? %> -

      个性签名:<%= item.user_extensions.brief_introduction %>

      + <% for item in list %> +
      + +
      + <%= item.show_name %> +
      +
      + <% if item.user_extensions && !item.user_extensions.brief_introduction.nil? && !item.user_extensions.brief_introduction.empty? %> +

      个性签名:<%= item.user_extensions.brief_introduction %>

      + <% end %> + + + + <% if (item.user_extensions.identity == 0 || item.user_extensions.identity == 1) && !item.user_extensions.school.nil? %> + + + <% elsif item.user_extensions.identity == 3 && !item.user_extensions.occupation.nil? && !item.user_extensions.occupation.empty? %> + + + <% elsif item.user_extensions.identity == 2 %> + + + <% end %> +
      加入时间:<%= format_date(item.created_on) %>工作单位: +
    • + <%= item.user_extensions.school.name %> +
    • +
      工作单位: +
    • + <%= item.user_extensions.occupation %> +
    • +
      工作单位: +
    • + <%= item.show_name %> +
    • +
      +
      +
      + + <% if(User.current.logged? && User.current != item )%> + <%if(item.watched_by?(User.current))%> + 取消关注 + <% else %> + 添加关注 + <% end %> <% end %> - - - - <% if (item.user_extensions.identity == 0 || item.user_extensions.identity == 1) && !item.user_extensions.school.nil? %> - - - <% elsif item.user_extensions.identity == 3 && !item.user_extensions.occupation.nil? && !item.user_extensions.occupation.empty? %> - - - <% elsif item.user_extensions.identity == 2 %> - - - <% end %> -
      加入时间:<%= format_date(item.created_on) %>工作单位: -
    • - <%= item.user_extensions.school.name %> -
    • -
      工作单位: -
    • - <%= item.user_extensions.occupation %> -
    • -
      工作单位: -
    • - <%= item.show_name %> -
    • -
      +
      -
      - - <% if(User.current.logged? && User.current != item )%> - <%if(item.watched_by?(User.current))%> - 取消关注 - <% else %> - 添加关注 - <% end %> - <% end %> -
      -
      -<% end %> -
      -
      -
        - <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => true, :flag => true, :is_new => true%> -
      -
      -
      -
      -<% else %> -

      <%= l(:label_no_data) %>

      -<% end %> + <% end %> +<% end %> \ No newline at end of file diff --git a/app/views/users/user_fanslist.html.erb b/app/views/users/user_fanslist.html.erb index 77d85565e..041dabd03 100644 --- a/app/views/users/user_fanslist.html.erb +++ b/app/views/users/user_fanslist.html.erb @@ -7,30 +7,39 @@ } -
      -
      - <% if @action == 'fans' %> +
      +
      + <% if @action == 'fans' %>

      粉丝

      共有<%=@obj_count%>名粉丝
      - <% elsif @action == 'visitor' %> + <% elsif @action == 'visitor' %>

      访客

      共有<%=@obj_count%>访客
      - <% else %> + <% else %>

      关注

      一共关注<%=@obj_count%>
      - <% end %> + <% end %> +
      +
      +
      + <%# for item in @list %> + <%= render :partial => 'users/user_fans_item', :locals => {:list => @list,:target=>@user,:action_name=>@action,:page=>params[:page]} %> + <%# end %> +
      +

      <%= l(:label_no_data) %>

      + +
      +
      +
        + <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true, :is_new => true%> +
      -
      - <%# for item in @list %> - <%= render :partial => 'users/user_fans_item', :locals => {:list => @list,:target=>@user,:action_name=>@action,:page=>params[:page]} %> - <%# end %> -
      - - - - - -
      + + + + + +
      From 8d980b16dba84b107f6007f2714e7af814a967fb Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Tue, 22 Nov 2016 10:10:53 +0800 Subject: [PATCH 09/20] =?UTF-8?q?=E6=8D=A2=E8=A1=8C=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/projects/show.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/projects/show.html.erb b/app/views/projects/show.html.erb index f9a88baf8..3467214c9 100644 --- a/app/views/projects/show.html.erb +++ b/app/views/projects/show.html.erb @@ -1,5 +1,5 @@ -
      +
      <%= render :partial => 'projects/invite_code' %>
      <% if @project.description.blank? %> From c571d195483065c15af0aaf02d3571d12c1357b4 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Tue, 22 Nov 2016 10:16:09 +0800 Subject: [PATCH 10/20] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E7=AE=80=E4=BB=8B?= =?UTF-8?q?=E5=8D=95=E8=AF=8D=E4=B8=8D=E6=8D=A2=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/projects/show.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/projects/show.html.erb b/app/views/projects/show.html.erb index 09ed2216a..5a38e3b38 100644 --- a/app/views/projects/show.html.erb +++ b/app/views/projects/show.html.erb @@ -1,5 +1,5 @@ -
      +
      <%= render :partial => 'projects/invite_code' %>
      <% if @project.description.blank? %> From 9720f84fce12e57da1373718c1c6f0792e2b8313 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Wed, 23 Nov 2016 13:29:02 +0800 Subject: [PATCH 11/20] =?UTF-8?q?js=E7=9A=84=E8=87=AA=E5=8A=A8=E8=BD=AC?= =?UTF-8?q?=E6=8D=A2URL=E5=87=BD=E6=95=B0autoUrl=E5=8A=A0=E4=B8=8A?= =?UTF-8?q?=E4=B8=AA=E5=BC=82=E5=B8=B8=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/javascripts/application.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 3f5a739f9..ac8dfcc44 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -1706,7 +1706,14 @@ function autoUrl(id){ } return reStr ; }); - $(this).html(html); + try{ + $(this).html(html); + } + catch (e) + { + console.log(e.name + ": " + e.message); + } + } }); } @@ -1725,7 +1732,13 @@ function autoUrl(id){ } return reStr ; }); - $("#"+id).html(html); + try{ + $("#"+id).html(html); + } + catch (e) + { + console.log(e.name + ": " + e.message); + } } if(!(!!window.ActiveXObject || "ActiveXObject" in window)){ autoMedia(id); From 2dc6171b480d55edef70cf73a11e51312c242476 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Wed, 23 Nov 2016 16:40:31 +0800 Subject: [PATCH 12/20] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E5=8F=8D=E9=A6=88?= =?UTF-8?q?=E6=97=B6=E7=9A=84=E6=8F=90=E7=A4=BA=E8=AF=AD=E5=8A=A0=E5=85=A5?= =?UTF-8?q?www.trustie.net?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/wechats_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/wechats_controller.rb b/app/controllers/wechats_controller.rb index a082d72ff..654f83855 100644 --- a/app/controllers/wechats_controller.rb +++ b/app/controllers/wechats_controller.rb @@ -137,7 +137,7 @@ class WechatsController < ActionController::Base on :fallback, respond: 'fallback message' on :click, with: 'FEEDBACK' do |request, key| - request.reply.text "如有问题反馈,请您:\n1、直接切换至输入框,发微信给我们。\n2、加入QQ群:373967360,直接互动。\n\n如您有合作事宜洽谈,请联系:\n王林春 老师\n手机:13467631747\nQQ:494496321" + request.reply.text "如有问题反馈,请您:\n1、直接切换至输入框,发微信给我们。\n2、加入QQ群:373967360,直接互动。\n3、登录网站:www.trustie.net,给我们留言。\n\n如您有合作事宜洽谈,请联系:\n王林春 老师\n手机:13467631747\nQQ:494496321" end on :click, with: 'MY_NEWS' do |request, key| From 67a9d04a642332f58fdc50f6a68acb0318dd14ed Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 23 Nov 2016 17:14:49 +0800 Subject: [PATCH 13/20] =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=BA=93=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E5=88=A0=E9=99=A4=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/projects_controller.rb | 27 ++++++++++++++++++- app/helpers/projects_helper.rb | 10 +++++++ .../_reposistory_destory_pop.html.erb | 22 +++++++++++++++ app/views/projects/destroy_repository.js.erb | 6 +++++ .../settings/_new_repositories.html.erb | 14 +++++++--- config/routes.rb | 1 + public/stylesheets/css/common.css | 1 + 7 files changed, 77 insertions(+), 4 deletions(-) create mode 100644 app/views/projects/_reposistory_destory_pop.html.erb create mode 100644 app/views/projects/destroy_repository.js.erb diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 2bdaddb25..304ab8e02 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -739,7 +739,7 @@ class ProjectsController < ApplicationController rescue Exception => e puts e end - # 删除Trustie班额本库记录 + # 删除Trustie版本库记录 repoisitory = Repository.where(:project_id => @project.id, :type => GITLABTYPE).first repoisitory.delete @project.update_column(:gpid, nil) @@ -799,6 +799,31 @@ class ProjectsController < ApplicationController @project = nil end + REP_TYPE = "Repository::Gitlab" + # Delete @project's repository + def destroy_repository + if is_project_manager?(User.current.id, @project.id) + @gitlab_repository = Repository.where(:project_id => @project, :type => REP_TYPE).first + @is_true = params[:is_true] + if @is_true + begin + g = Gitlab.client + @gitlab_repository.destroy + @gitlab_repository = nil + @project.update_attribute(:gpid, nil) + scm = params[:repository_scm] || (Redmine::Scm::Base.all & Setting.enabled_scm).first + @repository = Repository.factory(scm) + @repository.is_default = @project.repository.nil? + g.delete_project(@project.gpid) + rescue Exception => e + puts e + end + end + else + return render_403 + end + end + def show_projects_score respond_to do |format| format.html { render :layout => "base_projects"} diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index 3dff9c414..fb757665f 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -302,6 +302,16 @@ module ProjectsHelper type << option2 end + # 判断用户是否为项目管理员 + def is_project_manager?(user_id, project_id) + @result = false + mem = Member.where("user_id = ? and project_id = ?",user_id, project_id) + unless mem.blank? + @result = mem.first.roles.to_s.include?("Manager") ? true : false + end + return @result + end + # 用来判断用户是否是项目的管理员 # added by william def is_manager?(user_id,project_id) diff --git a/app/views/projects/_reposistory_destory_pop.html.erb b/app/views/projects/_reposistory_destory_pop.html.erb new file mode 100644 index 000000000..1f8dd06f2 --- /dev/null +++ b/app/views/projects/_reposistory_destory_pop.html.erb @@ -0,0 +1,22 @@ +
      +
      +

      提示

      + +
      +
      +
      +
        +
      • + 删除操作会彻底删除版本库及源码,一旦删除不能恢复
        + 你确定删除吗? +
      • +
      • + + 取  消 + + <%= link_to "确 定", destroy_repository_project_path(@project, :is_true => true), :remote => true, :class => "sy_btn_blue fl ml20", :onclick => "hideModal();" %> +
        +
      • +
      +
      +
      \ No newline at end of file diff --git a/app/views/projects/destroy_repository.js.erb b/app/views/projects/destroy_repository.js.erb new file mode 100644 index 000000000..3bc1d727b --- /dev/null +++ b/app/views/projects/destroy_repository.js.erb @@ -0,0 +1,6 @@ +<% if @is_true %> +$("#pro_st_tbc_06").html('<%= escape_javascript( render :partial => 'projects/settings/new_repositories') %>'); +<% else %> +var htmlvalue = "<%= escape_javascript(render :partial => 'projects/reposistory_destory_pop') %>"; +pop_box_new(htmlvalue,460,316); +<% end %> diff --git a/app/views/projects/settings/_new_repositories.html.erb b/app/views/projects/settings/_new_repositories.html.erb index a531e904a..1fb4f7b7a 100644 --- a/app/views/projects/settings/_new_repositories.html.erb +++ b/app/views/projects/settings/_new_repositories.html.erb @@ -14,7 +14,7 @@ - <%= f.text_field :identifier, :disabled =>@repository.nil? || @repository.identifier_frozen? ? true:false, :label=>"", :no_label => true, :class => "w650 fl", :style => "height: 28px;", :id => "project_setting_repository" %> + <%= f.text_field :identifier, :disabled => @repository.nil? || @repository.identifier_frozen? ? true:false, :label=>"", :no_label => true, :class => "w650 fl", :style => "height: 28px;", :id => "project_setting_repository" %>
    • @@ -35,14 +35,22 @@ 版本库名 管理系统 - 库路径 + 库路径 +   <%= @gitlab_repository.identifier %> Git - <%=h @repos_url %> + <%=h @repos_url %> + + <% if is_project_manager?(User.current.id, @project.id) %> + <%= link_to "删除", destroy_repository_project_path(@project), :class => "c_blue", :remote => true %> + <% else %> + <%= "删除" %> + <% end %> + diff --git a/config/routes.rb b/config/routes.rb index 3848c4b46..db1ad27e3 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -783,6 +783,7 @@ RedmineApp::Application.routes.draw do get 'file', :action => 'file', :as => 'file' get 'statistics', :action => 'statistics', :as => 'statistics' get 'repository_tree_changes', :action => 'repository_tree_changes', :as => 'repository_tree_changes' + get 'destroy_repository', :action => 'destroy_repository', :as => 'destroy_repository' get 'feedback', :action => 'feedback', :as => 'project_feedback' get 'watcherlist', :action=> 'watcherlist' diff --git a/public/stylesheets/css/common.css b/public/stylesheets/css/common.css index bbc85f3ce..fad7e766a 100644 --- a/public/stylesheets/css/common.css +++ b/public/stylesheets/css/common.css @@ -233,6 +233,7 @@ h4{ font-size:14px;}/*color:#3b3b3b;*/ .w20{ width:20px;} .w40{width: 40px;} .w45{ width: 45px;} +.w46{ width: 46px;} .w48{width:48px;} .w50 {width:50px;} .w56 {width:56px;} From 7713fba2f8627edb00d1f5e09a55c0936fb4347b Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Thu, 24 Nov 2016 14:30:24 +0800 Subject: [PATCH 14/20] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E7=95=99=E8=A8=80?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 7 ++++--- app/models/journals_for_message.rb | 5 +++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 56b536d30..049789115 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1369,9 +1369,10 @@ class UsersController < ApplicationController @jour = jours.limit(10).offset(@page * 10) @type = params[:type] if User.current == @user - jours.update_all(:is_readed => true, :status => false) - jours.each do |journal| - fetch_user_leaveWord_reply(journal).update_all(:is_readed => true, :status => false) + @jour.update_all(:is_readed => true, :status => false) + @jour.each do |journal| + # fetch_user_leaveWord_reply(journal).update_all(:is_readed => true, :status => false) + journal.delay.set_children_readed_delay end end @state = false diff --git a/app/models/journals_for_message.rb b/app/models/journals_for_message.rb index 4a9601d07..aa83c2210 100644 --- a/app/models/journals_for_message.rb +++ b/app/models/journals_for_message.rb @@ -344,4 +344,9 @@ class JournalsForMessage < ActiveRecord::Base def content_detail self.notes end + + def set_children_readed_delay + # fetch_user_leaveWord_reply(self).update_all(:is_readed => true, :status => false) + end + end From 45bbd7b293eb59601e41798f68dd1de06657bfd5 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 24 Nov 2016 14:47:02 +0800 Subject: [PATCH 15/20] =?UTF-8?q?pull=20request=20=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E7=9A=84=E6=97=B6=E5=80=99JS=E6=8E=A7?= =?UTF-8?q?=E5=88=B6=E5=88=86=E6=94=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/pull_requests_controller.rb | 2 +- app/views/pull_requests/_form.html.erb | 6 ++-- public/javascripts/project.js | 34 ++++++++++++++------- 3 files changed, 27 insertions(+), 15 deletions(-) diff --git a/app/controllers/pull_requests_controller.rb b/app/controllers/pull_requests_controller.rb index ec9f98ccf..6bfe72c21 100644 --- a/app/controllers/pull_requests_controller.rb +++ b/app/controllers/pull_requests_controller.rb @@ -92,7 +92,7 @@ class PullRequestsController < ApplicationController if compare_pull_request(source_branch, target_project_id, target_branch) # 如果传送了目标项目ID即向fork源项目发送请求 # if params[:forked_project_id] && params[:source_project] == "forked_project_name" - if params[:target_project_id] + if params[:target_project_id].to_i != @project.id 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) @fork_project_name = Project.find(params[:target_project_id]).try(:name) diff --git a/app/views/pull_requests/_form.html.erb b/app/views/pull_requests/_form.html.erb index 43b3bf4d9..d76c3e8a8 100644 --- a/app/views/pull_requests/_form.html.erb +++ b/app/views/pull_requests/_form.html.erb @@ -12,9 +12,9 @@ <% if @forked_project.nil? %> <%= select_tag :branch, options_for_select(@source_rev), :id => "pull_request_branch", :name => "target_branch", :value => "target_branch",:class => "fl PullReques_minselect ml5" %> <% else %> - + +