From 2b16c3f29f35ca9680a51aa9a4dfcd8dbed25f6d Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Fri, 5 Apr 2013 18:03:45 +0400 Subject: [PATCH 01/13] #81: use "rm -rf" for removing dir --- app/models/key_pair.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/key_pair.rb b/app/models/key_pair.rb index 54f306116..6cdfb076d 100644 --- a/app/models/key_pair.rb +++ b/app/models/key_pair.rb @@ -47,7 +47,7 @@ class KeyPair < ActiveRecord::Base end ensure # remove the directory. - FileUtils.remove_entry_secure dir + system "rm -rf #{dir}" end end From d47eaa7b943169158876162972c998a777a6dbdb Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Fri, 5 Apr 2013 18:08:37 +0400 Subject: [PATCH 02/13] #81: use rm_rf --- app/models/key_pair.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/key_pair.rb b/app/models/key_pair.rb index 6cdfb076d..439dff065 100644 --- a/app/models/key_pair.rb +++ b/app/models/key_pair.rb @@ -47,7 +47,7 @@ class KeyPair < ActiveRecord::Base end ensure # remove the directory. - system "rm -rf #{dir}" + FileUtils.rm_rf dir end end From b17ae312e8a95c1769b38092d23340a8b89c467b Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Mon, 8 Apr 2013 18:46:41 +0400 Subject: [PATCH 03/13] #81: rollback some changes, update code according to Vladimir's comments --- app/models/key_pair.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/models/key_pair.rb b/app/models/key_pair.rb index 439dff065..8bbeac841 100644 --- a/app/models/key_pair.rb +++ b/app/models/key_pair.rb @@ -21,7 +21,9 @@ class KeyPair < ActiveRecord::Base protected def check_keys - dir = Dir.mktmpdir('keys-', "#{APP_CONFIG['root_path']}/tmp") + tmp = "#{APP_CONFIG['root_path']}/tmp" + system "sudo chown rosa:rosa #{tmp} && chmod 1777 #{tmp}" + dir = Dir.mktmpdir('keys-', tmp) begin %w(pubring secring).each do |kind| filename = "#{dir}/#{kind}" @@ -47,7 +49,7 @@ class KeyPair < ActiveRecord::Base end ensure # remove the directory. - FileUtils.rm_rf dir + FileUtils.remove_entry_secure dir end end From 6c94b0766cd8a40c513a06fdcb94da0579927740 Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Mon, 8 Apr 2013 19:14:36 +0400 Subject: [PATCH 04/13] #81: small refactoring --- app/models/key_pair.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/key_pair.rb b/app/models/key_pair.rb index 8bbeac841..ca8a3fe8c 100644 --- a/app/models/key_pair.rb +++ b/app/models/key_pair.rb @@ -22,7 +22,7 @@ class KeyPair < ActiveRecord::Base def check_keys tmp = "#{APP_CONFIG['root_path']}/tmp" - system "sudo chown rosa:rosa #{tmp} && chmod 1777 #{tmp}" + system "sudo chown `whoami` #{tmp} && chmod 1777 #{tmp}" dir = Dir.mktmpdir('keys-', tmp) begin %w(pubring secring).each do |kind| From 8a09770e9dc1e443dd705829d55ef21cb16c0896 Mon Sep 17 00:00:00 2001 From: Alexander Machehin Date: Mon, 8 Apr 2013 23:48:45 +0600 Subject: [PATCH 05/13] [#19] fix url to issue --- lib/modules/models/markdown.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/modules/models/markdown.rb b/lib/modules/models/markdown.rb index 1890b5923..a636dbddd 100644 --- a/lib/modules/models/markdown.rb +++ b/lib/modules/models/markdown.rb @@ -173,7 +173,7 @@ module Modules def reference_issue(identifier) if issue = Issue.find_by_hash_tag(identifier, current_ability, @project) - url = project_issue_path(@project.owner, @project.name, issue.serial_id) + url = project_issue_path(issue.project.owner, issue.project.name, issue.serial_id) title = "#{Issue.model_name.human}: #{issue.title}" link_to(identifier, url, html_options.merge(title: title, class: "gfm gfm-issue #{html_options[:class]}")) end From 7c94715a4ea0d6838d1a25fdd294be9ebe3ffd30 Mon Sep 17 00:00:00 2001 From: Alexander Machehin Date: Tue, 9 Apr 2013 00:39:50 +0600 Subject: [PATCH 06/13] [#19] fix url to pull request --- lib/modules/models/markdown.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/modules/models/markdown.rb b/lib/modules/models/markdown.rb index a636dbddd..485e95553 100644 --- a/lib/modules/models/markdown.rb +++ b/lib/modules/models/markdown.rb @@ -183,7 +183,7 @@ module Modules issue = Issue.find_by_hash_tag(identifier, current_ability, @project, '!') if pull_request = issue.pull_request title = "#{PullRequest.model_name.human}: #{pull_request.title}" - link_to(identifier, project_pull_request_path(@project, pull_request), html_options.merge(title: title, class: "gfm gfm-pull_request #{html_options[:class]}")) + link_to(identifier, project_pull_request_path(pull_request.project, pull_request), html_options.merge(title: title, class: "gfm gfm-pull_request #{html_options[:class]}")) end end From ff0d5733aa768fb621f5789b8bae1dfa8299aa6d Mon Sep 17 00:00:00 2001 From: Alexander Machehin Date: Tue, 9 Apr 2013 00:45:46 +0600 Subject: [PATCH 07/13] [#19] fix error with pull request project --- lib/modules/models/markdown.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/modules/models/markdown.rb b/lib/modules/models/markdown.rb index 485e95553..9efb3eded 100644 --- a/lib/modules/models/markdown.rb +++ b/lib/modules/models/markdown.rb @@ -183,7 +183,7 @@ module Modules issue = Issue.find_by_hash_tag(identifier, current_ability, @project, '!') if pull_request = issue.pull_request title = "#{PullRequest.model_name.human}: #{pull_request.title}" - link_to(identifier, project_pull_request_path(pull_request.project, pull_request), html_options.merge(title: title, class: "gfm gfm-pull_request #{html_options[:class]}")) + link_to(identifier, project_pull_request_path(pull_request.to_project, pull_request), html_options.merge(title: title, class: "gfm gfm-pull_request #{html_options[:class]}")) end end From 923f06cc10268057ae9db37090609fe80223258c Mon Sep 17 00:00:00 2001 From: Alexander Machehin Date: Tue, 9 Apr 2013 16:25:05 +0600 Subject: [PATCH 08/13] [#19] fix undefined local variable or method 'options' --- lib/modules/models/markdown.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/modules/models/markdown.rb b/lib/modules/models/markdown.rb index 9efb3eded..0b0aad213 100644 --- a/lib/modules/models/markdown.rb +++ b/lib/modules/models/markdown.rb @@ -189,7 +189,7 @@ module Modules def reference_commit(identifier) if commit = @project.repo.commit(identifier) - link_to shortest_hash_id(@commit.id), commit_path(options[:project], @commit.id) + link_to shortest_hash_id(@commit.id), commit_path(@project, @commit.id) title = GitPresenters::CommitAsMessagePresenter.present(commit, :project => @project).caption link_to(identifier, commit_path(@project, commit), html_options.merge(title: title, class: "gfm gfm-commit #{html_options[:class]}")) end From a22be98f9b14dfffbc1d71067c40a617dfe72905 Mon Sep 17 00:00:00 2001 From: Alexander Machehin Date: Tue, 9 Apr 2013 16:46:26 +0600 Subject: [PATCH 09/13] [#19] fixed commit reference --- lib/modules/models/markdown.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/modules/models/markdown.rb b/lib/modules/models/markdown.rb index 0b0aad213..55fe6c288 100644 --- a/lib/modules/models/markdown.rb +++ b/lib/modules/models/markdown.rb @@ -189,9 +189,10 @@ module Modules def reference_commit(identifier) if commit = @project.repo.commit(identifier) - link_to shortest_hash_id(@commit.id), commit_path(@project, @commit.id) - title = GitPresenters::CommitAsMessagePresenter.present(commit, :project => @project).caption - link_to(identifier, commit_path(@project, commit), html_options.merge(title: title, class: "gfm gfm-commit #{html_options[:class]}")) + link_to shortest_hash_id(commit.id), commit_path(@project, commit.id) + title = GitPresenters::CommitAsMessagePresenter.present(commit, :project => @project) do |presenter| + link_to(identifier, commit_path(@project, commit), html_options.merge(title: presenter.caption, class: "gfm gfm-commit #{html_options[:class]}")) + end end end end From 09acc77059ad38fd0695f55ce2829fa0d1de4071 Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Tue, 9 Apr 2013 15:44:43 +0400 Subject: [PATCH 10/13] #79: update advisory.en.yml --- config/locales/models/advisory.en.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/locales/models/advisory.en.yml b/config/locales/models/advisory.en.yml index fe3e1a16f..db8ccbef4 100644 --- a/config/locales/models/advisory.en.yml +++ b/config/locales/models/advisory.en.yml @@ -1,7 +1,7 @@ en: layout: advisories: - atom_header: Advisories + atom_title: Advisories list_header: Advisories form_header: New advisory project_name: Project From 50235207a0124296fd62eecc6261c4b195dc4871 Mon Sep 17 00:00:00 2001 From: Alexander Machehin Date: Tue, 9 Apr 2013 17:47:45 +0600 Subject: [PATCH 11/13] [#19] fixed error with outdated commit reference --- .../git_presenters/commit_as_message_presenter.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/presenters/git_presenters/commit_as_message_presenter.rb b/app/presenters/git_presenters/commit_as_message_presenter.rb index 2d611d04e..26bc17c7b 100644 --- a/app/presenters/git_presenters/commit_as_message_presenter.rb +++ b/app/presenters/git_presenters/commit_as_message_presenter.rb @@ -13,16 +13,16 @@ class GitPresenters::CommitAsMessagePresenter < ApplicationPresenter else opts[:project] end - if @project - commit = commit || @project.repo.commit(comment.created_from_commit_hash.to_s(16)) + commit = commit || @project.repo.commit(comment.created_from_commit_hash.to_s(16)) if @project + if @project && commit @committer = User.where(:email => commit.committer.email).first || commit.committer @commit_hash = commit.id @committed_date, @authored_date = commit.committed_date, commit.authored_date @commit_message = commit.message else @committer = t('layout.commits.unknown_committer') - @commit_hash = comment.created_from_commit_hash + @commit_hash = comment.created_from_commit_hash.to_s(16) @committed_date = @authored_date = comment.created_at @commit_message = t('layout.commits.deleted') end From 9ac0e46e96eca5e4e1487dfe1fbac597db65f8d0 Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Tue, 9 Apr 2013 16:18:26 +0400 Subject: [PATCH 12/13] #62: show #created_at instead of #updated_at --- app/presenters/comment_presenter.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/presenters/comment_presenter.rb b/app/presenters/comment_presenter.rb index ddab23e53..db69cf852 100644 --- a/app/presenters/comment_presenter.rb +++ b/app/presenters/comment_presenter.rb @@ -81,7 +81,7 @@ class CommentPresenter < ApplicationPresenter end def date - @date ||= I18n.l(@comment.updated_at, :format => :long) + @date ||= I18n.l(@comment.created_at, :format => :long) end def comment_id? From 0ef0e55e58ddfe469d63eab4c22ac9dc7b5aab4f Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Tue, 9 Apr 2013 16:57:29 +0400 Subject: [PATCH 13/13] #91: remove greeting from issue_assign_notification, update specs --- app/mailers/user_mailer.rb | 2 +- app/views/user_mailer/issue_assign_notification.en.haml | 6 +----- app/views/user_mailer/issue_assign_notification.ru.haml | 6 +----- spec/mailers/user_mailer_spec.rb | 4 ---- 4 files changed, 3 insertions(+), 15 deletions(-) diff --git a/app/mailers/user_mailer.rb b/app/mailers/user_mailer.rb index b79be2446..71f4d8ea9 100644 --- a/app/mailers/user_mailer.rb +++ b/app/mailers/user_mailer.rb @@ -42,7 +42,7 @@ class UserMailer < ActionMailer::Base end def issue_assign_notification(issue, user) - @user, @issue = user, issue + @issue = issue mail( :to => email_with_name(user, user.email), :subject => subject_for_issue(@issue) diff --git a/app/views/user_mailer/issue_assign_notification.en.haml b/app/views/user_mailer/issue_assign_notification.en.haml index 3aa4a049a..91522375b 100644 --- a/app/views/user_mailer/issue_assign_notification.en.haml +++ b/app/views/user_mailer/issue_assign_notification.en.haml @@ -1,7 +1,3 @@ -%p== Hello, #{@user.user_appeal}. - - %p You have been assigned to issue #{ link_to @issue.title, project_issue_url(@issue.project, @issue) } - -= render 'footer' += render 'footer' \ No newline at end of file diff --git a/app/views/user_mailer/issue_assign_notification.ru.haml b/app/views/user_mailer/issue_assign_notification.ru.haml index 5b5dcd7d5..616f120de 100644 --- a/app/views/user_mailer/issue_assign_notification.ru.haml +++ b/app/views/user_mailer/issue_assign_notification.ru.haml @@ -1,7 +1,3 @@ -%p== Здравствуйте, #{@user.user_appeal}. - - %p Вам была назначена задача #{ link_to @issue.title, project_issue_url(@issue.project, @issue) } - -= render 'footer' += render 'footer' \ No newline at end of file diff --git a/spec/mailers/user_mailer_spec.rb b/spec/mailers/user_mailer_spec.rb index 95b8fd7f8..72c8674ec 100644 --- a/spec/mailers/user_mailer_spec.rb +++ b/spec/mailers/user_mailer_spec.rb @@ -64,10 +64,6 @@ describe UserMailer do @email.from.should == [APP_CONFIG['do-not-reply-email']] end - it 'should assign user name' do - @email.body.encoded.should match(@user.name) - end - it 'should assign issue title' do @email.body.encoded.should match(@issue.title) end