diff --git a/Gemfile b/Gemfile
index 248704ebd..048bda1da 100644
--- a/Gemfile
+++ b/Gemfile
@@ -53,7 +53,7 @@ end
gem 'newrelic_rpm'
group :development do
- # gem 'letter_opener'
+ gem 'mailcatcher' # 'letter_opener'
gem 'rails3-generators'
gem 'web-app-theme'
gem 'hpricot'
diff --git a/Gemfile.lock b/Gemfile.lock
index d71c4ed97..1c497b240 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -85,6 +85,7 @@ GEM
diff-lcs (1.1.3)
erubis (2.6.6)
abstract (>= 1.0.0)
+ eventmachine (0.12.10)
expression_parser (0.9.0)
factory_girl (2.3.2)
activesupport
@@ -121,6 +122,16 @@ GEM
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
+ mailcatcher (0.2.4)
+ eventmachine
+ haml
+ i18n
+ json
+ mail
+ sinatra
+ skinny (>= 0.1.2)
+ sqlite3-ruby
+ thin
meta-tags (1.2.4)
actionpack
mime-types (1.17.2)
@@ -212,7 +223,17 @@ GEM
sinatra (1.2.8)
rack (~> 1.1)
tilt (>= 1.2.2, < 2.0)
+ skinny (0.2.0)
+ eventmachine (~> 0.12)
+ thin (~> 1.2)
+ sqlite3 (1.3.5)
+ sqlite3-ruby (1.3.3)
+ sqlite3 (>= 1.3.3)
state_machine (1.1.2)
+ thin (1.3.1)
+ daemons (>= 1.0.9)
+ eventmachine (>= 0.12.6)
+ rack (>= 1.0.0)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
@@ -260,6 +281,7 @@ DEPENDENCIES
hirb
hpricot
jammit
+ mailcatcher
meta-tags (~> 1.2.4)
newrelic_rpm
omniauth (~> 1.0.1)
diff --git a/app/mailers/user_mailer.rb b/app/mailers/user_mailer.rb
index 4fcc5488b..6609ac427 100644
--- a/app/mailers/user_mailer.rb
+++ b/app/mailers/user_mailer.rb
@@ -33,4 +33,9 @@ class UserMailer < ActionMailer::Base
format.html
end
end
+
+ def invite_approve_notification(register_request)
+ @register_request = register_request
+ mail :to => register_request.email, :subject => I18n.t("notifications.subjects.invite_approve_notification")
+ end
end
diff --git a/app/models/register_request.rb b/app/models/register_request.rb
index 50203ba0c..a0299556f 100644
--- a/app/models/register_request.rb
+++ b/app/models/register_request.rb
@@ -5,14 +5,21 @@ class RegisterRequest < ActiveRecord::Base
scope :approved, where(:approved => true)
scope :unprocessed, where(:approved => false, :rejected => false)
- before_create :generate_token
+ # before_create :generate_token
+ before_update :invite_approve_notification
- validates :name, :presence => true
validates :email, :presence => true, :uniqueness => {:case_sensitive => false}, :format => { :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i }
protected
- def generate_token
- self.token = Digest::SHA1.hexdigest(name + email + Time.now.to_s + rand.to_s)
+ def generate_token
+ self.token = Digest::SHA1.hexdigest(name + email + Time.now.to_s + rand.to_s)
+ end
+
+ def invite_approve_notification
+ if approved_changed? and approved == true
+ generate_token
+ UserMailer.invite_approve_notification(self).deliver
end
+ end
end
diff --git a/app/views/register_requests/index.html.haml b/app/views/register_requests/index.html.haml
index 4720b8c83..a860887aa 100644
--- a/app/views/register_requests/index.html.haml
+++ b/app/views/register_requests/index.html.haml
@@ -15,13 +15,17 @@
%th
%th= t("activerecord.attributes.register_request.name")
%th= t("activerecord.attributes.register_request.email")
+ %th= t("activerecord.attributes.register_request.interest")
+ %th= t("activerecord.attributes.register_request.more")
%th= t("activerecord.attributes.register_request.created_at")
- %th.last
+ %th
- @register_requests.each do |request|
%tr{:class => cycle("odd", "even")}
%td= check_box_tag 'request_ids[]', request.id
%td= request.name
%td= request.email
+ %td= request.interest
+ %td= request.more
%td= request.created_at
%td
= link_to t("layout.approve"), register_request_approve_path(request) if can? :approve, request
diff --git a/app/views/user_mailer/invite_approve_notification.html.haml b/app/views/user_mailer/invite_approve_notification.html.haml
new file mode 100644
index 000000000..d669eb178
--- /dev/null
+++ b/app/views/user_mailer/invite_approve_notification.html.haml
@@ -0,0 +1,7 @@
+%p== Здравствуйте, #{@register_request.name}.
+
+%p
+ Вы приглашены в проект ABF. Чтобы зарегистрироваться перейдите по
+ = link_to 'ссылке', new_user_registration_url(:invitation_token => @register_request.token)
+
+%p== Команда поддержки «ROSA Build System»
diff --git a/config/environments/development.rb b/config/environments/development.rb
index 3e4c691ae..38b0372c3 100644
--- a/config/environments/development.rb
+++ b/config/environments/development.rb
@@ -16,6 +16,8 @@ Rosa::Application.configure do
# Don't care if the mailer can't send
config.action_mailer.raise_delivery_errors = false
+ config.action_mailer.delivery_method = :smtp # :letter_opener
+ config.action_mailer.smtp_settings = { :host => "localhost", :port => 1025 }
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
# Print deprecation notices to the Rails logger
diff --git a/config/locales/en.yml b/config/locales/en.yml
index d864d5797..18777b03d 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -946,6 +946,7 @@ en:
new_user_notification: Registered on project «%{ project_name }»
issue_assign_notification: New task assigned
new_commit_comment_notification: New comment to commit
+ invite_approve_notification: Invitation to ABF
project:
category_id: Category
diff --git a/config/locales/ru.yml b/config/locales/ru.yml
index c165f173a..e156c522f 100644
--- a/config/locales/ru.yml
+++ b/config/locales/ru.yml
@@ -793,3 +793,4 @@ ru:
new_user_notification: Регистрация на проекте «%{ project_name }»
issue_assign_notification: Вам назначили задачу
new_commit_comment_notification: Новый комментарий к коммиту
+ invite_approve_notification: Приглашение в ABF
diff --git a/db/migrate/20120210141153_add_more_fields_to_register_requests.rb b/db/migrate/20120210141153_add_more_fields_to_register_requests.rb
new file mode 100644
index 000000000..cbe0dc71a
--- /dev/null
+++ b/db/migrate/20120210141153_add_more_fields_to_register_requests.rb
@@ -0,0 +1,11 @@
+class AddMoreFieldsToRegisterRequests < ActiveRecord::Migration
+ def self.up
+ add_column :register_requests, :interest, :string
+ add_column :register_requests, :more, :text
+ end
+
+ def self.down
+ remove_column :register_requests, :interest
+ remove_column :register_requests, :more
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 33856c334..9e4ecacb8 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20120209135822) do
+ActiveRecord::Schema.define(:version => 20120210141153) do
create_table "arches", :force => true do |t|
t.string "name", :null => false
@@ -90,12 +90,12 @@ ActiveRecord::Schema.define(:version => 20120209135822) do
end
create_table "comments", :force => true do |t|
- t.string "commentable_id"
t.string "commentable_type"
t.integer "user_id"
t.text "body"
t.datetime "created_at"
t.datetime "updated_at"
+ t.decimal "commentable_id", :precision => 50, :scale => 0
end
create_table "containers", :force => true do |t|
@@ -117,6 +117,7 @@ ActiveRecord::Schema.define(:version => 20120209135822) do
t.string "locked_by"
t.datetime "created_at"
t.datetime "updated_at"
+ t.string "queue"
end
add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority"
@@ -253,15 +254,15 @@ ActiveRecord::Schema.define(:version => 20120209135822) do
t.text "description"
t.string "ancestry"
t.boolean "has_issues", :default => true
- t.boolean "has_wiki", :default => false
t.string "srpm_file_name"
t.string "srpm_content_type"
t.integer "srpm_file_size"
t.datetime "srpm_updated_at"
+ t.boolean "has_wiki", :default => false
end
add_index "projects", ["category_id"], :name => "index_projects_on_category_id"
- add_index "projects", ["owner_id"], :name => "index_projects_on_name_and_owner_id_and_owner_type", :unique => true
+ add_index "projects", ["owner_id"], :name => "index_projects_on_name_and_owner_id_and_owner_type", :unique => true, :case_sensitive => false
create_table "register_requests", :force => true do |t|
t.string "name"
@@ -271,9 +272,12 @@ ActiveRecord::Schema.define(:version => 20120209135822) do
t.boolean "rejected", :default => false
t.datetime "created_at"
t.datetime "updated_at"
+ t.string "interest"
+ t.text "more"
end
add_index "register_requests", ["email"], :name => "index_register_requests_on_email", :unique => true, :case_sensitive => false
+ add_index "register_requests", ["token"], :name => "index_register_requests_on_token", :unique => true, :case_sensitive => false
create_table "relations", :force => true do |t|
t.integer "object_id"
@@ -335,7 +339,6 @@ ActiveRecord::Schema.define(:version => 20120209135822) do
t.string "email", :default => "", :null => false
t.string "encrypted_password", :limit => 128, :default => "", :null => false
t.string "reset_password_token"
- t.datetime "reset_password_sent_at"
t.datetime "remember_created_at"
t.datetime "created_at"
t.datetime "updated_at"
@@ -343,6 +346,7 @@ ActiveRecord::Schema.define(:version => 20120209135822) do
t.string "uname"
t.string "role"
t.string "language", :default => "en"
+ t.datetime "reset_password_sent_at"
t.integer "own_projects_count", :default => 0, :null => false
end
diff --git a/public/invite.html b/public/invite.html
index 32ac74325..32141fb72 100644
--- a/public/invite.html
+++ b/public/invite.html
@@ -3,7 +3,7 @@
Сборочная среда
-
+
@@ -24,11 +24,12 @@
-
Здравствуйте, вы попали на страницу нашего нового сервиса ABF, который сейчас проходит тестирование.
- Это проект универсального build-сервера ABF, цель которого — автоматизировать согласование зависимостей при пересборке пакетов, облегчить работу билд-менеджеров, гарантировать, что все пакеты в образе собраны без конфликтов друг с другом.
- FAQ
- Документация
- Обсуждение
+
+ Приветствуем Вас!
+ Вы находитесь на странице размещения заявок на участие в бета-тестировании сборочного сервиса ABF компании РОСА.
+ В первую очередь одобряются заявки от потенциальных майнтейнеров и представителей дистрибутивных команд.
+ Ознакомиться с документацией можно здесь .
+ Мы будем рады ответить на Ваши вопросы на форуме проекта.
@@ -37,13 +38,11 @@
+
Хочу стать бета-тестером ABF!
+