Commit 86a8796b authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Create EmailsOnPushService model

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 5ac57305
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
require_relative "project_services/assembla_service" require_relative "project_services/assembla_service"
require_relative "project_services/campfire_service" require_relative "project_services/campfire_service"
require_relative "project_services/emails_on_push_service"
require_relative "project_services/flowdock_service" require_relative "project_services/flowdock_service"
require_relative "project_services/gitlab_ci_service" require_relative "project_services/gitlab_ci_service"
require_relative "project_services/hipchat_service" require_relative "project_services/hipchat_service"
...@@ -55,6 +56,7 @@ class Project < ActiveRecord::Base ...@@ -55,6 +56,7 @@ class Project < ActiveRecord::Base
has_one :last_event, -> {order 'events.created_at DESC'}, class_name: 'Event', foreign_key: 'project_id' has_one :last_event, -> {order 'events.created_at DESC'}, class_name: 'Event', foreign_key: 'project_id'
has_one :gitlab_ci_service, dependent: :destroy has_one :gitlab_ci_service, dependent: :destroy
has_one :campfire_service, dependent: :destroy has_one :campfire_service, dependent: :destroy
has_one :emails_on_push_service, dependent: :destroy
has_one :pivotaltracker_service, dependent: :destroy has_one :pivotaltracker_service, dependent: :destroy
has_one :hipchat_service, dependent: :destroy has_one :hipchat_service, dependent: :destroy
has_one :flowdock_service, dependent: :destroy has_one :flowdock_service, dependent: :destroy
...@@ -244,7 +246,7 @@ class Project < ActiveRecord::Base ...@@ -244,7 +246,7 @@ class Project < ActiveRecord::Base
end end
def available_services_names def available_services_names
%w(gitlab_ci campfire hipchat pivotaltracker flowdock assembla) %w(gitlab_ci campfire hipchat pivotaltracker flowdock assembla emails_on_push)
end end
def gitlab_ci? def gitlab_ci?
......
# == Schema Information
#
# Table name: services
#
# id :integer not null, primary key
# type :string(255)
# title :string(255)
# token :string(255)
# project_id :integer not null
# created_at :datetime not null
# updated_at :datetime not null
# active :boolean default(FALSE), not null
# project_url :string(255)
# subdomain :string(255)
# room :string(255)
#
class EmailsOnPushService < Service
attr_accessible :recipients
validates :recipients, presence: true, if: :activated?
def title
'Emails on push'
end
def description
'Send emails to recipients on push'
end
def to_param
'emails_on_push'
end
def execute
true
end
def fields
[
{ type: 'textarea', name: 'recipients', placeholder: 'Recipients' },
]
end
end
class AddRecipientsToService < ActiveRecord::Migration
def change
add_column :services, :recipients, :text
end
end
...@@ -11,7 +11,10 @@ ...@@ -11,7 +11,10 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20131214224427) do ActiveRecord::Schema.define(version: 20131217102743) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
create_table "broadcast_messages", force: true do |t| create_table "broadcast_messages", force: true do |t|
t.text "message", null: false t.text "message", null: false
...@@ -102,8 +105,8 @@ ActiveRecord::Schema.define(version: 20131214224427) do ...@@ -102,8 +105,8 @@ ActiveRecord::Schema.define(version: 20131214224427) do
t.string "title" t.string "title"
t.datetime "created_at", null: false t.datetime "created_at", null: false
t.datetime "updated_at", null: false t.datetime "updated_at", null: false
t.text "st_commits", limit: 2147483647 t.text "st_commits"
t.text "st_diffs", limit: 2147483647 t.text "st_diffs"
t.integer "milestone_id" t.integer "milestone_id"
t.string "state" t.string "state"
t.string "merge_status" t.string "merge_status"
...@@ -219,13 +222,14 @@ ActiveRecord::Schema.define(version: 20131214224427) do ...@@ -219,13 +222,14 @@ ActiveRecord::Schema.define(version: 20131214224427) do
t.string "project_url" t.string "project_url"
t.string "subdomain" t.string "subdomain"
t.string "room" t.string "room"
t.text "recipients"
end end
add_index "services", ["project_id"], name: "index_services_on_project_id", using: :btree add_index "services", ["project_id"], name: "index_services_on_project_id", using: :btree
create_table "snippets", force: true do |t| create_table "snippets", force: true do |t|
t.string "title" t.string "title"
t.text "content", limit: 2147483647 t.text "content"
t.integer "author_id", null: false t.integer "author_id", null: false
t.integer "project_id" t.integer "project_id"
t.datetime "created_at", null: false t.datetime "created_at", null: false
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment