From 5d4eec08a19cb0f33eaa4d37490e30a00c496ba0 Mon Sep 17 00:00:00 2001 From: Sven Strickroth Date: Wed, 5 Aug 2015 21:26:49 +0200 Subject: Apply markdown filter for project descriptions on explore view Signed-off-by: Sven Strickroth --- app/views/explore/projects/_project.html.haml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/views/explore/projects/_project.html.haml b/app/views/explore/projects/_project.html.haml index d769c91545d..1e8a89e3661 100644 --- a/app/views/explore/projects/_project.html.haml +++ b/app/views/explore/projects/_project.html.haml @@ -9,8 +9,8 @@ .project-info - if project.description.present? - %p.project-description.str-truncated - = project.description + .project-description.str-truncated + = markdown(project.description, pipeline: :description) .repo-info - unless project.empty_repo? -- cgit v1.2.1 From 70f5291808469a808eb2bee70e9e97acc7716bb6 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Thu, 6 Aug 2015 00:20:41 -0700 Subject: Always add current user to autocomplete controller to support filter by "Me" Partial fix #2202 --- app/controllers/autocomplete_controller.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'app') diff --git a/app/controllers/autocomplete_controller.rb b/app/controllers/autocomplete_controller.rb index 52e9c58b47c..5c3ca8e23c9 100644 --- a/app/controllers/autocomplete_controller.rb +++ b/app/controllers/autocomplete_controller.rb @@ -33,6 +33,8 @@ class AutocompleteController < ApplicationController @users = @users.search(params[:search]) if params[:search].present? @users = @users.active @users = @users.page(params[:page]).per(PER_PAGE) + # Always include current user if available to filter by "Me" + @users = User.find(@users.pluck(:id) + [current_user.id]).uniq if current_user render json: @users, only: [:name, :username, :id], methods: [:avatar_url] end -- cgit v1.2.1 From d044c142907a274e5e91a93a8377c6879af80172 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 6 Aug 2015 12:31:24 +0200 Subject: Ensure old namespace directory exists before moving it Signed-off-by: Dmitriy Zaporozhets --- app/models/namespace.rb | 3 +++ 1 file changed, 3 insertions(+) (limited to 'app') diff --git a/app/models/namespace.rb b/app/models/namespace.rb index 815672a1bf7..161a16ca61c 100644 --- a/app/models/namespace.rb +++ b/app/models/namespace.rb @@ -114,6 +114,9 @@ class Namespace < ActiveRecord::Base end def move_dir + # Ensure old directory exists before moving it + gitlab_shell.add_namespace(path_was) + if gitlab_shell.mv_namespace(path_was, path) # If repositories moved successfully we need to # send update instructions to users. -- cgit v1.2.1 From cba7f20dc8614d12e3eeda6e14f454aeb22b9b54 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 6 Aug 2015 14:03:27 +0200 Subject: Allow users to send abuse reports Signed-off-by: Dmitriy Zaporozhets --- app/controllers/abuse_reports_controller.rb | 23 +++++++++++++++++++++++ app/models/abuse_report.rb | 9 +++++++++ app/views/abuse_reports/new.html.haml | 29 +++++++++++++++++++++++++++++ app/views/users/show.html.haml | 10 ++++++++++ 4 files changed, 71 insertions(+) create mode 100644 app/controllers/abuse_reports_controller.rb create mode 100644 app/models/abuse_report.rb create mode 100644 app/views/abuse_reports/new.html.haml (limited to 'app') diff --git a/app/controllers/abuse_reports_controller.rb b/app/controllers/abuse_reports_controller.rb new file mode 100644 index 00000000000..757be5ef727 --- /dev/null +++ b/app/controllers/abuse_reports_controller.rb @@ -0,0 +1,23 @@ +class AbuseReportsController < ApplicationController + def new + @abuse_report = AbuseReport.new + @abuse_report.user_id = params[:user_id] + end + + def create + @abuse_report = AbuseReport.new(report_params) + @abuse_report.reporter = current_user + + if @abuse_report.save + redirect_to root_path, notice: 'Thank you for report. GitLab administrator will be able to see it' + else + render :new + end + end + + private + + def report_params + params.require(:abuse_report).permit(:user_id, :message) + end +end diff --git a/app/models/abuse_report.rb b/app/models/abuse_report.rb new file mode 100644 index 00000000000..c8c39db11bc --- /dev/null +++ b/app/models/abuse_report.rb @@ -0,0 +1,9 @@ +class AbuseReport < ActiveRecord::Base + belongs_to :reporter, class_name: "User" + belongs_to :user + + validates :reporter, presence: true + validates :user, presence: true + validates :message, presence: true + validates :user_id, uniqueness: { scope: :reporter_id } +end diff --git a/app/views/abuse_reports/new.html.haml b/app/views/abuse_reports/new.html.haml new file mode 100644 index 00000000000..736456b67ba --- /dev/null +++ b/app/views/abuse_reports/new.html.haml @@ -0,0 +1,29 @@ +- page_title "Report abuse" +%h3.page-title Report abuse +%p Please use this form if user makes spam or inappropriate content +%hr += form_for @abuse_report, html: { class: 'form-horizontal'} do |f| + = f.hidden_field :user_id + - if @abuse_report.errors.any? + .alert.alert-danger + - @abuse_report.errors.full_messages.each do |msg| + %p= msg + .form-group + = f.label :user_id, class: 'control-label' + .col-sm-10 + = users_select_tag("abuse_reports[user_id]", placeholder: 'Select user to report abuse', + class: 'custom-form-control js-select2', selected: @abuse_report.user_id, scope: :all) + .form-group + = f.label :message, class: 'control-label' + .col-sm-10 + = f.text_area :message, class: "form-control", rows: 2, required: true + .help-block + Explain the problem with this account. + %br + If user sends spam please provide a link to spam issue or comment + + .form-actions + = f.submit "Send report", class: "btn btn-create" + +:coffeescript + new UsersSelect() diff --git a/app/views/users/show.html.haml b/app/views/users/show.html.haml index 43d847831d6..64b7f25ad37 100644 --- a/app/views/users/show.html.haml +++ b/app/views/users/show.html.haml @@ -18,6 +18,16 @@ = link_to profile_path, class: 'btn btn-sm' do %i.fa.fa-pencil-square-o Edit Profile settings + - elsif current_user + .pull-right + %span.dropdown + %a.light.dropdown-toggle.btn.btn-sm{href: '#', "data-toggle" => "dropdown"} + = icon('exclamation-circle') + %ul.dropdown-menu.dropdown-menu-right + %li + = link_to new_abuse_report_path(user_id: @user.id) do + Report abuse + .username @#{@user.username} .description -- cgit v1.2.1 From 7a9d432cdb84936bf8dd1359d363f42e6ebca542 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 6 Aug 2015 15:08:22 +0200 Subject: Add abuse report management in admin area Signed-off-by: Dmitriy Zaporozhets --- app/controllers/admin/abuse_reports_controller.rb | 11 +++++++++++ .../admin/abuse_reports/_abuse_report.html.haml | 23 ++++++++++++++++++++++ app/views/admin/abuse_reports/index.html.haml | 16 +++++++++++++++ app/views/layouts/nav/_admin.html.haml | 7 +++++++ 4 files changed, 57 insertions(+) create mode 100644 app/controllers/admin/abuse_reports_controller.rb create mode 100644 app/views/admin/abuse_reports/_abuse_report.html.haml create mode 100644 app/views/admin/abuse_reports/index.html.haml (limited to 'app') diff --git a/app/controllers/admin/abuse_reports_controller.rb b/app/controllers/admin/abuse_reports_controller.rb new file mode 100644 index 00000000000..34f37bca4ad --- /dev/null +++ b/app/controllers/admin/abuse_reports_controller.rb @@ -0,0 +1,11 @@ +class Admin::AbuseReportsController < Admin::ApplicationController + def index + @abuse_reports = AbuseReport.order(id: :desc).page(params[:page]) + end + + def destroy + AbuseReport.find(params[:id]).destroy + + redirect_to admin_abuse_reports_path, notice: 'Report was removed' + end +end diff --git a/app/views/admin/abuse_reports/_abuse_report.html.haml b/app/views/admin/abuse_reports/_abuse_report.html.haml new file mode 100644 index 00000000000..4449721ae38 --- /dev/null +++ b/app/views/admin/abuse_reports/_abuse_report.html.haml @@ -0,0 +1,23 @@ +- reporter = abuse_report.reporter +- user = abuse_report.user +%tr + %td + - if reporter + = link_to reporter.name, [:admin, reporter] + - else + (removed) + %td + = abuse_report.created_at.to_s(:short) + %td + = abuse_report.message + %td + - if user + = link_to user.name, [:admin, user] + - else + (removed) + %td + - if user + = link_to 'Block', block_admin_user_path(user), data: {confirm: 'USER WILL BE BLOCKED! Are you sure?'}, method: :put, class: "btn btn-xs btn-warning" + = link_to 'Remove user', [:admin, user], data: { confirm: "USER #{user.name} WILL BE REMOVED! Are you sure?" }, method: :delete, class: "btn btn-xs btn-remove" + %td + = link_to 'Remove report', [:admin, abuse_report], method: :delete, class: "btn btn-xs btn-close" diff --git a/app/views/admin/abuse_reports/index.html.haml b/app/views/admin/abuse_reports/index.html.haml new file mode 100644 index 00000000000..a3c900e16aa --- /dev/null +++ b/app/views/admin/abuse_reports/index.html.haml @@ -0,0 +1,16 @@ +- page_title "Abuse Reports" +%h3.page-title Abuse Reports +%hr +- if @abuse_reports.present? + %table.table + %thead + %tr + %th Reported by + %th Reported at + %th Message + %th User + %th + %th + = render @abuse_reports +- else + %h4 There are no abuse reports diff --git a/app/views/layouts/nav/_admin.html.haml b/app/views/layouts/nav/_admin.html.haml index a3191593dae..2065be3828a 100644 --- a/app/views/layouts/nav/_admin.html.haml +++ b/app/views/layouts/nav/_admin.html.haml @@ -57,6 +57,13 @@ %span Service Templates + = nav_link(controller: :abuse_reports) do + = link_to admin_abuse_reports_path, title: "Abuse reports" do + = icon('exclamation-circle fw') + %span + Abuse Reports + %span.count= AbuseReport.count(:all) + = nav_link(controller: :application_settings, html_options: { class: 'separate-item'}) do = link_to admin_application_settings_path, title: 'Settings', data: {placement: 'right'} do = icon('cogs fw') -- cgit v1.2.1 From e2b4f13b9b61795fa71cd157a611e132fc9094da Mon Sep 17 00:00:00 2001 From: Douwe Maan Date: Thu, 6 Aug 2015 15:10:51 +0200 Subject: Add project name to project head --- app/assets/stylesheets/generic/mobile.scss | 4 ++++ app/assets/stylesheets/pages/projects.scss | 8 +++++++- app/views/projects/_home_panel.html.haml | 1 + 3 files changed, 12 insertions(+), 1 deletion(-) (limited to 'app') diff --git a/app/assets/stylesheets/generic/mobile.scss b/app/assets/stylesheets/generic/mobile.scss index 24c828e0d97..bb7b9356c70 100644 --- a/app/assets/stylesheets/generic/mobile.scss +++ b/app/assets/stylesheets/generic/mobile.scss @@ -48,6 +48,10 @@ display: block; } + .project-home-desc { + font-size: 21px; + } + .project-repo-buttons, .git-clone-holder { display: none; diff --git a/app/assets/stylesheets/pages/projects.scss b/app/assets/stylesheets/pages/projects.scss index 029b167c38e..29d3dbc25eb 100644 --- a/app/assets/stylesheets/pages/projects.scss +++ b/app/assets/stylesheets/pages/projects.scss @@ -30,7 +30,13 @@ } } - .lead { + .project-home-desc { + h1 { + margin: 0; + margin-bottom: 10px; + font-size: 26px; + } + p { display: inline; } diff --git a/app/views/projects/_home_panel.html.haml b/app/views/projects/_home_panel.html.haml index 159ce1ecf3f..71e92970305 100644 --- a/app/views/projects/_home_panel.html.haml +++ b/app/views/projects/_home_panel.html.haml @@ -3,6 +3,7 @@ .project-identicon-holder = project_icon(@project, alt: '', class: 'project-avatar avatar s90') .project-home-desc.lead + %h1= @project.name - if @project.description.present? = markdown(@project.description, pipeline: :description) -- cgit v1.2.1 From 4ba26988101b502742a17cd47cc5634c28de2d03 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 6 Aug 2015 15:13:47 +0200 Subject: Remove selectbox from abuse form. Added pagination in admin area Signed-off-by: Dmitriy Zaporozhets --- app/views/abuse_reports/new.html.haml | 7 ++----- app/views/admin/abuse_reports/index.html.haml | 1 + 2 files changed, 3 insertions(+), 5 deletions(-) (limited to 'app') diff --git a/app/views/abuse_reports/new.html.haml b/app/views/abuse_reports/new.html.haml index 736456b67ba..26a569222b4 100644 --- a/app/views/abuse_reports/new.html.haml +++ b/app/views/abuse_reports/new.html.haml @@ -11,8 +11,8 @@ .form-group = f.label :user_id, class: 'control-label' .col-sm-10 - = users_select_tag("abuse_reports[user_id]", placeholder: 'Select user to report abuse', - class: 'custom-form-control js-select2', selected: @abuse_report.user_id, scope: :all) + - name = "#{@abuse_report.user.name} (@#{@abuse_report.user.username})" + = text_field_tag :user_name, name, class: "form-control", readonly: true .form-group = f.label :message, class: 'control-label' .col-sm-10 @@ -24,6 +24,3 @@ .form-actions = f.submit "Send report", class: "btn btn-create" - -:coffeescript - new UsersSelect() diff --git a/app/views/admin/abuse_reports/index.html.haml b/app/views/admin/abuse_reports/index.html.haml index a3c900e16aa..4a25848f156 100644 --- a/app/views/admin/abuse_reports/index.html.haml +++ b/app/views/admin/abuse_reports/index.html.haml @@ -12,5 +12,6 @@ %th %th = render @abuse_reports + = paginate @abuse_reports - else %h4 There are no abuse reports -- cgit v1.2.1 From ed7a8c9221fe544afb666e2b10672c759c821507 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 6 Aug 2015 15:15:17 +0200 Subject: Improve wording in abuse report form Signed-off-by: Dmitriy Zaporozhets --- app/controllers/abuse_reports_controller.rb | 3 ++- app/views/abuse_reports/new.html.haml | 6 ++---- 2 files changed, 4 insertions(+), 5 deletions(-) (limited to 'app') diff --git a/app/controllers/abuse_reports_controller.rb b/app/controllers/abuse_reports_controller.rb index 757be5ef727..65dbd5ef551 100644 --- a/app/controllers/abuse_reports_controller.rb +++ b/app/controllers/abuse_reports_controller.rb @@ -9,7 +9,8 @@ class AbuseReportsController < ApplicationController @abuse_report.reporter = current_user if @abuse_report.save - redirect_to root_path, notice: 'Thank you for report. GitLab administrator will be able to see it' + message = "Thank you for your report. A GitLab administrator will look into it shortly." + redirect_to root_path, notice: message else render :new end diff --git a/app/views/abuse_reports/new.html.haml b/app/views/abuse_reports/new.html.haml index 26a569222b4..a3b34345a3c 100644 --- a/app/views/abuse_reports/new.html.haml +++ b/app/views/abuse_reports/new.html.haml @@ -1,6 +1,6 @@ - page_title "Report abuse" %h3.page-title Report abuse -%p Please use this form if user makes spam or inappropriate content +%p Please use this form to report users who create spam issues or comments or who otherwise behave inappropriately. %hr = form_for @abuse_report, html: { class: 'form-horizontal'} do |f| = f.hidden_field :user_id @@ -18,9 +18,7 @@ .col-sm-10 = f.text_area :message, class: "form-control", rows: 2, required: true .help-block - Explain the problem with this account. - %br - If user sends spam please provide a link to spam issue or comment + Explain the problem with this user. If appropriate, provide a link to the relevant issue or comment. .form-actions = f.submit "Send report", class: "btn btn-create" -- cgit v1.2.1 From ab6aa8a48bbee2b62a2ddc0a2a7807109d814f0a Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 6 Aug 2015 17:22:45 +0200 Subject: Split merge conflict messages on 2 lines Signed-off-by: Dmitriy Zaporozhets --- app/views/projects/merge_requests/widget/open/_conflicts.html.haml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'app') diff --git a/app/views/projects/merge_requests/widget/open/_conflicts.html.haml b/app/views/projects/merge_requests/widget/open/_conflicts.html.haml index d1db5fec43a..7dc3b4eb2cc 100644 --- a/app/views/projects/merge_requests/widget/open/_conflicts.html.haml +++ b/app/views/projects/merge_requests/widget/open/_conflicts.html.haml @@ -1,7 +1,8 @@ - if @merge_request.can_be_merged_by?(current_user) %h4 This merge request contains merge conflicts that must be resolved. - You can try it manually on the + %p + You can merge it manually using the %strong = link_to "command line", "#modal_merge_info", class: "how_to_merge_link vlink", title: "How To Merge", "data-toggle" => "modal" - else -- cgit v1.2.1 From 7d2259b36f92a589c58634f56dddca6cd7037b1c Mon Sep 17 00:00:00 2001 From: Gert Goet Date: Thu, 6 Aug 2015 21:06:14 +0200 Subject: Diff colors on MR Discussion like on Changes-tab Fixes #2216 --- app/views/projects/notes/discussions/_diff.html.haml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'app') diff --git a/app/views/projects/notes/discussions/_diff.html.haml b/app/views/projects/notes/discussions/_diff.html.haml index 711aa39101b..0301445b5b2 100644 --- a/app/views/projects/notes/discussions/_diff.html.haml +++ b/app/views/projects/notes/discussions/_diff.html.haml @@ -12,18 +12,19 @@ .diff-content %table - note.truncated_diff_lines.each do |line| + - type = line.type - line_code = generate_line_code(note.file_path, line) - %tr.line_holder{ id: line_code } - - if line.type == "match" + %tr.line_holder{ id: line_code, class: "#{type}" } + - if type == "match" %td.old_line= "..." %td.new_line= "..." %td.line_content.matched= line.text - else - %td.old_line{class: line.type == "new" ? "new" : "old"} - = raw(line.type == "new" ? " " : line.old_pos) - %td.new_line{class: line.type == "new" ? "new" : "old"} - = raw(line.type == "old" ? " " : line.new_pos) - %td.line_content{class: "noteable_line #{line.type} #{line_code}", "line_code" => line_code}= raw diff_line_content(line.text) + %td.old_line + = raw(type == "new" ? " " : line.old_pos) + %td.new_line + = raw(type == "old" ? " " : line.new_pos) + %td.line_content{class: "noteable_line #{type} #{line_code}", "line_code" => line_code}= raw diff_line_content(line.text) - if line_code == note.line_code = render "projects/notes/diff_notes_with_reply", notes: discussion_notes -- cgit v1.2.1