From 20e5ad626bd98b1c062d103279e82fdd52768403 Mon Sep 17 00:00:00 2001 From: Al Tobey Date: Thu, 5 Jul 2012 15:25:53 -0700 Subject: [PATCH 01/15] The gitlab.pub file probably shouldn't be world readable, but let's start with just making it read-only and not executable. --- doc/installation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/installation.md b/doc/installation.md index f15eff88fc5..d5cae19028a 100644 --- a/doc/installation.md +++ b/doc/installation.md @@ -110,7 +110,7 @@ Setup: sudo -u git sh -c 'echo -e "PATH=\$PATH:/home/git/bin\nexport PATH" >> /home/git/.profile' sudo -u git -H sh -c "PATH=/home/git/bin:$PATH; /home/git/gitolite/src/gl-system-install" sudo cp /home/gitlab/.ssh/id_rsa.pub /home/git/gitlab.pub - sudo chmod 777 /home/git/gitlab.pub + sudo chmod 0444 /home/git/gitlab.pub sudo -u git -H sed -i 's/0077/0007/g' /home/git/share/gitolite/conf/example.gitolite.rc sudo -u git -H sh -c "PATH=/home/git/bin:$PATH; gl-setup -q /home/git/gitlab.pub" -- GitLab From 6c8d2259bab966440a53a4f8c9e5eb4f6b2ba249 Mon Sep 17 00:00:00 2001 From: rjmooney Date: Fri, 13 Jul 2012 10:26:52 -0700 Subject: [PATCH 02/15] Clarify the nginx configuration. --- doc/installation.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/doc/installation.md b/doc/installation.md index d5cae19028a..29a688bd61a 100644 --- a/doc/installation.md +++ b/doc/installation.md @@ -216,15 +216,15 @@ Application can be started with next command: sudo -u gitlab cp config/unicorn.rb.orig config/unicorn.rb sudo -u gitlab bundle exec unicorn_rails -c config/unicorn.rb -E production -D -Edit /etc/nginx/nginx.conf. Add in **http** section: +Edit /etc/nginx/nginx.conf. In the *http* section add: upstream gitlab { server unix:/home/gitlab/gitlab/tmp/sockets/gitlab.socket; } server { - listen YOUR_SERVER_IP:80; - server_name gitlab.YOUR_DOMAIN.com; + listen YOUR_SERVER_IP:80; # e.g., listen 192.168.1.1:80; + server_name YOUR_SERVER_FQDN; # e.g., server_name source.example.com; root /home/gitlab/gitlab/public; # individual nginx logs for this gitlab vhost @@ -232,26 +232,26 @@ Edit /etc/nginx/nginx.conf. Add in **http** section: error_log /var/log/nginx/gitlab_error.log; location / { - # serve static files from defined root folder;. - # @gitlab is a named location for the upstream fallback, see below - try_files $uri $uri/index.html $uri.html @gitlab; + # serve static files from defined root folder;. + # @gitlab is a named location for the upstream fallback, see below + try_files $uri $uri/index.html $uri.html @gitlab; } # if a file, which is not found in the root folder is requested, # then the proxy pass the request to the upsteam (gitlab unicorn) location @gitlab { proxy_redirect off; + # you need to change this to "https", if you set "ssl" directive to "on" proxy_set_header X-FORWARDED_PROTO http; - proxy_set_header Host gitlab.YOUR_SUBDOMAIN.com:80; + proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_pass http://gitlab; } - } -gitlab.YOUR_DOMAIN.com - change to your domain. +Change **YOUR_SERVER_IP** and **YOUR_SERVER_FQDN** to the IP address and fully-qualified domain name of the host serving GitLab. Restart nginx: -- GitLab From bf692c49133747d20089c3282525b52e0a2a523a Mon Sep 17 00:00:00 2001 From: Pavel Savchenko Date: Sat, 14 Jul 2012 10:09:26 +0300 Subject: [PATCH 03/15] Add step to make sure tmp directory exists in /home/gitlab/gitlab/ (since the step Setup DB fails if it doesn't. see issue #1038 for more detials. --- doc/installation.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/installation.md b/doc/installation.md index 29a688bd61a..a6d329e86d7 100644 --- a/doc/installation.md +++ b/doc/installation.md @@ -139,6 +139,8 @@ Permissions: cd /home/gitlab sudo -H -u gitlab git clone -b stable git://github.com/gitlabhq/gitlabhq.git gitlab cd gitlab + + sudo -u gitlab mkdir tmp # Rename config files sudo -u gitlab cp config/gitlab.yml.example config/gitlab.yml -- GitLab From 9722f57f6c326a1746a6f63122ada9238633f447 Mon Sep 17 00:00:00 2001 From: Hans Fase Date: Sun, 15 Jul 2012 17:17:46 -0300 Subject: [PATCH 04/15] libreadline-gplv2-dev >> libreadline6-dev --- doc/installation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/installation.md b/doc/installation.md index a6d329e86d7..3dfedfe10ad 100644 --- a/doc/installation.md +++ b/doc/installation.md @@ -60,7 +60,7 @@ Also read the [Read this before you submit an issue](https://github.com/gitlabhq sudo apt-get update sudo apt-get upgrade - sudo apt-get install -y wget curl gcc checkinstall libxml2-dev libxslt-dev sqlite3 libsqlite3-dev libcurl4-openssl-dev libreadline-gplv2-dev libc6-dev libssl-dev libmysql++-dev make build-essential zlib1g-dev libicu-dev redis-server openssh-server git-core python-dev python-pip libyaml-dev sendmail + sudo apt-get install -y wget curl gcc checkinstall libxml2-dev libxslt-dev sqlite3 libsqlite3-dev libcurl4-openssl-dev libreadline6-dev libc6-dev libssl-dev libmysql++-dev make build-essential zlib1g-dev libicu-dev redis-server openssh-server git-core python-dev python-pip libyaml-dev sendmail # If you want to use MySQL: sudo apt-get install -y mysql-server mysql-client libmysqlclient-dev -- GitLab From ae9d5185ddf510501f8a40d967fc30db53093d7a Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Mon, 16 Jul 2012 08:03:10 +0300 Subject: [PATCH 05/15] Admin logs improved. Commits list box styled --- app/assets/stylesheets/gitlab_bootstrap.scss | 47 +++++++++++++++---- app/views/admin/logs/show.html.haml | 15 +++--- app/views/commits/_commits.html.haml | 4 +- app/views/commits/_head.html.haml | 4 +- app/views/commits/compare.html.haml | 2 +- .../merge_requests/show/_commits.html.haml | 4 +- lib/gitlab/logger.rb | 2 +- 7 files changed, 58 insertions(+), 20 deletions(-) diff --git a/app/assets/stylesheets/gitlab_bootstrap.scss b/app/assets/stylesheets/gitlab_bootstrap.scss index e2d639065ed..8197590f5a2 100644 --- a/app/assets/stylesheets/gitlab_bootstrap.scss +++ b/app/assets/stylesheets/gitlab_bootstrap.scss @@ -202,6 +202,10 @@ a:focus { color:$style_color; } +.nav-tabs > .active > a { + font-weight:bold; +} + /** COLORS **/ .cgray { color:gray; } .cred { color:#D12F19; } @@ -443,6 +447,13 @@ form { background-image: -moz-linear-gradient(#eee 6.6%, #dfdfdf); background-image: -o-linear-gradient(#eee 6.6%, #dfdfdf); + &.small { + line-height: 28px; + font-size: 14px; + line-height:28px; + text-shadow: 0 1px 1px white; + } + form { padding:9px 0; margin:0px; @@ -628,13 +639,6 @@ h3.page_title { line-height: 28px; } -pre.logs { - .log { - font-size:12px; - line-height:18px; - } -} - /** * File content holder * @@ -676,10 +680,10 @@ pre.logs { } .file_content { background:#fff; - color:#514721; font-size: 11px; &.wiki { + font-size: 13px; code { padding:0 4px; } @@ -730,6 +734,33 @@ pre.logs { } } + &.logs { + background:#eee; + max-height: 700px; + overflow-y: auto; + + ol { + margin-left:40px; + padding: 10px 0; + border-left: 1px solid #CCC; + margin-bottom:0; + background: white; + li { + color:#888; + p { + margin:0; + color:#333; + line-height:24px; + padding-left: 10px; + } + + &:hover { + background:$hover; + } + } + } + } + /** * Code file */ diff --git a/app/views/admin/logs/show.html.haml b/app/views/admin/logs/show.html.haml index 7963e18adcd..800d3bb288f 100644 --- a/app/views/admin/logs/show.html.haml +++ b/app/views/admin/logs/show.html.haml @@ -1,6 +1,9 @@ -%h4 - %i.icon-file - githost.log -%pre.logs - - Gitlab::Logger.read_latest.each do |line| - %span.log= line +.file_holder#README + .file_title + %i.icon-file + githost.log + .file_content.logs + %ol + - Gitlab::Logger.read_latest.each do |line| + %li + %p= line diff --git a/app/views/commits/_commits.html.haml b/app/views/commits/_commits.html.haml index c2c9ca624b2..c3c7d49ce74 100644 --- a/app/views/commits/_commits.html.haml +++ b/app/views/commits/_commits.html.haml @@ -1,4 +1,6 @@ - @commits.group_by { |c| c.committed_date.to_date }.each do |day, commits| %div.ui-box - %h5= day.stamp("28 Aug, 2010") + %h5.small + %i.icon-calendar + = day.stamp("28 Aug, 2010") %ul.unstyled= render commits diff --git a/app/views/commits/_head.html.haml b/app/views/commits/_head.html.haml index 8e9195c5b50..453ca4eac12 100644 --- a/app/views/commits/_head.html.haml +++ b/app/views/commits/_head.html.haml @@ -13,12 +13,12 @@ %li{:class => "#{branches_tab_class}"} = link_to project_repository_path(@project) do Branches - %span.number= @project.repo.branch_count + %span.badge= @project.repo.branch_count %li{:class => "#{'active' if current_page?(tags_project_repository_path(@project)) }"} = link_to tags_project_repository_path(@project) do Tags - %span.number= @project.repo.tag_count + %span.badge= @project.repo.tag_count - if current_page?(project_commits_path(@project)) && current_user.private_token diff --git a/app/views/commits/compare.html.haml b/app/views/commits/compare.html.haml index c02263296f4..66ed8dad595 100644 --- a/app/views/commits/compare.html.haml +++ b/app/views/commits/compare.html.haml @@ -20,7 +20,7 @@ = "..." = text_field_tag :to, params[:to], :placeholder => "aa8b4ef", :class => "xlarge" .actions - = submit_tag "Compare", :class => "btn primary" + = submit_tag "Compare", :class => "btn btn-primary" - unless @commits.empty? diff --git a/app/views/merge_requests/show/_commits.html.haml b/app/views/merge_requests/show/_commits.html.haml index 78fe1a062d3..d10e8fd597a 100644 --- a/app/views/merge_requests/show/_commits.html.haml +++ b/app/views/merge_requests/show/_commits.html.haml @@ -1,6 +1,8 @@ - if @commits.present? .ui-box - %h5 Commits (#{@commits.count}) + %h5 + %i.icon-list + Commits (#{@commits.count}) .merge-request-commits - if @commits.count > 8 %ul.first_mr_commits.unstyled diff --git a/lib/gitlab/logger.rb b/lib/gitlab/logger.rb index e8d20ad90c2..5249fdbca0e 100644 --- a/lib/gitlab/logger.rb +++ b/lib/gitlab/logger.rb @@ -8,7 +8,7 @@ module Gitlab def self.read_latest path = Rails.root.join("log/githost.log") - logs = `tail -n 50 #{path}`.split("\n") + logs = File.read(path).split("\n") end end end -- GitLab From f2b7c007da2ff7e1717533aeabc9d9fdf846b214 Mon Sep 17 00:00:00 2001 From: moregeek Date: Mon, 16 Jul 2012 14:01:32 +0200 Subject: [PATCH 06/15] show flash notice after deletion of a project --- app/controllers/admin/projects_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/admin/projects_controller.rb b/app/controllers/admin/projects_controller.rb index 5266b406504..c0508428275 100644 --- a/app/controllers/admin/projects_controller.rb +++ b/app/controllers/admin/projects_controller.rb @@ -72,6 +72,6 @@ class Admin::ProjectsController < ApplicationController @admin_project = Project.find_by_code(params[:id]) @admin_project.destroy - redirect_to admin_projects_url + redirect_to admin_projects_url, notice: 'Project was successfully deleted.' end end -- GitLab From 137dfdc7092c0a15e1c75f738ebbebc001970f1f Mon Sep 17 00:00:00 2001 From: Pat Thoyts Date: Mon, 16 Jul 2012 23:31:28 +0100 Subject: [PATCH 07/15] Improve handling of misconfigured LDAP accounts. Gitlab requires an email address for all user accounts as this is the default account id and is used for sending notifications. LDAP accounts may be missing email fields so handle this by showing a sensible error message before redirecting to the login screen again. Resolves github issue #899 Signed-off-by: Pat Thoyts --- app/controllers/omniauth_callbacks_controller.rb | 13 +++++++++++++ app/models/user.rb | 3 ++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/app/controllers/omniauth_callbacks_controller.rb b/app/controllers/omniauth_callbacks_controller.rb index 629b6819fb1..fb759c371c4 100644 --- a/app/controllers/omniauth_callbacks_controller.rb +++ b/app/controllers/omniauth_callbacks_controller.rb @@ -1,4 +1,17 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController + + # Extend the standard message generation to accept our custom exception + def failure_message + exception = env["omniauth.error"] + if exception.class == OmniAuth::Error + error = exception.message + else + error = exception.error_reason if exception.respond_to?(:error_reason) + error ||= exception.error if exception.respond_to?(:error) + error ||= env["omniauth.error.type"].to_s + end + error.to_s.humanize if error + end def ldap # We only find ourselves here if the authentication to LDAP was successful. diff --git a/app/models/user.rb b/app/models/user.rb index b87e149ca0f..a3e08fa7d0b 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -80,7 +80,8 @@ class User < ActiveRecord::Base def self.find_for_ldap_auth(omniauth_info) name = omniauth_info.name.force_encoding("utf-8") - email = omniauth_info.email.downcase + email = omniauth_info.email.downcase unless omniauth_info.email.nil? + raise OmniAuth::Error, "LDAP accounts must provide an email address" if email.nil? if @user = User.find_by_email(email) @user -- GitLab From 55a09e934ee5c7c77a7f74d18bf74cc782ed0770 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 17 Jul 2012 08:17:16 +0300 Subject: [PATCH 08/15] MR index pollished --- app/assets/stylesheets/gitlab_bootstrap.scss | 2 +- app/assets/stylesheets/sections/merge_requests.scss | 12 ++++++++++++ app/views/merge_requests/_merge_request.html.haml | 10 ++++++---- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/app/assets/stylesheets/gitlab_bootstrap.scss b/app/assets/stylesheets/gitlab_bootstrap.scss index 8197590f5a2..119180c5abb 100644 --- a/app/assets/stylesheets/gitlab_bootstrap.scss +++ b/app/assets/stylesheets/gitlab_bootstrap.scss @@ -429,7 +429,7 @@ form { */ .ui-box { background:#F9F9F9; - margin-bottom: 40px; + margin-bottom: 25px; @include round-borders-all(4px); border-color: #CCC; diff --git a/app/assets/stylesheets/sections/merge_requests.scss b/app/assets/stylesheets/sections/merge_requests.scss index ad496238a13..34f43acf839 100644 --- a/app/assets/stylesheets/sections/merge_requests.scss +++ b/app/assets/stylesheets/sections/merge_requests.scss @@ -82,3 +82,15 @@ } } } + +li.merge_request { + padding:7px 10px; + img.avatar { + width: 32px; + margin-top: 4px; + } + p { + padding: 0px; + padding-bottom: 2px; + } +} diff --git a/app/views/merge_requests/_merge_request.html.haml b/app/views/merge_requests/_merge_request.html.haml index d9634a4fcc8..b9a005e08be 100644 --- a/app/views/merge_requests/_merge_request.html.haml +++ b/app/views/merge_requests/_merge_request.html.haml @@ -15,12 +15,14 @@ → = merge_request.target_branch = image_tag gravatar_icon(merge_request.author_email), :class => "avatar" + + = link_to project_merge_request_path(merge_request.project, merge_request) do + %p.row_title= truncate(merge_request.title, :length => 80) + %span.update-author - %strong= merge_request.author_name - authored + %small.cdark= "##{merge_request.id}" + authored by #{merge_request.author_name} = time_ago_in_words(merge_request.created_at) ago - if merge_request.upvotes > 0 %span.badge.badge-success= "+#{merge_request.upvotes}" - = link_to project_merge_request_path(merge_request.project, merge_request) do - %p.row_title= truncate(merge_request.title, :length => 80) -- GitLab From 76f6581c87d1f09da54ca6e55e3737f7b14aad1f Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 17 Jul 2012 08:19:16 +0300 Subject: [PATCH 09/15] Feature: Unassigned Merge Requests --- app/models/merge_request.rb | 2 +- app/observers/mailer_observer.rb | 2 +- app/views/merge_requests/_form.html.haml | 20 +++++++++++++------ app/views/merge_requests/edit.html.haml | 2 +- app/views/merge_requests/new.html.haml | 2 +- .../merge_requests/show/_mr_box.html.haml | 7 ++++--- spec/models/merge_request_spec.rb | 1 - 7 files changed, 22 insertions(+), 14 deletions(-) diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index d3e531f7818..27b8e07dc9a 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -22,7 +22,6 @@ class MergeRequest < ActiveRecord::Base :should_remove_source_branch validates_presence_of :project_id - validates_presence_of :assignee_id validates_presence_of :author_id validates_presence_of :source_branch validates_presence_of :target_branch @@ -36,6 +35,7 @@ class MergeRequest < ActiveRecord::Base delegate :name, :email, :to => :assignee, + :allow_nil => true, :prefix => true validates :title, diff --git a/app/observers/mailer_observer.rb b/app/observers/mailer_observer.rb index 880fd5026a4..451deccd14f 100644 --- a/app/observers/mailer_observer.rb +++ b/app/observers/mailer_observer.rb @@ -43,7 +43,7 @@ class MailerObserver < ActiveRecord::Observer end def new_merge_request(merge_request) - if merge_request.assignee != current_user + if merge_request.assignee && merge_request.assignee != current_user Notify.new_merge_request_email(merge_request.id).deliver end end diff --git a/app/views/merge_requests/_form.html.haml b/app/views/merge_requests/_form.html.haml index d69faa142d5..4f20a06fd25 100644 --- a/app/views/merge_requests/_form.html.haml +++ b/app/views/merge_requests/_form.html.haml @@ -5,7 +5,8 @@ - @merge_request.errors.full_messages.each do |msg| %li= msg - %h3.padded.cgray 1. Select Branches + %h4.cdark 1. Select Branches + %br .row .span6 @@ -30,14 +31,21 @@ .bottom_commit .mr_target_commit - %h3.padded.cgray 2. Fill info + %h4.cdark 2. Fill info + .clearfix - = f.label :assignee_id, "Assign to", :class => "control-label" - .controls= f.select(:assignee_id, @project.users.all.collect {|p| [ p.name, p.id ] }, { :include_blank => "Select user" }, :style => "width:250px") + .main_box + .top_box_content + = f.label :title do + %strong= "Title *" + .input= f.text_field :title, :class => "input-xxlarge pad", :maxlength => 255, :rows => 5 + .middle_box_content + = f.label :assignee_id do + %i.icon-user + Assign to + .input= f.select(:assignee_id, @project.users.all.collect {|p| [ p.name, p.id ] }, { :include_blank => "Select user" }, :style => "width:250px") .control-group - = f.label :title, :class => "control-label" - .controls= f.text_field :title, :class => "input-xxlarge pad", :maxlength => 255, :rows => 5 .form-actions = f.submit 'Save', :class => "btn-primary btn" diff --git a/app/views/merge_requests/edit.html.haml b/app/views/merge_requests/edit.html.haml index 9e4f9327cdc..eee148994d7 100644 --- a/app/views/merge_requests/edit.html.haml +++ b/app/views/merge_requests/edit.html.haml @@ -1,4 +1,4 @@ -%h3 +%h3.page_title = "Edit merge request #{@merge_request.id}" %hr = render 'form' diff --git a/app/views/merge_requests/new.html.haml b/app/views/merge_requests/new.html.haml index efafa45d758..594089995ea 100644 --- a/app/views/merge_requests/new.html.haml +++ b/app/views/merge_requests/new.html.haml @@ -1,3 +1,3 @@ -%h3 New Merge Request +%h3.page_title New Merge Request %hr = render 'form' diff --git a/app/views/merge_requests/show/_mr_box.html.haml b/app/views/merge_requests/show/_mr_box.html.haml index 3027719d94d..b542dac98e0 100644 --- a/app/views/merge_requests/show/_mr_box.html.haml +++ b/app/views/merge_requests/show/_mr_box.html.haml @@ -13,9 +13,10 @@ = image_tag gravatar_icon(@merge_request.author_email), :width => 16, :class => "lil_av" %strong.author= link_to_merge_request_author(@merge_request) - %cite.cgray and currently assigned to - = image_tag gravatar_icon(@merge_request.assignee_email), :width => 16, :class => "lil_av" - %strong.author= link_to_merge_request_assignee(@merge_request) + - if @merge_request.assignee + %cite.cgray and currently assigned to + = image_tag gravatar_icon(@merge_request.assignee_email), :width => 16, :class => "lil_av" + %strong.author= link_to_merge_request_assignee(@merge_request) - if @merge_request.closed diff --git a/spec/models/merge_request_spec.rb b/spec/models/merge_request_spec.rb index 8d750bef5a5..ac986ccebe3 100644 --- a/spec/models/merge_request_spec.rb +++ b/spec/models/merge_request_spec.rb @@ -13,7 +13,6 @@ describe MergeRequest do it { should validate_presence_of(:title) } it { should validate_presence_of(:author_id) } it { should validate_presence_of(:project_id) } - it { should validate_presence_of(:assignee_id) } end describe "Scope" do -- GitLab From 12913193c14a9760071ac53925a47819bcc55cc7 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 17 Jul 2012 08:21:16 +0300 Subject: [PATCH 10/15] Colored labels for events on dashboard --- app/assets/stylesheets/gitlab_bootstrap.scss | 17 ++++++++++++++--- app/views/events/_event_issue.html.haml | 4 ++-- app/views/events/_event_merge_request.html.haml | 4 ++-- app/views/events/_event_push.html.haml | 2 +- 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/app/assets/stylesheets/gitlab_bootstrap.scss b/app/assets/stylesheets/gitlab_bootstrap.scss index 119180c5abb..9feb2b818c9 100644 --- a/app/assets/stylesheets/gitlab_bootstrap.scss +++ b/app/assets/stylesheets/gitlab_bootstrap.scss @@ -303,9 +303,20 @@ table.no-borders { } .event_label { - background: #FCEEC1; - padding: 2px 2px 0; - font-family: monospace; + @extend .label; + background-color: #999; + + &.pushed { + background-color: #3A87AD; + } + + &.opened { + background-color: #468847; + } + + &.closed { + background-color: #B94A48; + } } img.avatar { diff --git a/app/views/events/_event_issue.html.haml b/app/views/events/_event_issue.html.haml index 13fb20cd379..4293be8204e 100644 --- a/app/views/events/_event_issue.html.haml +++ b/app/views/events/_event_issue.html.haml @@ -1,7 +1,7 @@ = image_tag gravatar_icon(event.author_email), :class => "avatar" %strong #{event.author_name} -%span.event_label= event.action_name - issue +%span.event_label{:class => event.action_name}= event.action_name +issue = link_to project_issue_path(event.project, event.issue) do %strong= truncate event.issue_title at diff --git a/app/views/events/_event_merge_request.html.haml b/app/views/events/_event_merge_request.html.haml index e59a74b9554..774921a7f2a 100644 --- a/app/views/events/_event_merge_request.html.haml +++ b/app/views/events/_event_merge_request.html.haml @@ -2,8 +2,8 @@ .event_icon= image_tag "event_mr_merged.png" = image_tag gravatar_icon(event.author_email), :class => "avatar" %strong #{event.author_name} -%span.event_label= event.action_name - merge request +%span.event_label{:class => event.action_name}= event.action_name +merge request = link_to project_merge_request_path(event.project, event.merge_request) do %strong= truncate event.merge_request_title at diff --git a/app/views/events/_event_push.html.haml b/app/views/events/_event_push.html.haml index 3aadd226614..59d8962bb16 100644 --- a/app/views/events/_event_push.html.haml +++ b/app/views/events/_event_push.html.haml @@ -2,7 +2,7 @@ .event_icon= image_tag "event_push.png" = image_tag gravatar_icon(event.author_email), :class => "avatar" %strong #{event.author_name} - %span.event_label= event.push_action_name + %span.event_label.pushed= event.push_action_name = event.ref_type = link_to project_commits_path(event.project, :ref => event.ref_name) do %strong= event.ref_name -- GitLab From 1ea6890ffe820f20f847def37efc3eaf4b93bd34 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 17 Jul 2012 08:23:16 +0300 Subject: [PATCH 11/15] CHANGELOG updated. Fixed MR bug. Logger improved --- CHANGELOG | 4 ++++ app/assets/stylesheets/gitlab_bootstrap.scss | 4 ++++ app/models/merge_request.rb | 2 +- lib/gitlab/logger.rb | 18 ++++++++++++++---- 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 172357603cb..fe243d65e4b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,9 @@ v 2.7.0 - Issue Labels + - Inline diff + - Git HTTP + - API + - UI improved v 2.6.0 - UI polished diff --git a/app/assets/stylesheets/gitlab_bootstrap.scss b/app/assets/stylesheets/gitlab_bootstrap.scss index 9feb2b818c9..c0a20762d0a 100644 --- a/app/assets/stylesheets/gitlab_bootstrap.scss +++ b/app/assets/stylesheets/gitlab_bootstrap.scss @@ -317,6 +317,10 @@ table.no-borders { &.closed { background-color: #B94A48; } + + &.merged { + background-color: #2A2; + } } img.avatar { diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index 27b8e07dc9a..2581f3be4c9 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -128,7 +128,7 @@ class MergeRequest < ActiveRecord::Base def unmerged_diffs commits = project.repo.commits_between(target_branch, source_branch).map {|c| Commit.new(c)} - diffs = project.repo.diff(commits.first.prev_commit.id, commits.last.id) + diffs = project.repo.diff(commits.first.prev_commit.id, commits.last.id) rescue [] end def last_commit diff --git a/lib/gitlab/logger.rb b/lib/gitlab/logger.rb index 5249fdbca0e..aff13baf67b 100644 --- a/lib/gitlab/logger.rb +++ b/lib/gitlab/logger.rb @@ -1,14 +1,24 @@ module Gitlab - class Logger + class Logger < ::Logger def self.error(message) - @@logger ||= ::Logger.new(File.join(Rails.root, "log/githost.log")) - message = Time.now.to_s(:long) + " -> " + message - @@logger.error(message) + build.error(message) + end + + def self.info(message) + build.info(message) end def self.read_latest path = Rails.root.join("log/githost.log") logs = File.read(path).split("\n") end + + def self.build + new(File.join(Rails.root, "log/githost.log")) + end + + def format_message(severity, timestamp, progname, msg) + "#{timestamp.to_s(:long)} -> #{severity} -> #{msg}\n" + end end end -- GitLab From 096791b7f24a1b14a0972165f83c1a3d4ba7a041 Mon Sep 17 00:00:00 2001 From: Michael Richardson Date: Wed, 18 Jul 2012 11:59:32 +0100 Subject: [PATCH 12/15] Fixing MySQL syntax error --- lib/tasks/gitlab/backup.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tasks/gitlab/backup.rake b/lib/tasks/gitlab/backup.rake index 4fbde37ef3e..014483d4e8c 100644 --- a/lib/tasks/gitlab/backup.rake +++ b/lib/tasks/gitlab/backup.rake @@ -159,7 +159,7 @@ namespace :gitlab do print "- Dumping table #{tbl}... " count = 1 File.open(File.join(backup_path_db, tbl + ".yml"), "w+") do |file| - ActiveRecord::Base.connection.select_all("SELECT * FROM #{tbl}").each do |line| + ActiveRecord::Base.connection.select_all("SELECT * FROM `#{tbl}`").each do |line| line.delete_if{|k,v| v.blank?} output = {tbl + '_' + count.to_s => line} file << output.to_yaml.gsub(/^---\n/,'') + "\n" -- GitLab From f74050a1df93cc3c70f6e1685f3cce7da68be5e5 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 19 Jul 2012 12:52:28 +0300 Subject: [PATCH 13/15] Ignore backups dir --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 8c626989bb8..725f289db55 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ log/*.log tmp/ .sass-cache/ coverage/* +backups/* *.swp public/uploads/ .rvmrc -- GitLab From 5702bb9492ffebf2a437242fe37fda5a37eacdab Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 19 Jul 2012 07:05:57 +0300 Subject: [PATCH 14/15] Fix comments in MR. Fixed event destroy with user --- app/assets/javascripts/note.js | 4 ++-- app/assets/stylesheets/gitlab_bootstrap.scss | 3 ++- app/assets/stylesheets/header.scss | 11 +++++++---- app/controllers/admin/projects_controller.rb | 2 +- app/models/user.rb | 5 +++++ app/views/admin/projects/index.html.haml | 6 +++--- app/views/admin/users/index.html.haml | 4 ++-- app/views/notes/_form.html.haml | 2 +- app/views/notes/_per_line_form.html.haml | 2 +- 9 files changed, 24 insertions(+), 15 deletions(-) diff --git a/app/assets/javascripts/note.js b/app/assets/javascripts/note.js index 4d97ffefdce..c45a45d2fcb 100644 --- a/app/assets/javascripts/note.js +++ b/app/assets/javascripts/note.js @@ -25,11 +25,11 @@ init: $(this).closest('li').fadeOut(); }); $("#new_note").live("ajax:before", function(){ - $("#submit_note").attr("disabled", "disabled"); + $(".submit_note").attr("disabled", "disabled"); }) $("#new_note").live("ajax:complete", function(){ - $("#submit_note").removeAttr("disabled"); + $(".submit_note").removeAttr("disabled"); }) $("#note_note").live("focus", function(){ diff --git a/app/assets/stylesheets/gitlab_bootstrap.scss b/app/assets/stylesheets/gitlab_bootstrap.scss index c0a20762d0a..b2bc4593a29 100644 --- a/app/assets/stylesheets/gitlab_bootstrap.scss +++ b/app/assets/stylesheets/gitlab_bootstrap.scss @@ -213,6 +213,7 @@ a:focus { .cblack { color:#111; } .cdark { color:#444 } .cwhite { color:#fff !important } +.bgred { background: #F2DEDE !important} /** COMMON STYLES **/ .left { @@ -650,7 +651,7 @@ p { h3.page_title { color:#456; font-size:20px; - font-weight: 600; + font-weight: normal; line-height: 28px; } diff --git a/app/assets/stylesheets/header.scss b/app/assets/stylesheets/header.scss index 5e2e410071b..c3a570036bb 100644 --- a/app/assets/stylesheets/header.scss +++ b/app/assets/stylesheets/header.scss @@ -96,7 +96,7 @@ header { */ .search { float: right; - margin-right: 55px; + margin-right: 50px; .search-input { @extend .span2; @@ -125,11 +125,14 @@ header { display: block; cursor: pointer; img { + -moz-box-shadow: 0 0 5px #ccc; + -webkit-box-shadow: 0 0 5px #ccc; + box-shadow: 0 0 5px #ccc; border-radius: 4px; - right: 0px; + right: 5px; position: absolute; - width: 33px; - height: 33px; + width: 31px; + height: 31px; display: block; top: 0; &:after { diff --git a/app/controllers/admin/projects_controller.rb b/app/controllers/admin/projects_controller.rb index c0508428275..0ff97bf2c32 100644 --- a/app/controllers/admin/projects_controller.rb +++ b/app/controllers/admin/projects_controller.rb @@ -6,7 +6,7 @@ class Admin::ProjectsController < ApplicationController def index @admin_projects = Project.scoped @admin_projects = @admin_projects.search(params[:name]) if params[:name].present? - @admin_projects = @admin_projects.page(params[:page]) + @admin_projects = @admin_projects.page(params[:page]).per(20) end def show diff --git a/app/models/user.rb b/app/models/user.rb index a3e08fa7d0b..0836ca4919f 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -15,6 +15,11 @@ class User < ActiveRecord::Base has_many :my_own_projects, :class_name => "Project", :foreign_key => :owner_id has_many :keys, :dependent => :destroy + has_many :events, + :class_name => "Event", + :foreign_key => :author_id, + :dependent => :destroy + has_many :recent_events, :class_name => "Event", :foreign_key => :author_id, diff --git a/app/views/admin/projects/index.html.haml b/app/views/admin/projects/index.html.haml index 932fb37ddf6..7218eebb62a 100644 --- a/app/views/admin/projects/index.html.haml +++ b/app/views/admin/projects/index.html.haml @@ -13,8 +13,8 @@ %th Team Members %th Post Receive %th Last Commit - %th - %th + %th Edit + %th.cred Danger Zone! - @admin_projects.each do |project| %tr @@ -24,5 +24,5 @@ %td= check_box_tag :post_receive_file, 1, project.has_post_receive_file?, :disabled => true %td= last_commit(project) %td= link_to 'Edit', edit_admin_project_path(project), :id => "edit_#{dom_id(project)}", :class => "btn small" - %td= link_to 'Destroy', [:admin, project], :confirm => 'Are you sure?', :method => :delete, :class => "btn small danger" + %td.bgred= link_to 'Destroy', [:admin, project], :confirm => "REMOVE #{project.name}? Are you sure?", :method => :delete, :class => "btn small danger" = paginate @admin_projects, :theme => "admin" diff --git a/app/views/admin/users/index.html.haml b/app/views/admin/users/index.html.haml index 481bf37bb0b..5d5320db0e3 100644 --- a/app/views/admin/users/index.html.haml +++ b/app/views/admin/users/index.html.haml @@ -27,7 +27,7 @@ %th Projects %th Edit %th Blocked - %th + %th.cred Danger Zone! - @admin_users.each do |user| %tr @@ -41,6 +41,6 @@ = link_to 'Unblock', unblock_admin_user_path(user), :method => :put, :class => "btn small success" - else = link_to 'Block', block_admin_user_path(user), :confirm => 'USER WILL BE BLOCKED! Are you sure?', :method => :put, :class => "btn small danger" - %td= link_to 'Destroy', [:admin, user], :confirm => 'USER WILL BE REMOVED! Are you sure?', :method => :delete, :class => "btn small danger" + %td.bgred= link_to 'Destroy', [:admin, user], :confirm => "USER #{user.name} WILL BE REMOVED! Are you sure?", :method => :delete, :class => "btn small danger" = paginate @admin_users, :theme => "admin" diff --git a/app/views/notes/_form.html.haml b/app/views/notes/_form.html.haml index 03774d160b9..f5aa1495796 100644 --- a/app/views/notes/_form.html.haml +++ b/app/views/notes/_form.html.haml @@ -32,4 +32,4 @@ %span Any file less than 10 MB - = f.submit 'Add Comment', :class => "btn primary", :id => "submit_note" + = f.submit 'Add Comment', :class => "btn primary submit_note", :id => "submit_note" diff --git a/app/views/notes/_per_line_form.html.haml b/app/views/notes/_per_line_form.html.haml index 94c558029d2..8beaf9b5e0c 100644 --- a/app/views/notes/_per_line_form.html.haml +++ b/app/views/notes/_per_line_form.html.haml @@ -24,7 +24,7 @@ = check_box_tag :notify_author, 1 , @note.noteable_type == "Commit" %span Commit author .actions - = f.submit 'Add note', :class => "btn primary", :id => "submit_note" + = f.submit 'Add note', :class => "btn primary submit_note", :id => "submit_note" = link_to "Close", "#", :class => "btn hide-button" :javascript -- GitLab From 5bb311a2987857dfe6019a9e907538d978f5ca09 Mon Sep 17 00:00:00 2001 From: Ian Morgan Date: Thu, 19 Jul 2012 20:09:19 -0400 Subject: [PATCH 15/15] Add comments to Wiki pages --- app/assets/stylesheets/notes.scss | 3 ++- app/controllers/admin/mailer_controller.rb | 2 ++ app/controllers/notes_controller.rb | 2 ++ app/controllers/wikis_controller.rb | 2 ++ app/mailers/notify.rb | 7 ++++++ app/models/wiki.rb | 1 + app/observers/mailer_observer.rb | 1 + app/views/notify/note_wiki_email.html.haml | 24 ++++++++++++++++++ app/views/wikis/show.html.haml | 2 ++ spec/requests/wikis_notes_spec.rb | 29 ++++++++++++++++++++++ 10 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 app/views/notify/note_wiki_email.html.haml create mode 100644 spec/requests/wikis_notes_spec.rb diff --git a/app/assets/stylesheets/notes.scss b/app/assets/stylesheets/notes.scss index 39db704b1a9..39e03813a8b 100644 --- a/app/assets/stylesheets/notes.scss +++ b/app/assets/stylesheets/notes.scss @@ -14,7 +14,8 @@ border-bottom:1px solid #aaa; } -.issue_notes { +.issue_notes, +.wiki_notes { .note_content { float:left; width:400px; diff --git a/app/controllers/admin/mailer_controller.rb b/app/controllers/admin/mailer_controller.rb index 2352e189204..ec6d24bdaba 100644 --- a/app/controllers/admin/mailer_controller.rb +++ b/app/controllers/admin/mailer_controller.rb @@ -18,6 +18,8 @@ class Admin::MailerController < ApplicationController when "Issue" then @issue = Issue.first render :file => 'notify/note_issue_email', :layout => 'notify' + when "Wiki" then + render :file => 'notify/note_wiki_email', :layout => 'notify' else render :file => 'notify/note_wall_email', :layout => 'notify' end diff --git a/app/controllers/notes_controller.rb b/app/controllers/notes_controller.rb index a2638d9597c..9e89140e8f1 100644 --- a/app/controllers/notes_controller.rb +++ b/app/controllers/notes_controller.rb @@ -51,6 +51,8 @@ class NotesController < ApplicationController then project.issues.find(params[:target_id]).notes.inc_author.order("created_at DESC").limit(20) when "merge_request" then project.merge_requests.find(params[:target_id]).notes.inc_author.order("created_at DESC").limit(20) + when "wiki" + then project.wikis.find(params[:target_id]).notes.order("created_at DESC").limit(20) end @notes = if params[:last_id] diff --git a/app/controllers/wikis_controller.rb b/app/controllers/wikis_controller.rb index 9bcd20c3187..06e3564be56 100644 --- a/app/controllers/wikis_controller.rb +++ b/app/controllers/wikis_controller.rb @@ -17,6 +17,8 @@ class WikisController < ApplicationController return render_404 unless can?(current_user, :write_wiki, @project) end + @note = @project.notes.new(:noteable => @wiki) + respond_to do |format| if @wiki format.html diff --git a/app/mailers/notify.rb b/app/mailers/notify.rb index c673eb3d161..2ce940c35cc 100644 --- a/app/mailers/notify.rb +++ b/app/mailers/notify.rb @@ -46,6 +46,13 @@ class Notify < ActionMailer::Base mail(:to => recipient.email, :subject => "gitlab | note for issue #{@issue.id} | #{@note.project_name} ") end + def note_wiki_email(recipient_id, note_id) + recipient = User.find(recipient_id) + @note = Note.find(note_id) + @wiki = @note.noteable + mail(:to => recipient.email, :subject => "gitlab | note for wiki | #{@note.project_name}") + end + def new_merge_request_email(merge_request_id) @merge_request = MergeRequest.find(merge_request_id) mail(:to => @merge_request.assignee_email, :subject => "gitlab | new merge request | #{@merge_request.title} ") diff --git a/app/models/wiki.rb b/app/models/wiki.rb index ecc46fb4efb..d9ec069d14b 100644 --- a/app/models/wiki.rb +++ b/app/models/wiki.rb @@ -1,6 +1,7 @@ class Wiki < ActiveRecord::Base belongs_to :project belongs_to :user + has_many :notes, :as => :noteable, :dependent => :destroy validates :content, :title, :user_id, :presence => true validates :title, :length => 1..250 diff --git a/app/observers/mailer_observer.rb b/app/observers/mailer_observer.rb index 451deccd14f..b6f5217847a 100644 --- a/app/observers/mailer_observer.rb +++ b/app/observers/mailer_observer.rb @@ -34,6 +34,7 @@ class MailerObserver < ActiveRecord::Observer case note.noteable_type when "Commit"; Notify.note_commit_email(u.id, note.id).deliver when "Issue"; Notify.note_issue_email(u.id, note.id).deliver + when "Wiki"; Notify.note_wiki_email(u.id, note.id).deliver when "MergeRequest"; Notify.note_merge_request_email(u.id, note.id).deliver when "Snippet"; true else diff --git a/app/views/notify/note_wiki_email.html.haml b/app/views/notify/note_wiki_email.html.haml new file mode 100644 index 00000000000..91270682c6b --- /dev/null +++ b/app/views/notify/note_wiki_email.html.haml @@ -0,0 +1,24 @@ +%td.content{:align => "left", :style => "font-family: Helvetica, Arial, sans-serif; padding: 20px 0 0;", :valign => "top", :width => "600"} + %table{:border => "0", :cellpadding => "0", :cellspacing => "0", :style => "color: #717171; font: normal 11px Helvetica, Arial, sans-serif; margin: 0; padding: 0;", :width => "600"} + %tr + %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} + %td{:align => "left", :style => "padding: 20px 0 0;"} + %h2{:style => "color:#646464 !important; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "} + New comment - + = link_to project_issue_url(@wiki.project, @wiki, :anchor => "note_#{@note.id}") do + = "Wiki ##{@wiki.title.to_s}" + %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} + %tr + %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} + %td{:style => "padding: 15px 0 15px;", :valign => "top"} + %p{:style => "color:#767676; font-weight: normal; margin: 0; padding: 0; line-height: 20px; font-size: 12px;font-family: Helvetica, Arial, sans-serif; "} + %a{:href => "#", :style => "color: #0eb6ce; text-decoration: none;"} #{@note.author_name} + commented on Wiki page: + %br + %table{:border => "0", :cellpadding => "0", :cellspacing => "0", :width => "558"} + %tr + %td{:valign => "top"} + %div{ :style => "background:#f5f5f5; padding:20px;border:1px solid #ddd" } + = markdown(@note.note) + %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} + diff --git a/app/views/wikis/show.html.haml b/app/views/wikis/show.html.haml index 9aa287dff07..e9502430b34 100644 --- a/app/views/wikis/show.html.haml +++ b/app/views/wikis/show.html.haml @@ -15,3 +15,5 @@ - if can? current_user, :admin_wiki, @project = link_to project_wiki_path(@project, @wiki), :confirm => "Are you sure you want to delete this page?", :method => :delete do Delete this page + +.wiki_notes#notes= render "notes/notes", :tid => @wiki.id, :tt => "wiki" diff --git a/spec/requests/wikis_notes_spec.rb b/spec/requests/wikis_notes_spec.rb new file mode 100644 index 00000000000..144d0318bea --- /dev/null +++ b/spec/requests/wikis_notes_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' + +describe "Wikis" do + let(:project) { Factory :project } + + before do + login_as :user + project.add_access(@user, :read, :write) + end + + describe "add new note", :js => true do + before do + visit project_wiki_path(project, :index) + + fill_in "Title", :with => 'Test title' + fill_in "Content", :with => '[link test](test)' + click_on "Save" + + page.should have_content("Test title") + + fill_in "note_note", :with => "Comment on wiki!" + click_button "Add Comment" + end + + it "should contain the new note" do + page.should have_content("Comment on wiki!") + end + end +end -- GitLab