From 5e8244d50397e682068617137f41d0439d109f04 Mon Sep 17 00:00:00 2001
From: Cristian Mircea Messel
Date: Sat, 26 Apr 2014 04:03:58 +0300
Subject: [PATCH 001/415] add missing self for consistency within class
---
app/models/project.rb | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/app/models/project.rb b/app/models/project.rb
index 6e5afb8a..0fef0787 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -114,10 +114,10 @@ def tip_for commit
end
# create tip
- tip = tips.create({ user: user,
- amount: amount,
- commit: commit.sha,
- commit_message: commit.commit.message })
+ tip = self.tips.create({ user: user,
+ amount: amount,
+ commit: commit.sha,
+ commit_message: commit.commit.message })
tip.notify_user
@@ -172,11 +172,11 @@ def update_info
end
def amount_to_pay
- tips.to_pay.sum(:amount)
+ self.tips.to_pay.sum(:amount)
end
def has_undecided_tips?
- tips.undecided.any?
+ self.tips.undecided.any?
end
def commit_url(commit)
From 5d1480c04fc9846aff1692377708f70bc7c53fd6 Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Fri, 25 Jul 2014 14:00:50 +0800
Subject: [PATCH 002/415] users can change their display_name
---
app/controllers/users_controller.rb | 2 +-
app/models/user.rb | 4 ++--
app/views/layouts/application.html.haml | 2 +-
app/views/projects/show.html.haml | 4 ++--
app/views/tips/index.html.haml | 6 +++---
app/views/user_mailer/check_bitcoin_address.html.haml | 2 +-
app/views/user_mailer/new_tip.html.haml | 2 +-
app/views/users/index.html.haml | 4 ++--
app/views/users/show.html.haml | 5 +++--
config/locales/en.yml | 3 ++-
db/migrate/20140725054216_add_display_name_to_users.rb | 5 +++++
db/schema.rb | 3 ++-
spec/mailers/user_mailer_spec.rb | 6 +++---
spec/models/user_spec.rb | 6 +++---
14 files changed, 31 insertions(+), 23 deletions(-)
create mode 100644 db/migrate/20140725054216_add_display_name_to_users.rb
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index b60d16f5..f3e5a8db 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -36,7 +36,7 @@ def login
private
def users_params
- params.require(:user).permit(:bitcoin_address, :password, :password_confirmation, :unsubscribed)
+ params.require(:user).permit(:bitcoin_address, :password, :password_confirmation, :unsubscribed, :display_name)
end
def load_user
diff --git a/app/models/user.rb b/app/models/user.rb
index e88fdf25..915dd0ff 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -24,8 +24,8 @@ def balance
tips.decided.unpaid.sum(:amount)
end
- def full_name
- name.presence || nickname.presence || email
+ def display_name
+ attributes['display_name'].presence || name.presence || nickname.presence || email
end
def subscribed?
diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml
index aba3e447..64551ad7 100644
--- a/app/views/layouts/application.html.haml
+++ b/app/views/layouts/application.html.haml
@@ -35,7 +35,7 @@
%div.pull-right
%small
- if current_user
- = current_user.full_name
+ = current_user.display_name
\/
= link_to btc_human(current_user.balance), current_user
\/
diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml
index 6b70cf1e..19a1ac34 100644
--- a/app/views/projects/show.html.haml
+++ b/app/views/projects/show.html.haml
@@ -64,9 +64,9 @@
%li
= l tip.created_at, format: :short
- if tip.user.nickname.blank?
- = tip.user.full_name
+ = tip.user.display_name
- else
- = link_to tip.user.full_name, "https://github.com/#{tip.user.nickname}", target: '_blank'
+ = link_to tip.user.display_name, "https://github.com/#{tip.user.nickname}", target: '_blank'
- if tip.decided?
= raw t('.received', amount: btc_human(tip.amount))
- else
diff --git a/app/views/tips/index.html.haml b/app/views/tips/index.html.haml
index 68ed00c7..3d5b5082 100644
--- a/app/views/tips/index.html.haml
+++ b/app/views/tips/index.html.haml
@@ -2,7 +2,7 @@
- if @project
= raw t('.project_tips', project: link_to(@project.full_name, pretty_project_path(@project)))
- elsif @user
- = raw t('.user_tips', user: link_to(@user.full_name, @user))
+ = raw t('.user_tips', user: link_to(@user.display_name, @user))
- else
= t('.tips')
%p
@@ -24,9 +24,9 @@
- unless @user
%td
- if tip.user.nickname.blank?
- = tip.user.full_name
+ = tip.user.display_name
- else
- = link_to tip.user.full_name, "https://github.com/#{tip.user.nickname}", target: '_blank'
+ = link_to tip.user.display_name, "https://github.com/#{tip.user.nickname}", target: '_blank'
- unless @project
%td= link_to tip.project.full_name, tip.project
%td= link_to tip.commit[0..6], "https://github.com/#{tip.project.full_name}/commit/#{tip.commit}", target: :blank
diff --git a/app/views/user_mailer/check_bitcoin_address.html.haml b/app/views/user_mailer/check_bitcoin_address.html.haml
index 56adfce6..5d19ec4a 100644
--- a/app/views/user_mailer/check_bitcoin_address.html.haml
+++ b/app/views/user_mailer/check_bitcoin_address.html.haml
@@ -1,4 +1,4 @@
-%h4 Hello, #{@user.full_name}!
+%h4 Hello, #{@user.display_name}!
%p Recently, we discovered a security breach in our system and it's possible that someone changed your Bitcoin address. Please check it:
diff --git a/app/views/user_mailer/new_tip.html.haml b/app/views/user_mailer/new_tip.html.haml
index 52e21d40..9d92730c 100644
--- a/app/views/user_mailer/new_tip.html.haml
+++ b/app/views/user_mailer/new_tip.html.haml
@@ -1,4 +1,4 @@
-%h4 Hello, #{@user.full_name}!
+%h4 Hello, #{@user.display_name}!
%p You were tipped #{btc_human @tip.amount} for your commit on Project #{@tip.project.full_name}. Please, log in and tell us your bitcoin address to get it.
diff --git a/app/views/users/index.html.haml b/app/views/users/index.html.haml
index ba7b0b18..23b89916 100644
--- a/app/views/users/index.html.haml
+++ b/app/views/users/index.html.haml
@@ -11,9 +11,9 @@
%tr
%td
- if user.nickname.blank?
- = user.full_name
+ = user.display_name
- else
- = link_to user.full_name, "https://github.com/#{user.nickname}", target: '_blank'
+ = link_to user.display_name, "https://github.com/#{user.nickname}", target: '_blank'
%td= user.commits_count
%td= btc_human user.withdrawn_amount
= paginate @users
diff --git a/app/views/users/show.html.haml b/app/views/users/show.html.haml
index 9bc44a6d..41e3ff16 100644
--- a/app/views/users/show.html.haml
+++ b/app/views/users/show.html.haml
@@ -1,4 +1,4 @@
-%h1= @user.name
+%h1= @user.display_name
%p
%strong= t('.balance')
%p
@@ -21,10 +21,11 @@
%p= @user.email
= twitter_bootstrap_form_for @user do |f|
= f.text_field :bitcoin_address, placeholder: t('.bitcoin_address_placeholder')
+ = f.text_field :display_name
- if f.object.bitcoin_address.blank?
= f.check_box :unsubscribed, t('.notify'), { checked: !f.object.unsubscribed? }, '0', '1'
%br
- = f.submit t('.submit_bitcoin_address')
+ = f.submit t('.submit_user')
%br
%p
%strong= link_to t('.change_password'), '#new_password_form', data: {toggle: "collapse"}
diff --git a/config/locales/en.yml b/config/locales/en.yml
index d3395633..3ae10a18 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -146,7 +146,7 @@ en:
received: "%{time} received %{amount} for commit %{commit} in %{project}"
bitcoin_address_placeholder: Your bitcoin address
notify: Notify me about new tips (no more than one email per month)
- submit_bitcoin_address: Update Bitcoin address
+ submit_user: Update user info
change_password: Change your password
submit_password: Change my password
withdrawals:
@@ -194,3 +194,4 @@ en:
bitcoin_address: Bitcoin address
password: Password
password_confirmation: Password confirmation
+ display_name: Display name
diff --git a/db/migrate/20140725054216_add_display_name_to_users.rb b/db/migrate/20140725054216_add_display_name_to_users.rb
new file mode 100644
index 00000000..9e783036
--- /dev/null
+++ b/db/migrate/20140725054216_add_display_name_to_users.rb
@@ -0,0 +1,5 @@
+class AddDisplayNameToUsers < ActiveRecord::Migration
+ def change
+ add_column :users, :display_name, :string
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 81ba432b..5a0eaaaf 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 20140722092532) do
+ActiveRecord::Schema.define(version: 20140725054216) do
create_table "collaborators", force: true do |t|
t.integer "project_id"
@@ -121,6 +121,7 @@
t.datetime "confirmation_sent_at"
t.string "confirmation_token"
t.string "unconfirmed_email"
+ t.string "display_name"
end
add_index "users", ["email"], name: "index_users_on_email", unique: true
diff --git a/spec/mailers/user_mailer_spec.rb b/spec/mailers/user_mailer_spec.rb
index ea39c905..6e21c8a7 100644
--- a/spec/mailers/user_mailer_spec.rb
+++ b/spec/mailers/user_mailer_spec.rb
@@ -2,7 +2,7 @@
describe UserMailer do
describe 'new_tip' do
- let(:user) { mock_model User, name: 'kd', email: 'kd.engineer@yahoo.co.in', full_name: 'kuldeep aggarwal', login_token: 'my login token', balance: 10 }
+ let(:user) { mock_model User, name: 'kd', email: 'kd.engineer@yahoo.co.in', display_name: 'kuldeep aggarwal', login_token: 'my login token', balance: 10 }
let(:project) { mock_model Project, full_name: 'logger-extension' }
let(:tip) { mock_model Tip, amount: 0.0001, project: project }
let(:mail) { UserMailer.new_tip(user, tip) }
@@ -19,8 +19,8 @@
expect(mail.from).to eq ['no-reply@tip4commit.com']
end
- it 'assigns user\'s full_name' do
- expect(mail.body.encoded).to match(user.full_name)
+ it 'assigns user\'s display_name' do
+ expect(mail.body.encoded).to match(user.display_name)
end
it 'assigns users\' balance' do
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index 8f646a9f..c95a5918 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -6,21 +6,21 @@
describe 'full_name' do
context 'when name is present' do
it 'returns name' do
- expect(user.full_name).to eq(user.name)
+ expect(user.display_name).to eq(user.name)
end
end
context 'when name is absent and nickname is present' do
it 'returns nickname' do
user.name = nil
- expect(user.full_name).to eq(user.nickname)
+ expect(user.display_name).to eq(user.nickname)
end
end
context 'when name and nickname is absent and email is absent' do
it 'returns email' do
user.name = user.nickname = nil
- expect(user.full_name).to eq(user.email)
+ expect(user.display_name).to eq(user.email)
end
end
end
From e7ca64ae86a241a0e7146d50c2eaec99f8e1f390 Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Mon, 28 Jul 2014 21:40:43 +0800
Subject: [PATCH 003/415] rescued from Net::SMTPServerBusy
---
app/models/tip.rb | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/app/models/tip.rb b/app/models/tip.rb
index b7594537..9a775e9b 100644
--- a/app/models/tip.rb
+++ b/app/models/tip.rb
@@ -108,8 +108,12 @@ def amount_percentage=(percentage)
def notify_user
if amount and amount > 0 and user.bitcoin_address.blank? and !user.unsubscribed
if user.notified_at.nil? or user.notified_at < 30.days.ago
- UserMailer.new_tip(user, self).deliver
- user.touch :notified_at
+ begin
+ UserMailer.new_tip(user, self).deliver
+ user.touch :notified_at
+ rescue Net::SMTPServerBusy => e
+ Rails.logger.info "Error: #{e.class}: #{e.message}"
+ end
end
end
end
From d0a69b87bd37d856d3e32eedc52b19096c8561d4 Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Mon, 4 Aug 2014 20:58:04 +0800
Subject: [PATCH 004/415] uses https in notification emails
---
config/environments/production.rb | 1 +
config/environments/test.rb | 2 +-
spec/mailers/user_mailer_spec.rb | 4 ++++
3 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/config/environments/production.rb b/config/environments/production.rb
index d1485d96..7dfac981 100644
--- a/config/environments/production.rb
+++ b/config/environments/production.rb
@@ -68,6 +68,7 @@
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true
+ config.action_mailer.default_url_options = { :host => 'tip4commit.com', :protocol => 'https' }
config.action_mailer.default_options = {from: 'no-reply@' + CONFIG['smtp_settings']['domain'] }
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
diff --git a/config/environments/test.rb b/config/environments/test.rb
index a696349d..359f1c92 100644
--- a/config/environments/test.rb
+++ b/config/environments/test.rb
@@ -31,7 +31,7 @@
# ActionMailer::Base.deliveries array.
config.action_mailer.delivery_method = :test
config.action_mailer.raise_delivery_errors = false
- config.action_mailer.default_url_options = { :host => 'tip4commit.com' }
+ config.action_mailer.default_url_options = { :host => 'tip4commit.com', :protocol => 'https' }
config.action_mailer.default_options = { from: 'no-reply@tip4commit.com' }
# Print deprecation notices to the stderr.
diff --git a/spec/mailers/user_mailer_spec.rb b/spec/mailers/user_mailer_spec.rb
index 6e21c8a7..4b0f1308 100644
--- a/spec/mailers/user_mailer_spec.rb
+++ b/spec/mailers/user_mailer_spec.rb
@@ -26,5 +26,9 @@
it 'assigns users\' balance' do
expect(mail.body.encoded).to match("Please, log in and tell us your bitcoin address to get it.
\r\nYour current balance is 0.00000010 Ƀ")
end
+
+ it 'useses secure protocol for links' do
+ expect(mail.body.encoded).to match('https')
+ end
end
end
From a8eb98a8719eba49a2f8f169180267d536af41d8 Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Mon, 4 Aug 2014 21:46:18 +0800
Subject: [PATCH 005/415] temporarily proxying coingiving
---
README.md | 4 ++--
app/assets/javascripts/application.js.coffee | 2 +-
app/views/projects/show.html.haml | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/README.md b/README.md
index 8fd3cf95..21fea313 100644
--- a/README.md
+++ b/README.md
@@ -1,11 +1,11 @@
Tip4commit
==========
-[](http://tip4commit.com/projects/307) [](https://travis-ci.org/tip4commit/tip4commit)
+[](https://tip4commit.com/projects/307) [](https://travis-ci.org/tip4commit/tip4commit)
Donate bitcoins to open source projects or make commits and get tips for it.
-Official site: http://tip4commit.com/
+Official site: https://tip4commit.com/
Forum thread: https://bitcointalk.org/index.php?topic=315802
diff --git a/app/assets/javascripts/application.js.coffee b/app/assets/javascripts/application.js.coffee
index 23595f33..a2a76b69 100644
--- a/app/assets/javascripts/application.js.coffee
+++ b/app/assets/javascripts/application.js.coffee
@@ -15,4 +15,4 @@ $(document).on "ready page:change", ->
window.addthis_share = null
# Finally, load addthis
- $.getScript "http://s7.addthis.com/js/250/addthis_widget.js#pubid=ra-526425ac0ea0780b"
+ $.getScript "//s7.addthis.com/js/250/addthis_widget.js#pubid=ra-526425ac0ea0780b"
diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml
index 19a1ac34..95b1d908 100644
--- a/app/views/projects/show.html.haml
+++ b/app/views/projects/show.html.haml
@@ -18,7 +18,7 @@
.panel-heading
%h4.panel-title= t('.project_sponsors')
.panel-body
- %iframe{ src: "http://coingiving.com/project_sponsors?url=#{project_url @project}", scrolling: "no", style: 'width:100%; height:500px; border:0px; padding:0;overflow:hidden'}
+ %iframe{ src: "/coingiving/project_sponsors?url=#{project_url @project}", scrolling: "no", style: 'width:100%; height:500px; border:0px; padding:0;overflow:hidden'}
.hidden
%span(data-coingiving="title")= "[tip4commit] " + @project.full_name
%span(data-coingiving="description")= @project.description
From e5066bc22f12f9de2c2fb9e3ca4ab75175409114 Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Tue, 5 Aug 2014 12:29:33 +0800
Subject: [PATCH 006/415] attemp to use soingiving with self-signed certificate
---
app/views/projects/show.html.haml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml
index 95b1d908..3ac725a8 100644
--- a/app/views/projects/show.html.haml
+++ b/app/views/projects/show.html.haml
@@ -18,7 +18,7 @@
.panel-heading
%h4.panel-title= t('.project_sponsors')
.panel-body
- %iframe{ src: "/coingiving/project_sponsors?url=#{project_url @project}", scrolling: "no", style: 'width:100%; height:500px; border:0px; padding:0;overflow:hidden'}
+ %iframe{ src: "//coingiving.com/project_sponsors?url=#{project_url @project}", scrolling: "no", style: 'width:100%; height:500px; border:0px; padding:0;overflow:hidden'}
.hidden
%span(data-coingiving="title")= "[tip4commit] " + @project.full_name
%span(data-coingiving="description")= @project.description
From b60cf08fcfd6fcf7b828fd3b2c6eab066c79fc76 Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Thu, 7 Aug 2014 09:18:01 +0800
Subject: [PATCH 007/415] always use https project url
---
app/views/projects/show.html.haml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml
index 3ac725a8..1c7194f9 100644
--- a/app/views/projects/show.html.haml
+++ b/app/views/projects/show.html.haml
@@ -18,7 +18,7 @@
.panel-heading
%h4.panel-title= t('.project_sponsors')
.panel-body
- %iframe{ src: "//coingiving.com/project_sponsors?url=#{project_url @project}", scrolling: "no", style: 'width:100%; height:500px; border:0px; padding:0;overflow:hidden'}
+ %iframe{ src: "//coingiving.com/?url=#{project_url(@project, :protocol => 'https')}", scrolling: "no", style: 'width:100%; height:500px; border:0px; padding:0;overflow:hidden'}
.hidden
%span(data-coingiving="title")= "[tip4commit] " + @project.full_name
%span(data-coingiving="description")= @project.description
From 203e1be924a70db051f3816ffe07a89d8e3b444e Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Thu, 7 Aug 2014 09:22:53 +0800
Subject: [PATCH 008/415] fixed url
---
app/views/projects/show.html.haml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml
index 1c7194f9..62e385ed 100644
--- a/app/views/projects/show.html.haml
+++ b/app/views/projects/show.html.haml
@@ -18,7 +18,7 @@
.panel-heading
%h4.panel-title= t('.project_sponsors')
.panel-body
- %iframe{ src: "//coingiving.com/?url=#{project_url(@project, :protocol => 'https')}", scrolling: "no", style: 'width:100%; height:500px; border:0px; padding:0;overflow:hidden'}
+ %iframe{ src: "//coingiving.com/project_sponsors?url=#{project_url(@project, :protocol => 'https')}", scrolling: "no", style: 'width:100%; height:500px; border:0px; padding:0;overflow:hidden'}
.hidden
%span(data-coingiving="title")= "[tip4commit] " + @project.full_name
%span(data-coingiving="description")= @project.description
From e908efd3026b16829e98288b5f88ba4b45b4b6d3 Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Thu, 7 Aug 2014 11:18:19 +0800
Subject: [PATCH 009/415] added project deposits page
---
app/assets/javascripts/deposits.js.coffee | 3 +++
app/assets/stylesheets/deposits.css.scss | 3 +++
app/controllers/deposits_controller.rb | 17 ++++++++++++
app/helpers/deposits_helper.rb | 2 ++
app/models/deposit.rb | 9 +++++++
app/models/project.rb | 4 +--
app/views/deposits/index.html.haml | 28 ++++++++++++++++++++
app/views/projects/show.html.haml | 7 +++--
config/locales/en.yml | 14 +++++++++-
config/routes.rb | 2 ++
features/step_definitions/common.rb | 2 +-
spec/controllers/deposits_controller_spec.rb | 12 +++++++++
12 files changed, 97 insertions(+), 6 deletions(-)
create mode 100644 app/assets/javascripts/deposits.js.coffee
create mode 100644 app/assets/stylesheets/deposits.css.scss
create mode 100644 app/controllers/deposits_controller.rb
create mode 100644 app/helpers/deposits_helper.rb
create mode 100644 app/views/deposits/index.html.haml
create mode 100644 spec/controllers/deposits_controller_spec.rb
diff --git a/app/assets/javascripts/deposits.js.coffee b/app/assets/javascripts/deposits.js.coffee
new file mode 100644
index 00000000..24f83d18
--- /dev/null
+++ b/app/assets/javascripts/deposits.js.coffee
@@ -0,0 +1,3 @@
+# Place all the behaviors and hooks related to the matching controller here.
+# All this logic will automatically be available in application.js.
+# You can use CoffeeScript in this file: http://coffeescript.org/
diff --git a/app/assets/stylesheets/deposits.css.scss b/app/assets/stylesheets/deposits.css.scss
new file mode 100644
index 00000000..a47ad02e
--- /dev/null
+++ b/app/assets/stylesheets/deposits.css.scss
@@ -0,0 +1,3 @@
+// Place all the styles related to the Deposits controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
diff --git a/app/controllers/deposits_controller.rb b/app/controllers/deposits_controller.rb
new file mode 100644
index 00000000..2305f7fc
--- /dev/null
+++ b/app/controllers/deposits_controller.rb
@@ -0,0 +1,17 @@
+class DepositsController < ApplicationController
+ before_action :load_project
+
+ def index
+ if params[:project_id]
+ @deposits = @project.deposits.order(created_at: :desc).page(params[:page]).per(30)
+ else
+ @deposits = Deposit.includes(:project).order(created_at: :desc).page(params[:page]).per(30)
+ end
+ end
+
+ private
+
+ def load_project
+ super(params[:project_id]) if params[:project_id].present?
+ end
+end
diff --git a/app/helpers/deposits_helper.rb b/app/helpers/deposits_helper.rb
new file mode 100644
index 00000000..3cf0cb4a
--- /dev/null
+++ b/app/helpers/deposits_helper.rb
@@ -0,0 +1,2 @@
+module DepositsHelper
+end
diff --git a/app/models/deposit.rb b/app/models/deposit.rb
index 6dd62b74..79830947 100644
--- a/app/models/deposit.rb
+++ b/app/models/deposit.rb
@@ -1,6 +1,15 @@
class Deposit < ActiveRecord::Base
belongs_to :project
+ CONFIRMATIONS_NEEDED = 2
+
+ scope :confirmed, -> { where("confirmations >= #{CONFIRMATIONS_NEEDED}") }
+ scope :unconfirmed, -> { where("confirmations < #{CONFIRMATIONS_NEEDED}") }
+
+ def confirmed?
+ confirmations.to_i >= CONFIRMATIONS_NEEDED
+ end
+
def fee
(amount * fee_size).to_i
end
diff --git a/app/models/project.rb b/app/models/project.rb
index a5f93ba9..b9cfa394 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -126,7 +126,7 @@ def tip_for commit
end
def donated
- self.deposits.where("confirmations > 0").map(&:available_amount).sum
+ self.deposits.confirmed.map(&:available_amount).sum
end
def available_amount
@@ -134,7 +134,7 @@ def available_amount
end
def unconfirmed_amount
- self.deposits.where(:confirmations => 0).where('created_at > ?', 7.days.ago).map(&:available_amount).sum
+ self.deposits.unconfirmed.where('created_at > ?', 7.days.ago).map(&:available_amount).sum
end
def tips_paid_amount
diff --git a/app/views/deposits/index.html.haml b/app/views/deposits/index.html.haml
new file mode 100644
index 00000000..07e9da27
--- /dev/null
+++ b/app/views/deposits/index.html.haml
@@ -0,0 +1,28 @@
+%h1
+ - if @project
+ = raw t('.project_deposits', project: link_to(@project.full_name, pretty_project_path(@project)))
+ - else
+ = t('.deposits')
+%p
+ %table.table
+ %thead
+ %tr
+ %th= t('.created_at')
+ - unless @project
+ %th= t('.project')
+ %th= t('.amount')
+ %th= t('.fee')
+ %th= t('.transaction')
+ %th= t('.confirmed')
+ %tbody
+ - @deposits.each do |deposit|
+ %tr
+ %td= l deposit.created_at, format: :short
+ - unless @project
+ %td= link_to(deposit.project.full_name, deposit.project)
+ %td= btc_human deposit.amount
+ %td= btc_human deposit.fee
+ %td= link_to deposit.txid, "https://blockchain.info/tx/#{deposit.txid}", target: :blank
+ %td= deposit.confirmed? ? t('.confirmed_yes') : t('.confirmed_no')
+
+ = paginate @deposits
diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml
index 62e385ed..9cc1b089 100644
--- a/app/views/projects/show.html.haml
+++ b/app/views/projects/show.html.haml
@@ -27,7 +27,10 @@
.col-md-8
- unless @project.description.blank?
.well.well-sm= @project.description
- %h4= t('.balance')
+ %h4
+ = t('.balance')
+ - if @project.deposits.count > 0
+ %small= link_to t('.deposits'), project_deposits_path(@project)
= btc_human @project.available_amount
- if @project.hold_tips?
= t('.custom_tip_size')
@@ -58,7 +61,7 @@
%h4
=t('.last_tips')
- if @project_tips.count > 5
- = link_to t('.see_all'), project_tips_path(@project)
+ %small= link_to t('.see_all'), project_tips_path(@project)
%ul
- @recent_tips.each do |tip|
%li
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 3ae10a18..cc3a95f8 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -81,6 +81,7 @@ en:
project_sponsors: Project Sponsors
fee: "%{percentage} of deposited funds will be used to tip for new commits."
balance: Balance
+ deposits: deposits
custom_tip_size: (each new commit receives a percentage of available balance)
default_tip_size: "(each new commit receives %{percentage} of available balance)"
unconfirmed_amount: "(%{amount} unconfirmed)"
@@ -120,7 +121,7 @@ en:
tips:
index:
tips: Tips
- project_tips: "%{project} tips"
+ project_tips: '%{project} tips'
user_tips: "%{user} tips"
created_at: Created At
commiter: Commiter
@@ -133,6 +134,17 @@ en:
below_threshold: "User's balance is below withdrawal threshold"
waiting: Waiting for withdrawal
error: (error sending transaction)
+ deposits:
+ index:
+ project_deposits: '%{project} deposits'
+ deposits: Deposits
+ created_at: Created At
+ project: Project
+ amount: Amount
+ transaction: Transaction
+ confirmed: Confirmed
+ confirmed_yes: 'Yes'
+ confirmed_no: 'No'
users:
index:
title: Top Contributors
diff --git a/config/routes.rb b/config/routes.rb
index e11e8e36..f2f3be29 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -26,8 +26,10 @@
patch :decide_tip_amounts
end
resources :tips, :only => [:index]
+ resources :deposits, :only => [:index]
end
resources :tips, :only => [:index]
+ resources :deposits, :only => [:index]
resources :withdrawals, :only => [:index]
# The priority is based upon order of creation: first created -> highest priority.
diff --git a/features/step_definitions/common.rb b/features/step_definitions/common.rb
index 3f963502..633b40ec 100644
--- a/features/step_definitions/common.rb
+++ b/features/step_definitions/common.rb
@@ -27,7 +27,7 @@
end
Given(/^a deposit of "(.*?)"$/) do |arg1|
- Deposit.create!(project: @project, amount: arg1.to_d * 1e8, confirmations: 1)
+ Deposit.create!(project: @project, amount: arg1.to_d * 1e8, confirmations: 2)
end
Given(/^the last known commit is "(.*?)"$/) do |arg1|
diff --git a/spec/controllers/deposits_controller_spec.rb b/spec/controllers/deposits_controller_spec.rb
new file mode 100644
index 00000000..3180085e
--- /dev/null
+++ b/spec/controllers/deposits_controller_spec.rb
@@ -0,0 +1,12 @@
+require 'spec_helper'
+
+describe DepositsController do
+
+ describe "GET 'index'" do
+ it "returns http success" do
+ get 'index'
+ expect(response).to be_success
+ end
+ end
+
+end
From 2cec4643e237685ac3b662e5ddc0a6ec5f4afd90 Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Mon, 11 Aug 2014 11:15:14 +0800
Subject: [PATCH 010/415] send transaction only if there are more than 2 users
are waiting for withdrawals
---
lib/bitcoin_tipper.rb | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/bitcoin_tipper.rb b/lib/bitcoin_tipper.rb
index c3a3d646..f9f215dd 100644
--- a/lib/bitcoin_tipper.rb
+++ b/lib/bitcoin_tipper.rb
@@ -23,15 +23,15 @@ def self.work withdraw = true
if withdraw
Rails.logger.info "Traversing users..."
- is_sendmany_needed = false
+ users_waiting_for_withdrawal = 0
User.find_each do |user|
if user.bitcoin_address.present? && user.balance > CONFIG["min_payout"]
- is_sendmany_needed = true
+ users_waiting_for_withdrawal += 1
Rails.logger.info "Sendmany is needed"
end
end
- self.create_sendmany if is_sendmany_needed
+ self.create_sendmany if users_waiting_for_withdrawal > 2
Rails.logger.info "Traversing sendmanies..."
Sendmany.where(txid: nil).each do |sendmany|
From 5e5cfb0047f25b387fa04338a3ede5a611719ca9 Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Mon, 11 Aug 2014 11:38:47 +0800
Subject: [PATCH 011/415] configure pages count for specific repositories
---
app/services/github.rb | 3 ++-
config/config.yml.sample | 4 +++-
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/app/services/github.rb b/app/services/github.rb
index 1f03ed94..08fdd84b 100644
--- a/app/services/github.rb
+++ b/app/services/github.rb
@@ -15,7 +15,8 @@ def commits project
commits = client.commits project.full_name
last_response = client.last_response
- (CONFIG['github']['pages'].to_i - 1).times do
+ pages = (CONFIG['github']['project_pages'][project.full_name] || CONFIG['github']['pages'] || 1).to_i
+ (pages - 1).times do
if last_response.rels[:next]
last_response = last_response.rels[:next].get
commits += last_response.data
diff --git a/config/config.yml.sample b/config/config.yml.sample
index 71b5ee55..6d292b47 100644
--- a/config/config.yml.sample
+++ b/config/config.yml.sample
@@ -2,7 +2,9 @@ github:
key: "111111111111"
secret: "111111111111"
auto_paginate: false
- pages: 1
+ pages: 3
+ project_pages:
+ "torvalds/linux": 30
blockchain_info:
guid: "111111111111"
From 049521bd9d0687a00760db303c3a8e2ab0635540 Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Mon, 11 Aug 2014 11:49:11 +0800
Subject: [PATCH 012/415] typo
---
lib/bitcoin_tipper.rb | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/lib/bitcoin_tipper.rb b/lib/bitcoin_tipper.rb
index f9f215dd..0c61921a 100644
--- a/lib/bitcoin_tipper.rb
+++ b/lib/bitcoin_tipper.rb
@@ -27,11 +27,13 @@ def self.work withdraw = true
User.find_each do |user|
if user.bitcoin_address.present? && user.balance > CONFIG["min_payout"]
users_waiting_for_withdrawal += 1
- Rails.logger.info "Sendmany is needed"
+ Rails.logger.info "User ##{user.id} is waiting for withdrawal"
end
end
- self.create_sendmany if users_waiting_for_withdrawal > 2
+ if users_waiting_for_withdrawal > 2
+ self.create_sendmany
+ end
Rails.logger.info "Traversing sendmanies..."
Sendmany.where(txid: nil).each do |sendmany|
From a6cb942f2f2cee3a4369e3fcbbb8c723bd8473d3 Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Mon, 11 Aug 2014 17:41:08 +0800
Subject: [PATCH 013/415] refacotred project creation and added search
---
Gemfile | 1 +
Gemfile.lock | 6 +++
app/controllers/projects_controller.rb | 21 +++-------
app/models/project.rb | 18 +++++++++
app/services/github.rb | 29 ++++++++++++--
app/views/projects/index.html.haml | 53 ++++++++++++++------------
config/routes.rb | 3 +-
7 files changed, 87 insertions(+), 44 deletions(-)
diff --git a/Gemfile b/Gemfile
index ec2ef4b3..976f7d06 100644
--- a/Gemfile
+++ b/Gemfile
@@ -27,6 +27,7 @@ gem 'bootstrap_form', github: 'sigmike/rails-bootstrap-forms', branch: 'removed_
gem 'sdoc', group: :doc, require: false
gem 'cancancan'
gem "i18n-js"
+gem 'dusen'
group :development do
gem 'capistrano', '~> 3.0.1'
diff --git a/Gemfile.lock b/Gemfile.lock
index 06a8a32d..10d196ef 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -127,6 +127,11 @@ GEM
thread_safe (~> 0.1)
warden (~> 1.2.3)
diff-lcs (1.2.5)
+ dusen (0.4.10)
+ activerecord
+ edge_rider (>= 0.2.5)
+ edge_rider (0.3.0)
+ activerecord
erubis (2.7.0)
execjs (2.0.2)
factory_girl (4.3.0)
@@ -313,6 +318,7 @@ DEPENDENCIES
database_cleaner
debugger (~> 1.6.5)
devise (~> 3.2.2)
+ dusen
factory_girl_rails (~> 4.3.0)
haml-rails (~> 0.5.3)
i18n-js
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index 29e6f4ab..4e57506c 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -79,21 +79,12 @@ def decide_tip_amounts
end
end
- def create
- project_name = params[:full_name].
- gsub(/https?\:\/\/github.com\//, '').
- gsub(/\#.+$/, '').
- gsub(' ', '')
- client = Octokit::Client.new \
- :client_id => CONFIG['github']['key'],
- :client_secret => CONFIG['github']['secret']
- begin
- repo = client.repo project_name
- @project = Project.find_or_create_by host: "github", full_name: repo.full_name
- @project.update_repository_info repo
- redirect_to pretty_project_path(@project)
- rescue Octokit::NotFound
- redirect_to projects_path, alert: I18n.t('errors.project_not_found')
+ def search
+ if project = Project.find_or_create_by_url(params[:query])
+ redirect_to project
+ else
+ @projects = Project.search(params[:query]).page(params[:page]).per(30)
+ render :index
end
end
diff --git a/app/models/project.rb b/app/models/project.rb
index b9cfa394..c7e99b57 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -10,6 +10,13 @@ class Project < ActiveRecord::Base
validates :full_name, :github_id, uniqueness: true, presence: true
validates :host, inclusion: [ "github", "bitbucket" ], presence: true
+ search_syntax do
+ search_by :text do |scope, phrases|
+ columns = [:full_name, :host, :description, :language]
+ scope.where_like(columns => phrases)
+ end
+ end
+
# before_save :check_tips_to_pay_against_avaiable_amount
def update_repository_info repo
@@ -188,4 +195,15 @@ def check_tips_to_pay_against_avaiable_amount
raise "Not enough funds to pay the pending tips on #{inspect} (#{available_amount} < 0)"
end
end
+
+ def self.find_or_create_by_url project_url
+
+ project_name = project_url.
+ gsub(/https?\:\/\/github.com\//, '').
+ gsub(/\#.+$/, '').
+ gsub(' ', '')
+
+ Github.new.find_or_create_project project_name
+
+ end
end
diff --git a/app/services/github.rb b/app/services/github.rb
index 08fdd84b..aab9a1fe 100644
--- a/app/services/github.rb
+++ b/app/services/github.rb
@@ -27,10 +27,33 @@ def commits project
end
def repository_info project
- if project.github_id.present?
- client.get "/repositories/#{project.github_id}"
+ if project.is_a?(String)
+ client.repo project
+ elsif project.is_a?(Project)
+ if project.github_id.present?
+ client.get "/repositories/#{project.github_id}"
+ else
+ client.repo project.full_name
+ end
+ else
+ raise 'Unknown parameter class'
+ end
+ end
+
+ def find_or_create_project project_name
+ if project = Project.find_by(host: "github", full_name: project_name)
+ project
+ elsif project_name =~ /\w+\/\w+/
+ begin
+ repo = repository_info project_name
+ project = Project.find_or_create_by host: "github", full_name: repo.full_name
+ project.update_repository_info repo
+ project
+ rescue Octokit::NotFound
+ nil
+ end
else
- client.repo project.full_name
+ nil
end
end
diff --git a/app/views/projects/index.html.haml b/app/views/projects/index.html.haml
index 5d5a5478..d34bd927 100644
--- a/app/views/projects/index.html.haml
+++ b/app/views/projects/index.html.haml
@@ -1,34 +1,37 @@
%h1= t('menu.projects')
%p
- = form_tag projects_path, role: 'form', method: :post do |f|
+ = form_tag search_projects_path, role: 'form', method: :post do |f|
.form-group
.row
.col-lg-10
- = text_field_tag :full_name, '', class: 'form-control', placeholder: t('.find_project.placeholder')
+ = text_field_tag :query, '', class: 'form-control', placeholder: t('.find_project.placeholder'), :value => params[:query]
.col-lg-2
= button_tag t('.find_project.button'), class: "btn form-control btn-default"
%p
- %table.table
- %thead
- %tr
- %th= t('.repository')
- %th= t('.description')
- %th= link_to_unless_current t('.watchers'), by_watchers_projects_path
- %th= link_to_unless_current t('.balance'), projects_path
- %th
- %tbody
- - @projects.each do |project|
+ - if @projects.count > 0
+ %table.table
+ %thead
%tr
- %td
- %strong= link_to project.full_name, pretty_project_path(project)
- - if !project.source_full_name.blank?
- %br
- %nobr
- %small
- = t('.forked_from')
- = link_to project.source_full_name, project.source_github_url, target: '_blank'
- %td= project.description
- %td= project.watchers_count
- %td= btc_human project.available_amount_cache
- %td= link_to t('.support'), pretty_project_path(project), class: 'btn btn-success'
- = paginate @projects
+ %th= t('.repository')
+ %th= t('.description')
+ %th= link_to_unless_current t('.watchers'), by_watchers_projects_path
+ %th= link_to_unless_current t('.balance'), projects_path
+ %th
+ %tbody
+ - @projects.each do |project|
+ %tr
+ %td
+ %strong= link_to project.full_name, pretty_project_path(project)
+ - if !project.source_full_name.blank?
+ %br
+ %nobr
+ %small
+ = t('.forked_from')
+ = link_to project.source_full_name, project.source_github_url, target: '_blank'
+ %td= project.description
+ %td= project.watchers_count
+ %td= btc_human project.available_amount_cache
+ %td= link_to t('.support'), pretty_project_path(project), class: 'btn btn-success'
+ = paginate @projects
+ - else
+ .alert.alert-warning{role: 'alert'}= I18n.t('errors.project_not_found')
diff --git a/config/routes.rb b/config/routes.rb
index f2f3be29..86e37e4f 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -17,9 +17,10 @@
end
resources :tips, :only => [:index]
end
- resources :projects, :only => [:show, :index, :create, :edit, :update] do
+ resources :projects, :only => [:show, :index, :edit, :update] do
collection do
get 'by_watchers'
+ post 'search'
end
member do
get :decide_tip_amounts
From d55c351e6a9b7cc5286f480b952c7b95091aef00 Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Mon, 11 Aug 2014 19:53:45 +0800
Subject: [PATCH 014/415] improved project search and sorting
---
app/controllers/projects_controller.rb | 30 +++++++++++++++-----------
app/views/deposits/index.html.haml | 2 +-
app/views/projects/index.html.haml | 13 +++++------
app/views/tips/index.html.haml | 2 +-
config/locales/en.yml | 2 +-
config/routes.rb | 3 +--
6 files changed, 28 insertions(+), 24 deletions(-)
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index 4e57506c..209162d7 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -5,12 +5,16 @@ class ProjectsController < ApplicationController
before_filter :load_project, only: [:show, :edit, :update, :decide_tip_amounts]
def index
- @projects = Project.order(available_amount_cache: :desc, watchers_count: :desc, full_name: :asc).page(params[:page]).per(30)
+ @projects = Project.order(projects_order).page(params[:page]).per(30)
end
- def by_watchers
- @projects = Project.order(watchers_count: :desc, available_amount_cache: :desc, full_name: :asc).page(params[:page]).per(30)
- render "index"
+ def search
+ if project = Project.find_or_create_by_url(params[:query])
+ redirect_to pretty_project_path(project)
+ else
+ @projects = Project.search(params[:query]).order(projects_order).page(params[:page]).per(30)
+ render :index
+ end
end
# Redirect to pretty url for html format
@@ -79,15 +83,6 @@ def decide_tip_amounts
end
end
- def search
- if project = Project.find_or_create_by_url(params[:query])
- redirect_to project
- else
- @projects = Project.search(params[:query]).page(params[:page]).per(30)
- render :index
- end
- end
-
private
def load_project
@@ -104,4 +99,13 @@ def load_project
def project_params
params.require(:project).permit(:hold_tips, tipping_policies_text_attributes: [:text])
end
+
+ def projects_order
+ {
+ 'balance' => {available_amount_cache: :desc, watchers_count: :desc, full_name: :asc},
+ 'watchers' => {watchers_count: :desc, available_amount_cache: :desc, full_name: :asc},
+ 'repository' => {full_name: :asc, available_amount_cache: :desc, watchers_count: :desc},
+ 'description' => {description: :desc, available_amount_cache: :desc, watchers_count: :desc, full_name: :asc}
+ }.[](params[:order] || 'balance')
+ end
end
diff --git a/app/views/deposits/index.html.haml b/app/views/deposits/index.html.haml
index 07e9da27..d179cb56 100644
--- a/app/views/deposits/index.html.haml
+++ b/app/views/deposits/index.html.haml
@@ -19,7 +19,7 @@
%tr
%td= l deposit.created_at, format: :short
- unless @project
- %td= link_to(deposit.project.full_name, deposit.project)
+ %td= link_to(deposit.project.full_name, pretty_project_path(deposit.project))
%td= btc_human deposit.amount
%td= btc_human deposit.fee
%td= link_to deposit.txid, "https://blockchain.info/tx/#{deposit.txid}", target: :blank
diff --git a/app/views/projects/index.html.haml b/app/views/projects/index.html.haml
index d34bd927..a61bcfe2 100644
--- a/app/views/projects/index.html.haml
+++ b/app/views/projects/index.html.haml
@@ -1,21 +1,22 @@
%h1= t('menu.projects')
%p
- = form_tag search_projects_path, role: 'form', method: :post do |f|
+ = form_tag search_projects_path, role: 'form', method: :get do |f|
.form-group
.row
.col-lg-10
= text_field_tag :query, '', class: 'form-control', placeholder: t('.find_project.placeholder'), :value => params[:query]
+ = hidden_field_tag :order, params[:order] || 'balance'
.col-lg-2
- = button_tag t('.find_project.button'), class: "btn form-control btn-default"
+ = button_tag t('.find_project.button'), class: "btn form-control btn-default", name: nil
%p
- if @projects.count > 0
%table.table
%thead
%tr
- %th= t('.repository')
- %th= t('.description')
- %th= link_to_unless_current t('.watchers'), by_watchers_projects_path
- %th= link_to_unless_current t('.balance'), projects_path
+ %th= link_to_unless_current t('.repository'), params.merge(:order => 'repository')
+ %th= link_to_unless_current t('.description'), params.merge(:order => 'description')
+ %th= link_to_unless_current t('.watchers'), params.merge(:order => 'watchers')
+ %th= link_to_unless params[:order].blank? || params[:order] == 'balance', t('.balance'), params.merge(:order => 'balance')
%th
%tbody
- @projects.each do |project|
diff --git a/app/views/tips/index.html.haml b/app/views/tips/index.html.haml
index 3d5b5082..a7ab46b7 100644
--- a/app/views/tips/index.html.haml
+++ b/app/views/tips/index.html.haml
@@ -28,7 +28,7 @@
- else
= link_to tip.user.display_name, "https://github.com/#{tip.user.nickname}", target: '_blank'
- unless @project
- %td= link_to tip.project.full_name, tip.project
+ %td= link_to tip.project.full_name, pretty_project_path(tip.project)
%td= link_to tip.commit[0..6], "https://github.com/#{tip.project.full_name}/commit/#{tip.commit}", target: :blank
%td= btc_human tip.amount
%td
diff --git a/config/locales/en.yml b/config/locales/en.yml
index cc3a95f8..168c31e3 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -66,7 +66,7 @@ en:
projects:
index:
find_project:
- placeholder: Enter GitHub project URL to find or add a project e.g. rails/rails
+ placeholder: Enter GitHub project URL to add a project or any keyword to find it...
button: Find or add project
repository: Repository
description: Description
diff --git a/config/routes.rb b/config/routes.rb
index 86e37e4f..16cdf7ad 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -19,8 +19,7 @@
end
resources :projects, :only => [:show, :index, :edit, :update] do
collection do
- get 'by_watchers'
- post 'search'
+ get 'search'
end
member do
get :decide_tip_amounts
From e8f124841ef8d78a5dbd5a86bdc2a9616309f922 Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Mon, 11 Aug 2014 22:18:16 +0800
Subject: [PATCH 015/415] fixed sort order
---
app/controllers/projects_controller.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index 209162d7..1944e6c9 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -105,7 +105,7 @@ def projects_order
'balance' => {available_amount_cache: :desc, watchers_count: :desc, full_name: :asc},
'watchers' => {watchers_count: :desc, available_amount_cache: :desc, full_name: :asc},
'repository' => {full_name: :asc, available_amount_cache: :desc, watchers_count: :desc},
- 'description' => {description: :desc, available_amount_cache: :desc, watchers_count: :desc, full_name: :asc}
+ 'description' => {description: :asc, available_amount_cache: :desc, watchers_count: :desc, full_name: :asc}
}.[](params[:order] || 'balance')
end
end
From ac6b1a72bae68bdcffaa2dd8d9c9e39e69b42e91 Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Sat, 16 Aug 2014 11:14:01 +0700
Subject: [PATCH 016/415] don't create duplicate users if github email has been
changed
---
app/controllers/users/omniauth_callbacks_controller.rb | 7 ++++++-
app/models/user.rb | 6 ++++--
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/app/controllers/users/omniauth_callbacks_controller.rb b/app/controllers/users/omniauth_callbacks_controller.rb
index 07231a8c..ebefbc65 100644
--- a/app/controllers/users/omniauth_callbacks_controller.rb
+++ b/app/controllers/users/omniauth_callbacks_controller.rb
@@ -5,7 +5,12 @@ def github
@user = User.find_by(nickname: @omniauth_info.nickname) ||
User.find_by(email: @omniauth_info.verified_emails)
- if @user.blank?
+ if @user.present?
+ if @omniauth_info.primary_email.present? && @user.email != @omniauth_info.primary_email
+ # update email if it has been changed
+ @user.update email: @omniauth_info.primary_email
+ end
+ else # user not found
if @omniauth_info.primary_email.present?
@user = User.create_with_omniauth!(@omniauth_info)
else
diff --git a/app/models/user.rb b/app/models/user.rb
index 915dd0ff..90ec7df1 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -52,11 +52,13 @@ def self.create_with_omniauth!(auth_info)
def self.find_or_create_with_commit commit
author = commit.commit.author
- where(email: author.email).first_or_create do |user|
+ nickname = commit.author.try(:login)
+ user = find_by(nickname: nickname) if nickname
+ user || where(email: author.email).first_or_create do |user|
user.email = author.email
user.password = Devise.friendly_token.first(Devise.password_length.min)
user.name = author.name
- user.nickname = commit.author.try(:login)
+ user.nickname = nickname
user.skip_confirmation!
end
end
From fa678df3ce2805f0a907ad631f5ec6b6e835945e Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Sat, 16 Aug 2014 11:45:31 +0700
Subject: [PATCH 017/415] fixed nil query param error
---
app/controllers/projects_controller.rb | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index 1944e6c9..4a4fece2 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -9,10 +9,10 @@ def index
end
def search
- if project = Project.find_or_create_by_url(params[:query])
+ if params[:query].present? && project = Project.find_or_create_by_url(params[:query])
redirect_to pretty_project_path(project)
else
- @projects = Project.search(params[:query]).order(projects_order).page(params[:page]).per(30)
+ @projects = Project.search(params[:query].to_s).order(projects_order).page(params[:page]).per(30)
render :index
end
end
From dedc43da18a66d2d112f31ae6971dd02514700bc Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Sat, 16 Aug 2014 13:48:18 +0700
Subject: [PATCH 018/415] removed unused fields
---
db/migrate/20140816062159_remove_paid_out_from_deposits.rb | 6 ++++++
db/schema.rb | 4 +---
2 files changed, 7 insertions(+), 3 deletions(-)
create mode 100644 db/migrate/20140816062159_remove_paid_out_from_deposits.rb
diff --git a/db/migrate/20140816062159_remove_paid_out_from_deposits.rb b/db/migrate/20140816062159_remove_paid_out_from_deposits.rb
new file mode 100644
index 00000000..b7726e56
--- /dev/null
+++ b/db/migrate/20140816062159_remove_paid_out_from_deposits.rb
@@ -0,0 +1,6 @@
+class RemovePaidOutFromDeposits < ActiveRecord::Migration
+ def change
+ remove_column :deposits, :paid_out, :integer, :limit => 8
+ remove_column :deposits, :paid_out_at, :datetime
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 5a0eaaaf..76d556ec 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 20140725054216) do
+ActiveRecord::Schema.define(version: 20140816062159) do
create_table "collaborators", force: true do |t|
t.integer "project_id"
@@ -26,8 +26,6 @@
t.integer "project_id"
t.string "txid"
t.integer "confirmations"
- t.integer "paid_out", limit: 8
- t.datetime "paid_out_at"
t.datetime "created_at"
t.datetime "updated_at"
t.integer "amount", limit: 8
From 05affae642a673363da76467aa4acba19e726726 Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Sat, 16 Aug 2014 13:48:39 +0700
Subject: [PATCH 019/415] addded tips and deposits csv export
---
Gemfile | 1 +
Gemfile.lock | 3 +++
app/controllers/deposits_controller.rb | 11 +++++++++--
app/controllers/home_controller.rb | 4 +---
app/controllers/tips_controller.rb | 11 ++++++++---
app/models/deposit.rb | 4 ++++
app/models/project.rb | 2 +-
app/models/tip.rb | 19 +++++++++++++++++++
8 files changed, 46 insertions(+), 9 deletions(-)
diff --git a/Gemfile b/Gemfile
index 976f7d06..6aea2ac1 100644
--- a/Gemfile
+++ b/Gemfile
@@ -28,6 +28,7 @@ gem 'sdoc', group: :doc, require: false
gem 'cancancan'
gem "i18n-js"
gem 'dusen'
+gem 'render_csv'
group :development do
gem 'capistrano', '~> 3.0.1'
diff --git a/Gemfile.lock b/Gemfile.lock
index 10d196ef..37602497 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -228,6 +228,8 @@ GEM
rdoc (4.1.1)
json (~> 1.4)
ref (1.0.5)
+ render_csv (2.0.0)
+ rails (>= 3.0)
rspec-collection_matchers (0.0.2)
rspec-expectations (>= 2.99.0.beta1)
rspec-core (3.0.0.beta1)
@@ -332,6 +334,7 @@ DEPENDENCIES
omniauth (~> 1.1.4)
omniauth-github!
rails (= 4.0.2)
+ render_csv
rspec-rails (~> 3.0.0.beta)
sass-rails (~> 4.0.0)
sawyer (~> 0.5.2)
diff --git a/app/controllers/deposits_controller.rb b/app/controllers/deposits_controller.rb
index 2305f7fc..67a2b25c 100644
--- a/app/controllers/deposits_controller.rb
+++ b/app/controllers/deposits_controller.rb
@@ -3,9 +3,16 @@ class DepositsController < ApplicationController
def index
if params[:project_id]
- @deposits = @project.deposits.order(created_at: :desc).page(params[:page]).per(30)
+ @deposits = @project.deposits
else
- @deposits = Deposit.includes(:project).order(created_at: :desc).page(params[:page]).per(30)
+ @deposits = Deposit.includes(:project)
+ end
+ @deposits = @deposits.order(created_at: :desc).
+ page(params[:page]).
+ per(params[:per_page] || 30)
+ respond_to do |format|
+ format.html
+ format.csv { render csv: @deposits, except: [:updated_at, :confirmations, :fee_size], add_methods: [:project_name, :fee, :confirmed?] }
end
end
diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb
index 220a14e3..2b145420 100644
--- a/app/controllers/home_controller.rb
+++ b/app/controllers/home_controller.rb
@@ -42,9 +42,7 @@ def blockchain_info_callback
project_id: project.id,
txid: params[:transaction_hash],
confirmations: params[:confirmations],
- amount: params[:value].to_i,
- paid_out: 0,
- paid_out_at: Time.now
+ amount: params[:value].to_i
})
project.update_cache
end
diff --git a/app/controllers/tips_controller.rb b/app/controllers/tips_controller.rb
index 14cfed58..8fc4670b 100644
--- a/app/controllers/tips_controller.rb
+++ b/app/controllers/tips_controller.rb
@@ -4,11 +4,16 @@ class TipsController < ApplicationController
def index
if params[:project_id]
- @tips = @project.tips.includes(:user).order(created_at: :desc).page(params[:page]).per(30)
+ @tips = @project.tips.includes(:user)
elsif params[:user_id] && @user = User.find(params[:user_id])
- @tips = @user.tips.includes(:project).order(created_at: :desc).page(params[:page]).per(30)
+ @tips = @user.tips.includes(:project)
else
- @tips = Tip.includes(:user, :project).order(created_at: :desc).page(params[:page]).per(30)
+ @tips = Tip.includes(:user, :project)
+ end
+ @tips = @tips.order(created_at: :desc).page(params[:page]).per(30)
+ respond_to do |format|
+ format.html
+ format.csv { render csv: @tips, except: [:updated_at, :commit, :commit_message, :refunded_at, :decided_at], add_methods: [:user_name, :project_name, :decided?, :claimed?, :paid?, :refunded?, :txid] }
end
end
diff --git a/app/models/deposit.rb b/app/models/deposit.rb
index 79830947..5891a98a 100644
--- a/app/models/deposit.rb
+++ b/app/models/deposit.rb
@@ -22,4 +22,8 @@ def available_amount
self.fee_size = CONFIG["our_fee"]
end
+ def project_name
+ project.full_name
+ end
+
end
diff --git a/app/models/project.rb b/app/models/project.rb
index c7e99b57..1a057929 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -1,5 +1,5 @@
class Project < ActiveRecord::Base
- has_many :deposits # todo: only confirmed deposits that have amount > paid_out
+ has_many :deposits # todo: only confirmed deposits
has_many :tips, inverse_of: :project
accepts_nested_attributes_for :tips
has_many :collaborators, autosave: true
diff --git a/app/models/tip.rb b/app/models/tip.rb
index 9a775e9b..d0c67bb9 100644
--- a/app/models/tip.rb
+++ b/app/models/tip.rb
@@ -54,6 +54,12 @@ def non_refunded?
scope :unclaimed, -> { joins(:user).
unpaid.
where('users.bitcoin_address' => ['', nil]) }
+ def claimed?
+ paid? || user.bitcoin_address.present?
+ end
+ def unclaimed?
+ !claimed?
+ end
scope :with_address, -> { joins(:user).where.not('users.bitcoin_address' => ['', nil]) }
def with_address?
@@ -135,4 +141,17 @@ def check_amount_against_project
def touch_decided_at_if_decided
self.decided_at = Time.now if amount_changed? && decided?
end
+
+ def project_name
+ project.full_name
+ end
+
+ def user_name
+ user.display_name
+ end
+
+ def txid
+ try(:sendmany).try(:txid)
+ end
+
end
From da204f14c21f5abc838be6e8dc3a7712f3c6fee7 Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Sat, 16 Aug 2014 13:50:49 +0700
Subject: [PATCH 020/415] fixed factory
---
spec/factories/deposit.rb | 2 --
1 file changed, 2 deletions(-)
diff --git a/spec/factories/deposit.rb b/spec/factories/deposit.rb
index e9f2ca10..e76681b0 100644
--- a/spec/factories/deposit.rb
+++ b/spec/factories/deposit.rb
@@ -3,8 +3,6 @@
association :project
txid "txid"
confirmations 1
- paid_out 1
- paid_out_at "2013-10-19 23:01:22"
amount 100
end
end
From 74e8dbd42699ec5f393c1c29c9844f6506b9395f Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Sat, 16 Aug 2014 14:50:20 +0700
Subject: [PATCH 021/415] fixed pagination #99
---
app/controllers/tips_controller.rb | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/app/controllers/tips_controller.rb b/app/controllers/tips_controller.rb
index 8fc4670b..99a91dfa 100644
--- a/app/controllers/tips_controller.rb
+++ b/app/controllers/tips_controller.rb
@@ -10,7 +10,9 @@ def index
else
@tips = Tip.includes(:user, :project)
end
- @tips = @tips.order(created_at: :desc).page(params[:page]).per(30)
+ @tips = @tips.order(created_at: :desc).
+ page(params[:page]).
+ per(params[:per_page] || 30)
respond_to do |format|
format.html
format.csv { render csv: @tips, except: [:updated_at, :commit, :commit_message, :refunded_at, :decided_at], add_methods: [:user_name, :project_name, :decided?, :claimed?, :paid?, :refunded?, :txid] }
From 1dc8b49203211b3ad76ae529c23e48ab40e98c1e Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Wed, 20 Aug 2014 09:05:56 +0700
Subject: [PATCH 022/415] fixed sign in link #101
---
app/views/projects/show.html.haml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml
index 9cc1b089..91123fdc 100644
--- a/app/views/projects/show.html.haml
+++ b/app/views/projects/show.html.haml
@@ -90,7 +90,7 @@
- if current_user.bitcoin_address.blank?
= raw t('.tell_us_bitcoin_address', tell_us_link: link_to(t('.tell_us_link'), current_user))
- else
- = t('.sign_in', sign_in_link: link_to(new_user_session_path, t('links.sign_in')))
+ = raw t('.sign_in', sign_in_link: link_to(t('links.sign_in'), new_user_session_path))
%h4= t('.promote_project', project: @project.full_name)
%p
From 908d21525089327b054ddc2f67391c1e9dadefa4 Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Wed, 20 Aug 2014 09:07:36 +0700
Subject: [PATCH 023/415] stripped tables #100
---
app/views/deposits/index.html.haml | 2 +-
app/views/projects/index.html.haml | 2 +-
app/views/tips/index.html.haml | 2 +-
app/views/users/index.html.haml | 2 +-
app/views/withdrawals/index.html.haml | 2 +-
5 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/app/views/deposits/index.html.haml b/app/views/deposits/index.html.haml
index d179cb56..7950e74d 100644
--- a/app/views/deposits/index.html.haml
+++ b/app/views/deposits/index.html.haml
@@ -4,7 +4,7 @@
- else
= t('.deposits')
%p
- %table.table
+ %table.table.table-striped
%thead
%tr
%th= t('.created_at')
diff --git a/app/views/projects/index.html.haml b/app/views/projects/index.html.haml
index a61bcfe2..95c1a613 100644
--- a/app/views/projects/index.html.haml
+++ b/app/views/projects/index.html.haml
@@ -10,7 +10,7 @@
= button_tag t('.find_project.button'), class: "btn form-control btn-default", name: nil
%p
- if @projects.count > 0
- %table.table
+ %table.table.table-striped
%thead
%tr
%th= link_to_unless_current t('.repository'), params.merge(:order => 'repository')
diff --git a/app/views/tips/index.html.haml b/app/views/tips/index.html.haml
index a7ab46b7..ded8f6e0 100644
--- a/app/views/tips/index.html.haml
+++ b/app/views/tips/index.html.haml
@@ -6,7 +6,7 @@
- else
= t('.tips')
%p
- %table.table
+ %table.table.table-striped
%thead
%tr
%th= t('.created_at')
diff --git a/app/views/users/index.html.haml b/app/views/users/index.html.haml
index 23b89916..13b5d405 100644
--- a/app/views/users/index.html.haml
+++ b/app/views/users/index.html.haml
@@ -1,6 +1,6 @@
%h1= t('.title')
%p
- %table.table
+ %table.table.table-striped
%thead
%tr
%th= t('.name')
diff --git a/app/views/withdrawals/index.html.haml b/app/views/withdrawals/index.html.haml
index 4e6e6275..9e0825e2 100644
--- a/app/views/withdrawals/index.html.haml
+++ b/app/views/withdrawals/index.html.haml
@@ -1,6 +1,6 @@
%h1= t('.title')
%p
- %table.table
+ %table.table.table-striped
%thead
%tr
%th= t('.created_at')
From 445154a74b9d8a878bf0c4c257ce58f476a64139 Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Sat, 23 Aug 2014 12:13:43 +0700
Subject: [PATCH 024/415] added branches support #102
---
app/controllers/projects_controller.rb | 2 +-
app/models/project.rb | 9 ++++++++-
app/services/bitbucket.rb | 6 ++++++
app/services/github.rb | 4 ++++
app/views/projects/edit.html.haml | 1 +
app/views/projects/show.html.haml | 2 +-
config/locales/en.yml | 3 ++-
db/migrate/20140823035950_add_branch_to_projects.rb | 5 +++++
db/schema.rb | 3 ++-
features/step_definitions/common.rb | 3 +++
10 files changed, 33 insertions(+), 5 deletions(-)
create mode 100644 db/migrate/20140823035950_add_branch_to_projects.rb
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index 4a4fece2..582c0852 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -97,7 +97,7 @@ def load_project
end
def project_params
- params.require(:project).permit(:hold_tips, tipping_policies_text_attributes: [:text])
+ params.require(:project).permit(:branch, :hold_tips, tipping_policies_text_attributes: [:text])
end
def projects_order
diff --git a/app/models/project.rb b/app/models/project.rb
index 1a057929..dad8d048 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -9,6 +9,7 @@ class Project < ActiveRecord::Base
validates :full_name, :github_id, uniqueness: true, presence: true
validates :host, inclusion: [ "github", "bitbucket" ], presence: true
+ validates :branch, presence: true
search_syntax do
search_by :text do |scope, phrases|
@@ -77,6 +78,10 @@ def collaborators_info
repository_client.collaborators_info self
end
+ def branches
+ repository_client.branches self
+ end
+
def new_commits
begin
commits = Timeout::timeout(90) do
@@ -87,7 +92,9 @@ def new_commits
select{|c| c.commit.author.email =~ Devise::email_regexp }.
# Filter commited after t4c project creation
select{|c| c.commit.committer.date > self.deposits.first.created_at }.
- to_a
+ to_a.
+ # tip for older commits first
+ reverse
end
rescue Octokit::BadGateway, Octokit::NotFound, Octokit::InternalServerError, Octokit::Forbidden,
Errno::ETIMEDOUT, Net::ReadTimeout, Faraday::Error::ConnectionFailed => e
diff --git a/app/services/bitbucket.rb b/app/services/bitbucket.rb
index 3d1bf549..207e050a 100644
--- a/app/services/bitbucket.rb
+++ b/app/services/bitbucket.rb
@@ -32,7 +32,13 @@ def collaborators_info project
[]
end
+ def branches project
+ # TODO
+ ['master']
+ end
+
def commits repository
+ # todo use repository.branch
data = request :get, changesets_path(repository.full_name)
data.changesets.map do |cs|
diff --git a/app/services/github.rb b/app/services/github.rb
index aab9a1fe..63641e7e 100644
--- a/app/services/github.rb
+++ b/app/services/github.rb
@@ -62,6 +62,10 @@ def collaborators_info project
(client.get("/orgs/#{project.full_name.split('/').first}/members") rescue [])
end
+ def branches project
+ client.get("/repos/#{project.full_name}/branches").map(&:name)
+ end
+
def repository_url project
"https://github.com/#{project.full_name}"
end
diff --git a/app/views/projects/edit.html.haml b/app/views/projects/edit.html.haml
index 767d9e15..a11658f8 100644
--- a/app/views/projects/edit.html.haml
+++ b/app/views/projects/edit.html.haml
@@ -5,6 +5,7 @@
.row
.col-md-12
= bootstrap_form_for @project do |f|
+ = f.select :branch, @project.branches, label: t('.branch')
= f.fields_for :tipping_policies_text, @project.tipping_policies_text || @project.build_tipping_policies_text do |fields|
= fields.text_area :text, rows: 10, label: t('.tipping_policies')
= f.check_box :hold_tips, label: t('.hold_tips')
diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml
index 91123fdc..19bfc4f9 100644
--- a/app/views/projects/show.html.haml
+++ b/app/views/projects/show.html.haml
@@ -84,7 +84,7 @@
= btc_human @project.next_tip_amount
%h4= t('.contribute_and_earn')
- = raw t('.cocontribute_and_earn_description', make_commits_link: link_to(t('.make_commits_link'), @project.github_url, target: '_blank'))
+ = raw t('.contribute_and_earn_description', make_commits_link: link_to(t('.make_commits_link'), @project.github_url, target: '_blank'), branch: @project.branch)
- if current_user
- if current_user.bitcoin_address.blank?
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 168c31e3..26e1feaf 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -98,7 +98,7 @@ en:
when_decided: when its amount is decided
next_tip: Next Tip
contribute_and_earn: Contribute and Earn
- cocontribute_and_earn_description: "Donate bitcoins to this project or %{make_commits_link} and get tips for it. If your commit is accepted by the project maintainer and there are bitcoins on its balance, you will get a tip!"
+ contribute_and_earn_description: "Donate bitcoins to this project or %{make_commits_link} and get tips for it. If your commit is accepted by the project maintainer (merged into %{branch} branch) and there are bitcoins on its balance, you will get a tip!"
make_commits_link: make commits
tell_us_bitcoin_address: "Just %{tell_us_link} your bitcoin address."
tell_us_link: tell us
@@ -109,6 +109,7 @@ en:
shield_title: tip for next commit
edit:
project_settings: "%{project} project settings"
+ branch: Branch
tipping_policies: Tipping policies
hold_tips: "Do not send the tips immediatly. Give collaborators the ability to modify the tips before they're sent"
save: Save the project settings
diff --git a/db/migrate/20140823035950_add_branch_to_projects.rb b/db/migrate/20140823035950_add_branch_to_projects.rb
new file mode 100644
index 00000000..d514601c
--- /dev/null
+++ b/db/migrate/20140823035950_add_branch_to_projects.rb
@@ -0,0 +1,5 @@
+class AddBranchToProjects < ActiveRecord::Migration
+ def change
+ add_column :projects, :branch, :string, default: 'master'
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 76d556ec..6721269e 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 20140816062159) do
+ActiveRecord::Schema.define(version: 20140823035950) do
create_table "collaborators", force: true do |t|
t.integer "project_id"
@@ -51,6 +51,7 @@
t.string "host", default: "github"
t.boolean "hold_tips", default: false
t.datetime "info_updated_at"
+ t.string "branch", default: "master"
end
add_index "projects", ["full_name"], name: "index_projects_on_full_name", unique: true
diff --git a/features/step_definitions/common.rb b/features/step_definitions/common.rb
index 633b40ec..28b359c9 100644
--- a/features/step_definitions/common.rb
+++ b/features/step_definitions/common.rb
@@ -1,5 +1,8 @@
Before do
ActionMailer::Base.deliveries.clear
+
+ # mock branches method to prevent api call
+ Project.any_instance.stub(:branches).and_return(%w(master))
end
Then(/^there should be (\d+) email sent$/) do |arg1|
From 5de4d26ecfc20ad1400ab72eba1b803345c9dc32 Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Sat, 23 Aug 2014 13:11:55 +0700
Subject: [PATCH 025/415] load all branches #102
---
app/services/github.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/services/github.rb b/app/services/github.rb
index 63641e7e..45cd78c6 100644
--- a/app/services/github.rb
+++ b/app/services/github.rb
@@ -63,7 +63,7 @@ def collaborators_info project
end
def branches project
- client.get("/repos/#{project.full_name}/branches").map(&:name)
+ Octokit::Client.new(:auto_paginate => true).get("/repos/#{project.full_name}/branches").map(&:name)
end
def repository_url project
From 8a88625d1fb4c975b750c7f916ee03a2424f67e3 Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Sat, 23 Aug 2014 13:12:15 +0700
Subject: [PATCH 026/415] leave branch blank by default #102
---
app/models/project.rb | 1 -
app/services/github.rb | 6 +++++-
app/views/projects/edit.html.haml | 2 +-
app/views/projects/show.html.haml | 2 +-
config/locales/en.yml | 4 +++-
db/migrate/20140823060921_make_default_branch_blank.rb | 5 +++++
db/schema.rb | 4 ++--
7 files changed, 17 insertions(+), 7 deletions(-)
create mode 100644 db/migrate/20140823060921_make_default_branch_blank.rb
diff --git a/app/models/project.rb b/app/models/project.rb
index dad8d048..5affe082 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -9,7 +9,6 @@ class Project < ActiveRecord::Base
validates :full_name, :github_id, uniqueness: true, presence: true
validates :host, inclusion: [ "github", "bitbucket" ], presence: true
- validates :branch, presence: true
search_syntax do
search_by :text do |scope, phrases|
diff --git a/app/services/github.rb b/app/services/github.rb
index 45cd78c6..1500aca4 100644
--- a/app/services/github.rb
+++ b/app/services/github.rb
@@ -12,7 +12,11 @@ def initialize
attr_reader :client
def commits project
- commits = client.commits project.full_name
+ if project.branch.blank?
+ commits = client.commits project.full_name
+ else
+ commits = client.commits project.full_name, sha: project.branch
+ end
last_response = client.last_response
pages = (CONFIG['github']['project_pages'][project.full_name] || CONFIG['github']['pages'] || 1).to_i
diff --git a/app/views/projects/edit.html.haml b/app/views/projects/edit.html.haml
index a11658f8..8cae05db 100644
--- a/app/views/projects/edit.html.haml
+++ b/app/views/projects/edit.html.haml
@@ -5,7 +5,7 @@
.row
.col-md-12
= bootstrap_form_for @project do |f|
- = f.select :branch, @project.branches, label: t('.branch')
+ = f.select :branch, @project.branches, label: t('.branch'), include_blank: t('.default_branch')
= f.fields_for :tipping_policies_text, @project.tipping_policies_text || @project.build_tipping_policies_text do |fields|
= fields.text_area :text, rows: 10, label: t('.tipping_policies')
= f.check_box :hold_tips, label: t('.hold_tips')
diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml
index 19bfc4f9..adf91c39 100644
--- a/app/views/projects/show.html.haml
+++ b/app/views/projects/show.html.haml
@@ -84,7 +84,7 @@
= btc_human @project.next_tip_amount
%h4= t('.contribute_and_earn')
- = raw t('.contribute_and_earn_description', make_commits_link: link_to(t('.make_commits_link'), @project.github_url, target: '_blank'), branch: @project.branch)
+ = raw t('.contribute_and_earn_description', make_commits_link: link_to(t('.make_commits_link'), @project.github_url, target: '_blank'), branch: @project.branch.present? ? t('.contribute_and_earn_branch', branch: @project.branch) : '')
- if current_user
- if current_user.bitcoin_address.blank?
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 26e1feaf..8172c06f 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -98,7 +98,8 @@ en:
when_decided: when its amount is decided
next_tip: Next Tip
contribute_and_earn: Contribute and Earn
- contribute_and_earn_description: "Donate bitcoins to this project or %{make_commits_link} and get tips for it. If your commit is accepted by the project maintainer (merged into %{branch} branch) and there are bitcoins on its balance, you will get a tip!"
+ contribute_and_earn_description: "Donate bitcoins to this project or %{make_commits_link} and get tips for it. If your commit is accepted %{branch} by a project maintainer and there are bitcoins on its balance, you will get a tip!"
+ contribute_and_earn_branch: "to %{branch} branch"
make_commits_link: make commits
tell_us_bitcoin_address: "Just %{tell_us_link} your bitcoin address."
tell_us_link: tell us
@@ -110,6 +111,7 @@ en:
edit:
project_settings: "%{project} project settings"
branch: Branch
+ default_branch: Default branch
tipping_policies: Tipping policies
hold_tips: "Do not send the tips immediatly. Give collaborators the ability to modify the tips before they're sent"
save: Save the project settings
diff --git a/db/migrate/20140823060921_make_default_branch_blank.rb b/db/migrate/20140823060921_make_default_branch_blank.rb
new file mode 100644
index 00000000..b191d00b
--- /dev/null
+++ b/db/migrate/20140823060921_make_default_branch_blank.rb
@@ -0,0 +1,5 @@
+class MakeDefaultBranchBlank < ActiveRecord::Migration
+ def change
+ change_column :projects, :branch, :string, default: nil
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 6721269e..9a468895 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 20140823035950) do
+ActiveRecord::Schema.define(version: 20140823060921) do
create_table "collaborators", force: true do |t|
t.integer "project_id"
@@ -51,7 +51,7 @@
t.string "host", default: "github"
t.boolean "hold_tips", default: false
t.datetime "info_updated_at"
- t.string "branch", default: "master"
+ t.string "branch"
end
add_index "projects", ["full_name"], name: "index_projects_on_full_name", unique: true
From 2bba7ead93375250cf67c5e970511e656b5fe63f Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Sat, 23 Aug 2014 13:18:11 +0700
Subject: [PATCH 027/415] use api_key to load branches #102
---
app/services/github.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/services/github.rb b/app/services/github.rb
index 1500aca4..d2b474d8 100644
--- a/app/services/github.rb
+++ b/app/services/github.rb
@@ -67,7 +67,7 @@ def collaborators_info project
end
def branches project
- Octokit::Client.new(:auto_paginate => true).get("/repos/#{project.full_name}/branches").map(&:name)
+ Octokit::Client.new(client_id: CONFIG['github']['key'], client_secret: CONFIG['github']['secret'], auto_paginate: true).get("/repos/#{project.full_name}/branches").map(&:name)
end
def repository_url project
From ed45e3a7c449cde4c2195ed21ad770315a5c816a Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Sat, 23 Aug 2014 13:41:04 +0700
Subject: [PATCH 028/415] load all branches
---
app/services/github.rb | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/app/services/github.rb b/app/services/github.rb
index d2b474d8..103c3cb9 100644
--- a/app/services/github.rb
+++ b/app/services/github.rb
@@ -67,7 +67,13 @@ def collaborators_info project
end
def branches project
- Octokit::Client.new(client_id: CONFIG['github']['key'], client_secret: CONFIG['github']['secret'], auto_paginate: true).get("/repos/#{project.full_name}/branches").map(&:name)
+ branches = client.get("/repos/#{project.full_name}/branches")
+ last_response = client.last_response
+ while last_response && last_response.rels[:next]
+ last_response = last_response.rels[:next].get
+ branches += last_response.data
+ end
+ branches.map(&:name)
end
def repository_url project
From 24ae5aeb98d676cfa6fb9adeedd828bddd57eaa3 Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Tue, 26 Aug 2014 10:46:19 +0700
Subject: [PATCH 029/415] fixed emoji. a workaround until Rails adds support
for UTF8MB4
---
Gemfile | 1 +
Gemfile.lock | 2 ++
config/initializers/demoji.rb | 1 +
3 files changed, 4 insertions(+)
create mode 100644 config/initializers/demoji.rb
diff --git a/Gemfile b/Gemfile
index 6aea2ac1..102e51fd 100644
--- a/Gemfile
+++ b/Gemfile
@@ -29,6 +29,7 @@ gem 'cancancan'
gem "i18n-js"
gem 'dusen'
gem 'render_csv'
+gem 'demoji'
group :development do
gem 'capistrano', '~> 3.0.1'
diff --git a/Gemfile.lock b/Gemfile.lock
index 37602497..e392291c 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -120,6 +120,7 @@ GEM
debugger-ruby_core_source (~> 1.3.5)
debugger-linecache (1.2.0)
debugger-ruby_core_source (1.3.5)
+ demoji (0.0.5)
devise (3.2.2)
bcrypt-ruby (~> 3.0)
orm_adapter (~> 0.1)
@@ -319,6 +320,7 @@ DEPENDENCIES
cucumber-rails
database_cleaner
debugger (~> 1.6.5)
+ demoji
devise (~> 3.2.2)
dusen
factory_girl_rails (~> 4.3.0)
diff --git a/config/initializers/demoji.rb b/config/initializers/demoji.rb
new file mode 100644
index 00000000..d4121d33
--- /dev/null
+++ b/config/initializers/demoji.rb
@@ -0,0 +1 @@
+ActiveRecord::Base.send :include, Demoji
From f2882c01681075bf47f6d07b752f54200ba22e40 Mon Sep 17 00:00:00 2001
From: Peter Dave Hello
Date: Sat, 30 Aug 2014 00:26:19 +0800
Subject: [PATCH 030/415] Use svg instead of png to get better image quality
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 21fea313..a88a4506 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
Tip4commit
==========
-[](https://tip4commit.com/projects/307) [](https://travis-ci.org/tip4commit/tip4commit)
+[](https://tip4commit.com/projects/307) [](https://travis-ci.org/tip4commit/tip4commit)
Donate bitcoins to open source projects or make commits and get tips for it.
From 62cfe57fcbfb639572ff066a5a37145e2d65c0ff Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Sun, 31 Aug 2014 21:52:04 +0900
Subject: [PATCH 031/415] added crawl-delay directive to robots.txt
---
public/robots.txt | 1 +
1 file changed, 1 insertion(+)
diff --git a/public/robots.txt b/public/robots.txt
index fdf08c9f..4860601a 100644
--- a/public/robots.txt
+++ b/public/robots.txt
@@ -1,2 +1,3 @@
User-agent: *
Disallow: /users/
+Crawl-delay: 10
From 95afb67f6dbcdcb586b0844ccdb86229f9d970a2 Mon Sep 17 00:00:00 2001
From: Peter Dave Hello
Date: Tue, 2 Sep 2014 03:06:22 +0800
Subject: [PATCH 032/415] Should use protocol-relative URL to load fonts. fix
#104
---
app/views/projects/show.svg.erb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/views/projects/show.svg.erb b/app/views/projects/show.svg.erb
index 0957c105..c987d9fc 100644
--- a/app/views/projects/show.svg.erb
+++ b/app/views/projects/show.svg.erb
@@ -63,7 +63,7 @@
font-family: 'Open Sans';
font-style: normal;
font-weight: 400;
- src: local('Open Sans'), local('OpenSans'), url(http://themes.googleusercontent.com/static/fonts/opensans/v6/cJZKeOuBrn4kERxqtaUH3bO3LdcAZYWl9Si6vvxL-qU.woff) format('woff');
+ src: local('Open Sans'), local('OpenSans'), url(//themes.googleusercontent.com/static/fonts/opensans/v6/cJZKeOuBrn4kERxqtaUH3bO3LdcAZYWl9Si6vvxL-qU.woff) format('woff');
}
]]>
From 791c05055d58531b5e9aca7172ebddb46d2a1e96 Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Wed, 3 Sep 2014 10:59:36 +0900
Subject: [PATCH 033/415] added https protocol. protocol-relative url in svg
doesn't work in firefox #104
---
app/views/projects/show.svg.erb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/views/projects/show.svg.erb b/app/views/projects/show.svg.erb
index c987d9fc..c4fd0a57 100644
--- a/app/views/projects/show.svg.erb
+++ b/app/views/projects/show.svg.erb
@@ -63,7 +63,7 @@
font-family: 'Open Sans';
font-style: normal;
font-weight: 400;
- src: local('Open Sans'), local('OpenSans'), url(//themes.googleusercontent.com/static/fonts/opensans/v6/cJZKeOuBrn4kERxqtaUH3bO3LdcAZYWl9Si6vvxL-qU.woff) format('woff');
+ src: local('Open Sans'), local('OpenSans'), url(https://themes.googleusercontent.com/static/fonts/opensans/v6/cJZKeOuBrn4kERxqtaUH3bO3LdcAZYWl9Si6vvxL-qU.woff) format('woff');
}
]]>
From 510bf7f66348f2941343407fbbf802e01dfd57c1 Mon Sep 17 00:00:00 2001
From: Jan Keromnes
Date: Thu, 11 Sep 2014 23:36:16 +0000
Subject: [PATCH 034/415] Add French translation to locales.
---
config/locales/fr.yml | 212 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 212 insertions(+)
create mode 100644 config/locales/fr.yml
diff --git a/config/locales/fr.yml b/config/locales/fr.yml
new file mode 100644
index 00000000..8519093d
--- /dev/null
+++ b/config/locales/fr.yml
@@ -0,0 +1,212 @@
+fr:
+ tip4commit: Tip4Commit
+ meta:
+ title: Contribuez aux logiciels libres
+ description: Faites don de bitcoins à des projets open source ou contribuez et recevez des pourboires.
+ menu:
+ home: Accueil
+ projects: Projets supportés
+ footer:
+ text: "Code source disponible sur %{github_link} et vous pouvez également %{support_link} son développement."
+ github_link: GitHub
+ support_link: subventionner
+ follow_link: Suivez @tip4commit
+ links:
+ sign_in: Se connecter
+ sign_out: Se déconnecter
+ errors:
+ project_not_found: Projet non trouvé.
+ access_denied: Accès refusé
+ can_assign_more_tips: "Vous ne pouvez pas attribuer plus de 100% de vos fonds disponibles."
+ wrong_bitcoin_address: Echec de mise à jour de l'adresse bitcoin
+ user_not_found: Utilisateur non trouvé
+ access_denied: "Vous n'avez pas le droit d'effectuer cette action !"
+ notices:
+ project_updated: Les paramètres du projet ont été mis à jour
+ tips_decided: Les montants des pourboires ont été définis
+ user_updated: Vos informations ont été enregistrées !
+ user_unsubscribed: "Vous avez été désinscrit ! Désolé de vous avoir dérangé. Celà dit, vous pouvez toujours nous donner votre adresse bitcoin pour recevoir vos fonds."
+ tip_amounts:
+ undecided: "Non défini"
+ free: "Gratuit : 0%"
+ tiny: "Minuscule : 0.1%"
+ small: "Petit : 0.5%"
+ normal: "Normal : 1%"
+ big: "Grand : 2%"
+ huge: "Géant : 5%"
+ js:
+ errors:
+ value:
+ invalid: Valeur non valide
+ email:
+ invalid: Adresse Email non valide
+ blank: L'Email est requis et doit être renseigné
+ password:
+ blank: Les mot de passe est requis et doit être renseigné
+ invalid: Le mot de passe et sa confirmation ne sont pas identiques
+ password_confirmation:
+ blank: La confirmation du mot de passe est requise et doit être renseignée
+ invalid: Le mot de passe et sa confirmation ne sont pas identiques
+ home:
+ index:
+ see_projects: Voir les projets
+ how_does_it_work:
+ title: Comment ça marche ?
+ text: Des gens donnent des bitcoins à des projets. Lorsque quelqu'une contribution est acceptée par un projet, nous donnons automatiquement un pourboire à son auteur.
+ button: En savoir plus sur le Bitcoin
+ donate:
+ title: Faire un don
+ text: Trouvez un projet que vous soutenez et désposez-y des bitcoins. Votre don d'ajoutera aux fonds des autres donnateurs pour récompenser les nouvelles contributions.
+ button: Trouver ou ajouter un projet
+ contribute:
+ title: Contribuer
+ text: Améliorez un projet ! Si votre contribution est acceptée par le mainteneur du projet, vous recevrez un pourboire !
+ sign_in_text: "Vérifiez simplement vos emails ou %{sign_in_link}."
+ button: Projets subventionnés
+ projects:
+ index:
+ find_project:
+ placeholder: "Indiquez l'URL d'un projet GitHub pour l'ajouter ou n'importe quel mot clef pour le trouver..."
+ button: Trouver ou ajouter un projet
+ repository: Dépôt
+ description: Description
+ watchers: Observateurs
+ balance: Fonds
+ forked_from: forké depuis
+ support: Subventionner
+ show:
+ title: "Contribuer à %{project}"
+ edit_project: Changer les paramètres du projet
+ decide_tip_amounts: Choisir un montant de pourboire
+ project_sponsors: Sponsors du projet
+ fee: "%{percentage} des fonds déposés seront utilisés pour récompenser les nouvelles contributions."
+ balance: Fonds
+ deposits: dépôts
+ custom_tip_size: (chaque nouvelle contribution reçoit un pourcentage des fonds disponibles)
+ default_tip_size: "(chaque contribution reçoit %{percentage} des fonds disponsibles)"
+ unconfirmed_amount: "(%{amount} non confirmé)"
+ tipping_policies: Politique des pourboires
+ updated_by_user: "(Dernière mise à jour par %{name} le %{date})"
+ updated_by_unknown: "(Dernière mise à jour le %{date})"
+ tips_paid: Pourboires Payés
+ unclaimed_amount: "(%{amount} n'ont pas été réclamés, et seront rendus au projet s'ils le restent pendant 1 mois.)"
+ last_tips: Derniers Pourboires
+ see_all: tout voir
+ received: "%{amount} reçus"
+ will_receive: recevra un pourboire
+ for_commit: pour la contribution
+ when_decided: lorsque le montant sera choisi
+ next_tip: Prochain Pourboire
+ contribute_and_earn: Contribuez et Gagnez
+ contribute_and_earn_description: "Donner des bitcoins à ce projet ou %{make_commits_link} et recevez des pourboires. Si votre contribution est acceptée %{branch} par un mainteneur du projet et qu'un fond de bitcoins est disponible, vous recevrez un pourboire !"
+ contribute_and_earn_branch: "sur la branche %{branch}"
+ make_commits_link: contribuer
+ tell_us_bitcoin_address: "%{tell_us_link} simplement votre adresse bitcoin."
+ tell_us_link: Renseignez
+ sign_in: "Verifiez simplement vos emails ou %{sign_in_link}."
+ promote_project: Promouvoir %{project}
+ embedding: Intégration
+ image_url: "URL de l'image:"
+ shield_title: prochain pourboire
+ edit:
+ project_settings: "Paramètres du projet %{project}"
+ branch: Branche
+ default_branch: Branche par défaut
+ tipping_policies: Politique des pourboires
+ hold_tips: "N'envoyez pas les bourboires tout de suite. Laissez à vos collaborateurs la possibilité de modifier les pourboires avant qu'ils ne soient envoyés"
+ save: Enregistrer les paramètres du projet
+ decide_tip_amounts:
+ commit: Contribution
+ author: Auteur
+ message: Message
+ tip: Pourboire (en fonction des fonds du projet)
+ submit: Envoyer les pourboires
+ tips:
+ index:
+ tips: Pourboires
+ project_tips: 'Pourboires pour %{project}'
+ user_tips: "Pourboires pour %{user}"
+ created_at: Créé à
+ commiter: Contributeur
+ project: Projet
+ commit: Contribution
+ amount: Montant
+ refunded: Rendus aux fonds du projet
+ undecided: Le montant du pourboire n'a pas encore été décidé
+ no_bitcoin_address: "L'utilisateur n'a pas indiqué d'adresse de retrait"
+ below_threshold: "Les fonds de l'utilisateur sont sous le seuil de retrait"
+ waiting: En attente de retrait
+ error: (erreur d'envoi de la transaction)
+ deposits:
+ index:
+ project_deposits: 'Versements pour %{project}'
+ deposits: Versements
+ created_at: Créé à
+ project: Projet
+ amount: Montant
+ transaction: Transaction
+ confirmed: Confirmée
+ confirmed_yes: 'Oui'
+ confirmed_no: 'Non'
+ users:
+ index:
+ title: Meilleurs Contributeurs
+ name: Nom
+ commits_count: Contributions récompensées
+ withdrawn: Retiré
+ show:
+ balance: Fonds
+ threshold: "Vous recevrez vos fonds dès qu'ils atteindront le seuil de %{threshold}"
+ see_all: tout voir
+ received: "%{time} %{amount} reçus pour avoir contribué %{commit} à %{project}"
+ bitcoin_address_placeholder: Votre adresse bitcoin
+ notify: Me tenir au courant des nouveaux pourboires (pas plus d'un email par mois)
+ submit_user: Mettre à jour
+ change_password: Modifier votre mot de passe
+ submit_password: Modifier mon mot de passe
+ withdrawals:
+ index:
+ title: Derniers Retraits
+ created_at: Créé à
+ transaction: Transaction
+ result: Résultat
+ error: Erreur
+ success: Succès
+ devise:
+ sessions:
+ new:
+ title: Se connecter
+ remember_me: Se souvenir de moi
+ submit: Se connecter
+ registrations:
+ new:
+ title: S'enregistrer
+ submit: S'enregistrer
+ passwords:
+ new:
+ title: Mot de passe oublié ?
+ submit: Envoyez-moi des instructions pour réinitialiser mon mot de passe
+ edit:
+ title: Modifier votre mot de passe
+ submit: Modifier mon mot de passe
+ confirmations:
+ new:
+ title: Renvoyer les instructions de confirmation
+ submit: Renvoyer les instructions de confirmation
+ links:
+ sign_in: Se connecter
+ sign_up: S'enregistrer
+ recover: Mot de passe oublié ?
+ confirm: "Vous n'avez pas reçu d'instructions de confirmation ?"
+ sign_in_with: "Se connecter avec %{provider}"
+ errors:
+ primary_email: votre adresse email principale doit être vérifiée.
+ onmiauth_info: impossible d'obtenir vos informations.
+ activerecord:
+ attributes:
+ user:
+ email: E-mail
+ bitcoin_address: Adresse bitcoin
+ password: Mot de passe
+ password_confirmation: Confirmation
+ display_name: Nom affiché
From 5fd68303af68a13ecf324a1cb293cda11b26acb8 Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Fri, 12 Sep 2014 11:54:55 +0900
Subject: [PATCH 035/415] allowed locale selection. added public domain flag
icons
---
Gemfile | 5 ++++-
Gemfile.lock | 6 ++++++
app/assets/images/flags/en.png | Bin 0 -> 599 bytes
app/assets/images/flags/fr.png | Bin 0 -> 545 bytes
app/controllers/application_controller.rb | 13 +++++++++++++
app/views/layouts/application.html.haml | 3 +++
config/application.rb | 1 +
7 files changed, 27 insertions(+), 1 deletion(-)
create mode 100644 app/assets/images/flags/en.png
create mode 100755 app/assets/images/flags/fr.png
diff --git a/Gemfile b/Gemfile
index 102e51fd..a6834913 100644
--- a/Gemfile
+++ b/Gemfile
@@ -26,11 +26,14 @@ gem 'twitter-bootstrap-rails', github: 'seyhunak/twitter-bootstrap-rails', br
gem 'bootstrap_form', github: 'sigmike/rails-bootstrap-forms', branch: 'removed_for_on_radio_label'
gem 'sdoc', group: :doc, require: false
gem 'cancancan'
-gem "i18n-js"
gem 'dusen'
gem 'render_csv'
gem 'demoji'
+gem "http_accept_language"
+gem 'rails-i18n'
+gem "i18n-js"
+
group :development do
gem 'capistrano', '~> 3.0.1'
gem 'capistrano-rvm', '~> 0.1.0', github: 'capistrano/rvm'
diff --git a/Gemfile.lock b/Gemfile.lock
index e392291c..49d79947 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -153,6 +153,7 @@ GEM
railties (>= 4.0.1)
hashie (2.0.5)
hike (1.2.3)
+ http_accept_language (2.0.2)
httpauth (0.2.1)
i18n (0.6.9)
i18n-js (2.1.2)
@@ -220,6 +221,9 @@ GEM
bundler (>= 1.3.0, < 2.0)
railties (= 4.0.2)
sprockets-rails (~> 2.0.0)
+ rails-i18n (4.0.3)
+ i18n (~> 0.6)
+ railties (~> 4.0)
railties (4.0.2)
actionpack (= 4.0.2)
activesupport (= 4.0.2)
@@ -325,6 +329,7 @@ DEPENDENCIES
dusen
factory_girl_rails (~> 4.3.0)
haml-rails (~> 0.5.3)
+ http_accept_language
i18n-js
jbuilder (~> 1.5.3)
jquery-rails (~> 3.0.4)
@@ -336,6 +341,7 @@ DEPENDENCIES
omniauth (~> 1.1.4)
omniauth-github!
rails (= 4.0.2)
+ rails-i18n
render_csv
rspec-rails (~> 3.0.0.beta)
sass-rails (~> 4.0.0)
diff --git a/app/assets/images/flags/en.png b/app/assets/images/flags/en.png
new file mode 100644
index 0000000000000000000000000000000000000000..258228e88cf66d8f6633fea6b641a595db9ed2a1
GIT binary patch
literal 599
zcmV-d0;v6oP)F!`e#okFI$hXy-zSVkh@Z#(&OW#F(7TVn9zXy5
z?|(*BMIkjqZiZh!|0@c4n#unD^VddO*!0j$hBaN2wq9r2cjx4301to!!KY#vlaQOf0*T3Jt{{cn*{$$jysP*=%mt%=F{OA8}!}r8C{-*Ytm!J16ywi{QJWc6RR5SukoX!@{)aQ<2Q35p1=S9GcamOGipiz9V4qQ6cfMZu%@l(
zoH?1N>$4MWS)RXsJIyU^y{i4Wr3Zii`Tpnc-^4K0ZO1?S|MSQF`kR#-_cHwZyL#&(
l5jnxi?yg&v(*Xhu01d=J3gt_FfdBvi07*qoM6N<$f(k(nI?4b5
literal 0
HcmV?d00001
diff --git a/app/assets/images/flags/fr.png b/app/assets/images/flags/fr.png
new file mode 100755
index 0000000000000000000000000000000000000000..22836232bcb13f71b46e3c2c288a5bbfc5f832c3
GIT binary patch
literal 545
zcmV++0^a?JP)a#_wV1IKYs$rKY#u(GBPT;82@4uuZ@Bjb*LEQg9?mr;O+S2#`&+mV~e*ORb`)x%NKmdU>F#Kou{O$MOzaSM~
zzkdA>20%8@c%VIe&z}7I_4EI)pA5nxKuZ7ukT?c80Dv$EOZfkT-E`F^-Z->CoUvPa
z;LJ@TE&78Ry{KaAw3nU$V)^suA5iJvzd-aK$OI|^Dg6g=4#;gl)j;F_{rb)L>(?&^
z27mw*k3kLqFbKjh`2Po^af3Uh(9&KEH^%mnOc-dpGpYiN{Gr?pd;!D)R1b8?@4rCu
zA5i2!5&(JtME&~t7wF?(znQ=`00a=rk6(X4uK)87qz8!qL0tn>4Pk>-1O4!u0T@;c
z3;+Sd^5e%JkZPbkfBphVECA>vpwi#J8UOqRh7v#kv3vu1;?F-WPG%tQ&mSg8_(0;3
z5e%5cC4q)90{! I18n.t('errors.access_denied')
end
+ before_filter :load_locale
+
private
+ def load_locale
+ if params[:locale] && ::Rails.application.config.available_locales.include?(params[:locale])
+ I18n.locale = session[:locale] = params[:locale].to_sym
+ redirect_to :back rescue true
+ elsif session[:locale]
+ I18n.locale = session[:locale]
+ elsif l = http_accept_language.compatible_language_from(::Rails.application.config.available_locales).to_sym rescue nil
+ I18n.locale = session[:locale] = l
+ end
+ end
+
def load_project(project)
if project.is_a? Project
@project = project
diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml
index 64551ad7..41519924 100644
--- a/app/views/layouts/application.html.haml
+++ b/app/views/layouts/application.html.haml
@@ -53,6 +53,9 @@
= yield
.footer
+ %p.pull-right
+ - ::Rails.application.config.available_locales.each do |locale|
+ = link_to image_tag("flags/#{locale}.png"), "?locale=#{locale}"
%p
©
= link_to t('tip4commit'), 'http://tip4commit.com/', target: '_blank'
diff --git a/config/application.rb b/config/application.rb
index 15b76d87..17bf72cb 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -25,6 +25,7 @@ class Application < Rails::Application
config.autoload_paths += %W(#{config.root}/lib)
config.assets.initialize_on_precompile = true
+ config.available_locales = %w(en fr)
end
end
From 1b87c2866cd31ae2ee0f0737963897d3a41a7ac6 Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Mon, 15 Sep 2014 11:24:40 +0700
Subject: [PATCH 036/415] fixed flags
---
app/assets/images/flags/en.png | Bin 599 -> 599 bytes
app/assets/images/flags/fr.png | Bin 545 -> 545 bytes
2 files changed, 0 insertions(+), 0 deletions(-)
diff --git a/app/assets/images/flags/en.png b/app/assets/images/flags/en.png
index 258228e88cf66d8f6633fea6b641a595db9ed2a1..ff701e19f6d2c0658fb23b1d94124cba4ce60851 100644
GIT binary patch
delta 14
Vcmcc4a-D^>Gr-TCcOy#>696Sj1V8`)
delta 15
Wcmcc4a-D^xGr-S%BWn;7BNqTFO9Vau
diff --git a/app/assets/images/flags/fr.png b/app/assets/images/flags/fr.png
index 22836232bcb13f71b46e3c2c288a5bbfc5f832c3..8332c4ec23c853944c29b02d7b32a88033f48a71 100755
GIT binary patch
delta 14
VcmZ3;vXF(fGr-TCcO#1o696A#1D*f?
delta 15
WcmZ3;vXF(PGr-S%BdZJ(BNqT8ivyeh
From a9473c0b55f17ea8641a3eed037dbae7c0c52031 Mon Sep 17 00:00:00 2001
From: arsenische
Date: Mon, 15 Sep 2014 10:32:33 +0600
Subject: [PATCH 037/415] french flag image
---
app/assets/images/flags/fr.png | Bin
1 file changed, 0 insertions(+), 0 deletions(-)
mode change 100755 => 100644 app/assets/images/flags/fr.png
diff --git a/app/assets/images/flags/fr.png b/app/assets/images/flags/fr.png
old mode 100755
new mode 100644
From a1b15b7d23a9f20330a1d4bad86570affc8a6c7f Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Mon, 15 Sep 2014 14:16:12 +0700
Subject: [PATCH 038/415] don't reload js and css with turbolinks
---
app/assets/javascripts/projects.js.coffee | 3 +--
app/assets/javascripts/users.js.coffee | 3 ++-
app/views/layouts/application.html.haml | 11 ++++++-----
3 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/app/assets/javascripts/projects.js.coffee b/app/assets/javascripts/projects.js.coffee
index 124a2fc9..849796e7 100644
--- a/app/assets/javascripts/projects.js.coffee
+++ b/app/assets/javascripts/projects.js.coffee
@@ -6,5 +6,4 @@ init = () ->
$('.qrcode').each () ->
$(this).qrcode($(this).attr('data-qrcode'));
-$ init
-$(document).on 'page:load', init
\ No newline at end of file
+$(document).on 'ready page:load', init
diff --git a/app/assets/javascripts/users.js.coffee b/app/assets/javascripts/users.js.coffee
index b0a9140b..b7fcd1a7 100644
--- a/app/assets/javascripts/users.js.coffee
+++ b/app/assets/javascripts/users.js.coffee
@@ -1,4 +1,4 @@
-$(document).ready ()->
+load_bootstrap_validator = ->
$('.registration_form').bootstrapValidator
message: I18n.t('js.errors.value.invalid')
fields:
@@ -39,3 +39,4 @@ $(document).ready ()->
notEmpty:
message: I18n.t('js.errors.password_confirmation.blank')
+$(document).on "ready page:load", load_bootstrap_validator
diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml
index 41519924..e2105bdd 100644
--- a/app/views/layouts/application.html.haml
+++ b/app/views/layouts/application.html.haml
@@ -14,11 +14,7 @@
/ %meta{:property => 'og:image', :content => asset_path('logo.png')}
/ %link{:rel => 'image_src', :type => 'image/png', :href => asset_path('logo.png')}
- = stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true
- = javascript_include_tag "application", "data-turbolinks-track" => true
-
- :javascript
- I18n.locale = #{I18n.locale.to_json};
+ = stylesheet_link_tag "application", media: "all"
= csrf_meta_tags
%body
@@ -62,3 +58,8 @@
2013-#{Date.today.year}.
= raw t('footer.text', github_link: link_to(t('footer.github_link'), 'https://github.com/tip4commit/tip4commit', target: '_blank'), support_link: link_to(t('footer.support_link'), 'http://tip4commit.com/projects/307'))
= link_to t('footer.follow_link'), 'https://twitter.com/tip4commit', target: '_blank'
+
+ = javascript_include_tag "application"
+
+ :javascript
+ I18n.locale = #{I18n.locale.to_json};
From 8c78b9d1ec62330ef6d811f55856887d47263a67 Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Mon, 15 Sep 2014 14:24:11 +0700
Subject: [PATCH 039/415] added kaminari and devise i18n. fixed missing
translation
---
Gemfile | 2 ++
Gemfile.lock | 6 ++++++
app/controllers/projects_controller.rb | 2 +-
app/views/layouts/application.html.haml | 4 ++--
4 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/Gemfile b/Gemfile
index a6834913..025850a6 100644
--- a/Gemfile
+++ b/Gemfile
@@ -33,6 +33,8 @@ gem 'demoji'
gem "http_accept_language"
gem 'rails-i18n'
gem "i18n-js"
+gem 'kaminari-i18n'
+gem 'devise-i18n'
group :development do
gem 'capistrano', '~> 3.0.1'
diff --git a/Gemfile.lock b/Gemfile.lock
index 49d79947..d9dcf137 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -127,6 +127,7 @@ GEM
railties (>= 3.2.6, < 5)
thread_safe (~> 0.1)
warden (~> 1.2.3)
+ devise-i18n (0.11.0)
diff-lcs (1.2.5)
dusen (0.4.10)
activerecord
@@ -173,6 +174,9 @@ GEM
kaminari (0.15.0)
actionpack (>= 3.0.0)
activesupport (>= 3.0.0)
+ kaminari-i18n (0.2.0)
+ kaminari
+ rails
less (2.4.0)
commonjs (~> 0.2.7)
less-rails (2.4.2)
@@ -326,6 +330,7 @@ DEPENDENCIES
debugger (~> 1.6.5)
demoji
devise (~> 3.2.2)
+ devise-i18n
dusen
factory_girl_rails (~> 4.3.0)
haml-rails (~> 0.5.3)
@@ -335,6 +340,7 @@ DEPENDENCIES
jquery-rails (~> 3.0.4)
jquery-turbolinks
kaminari (~> 0.15.0)
+ kaminari-i18n
less-rails (~> 2.4.2)
mysql2
octokit (~> 2.7.0)
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index 582c0852..07d776e7 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -5,7 +5,7 @@ class ProjectsController < ApplicationController
before_filter :load_project, only: [:show, :edit, :update, :decide_tip_amounts]
def index
- @projects = Project.order(projects_order).page(params[:page]).per(30)
+ @projects = Project.order(projects_order).page(params[:page]).per(1)
end
def search
diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml
index e2105bdd..a04dcf62 100644
--- a/app/views/layouts/application.html.haml
+++ b/app/views/layouts/application.html.haml
@@ -35,9 +35,9 @@
\/
= link_to btc_human(current_user.balance), current_user
\/
- = link_to t('sign_out'), destroy_user_session_path, method: :delete
+ = link_to t('links.sign_out'), destroy_user_session_path, method: :delete
- else
- = link_to t('sign_in'), new_user_session_path
+ = link_to t('links.sign_in'), new_user_session_path
%h3.text-muted.code-pro= t('tip4commit')
= render 'common/menu'
From f543992d3d12416affc6dba5e0ae8b7a5610d380 Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Mon, 15 Sep 2014 14:26:26 +0700
Subject: [PATCH 040/415] fixed pagination
---
app/controllers/projects_controller.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index 07d776e7..582c0852 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -5,7 +5,7 @@ class ProjectsController < ApplicationController
before_filter :load_project, only: [:show, :edit, :update, :decide_tip_amounts]
def index
- @projects = Project.order(projects_order).page(params[:page]).per(1)
+ @projects = Project.order(projects_order).page(params[:page]).per(30)
end
def search
From 25441ef407dfd9d868ed78deb74c81999a4a33bd Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Mon, 15 Sep 2014 14:46:48 +0700
Subject: [PATCH 041/415] removed needless translation files. attempt to fix
18n-js
---
app/assets/javascripts/i18n/translations.js | 2 +
config/locales/devise.en.yml | 60 ---------------------
config/locales/en.bootstrap.yml | 18 -------
3 files changed, 2 insertions(+), 78 deletions(-)
create mode 100644 app/assets/javascripts/i18n/translations.js
delete mode 100644 config/locales/devise.en.yml
delete mode 100644 config/locales/en.bootstrap.yml
diff --git a/app/assets/javascripts/i18n/translations.js b/app/assets/javascripts/i18n/translations.js
new file mode 100644
index 00000000..7bd072cb
--- /dev/null
+++ b/app/assets/javascripts/i18n/translations.js
@@ -0,0 +1,2 @@
+var I18n = I18n || {};
+I18n.translations = {"en":{"js":{"errors":{"value":{"invalid":"Value is invalid"},"email":{"invalid":"Invalid Email Address","blank":"The Email is required and can't be empty"},"password":{"blank":"The password is required and can't be empty","invalid":"The password and its confirmation are not same"},"password_confirmation":{"blank":"The password confirmation is required and can't be empty","invalid":"The password and its confirmation are not same"}}}},"fr":{"js":{"errors":{"value":{"invalid":"Valeur non valide"},"email":{"invalid":"Adresse Email non valide","blank":"L'Email est requis et doit être renseigné"},"password":{"blank":"Les mot de passe est requis et doit être renseigné","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"},"password_confirmation":{"blank":"La confirmation du mot de passe est requise et doit être renseignée","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"}}}}};
diff --git a/config/locales/devise.en.yml b/config/locales/devise.en.yml
deleted file mode 100644
index e7445b31..00000000
--- a/config/locales/devise.en.yml
+++ /dev/null
@@ -1,60 +0,0 @@
-# Additional translations at https://github.com/plataformatec/devise/wiki/I18n
-
-en:
- devise:
- confirmations:
- confirmed: "Your account was successfully confirmed. Please sign in."
- confirmed_and_signed_in: "Your account was successfully confirmed. You are now signed in."
- send_instructions: "You will receive an email with instructions about how to confirm your account in a few minutes."
- send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions about how to confirm your account in a few minutes."
- failure:
- already_authenticated: "You are already signed in."
- inactive: "Your account is not activated yet."
- invalid: "Invalid email or password."
- invalid_token: "Invalid authentication token."
- locked: "Your account is locked."
- not_found_in_database: "Invalid email or password."
- timeout: "Your session expired. Please sign in again to continue."
- unauthenticated: "You need to sign in or sign up before continuing."
- unconfirmed: "You have to confirm your account before continuing."
- mailer:
- confirmation_instructions:
- subject: "Confirmation instructions"
- reset_password_instructions:
- subject: "Reset password instructions"
- unlock_instructions:
- subject: "Unlock Instructions"
- omniauth_callbacks:
- failure: "Could not authenticate you from %{kind} because \"%{reason}\"."
- success: "Successfully authenticated from %{kind} account."
- passwords:
- no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided."
- send_instructions: "You will receive an email with instructions about how to reset your password in a few minutes."
- send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes."
- updated: "Your password was changed successfully. You are now signed in."
- updated_not_active: "Your password was changed successfully."
- registrations:
- destroyed: "Bye! Your account was successfully cancelled. We hope to see you again soon."
- signed_up: "Welcome! You have signed up successfully."
- signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated."
- signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked."
- signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please open the link to activate your account."
- update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and click on the confirm link to finalize confirming your new email address."
- updated: "You updated your account successfully."
- sessions:
- signed_in: "Signed in successfully."
- signed_out: "Signed out successfully."
- unlocks:
- send_instructions: "You will receive an email with instructions about how to unlock your account in a few minutes."
- send_paranoid_instructions: "If your account exists, you will receive an email with instructions about how to unlock it in a few minutes."
- unlocked: "Your account has been unlocked successfully. Please sign in to continue."
- errors:
- messages:
- already_confirmed: "was already confirmed, please try signing in"
- confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one"
- expired: "has expired, please request a new one"
- not_found: "not found"
- not_locked: "was not locked"
- not_saved:
- one: "1 error prohibited this %{resource} from being saved:"
- other: "%{count} errors prohibited this %{resource} from being saved:"
diff --git a/config/locales/en.bootstrap.yml b/config/locales/en.bootstrap.yml
deleted file mode 100644
index c98d8d85..00000000
--- a/config/locales/en.bootstrap.yml
+++ /dev/null
@@ -1,18 +0,0 @@
-# Sample localization file for English. Add more files in this directory for other locales.
-# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
-
-en:
- helpers:
- actions: "Actions"
- links:
- back: "Back"
- cancel: "Cancel"
- confirm: "Are you sure?"
- destroy: "Delete"
- new: "New"
- edit: "Edit"
- titles:
- edit: "Edit %{model}"
- save: "Save %{model}"
- new: "New %{model}"
- delete: "Delete %{model}"
From 436d2ca6d0c4d27f9850ef4f0d1e54732f787eff Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Mon, 15 Sep 2014 15:16:08 +0700
Subject: [PATCH 042/415] fixed reloading locale using turbo-links
---
app/views/layouts/application.html.haml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml
index a04dcf62..6a0b8821 100644
--- a/app/views/layouts/application.html.haml
+++ b/app/views/layouts/application.html.haml
@@ -61,5 +61,5 @@
= javascript_include_tag "application"
- :javascript
- I18n.locale = #{I18n.locale.to_json};
+ %script{"data-turbolinks-track" => "true"}
+ I18n.locale = #{raw I18n.locale.to_s.to_json};
From e237e0e5fcd7205e50706f831a55d8b52e2fb0f8 Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Mon, 15 Sep 2014 15:29:22 +0700
Subject: [PATCH 043/415] fixed tests
---
features/step_definitions/web.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/features/step_definitions/web.rb b/features/step_definitions/web.rb
index a3cb037d..c3a6c65c 100644
--- a/features/step_definitions/web.rb
+++ b/features/step_definitions/web.rb
@@ -8,7 +8,7 @@
},
}.to_ostruct
visit root_path
- click_on "Sign in"
+ first(:link, "Sign in").click
click_on "Sign in with Github"
page.should have_content("Successfully authenticated")
end
From 1c8198745e50a9db853f40a8713c2db9b4b976c8 Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Mon, 15 Sep 2014 15:29:30 +0700
Subject: [PATCH 044/415] fixed i18n-js
---
app/views/layouts/application.html.haml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml
index 6a0b8821..31fbd336 100644
--- a/app/views/layouts/application.html.haml
+++ b/app/views/layouts/application.html.haml
@@ -61,5 +61,5 @@
= javascript_include_tag "application"
- %script{"data-turbolinks-track" => "true"}
- I18n.locale = #{raw I18n.locale.to_s.to_json};
+ %script{"type" => "text/javascript", "data-turbolinks-track" => "true"}
+ I18n.locale = #{raw I18n.locale.to_json};
From c436ee0f888c14ac04a3809e90e7a627bdce53e2 Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Mon, 15 Sep 2014 15:34:19 +0700
Subject: [PATCH 045/415] fixed js
---
app/views/layouts/application.html.haml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml
index 31fbd336..df09296e 100644
--- a/app/views/layouts/application.html.haml
+++ b/app/views/layouts/application.html.haml
@@ -61,5 +61,5 @@
= javascript_include_tag "application"
- %script{"type" => "text/javascript", "data-turbolinks-track" => "true"}
- I18n.locale = #{raw I18n.locale.to_json};
+ %script{"data-turbolinks-track" => "true"}
+ I18n.locale = #{raw I18n.locale.to_json};
From e3c05cdbf4251b1589e629a62b9d87908b23fb95 Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Mon, 15 Sep 2014 15:43:34 +0700
Subject: [PATCH 046/415] fixed turbo-links and i18n-js
---
app/views/layouts/application.html.haml | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml
index df09296e..7984afd8 100644
--- a/app/views/layouts/application.html.haml
+++ b/app/views/layouts/application.html.haml
@@ -51,7 +51,7 @@
.footer
%p.pull-right
- ::Rails.application.config.available_locales.each do |locale|
- = link_to image_tag("flags/#{locale}.png"), "?locale=#{locale}"
+ = link_to image_tag("flags/#{locale}.png"), "?locale=#{locale}", data: {no_turbolink: true}
%p
©
= link_to t('tip4commit'), 'http://tip4commit.com/', target: '_blank'
@@ -61,5 +61,5 @@
= javascript_include_tag "application"
- %script{"data-turbolinks-track" => "true"}
- I18n.locale = #{raw I18n.locale.to_json};
+ :javascript
+ I18n.locale = #{I18n.locale.to_json};
From e3b384a9a85ae8a08ab31a37ab061e082fb22463 Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Mon, 15 Sep 2014 15:56:00 +0700
Subject: [PATCH 047/415] fixed turbo-links + i18n-js
---
app/views/layouts/application.html.haml | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml
index 7984afd8..39ce810d 100644
--- a/app/views/layouts/application.html.haml
+++ b/app/views/layouts/application.html.haml
@@ -15,6 +15,10 @@
/ %link{:rel => 'image_src', :type => 'image/png', :href => asset_path('logo.png')}
= stylesheet_link_tag "application", media: "all"
+ = javascript_include_tag "application"
+
+ :javascript
+ I18n.locale = #{I18n.locale.to_json};
= csrf_meta_tags
%body
@@ -58,8 +62,3 @@
2013-#{Date.today.year}.
= raw t('footer.text', github_link: link_to(t('footer.github_link'), 'https://github.com/tip4commit/tip4commit', target: '_blank'), support_link: link_to(t('footer.support_link'), 'http://tip4commit.com/projects/307'))
= link_to t('footer.follow_link'), 'https://twitter.com/tip4commit', target: '_blank'
-
- = javascript_include_tag "application"
-
- :javascript
- I18n.locale = #{I18n.locale.to_json};
From 31911c2ec2b5b16f15ced644045e04baf4eee011 Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Mon, 15 Sep 2014 16:14:29 +0700
Subject: [PATCH 048/415] localized addthis. locale passed to coingiving in
params
---
app/views/layouts/application.html.haml | 2 +-
app/views/projects/show.html.haml | 5 +++--
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml
index 39ce810d..70244692 100644
--- a/app/views/layouts/application.html.haml
+++ b/app/views/layouts/application.html.haml
@@ -18,7 +18,7 @@
= javascript_include_tag "application"
:javascript
- I18n.locale = #{I18n.locale.to_json};
+ I18n.locale = "#{I18n.locale}";
= csrf_meta_tags
%body
diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml
index adf91c39..cca16a66 100644
--- a/app/views/projects/show.html.haml
+++ b/app/views/projects/show.html.haml
@@ -18,7 +18,7 @@
.panel-heading
%h4.panel-title= t('.project_sponsors')
.panel-body
- %iframe{ src: "//coingiving.com/project_sponsors?url=#{project_url(@project, :protocol => 'https')}", scrolling: "no", style: 'width:100%; height:500px; border:0px; padding:0;overflow:hidden'}
+ %iframe{ src: "//coingiving.com/project_sponsors?url=#{project_url(@project, :protocol => 'https')}?locale=#{I18n.locale}", scrolling: "no", style: 'width:100%; height:500px; border:0px; padding:0;overflow:hidden'}
.hidden
%span(data-coingiving="title")= "[tip4commit] " + @project.full_name
%span(data-coingiving="description")= @project.description
@@ -95,7 +95,8 @@
%h4= t('.promote_project', project: @project.full_name)
%p
/ AddThis Button BEGIN
- .addthis_toolbox.addthis_default_style.addthis_32x32_style(addthis:data_track_clickback="false" addthis:data_track_addressbar="false")
+ .addthis_toolbox.addthis_default_style.addthis_32x32_style(addthis:data_track_clickback="false" addthis:data_track_addressbar="false"
+ addthis:ui_language="#{I18n.locale}")
%a.addthis_button_preferred_1
%a.addthis_button_preferred_2
%a.addthis_button_preferred_3
From c84b2cb806318d39c656a96ea0115b534c747c89 Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Mon, 15 Sep 2014 16:45:34 +0700
Subject: [PATCH 049/415] fixed coingiving
---
app/assets/images/flags/en.png | Bin 599 -> 599 bytes
app/assets/images/flags/fr.png | Bin 545 -> 545 bytes
app/views/projects/show.html.haml | 2 +-
3 files changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/assets/images/flags/en.png b/app/assets/images/flags/en.png
index ff701e19f6d2c0658fb23b1d94124cba4ce60851..258228e88cf66d8f6633fea6b641a595db9ed2a1 100644
GIT binary patch
delta 15
Wcmcc4a-D^xGr-S%BWn;7BNqTFO9Vau
delta 14
Vcmcc4a-D^>Gr-TCcOy#>696Sj1V8`)
diff --git a/app/assets/images/flags/fr.png b/app/assets/images/flags/fr.png
index 8332c4ec23c853944c29b02d7b32a88033f48a71..22836232bcb13f71b46e3c2c288a5bbfc5f832c3 100644
GIT binary patch
delta 15
WcmZ3;vXF(PGr-S%BdZJ(BNqT8ivyeh
delta 14
VcmZ3;vXF(fGr-TCcO#1o696A#1D*f?
diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml
index cca16a66..61de66dd 100644
--- a/app/views/projects/show.html.haml
+++ b/app/views/projects/show.html.haml
@@ -18,7 +18,7 @@
.panel-heading
%h4.panel-title= t('.project_sponsors')
.panel-body
- %iframe{ src: "//coingiving.com/project_sponsors?url=#{project_url(@project, :protocol => 'https')}?locale=#{I18n.locale}", scrolling: "no", style: 'width:100%; height:500px; border:0px; padding:0;overflow:hidden'}
+ %iframe{ src: "//coingiving.com/project_sponsors?locale=#{I18n.locale}&url=#{project_url(@project, :protocol => 'https')}", scrolling: "no", style: 'width:100%; height:500px; border:0px; padding:0;overflow:hidden'}
.hidden
%span(data-coingiving="title")= "[tip4commit] " + @project.full_name
%span(data-coingiving="description")= @project.description
From e1758976bb8e4d87bd910e6a7f04ec2316e617e9 Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Mon, 15 Sep 2014 17:55:29 +0700
Subject: [PATCH 050/415] reverted flags
---
app/assets/images/flags/en.png | Bin 599 -> 599 bytes
app/assets/images/flags/fr.png | Bin 545 -> 545 bytes
2 files changed, 0 insertions(+), 0 deletions(-)
diff --git a/app/assets/images/flags/en.png b/app/assets/images/flags/en.png
index 258228e88cf66d8f6633fea6b641a595db9ed2a1..ff701e19f6d2c0658fb23b1d94124cba4ce60851 100644
GIT binary patch
delta 14
Vcmcc4a-D^>Gr-TCcOy#>696Sj1V8`)
delta 15
Wcmcc4a-D^xGr-S%BWn;7BNqTFO9Vau
diff --git a/app/assets/images/flags/fr.png b/app/assets/images/flags/fr.png
index 22836232bcb13f71b46e3c2c288a5bbfc5f832c3..8332c4ec23c853944c29b02d7b32a88033f48a71 100644
GIT binary patch
delta 14
VcmZ3;vXF(fGr-TCcO#1o696A#1D*f?
delta 15
WcmZ3;vXF(PGr-S%BdZJ(BNqT8ivyeh
From c7188fdfa5617ac05503f50f6533d3790c898a5e Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Mon, 15 Sep 2014 17:59:23 +0700
Subject: [PATCH 051/415] removed broken icons
---
app/assets/images/flags/en.png | Bin 599 -> 0 bytes
app/assets/images/flags/fr.png | Bin 545 -> 0 bytes
2 files changed, 0 insertions(+), 0 deletions(-)
delete mode 100644 app/assets/images/flags/en.png
delete mode 100644 app/assets/images/flags/fr.png
diff --git a/app/assets/images/flags/en.png b/app/assets/images/flags/en.png
deleted file mode 100644
index ff701e19f6d2c0658fb23b1d94124cba4ce60851..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 599
zcmV-d0;v6oP)U(k2*|8J(R-+sudaynhucHbwAMTnor{mwqO^w7JHzaBsT
z{O^B8RYf5+LvDs&KmRKVd78=o{`1#HTiEo_OolaGleS)G+IQ#sUI`b*pv<`1zCJ=H0jd{{2S>p`ri%{LsXJ%FbMS
z$#S`6f|?OG!^Jxczkf6Q`UNF{l0Sd`ad7zm>({^EzyAS6{{CgrkluOb3l1A>ZU2~A
zK+FZ=zkmP!`TOVhpFbzBzFaPmD2$N3;+$pK?>zdet`f0002ovPDHLkV1gy;I?Vt8
diff --git a/app/assets/images/flags/fr.png b/app/assets/images/flags/fr.png
deleted file mode 100644
index 8332c4ec23c853944c29b02d7b32a88033f48a71..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 545
zcmV++0^a?JP)lgG%);U`26kn-@hOg
zU%!6+4+cOs(0HIde9xZz`}Onxub&LUB0x(30+2WcIRJn#2ut|?gWYu1Cf+!-K%B8#
zdf?1WA}#uZ8oj7u>$I1i0Al&`=O0k%-@icgAIJnM0xA6maSq6BK-ECw|NZ*S`0Lj%
z1_pot6puj;05Ax`F!=umqj7^frO?t|3^&I1kxUq9yECc+jQpY84SWH_0#pxl$?v~F
z@*hy-KN0|X07U)z`4{NpU%#2aHUI<=%a31wK(7Du52Oc(|3O^?R1IN+RRjI-n*kVB
z3=9AP#PZ|EACPLGJ%9cJNh|>9B%spYzZw7h1%?tp0I_@ndg9MNE>313@6R75NcceF
zkr51-#U+7;F#`Sf7i0rK0I_`g_NQ&Z
Date: Mon, 15 Sep 2014 17:59:45 +0700
Subject: [PATCH 052/415] added icons
---
app/assets/images/flags/en.png | Bin 0 -> 599 bytes
app/assets/images/flags/fr.png | Bin 0 -> 545 bytes
2 files changed, 0 insertions(+), 0 deletions(-)
create mode 100644 app/assets/images/flags/en.png
create mode 100644 app/assets/images/flags/fr.png
diff --git a/app/assets/images/flags/en.png b/app/assets/images/flags/en.png
new file mode 100644
index 0000000000000000000000000000000000000000..ff701e19f6d2c0658fb23b1d94124cba4ce60851
GIT binary patch
literal 599
zcmV-d0;v6oP)U(k2*|8J(R-+sudaynhucHbwAMTnor{mwqO^w7JHzaBsT
z{O^B8RYf5+LvDs&KmRKVd78=o{`1#HTiEo_OolaGleS)G+IQ#sUI`b*pv<`1zCJ=H0jd{{2S>p`ri%{LsXJ%FbMS
z$#S`6f|?OG!^Jxczkf6Q`UNF{l0Sd`ad7zm>({^EzyAS6{{CgrkluOb3l1A>ZU2~A
zK+FZ=zkmP!`TOVhpFbzBzFaPmD2$N3;+$pK?>zdet`f0002ovPDHLkV1gy;I?Vt8
literal 0
HcmV?d00001
diff --git a/app/assets/images/flags/fr.png b/app/assets/images/flags/fr.png
new file mode 100644
index 0000000000000000000000000000000000000000..8332c4ec23c853944c29b02d7b32a88033f48a71
GIT binary patch
literal 545
zcmV++0^a?JP)lgG%);U`26kn-@hOg
zU%!6+4+cOs(0HIde9xZz`}Onxub&LUB0x(30+2WcIRJn#2ut|?gWYu1Cf+!-K%B8#
zdf?1WA}#uZ8oj7u>$I1i0Al&`=O0k%-@icgAIJnM0xA6maSq6BK-ECw|NZ*S`0Lj%
z1_pot6puj;05Ax`F!=umqj7^frO?t|3^&I1kxUq9yECc+jQpY84SWH_0#pxl$?v~F
z@*hy-KN0|X07U)z`4{NpU%#2aHUI<=%a31wK(7Du52Oc(|3O^?R1IN+RRjI-n*kVB
z3=9AP#PZ|EACPLGJ%9cJNh|>9B%spYzZw7h1%?tp0I_@ndg9MNE>313@6R75NcceF
zkr51-#U+7;F#`Sf7i0rK0I_`g_NQ&Z
Date: Thu, 18 Sep 2014 12:59:31 +0700
Subject: [PATCH 053/415] allow project maintainers to disable notifying of new
users notify new users only if their balance hits 0.005 btc #111
---
app/controllers/projects_controller.rb | 2 +-
app/models/tip.rb | 4 +++-
app/views/projects/edit.html.haml | 1 +
app/views/projects/show.html.haml | 3 +++
config/locales/en.yml | 4 +++-
config/locales/fr.yml | 2 ++
.../20140918051752_add_disable_notifications_to_projects.rb | 5 +++++
db/schema.rb | 3 ++-
8 files changed, 20 insertions(+), 4 deletions(-)
create mode 100644 db/migrate/20140918051752_add_disable_notifications_to_projects.rb
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index 582c0852..ee02fbfa 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -97,7 +97,7 @@ def load_project
end
def project_params
- params.require(:project).permit(:branch, :hold_tips, tipping_policies_text_attributes: [:text])
+ params.require(:project).permit(:branch, :disable_notifications, :hold_tips, tipping_policies_text_attributes: [:text])
end
def projects_order
diff --git a/app/models/tip.rb b/app/models/tip.rb
index d0c67bb9..0b5ac7de 100644
--- a/app/models/tip.rb
+++ b/app/models/tip.rb
@@ -112,7 +112,9 @@ def amount_percentage=(percentage)
end
def notify_user
- if amount and amount > 0 and user.bitcoin_address.blank? and !user.unsubscribed
+ if amount && amount > 0 && user.bitcoin_address.blank? &&
+ !user.unsubscribed && !project.disable_notifications &&
+ user.balance > 0.005
if user.notified_at.nil? or user.notified_at < 30.days.ago
begin
UserMailer.new_tip(user, self).deliver
diff --git a/app/views/projects/edit.html.haml b/app/views/projects/edit.html.haml
index 8cae05db..5e4e5104 100644
--- a/app/views/projects/edit.html.haml
+++ b/app/views/projects/edit.html.haml
@@ -9,4 +9,5 @@
= f.fields_for :tipping_policies_text, @project.tipping_policies_text || @project.build_tipping_policies_text do |fields|
= fields.text_area :text, rows: 10, label: t('.tipping_policies')
= f.check_box :hold_tips, label: t('.hold_tips')
+ = f.check_box :disable_notifications, label: t('.disable_notifications')
= f.submit t('.save'), class: "btn btn-default"
diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml
index 61de66dd..b057d869 100644
--- a/app/views/projects/show.html.haml
+++ b/app/views/projects/show.html.haml
@@ -3,6 +3,9 @@
- content_for :description do
= @project.description
+- if @project.disable_notifications
+ .alert.alert-danger= t('.disabled_notifications')
+
%h1
= @project.full_name
%small= link_to glyph(:github), @project.github_url, target: '_blank'
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 8172c06f..ccf68ca9 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -78,6 +78,7 @@ en:
title: "Contribute to %{project}"
edit_project: Change project settings
decide_tip_amounts: Decide tip amounts
+ disabled_notifications: "Project maintainers have decided not to notify new contributors about tips and they probably don't like this way of funding."
project_sponsors: Project Sponsors
fee: "%{percentage} of deposited funds will be used to tip for new commits."
balance: Balance
@@ -115,6 +116,7 @@ en:
tipping_policies: Tipping policies
hold_tips: "Do not send the tips immediatly. Give collaborators the ability to modify the tips before they're sent"
save: Save the project settings
+ disable_notifications: Don't notify new contributors
decide_tip_amounts:
commit: Commit
author: Author
@@ -209,4 +211,4 @@ en:
bitcoin_address: Bitcoin address
password: Password
password_confirmation: Password confirmation
- display_name: Display name
+ display_name: Display name
\ No newline at end of file
diff --git a/config/locales/fr.yml b/config/locales/fr.yml
index 8519093d..0b610082 100644
--- a/config/locales/fr.yml
+++ b/config/locales/fr.yml
@@ -78,6 +78,7 @@ fr:
title: "Contribuer à %{project}"
edit_project: Changer les paramètres du projet
decide_tip_amounts: Choisir un montant de pourboire
+ disabled_notifications: "Project maintainers have decided not to notify new contributors about tips and they probably don't like this way of funding."
project_sponsors: Sponsors du projet
fee: "%{percentage} des fonds déposés seront utilisés pour récompenser les nouvelles contributions."
balance: Fonds
@@ -115,6 +116,7 @@ fr:
tipping_policies: Politique des pourboires
hold_tips: "N'envoyez pas les bourboires tout de suite. Laissez à vos collaborateurs la possibilité de modifier les pourboires avant qu'ils ne soient envoyés"
save: Enregistrer les paramètres du projet
+ disable_notifications: Don't notify new contributors
decide_tip_amounts:
commit: Contribution
author: Auteur
diff --git a/db/migrate/20140918051752_add_disable_notifications_to_projects.rb b/db/migrate/20140918051752_add_disable_notifications_to_projects.rb
new file mode 100644
index 00000000..98c03469
--- /dev/null
+++ b/db/migrate/20140918051752_add_disable_notifications_to_projects.rb
@@ -0,0 +1,5 @@
+class AddDisableNotificationsToProjects < ActiveRecord::Migration
+ def change
+ add_column :projects, :disable_notifications, :boolean
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 9a468895..b9683cf3 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 20140823060921) do
+ActiveRecord::Schema.define(version: 20140918051752) do
create_table "collaborators", force: true do |t|
t.integer "project_id"
@@ -52,6 +52,7 @@
t.boolean "hold_tips", default: false
t.datetime "info_updated_at"
t.string "branch"
+ t.boolean "disable_notifications"
end
add_index "projects", ["full_name"], name: "index_projects_on_full_name", unique: true
From 8949f0f235901f22ec11f5942acf741ad45c5563 Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Thu, 18 Sep 2014 15:49:53 +0700
Subject: [PATCH 054/415] fixed notification threshold
---
app/models/tip.rb | 2 +-
features/notification_threshold.feature | 19 +++++++++++++++++++
2 files changed, 20 insertions(+), 1 deletion(-)
create mode 100644 features/notification_threshold.feature
diff --git a/app/models/tip.rb b/app/models/tip.rb
index 0b5ac7de..969bd19a 100644
--- a/app/models/tip.rb
+++ b/app/models/tip.rb
@@ -114,7 +114,7 @@ def amount_percentage=(percentage)
def notify_user
if amount && amount > 0 && user.bitcoin_address.blank? &&
!user.unsubscribed && !project.disable_notifications &&
- user.balance > 0.005
+ user.balance > 500000
if user.notified_at.nil? or user.notified_at < 30.days.ago
begin
UserMailer.new_tip(user, self).deliver
diff --git a/features/notification_threshold.feature b/features/notification_threshold.feature
new file mode 100644
index 00000000..5e613f6e
--- /dev/null
+++ b/features/notification_threshold.feature
@@ -0,0 +1,19 @@
+Feature: Users should not be notified if their balance is small
+ Background:
+ Given a project "django"
+ And a deposit of "0.1"
+ And 2 new commits
+
+ Scenario: Without big deposits
+ When the new commits are read
+ Then there should be 0 email sent
+
+ Scenario: User's balance hits threshold
+ When 100 new commits
+ And the new commits are read
+ Then there should be 1 email sent
+
+ Scenario: With bigger donation
+ When a deposit of "2"
+ And the new commits are read
+ Then there should be 1 email sent
\ No newline at end of file
From fc871f69c729da473ef054d99d1aa17d95f14767 Mon Sep 17 00:00:00 2001
From: yunixon
Date: Thu, 25 Sep 2014 17:46:20 +0400
Subject: [PATCH 055/415] RU Locale
---
config/locales/ru.yml | 214 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 214 insertions(+)
create mode 100644 config/locales/ru.yml
diff --git a/config/locales/ru.yml b/config/locales/ru.yml
new file mode 100644
index 00000000..f573be31
--- /dev/null
+++ b/config/locales/ru.yml
@@ -0,0 +1,214 @@
+ru:
+ tip4commit: Tip4Commit
+ meta:
+ title: Помощь проектам с открытым исходным кодом
+ description: Пожертвования в биткойнах проектам с открытым исходным кодом или создание коммита и получение чаевых за него.
+ menu:
+ home: Главная
+ projects: Проекты
+ footer:
+ text: "Исходный код доступен на %{github_link} и также вы можете %{support_link} для развития."
+ github_link: GitHub
+ support_link: поддержка
+ follow_link: Следуй за @tip4commit
+ links:
+ sign_in: Войти
+ sign_out: Выйти
+ errors:
+ project_not_found: Проект не найден.
+ access_denied: Доступ запрещен
+ can_assign_more_tips: "Нельзя использовать более чем 100% свободных средств."
+ wrong_bitcoin_address: Ошибка обновления биткоин адреса
+ user_not_found: Пользователь не найден
+ access_denied: Вы не авторизованы для выполнения данного действия!
+ notices:
+ project_updated: Настройки проекта обновлены
+ tips_decided: Сумма для чаевых определена
+ user_updated: Ваш профиль обновлен!
+ user_unsubscribed: "Вы отписались! Приносим извинения за предоставленные неудобства. Однако, вы все равно можете оставить нам свой Биткоин адрес, чтобы получать вознагрождения"
+ tip_amounts:
+ undecided: "Не определено"
+ free: "Free: 0%"
+ tiny: "Tiny: 0.1%"
+ small: "Small: 0.5%"
+ normal: "Normal: 1%"
+ big: "Big: 2%"
+ huge: "Huge: 5%"
+ js:
+ errors:
+ value:
+ invalid: Неверное значение
+ email:
+ invalid: Ошибка в Email адресе
+ blank: Email не может быть пустым
+ password:
+ blank: Пароль не может быть пустым
+ invalid: Пароль и его подтверждение не совпадают
+ password_confirmation:
+ blank: Подтверждение пароля не может быть пустым
+ invalid: Пароль и его подтверждение не совпадают
+ home:
+ index:
+ see_projects: Проекты
+ how_does_it_work:
+ title: Как это работает?
+ text: Люди жертвуют биткоин монеты на проекты. Когда кто-либо принимает коммит в проекте своего репозитория, мы автоматически начисляем чаевые автору.
+ button: Узнать о Биткоин
+ donate:
+ title: Пожертвования
+ text: Найдите проект, который вам по душе и перечислите биткоин монеты на него. Ваши пожертвования вместе с пожертвованиями других автоматически будут зачисляться в качестве чаевых за новые коммиты.
+ button: Найти или Добавить проект
+ contribute:
+ title: Сопровождение
+ text: Идите и почините что-либо! Если ваш коммит будет принят контрибьютором проекта, вам будут начислены чаевые!
+ sign_in_text: "Просто проверьте ваш email или %{sign_in_link}."
+ button: Проекты
+ projects:
+ index:
+ find_project:
+ placeholder: Введите GitHub адрес вашего проекта для добавления или ключевое слово для поиска...
+ button: Найти или добавить проект
+ repository: Репозитроий
+ description: Описание
+ watchers: Наблюдателей
+ balance: Баланс
+ forked_from: forked from
+ support: Поддержка
+ show:
+ title: "Сопровождать: %{project}"
+ edit_project: Изменить настройки проекта
+ decide_tip_amounts: Установить сумму чаевых
+ disabled_notifications: "Контрибьюторы проекта решили не уведомлять новых участников о чаевых и вероятно им не нравиться такой способ финансирования."
+ project_sponsors: Спонсоры Проекта
+ fee: "%{percentage} средств будет использоваться в качестве чаевых за новый коммит."
+ balance: Баланс
+ deposits: депозиты
+ custom_tip_size: (каждый новый коммит получает процент от доступного остатка)
+ default_tip_size: "(каждый новый коммит получает %{percentage} от доступного остатка)"
+ unconfirmed_amount: "(%{amount} не подтверждено)"
+ tipping_policies: Чаевые
+ updated_by_user: "(Последние изменения %{name} на %{date})"
+ updated_by_unknown: "(Последния изменения на %{date})"
+ tips_paid: Оплаченные Чаевые
+ unclaimed_amount: "(%{amount} от суммы являются невостребованными, и будут возвращены проекту через месяц.)"
+ last_tips: Недавние Чаевые
+ see_all: смотреть все
+ received: "получено %{amount}"
+ will_receive: получат чаевые
+ for_commit: за коммит
+ when_decided: когда сумма задана
+ next_tip: Следующие чаевые
+ contribute_and_earn: Сопровождение и Заработок
+ contribute_and_earn_description: "Пожертвовать биткойны этому проекту или %{make_commits_link} и получить чаевые. Если ваш коммит будет принят в %{branch} контрибьютором проекта и есть биткойны на балансе проекта, то вы получите чаевые!"
+ contribute_and_earn_branch: "в %{branch} ветку"
+ make_commits_link: сделать коммит
+ tell_us_bitcoin_address: "Просто %{tell_us_link} ваш биткоин адрес."
+ tell_us_link: укажите
+ sign_in: "Просто проверьте ваш email или %{sign_in_link}."
+ promote_project: Содействовать %{project}
+ embedding: Внедрять
+ image_url: "URL изображения:"
+ shield_title: чаевые за следующий коммит
+ edit:
+ project_settings: "%{project} настройки проекта"
+ branch: Ветка
+ default_branch: Ветка по умолчанию
+ tipping_policies: Чаевые
+ hold_tips: "Не отправляйте чаевые сразу. Предоставьте коллабораторам возможность изменить чаевые перед тем как они будут отправлены"
+ save: Сохранить настройки проекта
+ disable_notifications: Не оповещать новых контрибьюторов
+ decide_tip_amounts:
+ commit: Коммит
+ author: Автор
+ message: Сообщение
+ tip: Чаевые (зависят от баланса проекта)
+ submit: Отправить выбранную сумму чаевых
+ tips:
+ index:
+ tips: Чаевые
+ project_tips: '%{project} чаевые'
+ user_tips: "%{user} чаевые"
+ created_at: Создано
+ commiter: Коммитер
+ project: Проект
+ commit: Коммит
+ amount: Сумма
+ refunded: Возвращено на депозит проекта
+ undecided: Сумма чаевых пока не может быть определена
+ no_bitcoin_address: Адрес вывода не указан
+ below_threshold: "Баланс пользователя ниже порога вывода"
+ waiting: Ожидает вывода
+ error: (ошибка при отправке)
+ deposits:
+ index:
+ project_deposits: '%{project} депозиты'
+ deposits: Депозиты
+ created_at: Создано
+ project: Проект
+ amount: Сумма
+ transaction: Транзакция
+ confirmed: Подтверждена
+ confirmed_yes: 'Да'
+ confirmed_no: 'Нет'
+ users:
+ index:
+ title: Топ Контрибьюторов
+ name: Имя
+ commits_count: Чаевых за коммиты
+ withdrawn: Выведено
+ show:
+ balance: Баланс
+ threshold: "Вы получите свои деньги, когда ваш баланс достигнет %{threshold}"
+ see_all: смотреть все
+ received: "%{time} получено %{amount} за коммит %{commit} в %{project}"
+ bitcoin_address_placeholder: Ваш биткоин адрес
+ notify: Сообщать мне о новых чаевых (не больше чем одно email в месяц)
+ submit_user: Обновить информацию пользователя
+ change_password: Смена пароля
+ submit_password: Сменить пароль
+ withdrawals:
+ index:
+ title: Последние Выводы
+ created_at: Создано
+ transaction: Транзакция
+ result: Результат
+ error: Ошибка
+ success: Успешно
+ devise:
+ sessions:
+ new:
+ title: Вход
+ remember_me: Запомнить меня
+ submit: Войти
+ registrations:
+ new:
+ title: Регистрация
+ submit: Войти
+ passwords:
+ new:
+ title: Забыли ваш пароль?
+ submit: Сбросить пароль
+ edit:
+ title: Смена пароля
+ submit: Сменить пароль
+ confirmations:
+ new:
+ title: Выслать еще раз письмо с подтверждением
+ submit: Выслать
+ links:
+ sign_in: Вход
+ sign_up: Регистрация
+ recover: Забыли ваш пароль?
+ confirm: Не получили письмо с подтверждением?
+ sign_in_with: "Войти с %{provider}"
+ errors:
+ primary_email: ваш email адрес подтвержден.
+ onmiauth_info: не удалось получить информацию.
+ activerecord:
+ attributes:
+ user:
+ email: E-mail
+ bitcoin_address: Биткоин адрес
+ password: Пароль
+ password_confirmation: Пароль еще раз
+ display_name: Имя
\ No newline at end of file
From 05b890d49d4fd0a58794e1240da0d4ca8e4d96da Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Fri, 26 Sep 2014 11:35:18 +0600
Subject: [PATCH 056/415] fixed russian translation
---
app/assets/javascripts/i18n/translations.js | 2 +-
app/views/projects/show.html.haml | 2 +-
config/application.rb | 2 +-
config/locales/en.yml | 1 +
config/locales/fr.yml | 1 +
config/locales/ru.yml | 79 +++++++++++----------
spec/spec_helper.rb | 2 +-
7 files changed, 46 insertions(+), 43 deletions(-)
diff --git a/app/assets/javascripts/i18n/translations.js b/app/assets/javascripts/i18n/translations.js
index 7bd072cb..8f971fc2 100644
--- a/app/assets/javascripts/i18n/translations.js
+++ b/app/assets/javascripts/i18n/translations.js
@@ -1,2 +1,2 @@
var I18n = I18n || {};
-I18n.translations = {"en":{"js":{"errors":{"value":{"invalid":"Value is invalid"},"email":{"invalid":"Invalid Email Address","blank":"The Email is required and can't be empty"},"password":{"blank":"The password is required and can't be empty","invalid":"The password and its confirmation are not same"},"password_confirmation":{"blank":"The password confirmation is required and can't be empty","invalid":"The password and its confirmation are not same"}}}},"fr":{"js":{"errors":{"value":{"invalid":"Valeur non valide"},"email":{"invalid":"Adresse Email non valide","blank":"L'Email est requis et doit être renseigné"},"password":{"blank":"Les mot de passe est requis et doit être renseigné","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"},"password_confirmation":{"blank":"La confirmation du mot de passe est requise et doit être renseignée","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"}}}}};
+I18n.translations = {"en":{"js":{"errors":{"value":{"invalid":"Value is invalid"},"email":{"invalid":"Invalid Email Address","blank":"The Email is required and can't be empty"},"password":{"blank":"The password is required and can't be empty","invalid":"The password and its confirmation are not same"},"password_confirmation":{"blank":"The password confirmation is required and can't be empty","invalid":"The password and its confirmation are not same"}}}},"fr":{"js":{"errors":{"value":{"invalid":"Valeur non valide"},"email":{"invalid":"Adresse Email non valide","blank":"L'Email est requis et doit être renseigné"},"password":{"blank":"Les mot de passe est requis et doit être renseigné","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"},"password_confirmation":{"blank":"La confirmation du mot de passe est requise et doit être renseignée","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"}}}},"ru":{"js":{"errors":{"value":{"invalid":"Неверное значение"},"email":{"invalid":"Ошибка в Email адресе","blank":"Email не может быть пустым"},"password":{"blank":"Пароль не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"},"password_confirmation":{"blank":"Подтверждение пароля не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"}}}}};
\ No newline at end of file
diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml
index b057d869..48043f1f 100644
--- a/app/views/projects/show.html.haml
+++ b/app/views/projects/show.html.haml
@@ -93,7 +93,7 @@
- if current_user.bitcoin_address.blank?
= raw t('.tell_us_bitcoin_address', tell_us_link: link_to(t('.tell_us_link'), current_user))
- else
- = raw t('.sign_in', sign_in_link: link_to(t('links.sign_in'), new_user_session_path))
+ = raw t('.sign_in', sign_in_link: link_to(t('links.sign_in_imp'), new_user_session_path))
%h4= t('.promote_project', project: @project.full_name)
%p
diff --git a/config/application.rb b/config/application.rb
index 17bf72cb..884f54ff 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -25,7 +25,7 @@ class Application < Rails::Application
config.autoload_paths += %W(#{config.root}/lib)
config.assets.initialize_on_precompile = true
- config.available_locales = %w(en fr)
+ config.available_locales = %w(en fr ru)
end
end
diff --git a/config/locales/en.yml b/config/locales/en.yml
index ccf68ca9..ef53d6d9 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -13,6 +13,7 @@ en:
follow_link: Follow @tip4commit
links:
sign_in: Sign in
+ sign_in_imp: sign in
sign_out: Sign Out
errors:
project_not_found: Project not found.
diff --git a/config/locales/fr.yml b/config/locales/fr.yml
index 0b610082..e00b0980 100644
--- a/config/locales/fr.yml
+++ b/config/locales/fr.yml
@@ -13,6 +13,7 @@ fr:
follow_link: Suivez @tip4commit
links:
sign_in: Se connecter
+ sign_in_imp: se connecter
sign_out: Se déconnecter
errors:
project_not_found: Projet non trouvé.
diff --git a/config/locales/ru.yml b/config/locales/ru.yml
index f573be31..7482c2cc 100644
--- a/config/locales/ru.yml
+++ b/config/locales/ru.yml
@@ -2,17 +2,18 @@ ru:
tip4commit: Tip4Commit
meta:
title: Помощь проектам с открытым исходным кодом
- description: Пожертвования в биткойнах проектам с открытым исходным кодом или создание коммита и получение чаевых за него.
+ description: Жертвуйте биткойны проектам с открытым исходным кодом или создавайте коммиты и получайте чаевые за них.
menu:
home: Главная
projects: Проекты
footer:
- text: "Исходный код доступен на %{github_link} и также вы можете %{support_link} для развития."
+ text: "Исходный код доступен на %{github_link}. Также вы можете %{support_link} разработку проекта."
github_link: GitHub
- support_link: поддержка
- follow_link: Следуй за @tip4commit
+ support_link: поддержать
+ follow_link: Следите за @tip4commit
links:
sign_in: Войти
+ sign_in_imp: войдите
sign_out: Выйти
errors:
project_not_found: Проект не найден.
@@ -23,7 +24,7 @@ ru:
access_denied: Вы не авторизованы для выполнения данного действия!
notices:
project_updated: Настройки проекта обновлены
- tips_decided: Сумма для чаевых определена
+ tips_decided: Сумма чаевых определена
user_updated: Ваш профиль обновлен!
user_unsubscribed: "Вы отписались! Приносим извинения за предоставленные неудобства. Однако, вы все равно можете оставить нам свой Биткоин адрес, чтобы получать вознагрождения"
tip_amounts:
@@ -52,61 +53,61 @@ ru:
see_projects: Проекты
how_does_it_work:
title: Как это работает?
- text: Люди жертвуют биткоин монеты на проекты. Когда кто-либо принимает коммит в проекте своего репозитория, мы автоматически начисляем чаевые автору.
+ text: Люди жертвуют биткоины на проекты. Если владелец проекта принимает коммит в репозиторий, мы автоматически начисляем чаевые автору этого коммита.
button: Узнать о Биткоин
donate:
- title: Пожертвования
- text: Найдите проект, который вам по душе и перечислите биткоин монеты на него. Ваши пожертвования вместе с пожертвованиями других автоматически будут зачисляться в качестве чаевых за новые коммиты.
- button: Найти или Добавить проект
+ title: Жертвуйте
+ text: Найдите проект который вам по душе и перечислите биткоины на него. Ваши пожертвования вместе с пожертвованиями других людей будут автоматически выплачиваться авторам новых коммитов в виде чаевых.
+ button: Найти или добавить проект
contribute:
- title: Сопровождение
- text: Идите и почините что-либо! Если ваш коммит будет принят контрибьютором проекта, вам будут начислены чаевые!
+ title: Участвуйте
+ text: Идите и почините что-нибудь! Если ваш коммит будет принят владельцами проекта, вам будут выплачены чаевые!
sign_in_text: "Просто проверьте ваш email или %{sign_in_link}."
button: Проекты
projects:
index:
find_project:
- placeholder: Введите GitHub адрес вашего проекта для добавления или ключевое слово для поиска...
+ placeholder: Введите GitHub адрес вашего проекта чтобы добавить его или ключевое слово для поиска...
button: Найти или добавить проект
repository: Репозитроий
description: Описание
watchers: Наблюдателей
balance: Баланс
- forked_from: forked from
- support: Поддержка
+ forked_from: ответвление от
+ support: Поддержать
show:
- title: "Сопровождать: %{project}"
+ title: "Помогайте %{project}"
edit_project: Изменить настройки проекта
decide_tip_amounts: Установить сумму чаевых
disabled_notifications: "Контрибьюторы проекта решили не уведомлять новых участников о чаевых и вероятно им не нравиться такой способ финансирования."
- project_sponsors: Спонсоры Проекта
- fee: "%{percentage} средств будет использоваться в качестве чаевых за новый коммит."
+ project_sponsors: Спонсоры проекта
+ fee: "%{percentage} средств будет выплачено в качестве чаевых за новый коммит."
balance: Баланс
deposits: депозиты
custom_tip_size: (каждый новый коммит получает процент от доступного остатка)
default_tip_size: "(каждый новый коммит получает %{percentage} от доступного остатка)"
unconfirmed_amount: "(%{amount} не подтверждено)"
- tipping_policies: Чаевые
+ tipping_policies: Политика чаевых
updated_by_user: "(Последние изменения %{name} на %{date})"
updated_by_unknown: "(Последния изменения на %{date})"
- tips_paid: Оплаченные Чаевые
+ tips_paid: Выплаченные чаевые
unclaimed_amount: "(%{amount} от суммы являются невостребованными, и будут возвращены проекту через месяц.)"
- last_tips: Недавние Чаевые
+ last_tips: Недавние чаевые
see_all: смотреть все
received: "получено %{amount}"
will_receive: получат чаевые
for_commit: за коммит
when_decided: когда сумма задана
next_tip: Следующие чаевые
- contribute_and_earn: Сопровождение и Заработок
- contribute_and_earn_description: "Пожертвовать биткойны этому проекту или %{make_commits_link} и получить чаевые. Если ваш коммит будет принят в %{branch} контрибьютором проекта и есть биткойны на балансе проекта, то вы получите чаевые!"
- contribute_and_earn_branch: "в %{branch} ветку"
- make_commits_link: сделать коммит
+ contribute_and_earn: Помогайте и зарабатывайте
+ contribute_and_earn_description: "Жертвуйте биткойны этому проекту или %{make_commits_link} и получайте чаевые за них. Если ваш коммит будет принят %{branch} владельцами проекта, а баланс этого проекта положительный, то вы получите чаевые!"
+ contribute_and_earn_branch: "в ветку %{branch}"
+ make_commits_link: создавайте коммиты
tell_us_bitcoin_address: "Просто %{tell_us_link} ваш биткоин адрес."
tell_us_link: укажите
sign_in: "Просто проверьте ваш email или %{sign_in_link}."
- promote_project: Содействовать %{project}
- embedding: Внедрять
+ promote_project: Продвигайте %{project}
+ embedding: Код для вставки
image_url: "URL изображения:"
shield_title: чаевые за следующий коммит
edit:
@@ -114,7 +115,7 @@ ru:
branch: Ветка
default_branch: Ветка по умолчанию
tipping_policies: Чаевые
- hold_tips: "Не отправляйте чаевые сразу. Предоставьте коллабораторам возможность изменить чаевые перед тем как они будут отправлены"
+ hold_tips: "Не отправляйте чаевые сразу. Предоставьте владельцам проекта возможность изменить чаевые перед тем как они будут отправлены"
save: Сохранить настройки проекта
disable_notifications: Не оповещать новых контрибьюторов
decide_tip_amounts:
@@ -126,24 +127,24 @@ ru:
tips:
index:
tips: Чаевые
- project_tips: '%{project} чаевые'
- user_tips: "%{user} чаевые"
- created_at: Создано
- commiter: Коммитер
+ project_tips: 'Чаевые %{project}'
+ user_tips: "Чаевые %{user}"
+ created_at: Время создания
+ commiter: Автор
project: Проект
commit: Коммит
amount: Сумма
refunded: Возвращено на депозит проекта
- undecided: Сумма чаевых пока не может быть определена
+ undecided: Сумма чаевых ещё не определена
no_bitcoin_address: Адрес вывода не указан
below_threshold: "Баланс пользователя ниже порога вывода"
waiting: Ожидает вывода
error: (ошибка при отправке)
deposits:
index:
- project_deposits: '%{project} депозиты'
+ project_deposits: 'Депозиты %{project}'
deposits: Депозиты
- created_at: Создано
+ created_at: Время создания
project: Проект
amount: Сумма
transaction: Транзакция
@@ -154,22 +155,22 @@ ru:
index:
title: Топ Контрибьюторов
name: Имя
- commits_count: Чаевых за коммиты
- withdrawn: Выведено
+ commits_count: Количество коммитов
+ withdrawn: Выплачено
show:
balance: Баланс
threshold: "Вы получите свои деньги, когда ваш баланс достигнет %{threshold}"
see_all: смотреть все
received: "%{time} получено %{amount} за коммит %{commit} в %{project}"
bitcoin_address_placeholder: Ваш биткоин адрес
- notify: Сообщать мне о новых чаевых (не больше чем одно email в месяц)
+ notify: Сообщать мне о новых чаевых (не чаще чем одно сообщение в месяц)
submit_user: Обновить информацию пользователя
change_password: Смена пароля
submit_password: Сменить пароль
withdrawals:
index:
- title: Последние Выводы
- created_at: Создано
+ title: Последние выплаты
+ created_at: Время выплаты
transaction: Транзакция
result: Результат
error: Ошибка
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index c857851f..cee30cb5 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -6,7 +6,7 @@
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'rspec/autorun'
-
+#
# Requires supporting ruby files with custom matchers and macros, etc, in
# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
# run as spec files by default. This means that files in spec/support that end
From 46ac18a810db5cddd5b8205d1cf05a94a364e598 Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Fri, 26 Sep 2014 11:39:03 +0600
Subject: [PATCH 057/415] flags
---
app/assets/images/flags/de.png | Bin 0 -> 545 bytes
app/assets/images/flags/ru.png | Bin 0 -> 420 bytes
public/javascripts/translations.js | 2 ++
3 files changed, 2 insertions(+)
create mode 100755 app/assets/images/flags/de.png
create mode 100755 app/assets/images/flags/ru.png
create mode 100644 public/javascripts/translations.js
diff --git a/app/assets/images/flags/de.png b/app/assets/images/flags/de.png
new file mode 100755
index 0000000000000000000000000000000000000000..ac4a977362738ca7daa20784717f10f9617136b4
GIT binary patch
literal 545
zcmV++0^a?JP)h<6BFn%a
z@b8~2SoNP@zd$;E{sbbRuHQd?{QCI=sNwhbA3*&Qe}GP900=;09NYi^fU@pUdVa9*13;+Sd!tjgXKhXQEMobL97(p6<{RLvMGBN!7
j!N9=G@a-1^K!5=NcXWu!7_DDe00000NkvXXu0mjfeQx^H
literal 0
HcmV?d00001
diff --git a/app/assets/images/flags/ru.png b/app/assets/images/flags/ru.png
new file mode 100755
index 0000000000000000000000000000000000000000..47da4214fd9edb383687c1d4f84fe8b42a51ceb2
GIT binary patch
literal 420
zcmV;V0bBlwP)X|NRSO0LlM<{-BURBqYRGSojej
zfLOL~|EH_V_~;P>Nc10*D0|Jxss<
zFi1)Q<$$6LU}rIc*dU*QNFV}+9T))>0|XG`SD?F)5CbX~O$rDA0t^5@iDe$xIAIn5
O0000
Date: Fri, 26 Sep 2014 11:33:34 +0400
Subject: [PATCH 058/415] Fixed russian translation
---
config/locales/ru.yml | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/config/locales/ru.yml b/config/locales/ru.yml
index 7482c2cc..0601048d 100644
--- a/config/locales/ru.yml
+++ b/config/locales/ru.yml
@@ -29,12 +29,12 @@ ru:
user_unsubscribed: "Вы отписались! Приносим извинения за предоставленные неудобства. Однако, вы все равно можете оставить нам свой Биткоин адрес, чтобы получать вознагрождения"
tip_amounts:
undecided: "Не определено"
- free: "Free: 0%"
- tiny: "Tiny: 0.1%"
- small: "Small: 0.5%"
- normal: "Normal: 1%"
- big: "Big: 2%"
- huge: "Huge: 5%"
+ free: "Нет: 0%"
+ tiny: "Крошечные: 0.1%"
+ small: "Маленькие: 0.5%"
+ normal: "Обычные: 1%"
+ big: "Большие: 2%"
+ huge: "Огромные: 5%"
js:
errors:
value:
@@ -95,9 +95,9 @@ ru:
last_tips: Недавние чаевые
see_all: смотреть все
received: "получено %{amount}"
- will_receive: получат чаевые
+ will_receive: получит чаевые
for_commit: за коммит
- when_decided: когда сумма задана
+ when_decided: когда сумма будет определена
next_tip: Следующие чаевые
contribute_and_earn: Помогайте и зарабатывайте
contribute_and_earn_description: "Жертвуйте биткойны этому проекту или %{make_commits_link} и получайте чаевые за них. Если ваш коммит будет принят %{branch} владельцами проекта, а баланс этого проекта положительный, то вы получите чаевые!"
@@ -203,7 +203,7 @@ ru:
confirm: Не получили письмо с подтверждением?
sign_in_with: "Войти с %{provider}"
errors:
- primary_email: ваш email адрес подтвержден.
+ primary_email: ваш email адрес должен быть подтвержден.
onmiauth_info: не удалось получить информацию.
activerecord:
attributes:
From 24948534745868fc90ff5e07c7d7d38cc1593809 Mon Sep 17 00:00:00 2001
From: msizov
Date: Fri, 26 Sep 2014 18:53:52 +0700
Subject: [PATCH 059/415] =?UTF-8?q?Fixed=20a=20typo=20in=20a=20russian=20w?=
=?UTF-8?q?ord=20"=D0=A0=D0=B5=D0=BF=D0=BE=D0=B7=D0=B8=D1=82=D0=BE=D1=80?=
=?UTF-8?q?=D0=B8=D0=B9"?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
config/locales/ru.yml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/config/locales/ru.yml b/config/locales/ru.yml
index 7482c2cc..20fc45f6 100644
--- a/config/locales/ru.yml
+++ b/config/locales/ru.yml
@@ -69,7 +69,7 @@ ru:
find_project:
placeholder: Введите GitHub адрес вашего проекта чтобы добавить его или ключевое слово для поиска...
button: Найти или добавить проект
- repository: Репозитроий
+ repository: Репозиторий
description: Описание
watchers: Наблюдателей
balance: Баланс
@@ -212,4 +212,4 @@ ru:
bitcoin_address: Биткоин адрес
password: Пароль
password_confirmation: Пароль еще раз
- display_name: Имя
\ No newline at end of file
+ display_name: Имя
From 03fce9f70362029dbd7a2e5976a24f8dac637727 Mon Sep 17 00:00:00 2001
From: Jan Keromnes
Date: Sat, 27 Sep 2014 18:14:34 +0000
Subject: [PATCH 060/415] Update French locale.
---
config/locales/fr.yml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/config/locales/fr.yml b/config/locales/fr.yml
index e00b0980..3acd3398 100644
--- a/config/locales/fr.yml
+++ b/config/locales/fr.yml
@@ -79,7 +79,7 @@ fr:
title: "Contribuer à %{project}"
edit_project: Changer les paramètres du projet
decide_tip_amounts: Choisir un montant de pourboire
- disabled_notifications: "Project maintainers have decided not to notify new contributors about tips and they probably don't like this way of funding."
+ disabled_notifications: "Les responsables du projet ont décidé de ne pas prévenir les nouveaux contributeurs au sujet des pourboires, et n'apprécient probablement pas ce type de rémunération."
project_sponsors: Sponsors du projet
fee: "%{percentage} des fonds déposés seront utilisés pour récompenser les nouvelles contributions."
balance: Fonds
@@ -117,7 +117,7 @@ fr:
tipping_policies: Politique des pourboires
hold_tips: "N'envoyez pas les bourboires tout de suite. Laissez à vos collaborateurs la possibilité de modifier les pourboires avant qu'ils ne soient envoyés"
save: Enregistrer les paramètres du projet
- disable_notifications: Don't notify new contributors
+ disable_notifications: Ne pas prévenir les nouveaux contributeurs
decide_tip_amounts:
commit: Contribution
author: Auteur
From cae59eae495616dcbec329ba4090695e83663381 Mon Sep 17 00:00:00 2001
From: Nikita
Date: Sun, 28 Sep 2014 18:53:42 +0400
Subject: [PATCH 061/415] fix promote text
---
config/locales/ru.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/config/locales/ru.yml b/config/locales/ru.yml
index 77652f75..30b7f782 100644
--- a/config/locales/ru.yml
+++ b/config/locales/ru.yml
@@ -106,7 +106,7 @@ ru:
tell_us_bitcoin_address: "Просто %{tell_us_link} ваш биткоин адрес."
tell_us_link: укажите
sign_in: "Просто проверьте ваш email или %{sign_in_link}."
- promote_project: Продвигайте %{project}
+ promote_project: расскажите о %{project}
embedding: Код для вставки
image_url: "URL изображения:"
shield_title: чаевые за следующий коммит
From 55e46e04a76afb7a272c83962c8b097bd600803b Mon Sep 17 00:00:00 2001
From: bill auger
Date: Sat, 18 Oct 2014 03:59:52 +0000
Subject: [PATCH 062/415] prevent travis from bulding debugger gem
---
.travis.yml | 5 +++++
Gemfile | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/.travis.yml b/.travis.yml
index 24f8a5bd..c31607c3 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,9 +1,14 @@
language: ruby
+
rvm:
- 2.0.0
+
+bundler_args: --without development
+
before_script:
- cp config/config.yml.sample config/config.yml
- cp config/database.yml.sample config/database.yml
+
script:
- bundle exec rake spec
- bundle exec rake cucumber
diff --git a/Gemfile b/Gemfile
index 025850a6..0eb84dc3 100644
--- a/Gemfile
+++ b/Gemfile
@@ -42,12 +42,12 @@ group :development do
gem 'capistrano-bundler', '>= 1.1.0'
gem 'capistrano-rails', '~> 1.1.0'
gem 'sqlite3', '~> 1.3.8'
+ gem 'debugger', '~> 1.6.5'
end
group :development, :test do
gem 'factory_girl_rails', '~> 4.3.0'
gem 'rspec-rails', '~> 3.0.0.beta'
- gem 'debugger', '~> 1.6.5'
end
group :test do
From bbfbf8b0f3743ceddb7af758426d1f408d91edbc Mon Sep 17 00:00:00 2001
From: bill auger
Date: Sat, 18 Oct 2014 04:16:10 +0000
Subject: [PATCH 063/415] add sqlite3 to the test environment bundle for travis
---
Gemfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Gemfile b/Gemfile
index 0eb84dc3..0108e6d9 100644
--- a/Gemfile
+++ b/Gemfile
@@ -41,11 +41,11 @@ group :development do
gem 'capistrano-rvm', '~> 0.1.0', github: 'capistrano/rvm'
gem 'capistrano-bundler', '>= 1.1.0'
gem 'capistrano-rails', '~> 1.1.0'
- gem 'sqlite3', '~> 1.3.8'
gem 'debugger', '~> 1.6.5'
end
group :development, :test do
+ gem 'sqlite3', '~> 1.3.8'
gem 'factory_girl_rails', '~> 4.3.0'
gem 'rspec-rails', '~> 3.0.0.beta'
end
From 6702a4fbfe3d725a60e1b414698a8db4e14866f9 Mon Sep 17 00:00:00 2001
From: bill auger
Date: Sat, 18 Oct 2014 19:12:05 +0000
Subject: [PATCH 064/415] add sign_up link to header and home page
* site-wide header filters 'sign_up' and 'sign_in' links based on controller
* added sign_up message machine translations for 'fr' and 'ru' locales
---
app/assets/javascripts/i18n/translations.js | 2 +-
app/views/home/index.html.haml | 2 ++
app/views/layouts/application.html.haml | 7 ++++++-
config/locales/en.yml | 3 ++-
config/locales/fr.yml | 1 +
config/locales/ru.yml | 1 +
6 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/app/assets/javascripts/i18n/translations.js b/app/assets/javascripts/i18n/translations.js
index 8f971fc2..356c6e1d 100644
--- a/app/assets/javascripts/i18n/translations.js
+++ b/app/assets/javascripts/i18n/translations.js
@@ -1,2 +1,2 @@
var I18n = I18n || {};
-I18n.translations = {"en":{"js":{"errors":{"value":{"invalid":"Value is invalid"},"email":{"invalid":"Invalid Email Address","blank":"The Email is required and can't be empty"},"password":{"blank":"The password is required and can't be empty","invalid":"The password and its confirmation are not same"},"password_confirmation":{"blank":"The password confirmation is required and can't be empty","invalid":"The password and its confirmation are not same"}}}},"fr":{"js":{"errors":{"value":{"invalid":"Valeur non valide"},"email":{"invalid":"Adresse Email non valide","blank":"L'Email est requis et doit être renseigné"},"password":{"blank":"Les mot de passe est requis et doit être renseigné","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"},"password_confirmation":{"blank":"La confirmation du mot de passe est requise et doit être renseignée","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"}}}},"ru":{"js":{"errors":{"value":{"invalid":"Неверное значение"},"email":{"invalid":"Ошибка в Email адресе","blank":"Email не может быть пустым"},"password":{"blank":"Пароль не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"},"password_confirmation":{"blank":"Подтверждение пароля не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"}}}}};
\ No newline at end of file
+I18n.translations = {"en":{"js":{"errors":{"value":{"invalid":"Value is invalid"},"email":{"invalid":"Invalid Email Address","blank":"The Email is required and can't be empty"},"password":{"blank":"The password is required and can't be empty","invalid":"The password and its confirmation are not same"},"password_confirmation":{"blank":"The password confirmation is required and can't be empty","invalid":"The password and its confirmation are not same"}}}},"ru":{"js":{"errors":{"value":{"invalid":"Неверное значение"},"email":{"invalid":"Ошибка в Email адресе","blank":"Email не может быть пустым"},"password":{"blank":"Пароль не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"},"password_confirmation":{"blank":"Подтверждение пароля не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"}}}},"fr":{"js":{"errors":{"value":{"invalid":"Valeur non valide"},"email":{"invalid":"Adresse Email non valide","blank":"L'Email est requis et doit être renseigné"},"password":{"blank":"Les mot de passe est requis et doit être renseigné","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"},"password_confirmation":{"blank":"La confirmation du mot de passe est requise et doit être renseignée","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"}}}}};
\ No newline at end of file
diff --git a/app/views/home/index.html.haml b/app/views/home/index.html.haml
index f82c13d5..76c75087 100644
--- a/app/views/home/index.html.haml
+++ b/app/views/home/index.html.haml
@@ -25,6 +25,8 @@
= t('.contribute.text')
- if !current_user
= raw t('.contribute.sign_in_text', sign_in_link: link_to(t('links.sign_in'), new_user_session_path))
+ - if Devise.mappings[:user].registerable?
+ = raw t('.contribute.sign_up_text', sign_up_link: link_to(t('links.sign_up'), new_user_registration_path))
%p
%a.btn.btn-primary{href: projects_path}
= t('.contribute.button')
diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml
index 70244692..4caf47b9 100644
--- a/app/views/layouts/application.html.haml
+++ b/app/views/layouts/application.html.haml
@@ -41,7 +41,12 @@
\/
= link_to t('links.sign_out'), destroy_user_session_path, method: :delete
- else
- = link_to t('links.sign_in'), new_user_session_path
+ - if controller_name != 'registrations'
+ = link_to t('links.sign_up'), new_user_registration_path
+ - unless %w{sessions registrations}.include? controller_name
+ = " or "
+ - if controller_name != 'sessions'
+ = link_to t('links.sign_in'), new_user_session_path
%h3.text-muted.code-pro= t('tip4commit')
= render 'common/menu'
diff --git a/config/locales/en.yml b/config/locales/en.yml
index ef53d6d9..108c3985 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -62,7 +62,8 @@ en:
contribute:
title: Contribute
text: Go and fix something! If your commit is accepted by the project maintainer, you will get a tip!
- sign_in_text: "Just check your email or %{sign_in_link}."
+ sign_in_text: "Just check your email for an invitation or %{sign_in_link}."
+ sign_up_text: "If you have not yet received an invitation, you can %{sign_up_link} with a valid email address or via GitHub."
button: Supported projects
projects:
index:
diff --git a/config/locales/fr.yml b/config/locales/fr.yml
index 3acd3398..861ad848 100644
--- a/config/locales/fr.yml
+++ b/config/locales/fr.yml
@@ -63,6 +63,7 @@ fr:
title: Contribuer
text: Améliorez un projet ! Si votre contribution est acceptée par le mainteneur du projet, vous recevrez un pourboire !
sign_in_text: "Vérifiez simplement vos emails ou %{sign_in_link}."
+ sign_up_text: "Si vous n'avez pas encore reçu une invitation, vous pouvez %{sign_up_link} avec une adresse de courriel valide ou via GitHub."
button: Projets subventionnés
projects:
index:
diff --git a/config/locales/ru.yml b/config/locales/ru.yml
index 77652f75..84489ce8 100644
--- a/config/locales/ru.yml
+++ b/config/locales/ru.yml
@@ -63,6 +63,7 @@ ru:
title: Участвуйте
text: Идите и почините что-нибудь! Если ваш коммит будет принят владельцами проекта, вам будут выплачены чаевые!
sign_in_text: "Просто проверьте ваш email или %{sign_in_link}."
+ sign_up_text: "Если вы еще не получил приглашение, вы можете %{sign_up_link} с действительным адресом электронной почты или через GitHub."
button: Проекты
projects:
index:
From 69f3a75d95d57d2174f01f738266659c4598a0b8 Mon Sep 17 00:00:00 2001
From: Nikita
Date: Sat, 27 Sep 2014 23:32:08 +0400
Subject: [PATCH 065/415] changed search string
Changed the search string. now in the search button, you can accommodate any number of characters. Words don't come out for button borders in languages other than English
---
app/views/projects/index.html.haml | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/app/views/projects/index.html.haml b/app/views/projects/index.html.haml
index 95c1a613..e6d8debb 100644
--- a/app/views/projects/index.html.haml
+++ b/app/views/projects/index.html.haml
@@ -3,11 +3,12 @@
= form_tag search_projects_path, role: 'form', method: :get do |f|
.form-group
.row
- .col-lg-10
- = text_field_tag :query, '', class: 'form-control', placeholder: t('.find_project.placeholder'), :value => params[:query]
- = hidden_field_tag :order, params[:order] || 'balance'
- .col-lg-2
- = button_tag t('.find_project.button'), class: "btn form-control btn-default", name: nil
+ .col-lg-12
+ .input-group
+ = text_field_tag :query, '', class: 'form-control', placeholder: t('.find_project.placeholder'), :value => params[:query]
+ = hidden_field_tag :order, params[:order] || 'balance'
+ %span.input-group-btn
+ = button_tag t('.find_project.button'), class: "btn btn-default", name: nil
%p
- if @projects.count > 0
%table.table.table-striped
From 9d865ad717afc444c20e8d218957de2e9dd01795 Mon Sep 17 00:00:00 2001
From: Nikita
Date: Sat, 27 Sep 2014 23:44:08 +0400
Subject: [PATCH 066/415] Resize the button support
Resize the button "support" for the line size, line height
---
app/views/projects/index.html.haml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/views/projects/index.html.haml b/app/views/projects/index.html.haml
index e6d8debb..a6c1445a 100644
--- a/app/views/projects/index.html.haml
+++ b/app/views/projects/index.html.haml
@@ -33,7 +33,7 @@
%td= project.description
%td= project.watchers_count
%td= btc_human project.available_amount_cache
- %td= link_to t('.support'), pretty_project_path(project), class: 'btn btn-success'
+ %td= link_to t('.support'), pretty_project_path(project), class: 'btn btn-xs btn-success'
= paginate @projects
- else
.alert.alert-warning{role: 'alert'}= I18n.t('errors.project_not_found')
From 9a7720b7d0d0395239afe27f9955afaa843e65ed Mon Sep 17 00:00:00 2001
From: Nikita
Date: Sun, 28 Sep 2014 00:07:22 +0400
Subject: [PATCH 067/415] changed text support button
changed text support button
---
config/locales/en.yml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/config/locales/en.yml b/config/locales/en.yml
index ef53d6d9..0479830e 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -74,7 +74,7 @@ en:
watchers: Watchers
balance: Balance
forked_from: forked from
- support: Support
+ support: Support project
show:
title: "Contribute to %{project}"
edit_project: Change project settings
@@ -212,4 +212,4 @@ en:
bitcoin_address: Bitcoin address
password: Password
password_confirmation: Password confirmation
- display_name: Display name
\ No newline at end of file
+ display_name: Display name
From df7d75b1d3ff8a7d18e8986882ee0ef8f69982ba Mon Sep 17 00:00:00 2001
From: Nikita
Date: Sun, 28 Sep 2014 00:07:49 +0400
Subject: [PATCH 068/415] changed text support button
changed text support button
---
config/locales/ru.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/config/locales/ru.yml b/config/locales/ru.yml
index 30b7f782..8ccac7c6 100644
--- a/config/locales/ru.yml
+++ b/config/locales/ru.yml
@@ -74,7 +74,7 @@ ru:
watchers: Наблюдателей
balance: Баланс
forked_from: ответвление от
- support: Поддержать
+ support: Поддержать проект
show:
title: "Помогайте %{project}"
edit_project: Изменить настройки проекта
From 6ceb270009b006c76d3a919d96451f20f96aa66c Mon Sep 17 00:00:00 2001
From: Nikita
Date: Sun, 28 Sep 2014 00:34:21 +0400
Subject: [PATCH 069/415] Update ru.yml
added quotes on the problem
---
config/locales/ru.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/config/locales/ru.yml b/config/locales/ru.yml
index 8ccac7c6..017012de 100644
--- a/config/locales/ru.yml
+++ b/config/locales/ru.yml
@@ -74,7 +74,7 @@ ru:
watchers: Наблюдателей
balance: Баланс
forked_from: ответвление от
- support: Поддержать проект
+ support: "Поддержать проект"
show:
title: "Помогайте %{project}"
edit_project: Изменить настройки проекта
From 620f0ec55198af49c286a626144906b8e70ed6d7 Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Tue, 21 Oct 2014 12:32:52 +0600
Subject: [PATCH 070/415] capitalized promote_project text
---
config/locales/ru.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/config/locales/ru.yml b/config/locales/ru.yml
index 017012de..04b37acd 100644
--- a/config/locales/ru.yml
+++ b/config/locales/ru.yml
@@ -106,7 +106,7 @@ ru:
tell_us_bitcoin_address: "Просто %{tell_us_link} ваш биткоин адрес."
tell_us_link: укажите
sign_in: "Просто проверьте ваш email или %{sign_in_link}."
- promote_project: расскажите о %{project}
+ promote_project: "Расскажите о %{project}"
embedding: Код для вставки
image_url: "URL изображения:"
shield_title: чаевые за следующий коммит
From 3844df7021c4d02b281dc6ef89068835ca249e89 Mon Sep 17 00:00:00 2001
From: Michael Ford
Date: Tue, 7 Oct 2014 22:08:07 +0800
Subject: [PATCH 071/415] Use https links in new_tip.html.haml
---
app/views/user_mailer/new_tip.html.haml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/views/user_mailer/new_tip.html.haml b/app/views/user_mailer/new_tip.html.haml
index 9d92730c..001c1072 100644
--- a/app/views/user_mailer/new_tip.html.haml
+++ b/app/views/user_mailer/new_tip.html.haml
@@ -4,13 +4,13 @@
%p Your current balance is #{btc_human @user.balance}. If you don't enter a bitcoin address your tips will be returned to the project in 30 days.
-%p If you don't need bitcoins you can redirect your funds to any charity by using its address which you can find at #{link_to 'coingiving.com', 'http://coingiving.com/'}.
+%p If you don't need bitcoins you can redirect your funds to any charity by using its address which you can find at #{link_to 'coingiving.com', 'https://coingiving.com/'}.
%p= link_to 'Sign In', login_users_url(token: @user.login_token)
%p Thanks for contributing to Open Source!
-%p= link_to "tip4commit.com", "http://tip4commit.com/"
+%p= link_to "tip4commit.com", "https://tip4commit.com/"
%p
%small
From f22a9707dff7f55277c43266d90a6565271c187b Mon Sep 17 00:00:00 2001
From: bill auger
Date: Tue, 14 Oct 2014 16:48:20 +0000
Subject: [PATCH 072/415] allow config.yml to be loaded pre-processed
---
config/application.rb | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/config/application.rb b/config/application.rb
index 884f54ff..86f72d3b 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -6,7 +6,9 @@
# you've limited to :test, :development, or :production.
Bundler.require(:default, Rails.env)
-CONFIG ||= YAML::load(File.open("config/config.yml"))
+# load config.yaml preprocessed
+CONFIG ||= YAML::load(ERB.new(File.read("config/config.yml")).result)
+
module T4c
class Application < Rails::Application
From b415de2b12fef6d6ad4d2bb1a9783b697975e273 Mon Sep 17 00:00:00 2001
From: bill auger
Date: Sat, 18 Oct 2014 02:15:05 +0000
Subject: [PATCH 073/415] add developer README and prettify README.md
---
README.md | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/README.md b/README.md
index a88a4506..e045c2d0 100644
--- a/README.md
+++ b/README.md
@@ -1,17 +1,24 @@
Tip4commit
==========
-[](https://tip4commit.com/projects/307) [](https://travis-ci.org/tip4commit/tip4commit)
+[](https://tip4commit.com/projects/307)
+[](https://travis-ci.org/tip4commit/tip4commit)
-Donate bitcoins to open source projects or make commits and get tips for it.
+Donate bitcoins to open source projects or receive tips for code contributions.
-Official site: https://tip4commit.com/
+| | |
+| -------------- | ------------------------------------------------- |
+| Official site: | https://tip4commit.com/ |
+| Discussions: | https://bitcointalk.org/index.php?topic=315802 |
+| FAQs: | https://github.com/tip4commit/tip4commit/wiki/FAQ |
+| Issues: | https://github.com/tip4commit/tip4commit/issues |
-Forum thread: https://bitcointalk.org/index.php?topic=315802
-FAQ: https://github.com/tip4commit/tip4commit/wiki/FAQ
+Developers
+==========
+
+If you would like to contribute to the development of tip4commit, you can find the contribution guidelines and installation instructions on the [developer README](https://github.com/tip4commit/tip4commit/wiki/README---Developers)
-ToDo: https://github.com/tip4commit/tip4commit/issues
License
=======
From 3282c7c1536388bccaeb97fc0305a7f1ac2c534c Mon Sep 17 00:00:00 2001
From: kjanku1
Date: Sun, 12 Oct 2014 02:54:18 +0200
Subject: [PATCH 074/415] Added a polish translation
Not fully finished yet
---
app/assets/javascripts/i18n/translations.js | 4 +-
config/locales/pl.yml | 215 ++++++++++++++++++++
2 files changed, 217 insertions(+), 2 deletions(-)
create mode 100644 config/locales/pl.yml
diff --git a/app/assets/javascripts/i18n/translations.js b/app/assets/javascripts/i18n/translations.js
index 8f971fc2..bbe206d5 100644
--- a/app/assets/javascripts/i18n/translations.js
+++ b/app/assets/javascripts/i18n/translations.js
@@ -1,2 +1,2 @@
-var I18n = I18n || {};
-I18n.translations = {"en":{"js":{"errors":{"value":{"invalid":"Value is invalid"},"email":{"invalid":"Invalid Email Address","blank":"The Email is required and can't be empty"},"password":{"blank":"The password is required and can't be empty","invalid":"The password and its confirmation are not same"},"password_confirmation":{"blank":"The password confirmation is required and can't be empty","invalid":"The password and its confirmation are not same"}}}},"fr":{"js":{"errors":{"value":{"invalid":"Valeur non valide"},"email":{"invalid":"Adresse Email non valide","blank":"L'Email est requis et doit être renseigné"},"password":{"blank":"Les mot de passe est requis et doit être renseigné","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"},"password_confirmation":{"blank":"La confirmation du mot de passe est requise et doit être renseignée","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"}}}},"ru":{"js":{"errors":{"value":{"invalid":"Неверное значение"},"email":{"invalid":"Ошибка в Email адресе","blank":"Email не может быть пустым"},"password":{"blank":"Пароль не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"},"password_confirmation":{"blank":"Подтверждение пароля не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"}}}}};
\ No newline at end of file
+var I18n = I18n || {};
+I18n.translations = {"en":{"js":{"errors":{"value":{"invalid":"Value is invalid"},"email":{"invalid":"Invalid Email Address","blank":"The Email is required and can't be empty"},"password":{"blank":"The password is required and can't be empty","invalid":"The password and its confirmation are not same"},"password_confirmation":{"blank":"The password confirmation is required and can't be empty","invalid":"The password and its confirmation are not same"}}}},"fr":{"js":{"errors":{"value":{"invalid":"Valeur non valide"},"email":{"invalid":"Adresse Email non valide","blank":"L'Email est requis et doit être renseigné"},"password":{"blank":"Les mot de passe est requis et doit être renseigné","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"},"password_confirmation":{"blank":"La confirmation du mot de passe est requise et doit être renseignée","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"}}}},"ru":{"js":{"errors":{"value":{"invalid":"Неверное значение"},"email":{"invalid":"Ошибка в Email адресе","blank":"Email не может быть пустым"},"password":{"blank":"Пароль не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"},"password_confirmation":{"blank":"Подтверждение пароля не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"}}}}},"pl":{"js":{"errors":{"value":{"invalid":"Niepoprawna wartość"},"email":{"invalid":"Niepoprawny adres E-mail","blank":"E-mail jest wymagany i nie może być pusty"},"password":{"blank":"Hasło jest wymagane i nie może być puste","invalid":"Hasła nie są takie same"},"password_confirmation":{"blank":"Potwierdzenie hasła jest wymagane i nie może być puste","invalid":"Hasło i potwierdzenie nie są takie same"}}}};
\ No newline at end of file
diff --git a/config/locales/pl.yml b/config/locales/pl.yml
new file mode 100644
index 00000000..5e3023c6
--- /dev/null
+++ b/config/locales/pl.yml
@@ -0,0 +1,215 @@
+en:
+ tip4commit: Tip4Commit
+ meta:
+ title: Wspieraj Open Source
+ description: Podaruj Bitcoiny na projekty Open Source lub współpracuj tworząc nowe "commits" i otrzymuj napiwki.
+ menu:
+ home: Strona Główna
+ projects: Wspierane Projekty
+ footer:
+ text: "Kod żródłowy dostępny jest na %{github_link} możesz także %{support_link} jego rozwój."
+ github_link: GitHub
+ support_link: wsparcie
+ follow_link: Obserwuj @tip4commit
+ links:
+ sign_in: Zaloguj się
+ sign_in_imp: zaloguj się
+ sign_out: Wyloguj się
+ errors:
+ project_not_found: Nie znaleziono projektu.
+ access_denied: Odmowa dostępu
+ can_assign_more_tips: "Nie możesz przydzielić więcej niż 100% dostępnych środków."
+ wrong_bitcoin_address: Błąd w aktualizowaniu adresu bitcoin
+ user_not_found: Nie znaleziono użytkownika
+ access_denied: Nie masz uprawnień do wykonania tej czynności!
+ notices:
+ project_updated: Ustawienia prjektu zostały zaktualizowane
+ tips_decided: Rozmiary napiwków zostały zdefiniowane
+ user_updated: Informacje zostały zapisane!
+ user_unsubscribed: "Zrezygnowałeś z subskrypcji! Przepraszamy za wszelkie niedogodności. Nadal możesz zostawić swój adres bitcoin i otrzymywać napiwki."
+ tip_amounts:
+ undecided: "Nieokreślony"
+ free: "Darmowy: 0%"
+ tiny: "Bardzo mały: 0.1%"
+ small: "Mały: 0.5%"
+ normal: "Średni: 1%"
+ big: "Duży: 2%"
+ huge: "Bardzo duży: 5%"
+ js:
+ errors:
+ value:
+ invalid: Wartość jest niepoprawna
+ email:
+ invalid: Błędny adres E-mail
+ blank: E-mail jest wymagany i nie może być pusty
+ password:
+ blank: Hasło jest wymagane i nie może być puste
+ invalid: Hasło i jego potwierdzenie nie są takie same
+ password_confirmation:
+ blank: Potwierdzenie hasła jest wymagane i nie może być puste
+ invalid: Hasło i jego potwierdzenie nie są takie same
+ home:
+ index:
+ see_projects: Zobacz projekty
+ how_does_it_work:
+ title: Jak to działa?
+ text: Ludzie przesyłają bitcoiny. Kiedy kogoś "commit" zostanie zaakceptowany do repozytorium projektu, automatycznie płacimy autorowi.
+ button: Dowiedz się więcej o Bitcoin
+ donate:
+ title: Podaruj
+ text: Znajdź projekt, który ci się podoba i prześlij na niego bitcoiny. Twoje bitcoiny będzią zsumowana z innymi aby dać napiwki za nowe "commits".
+ button: Znajdż lub dodaj projekt
+ contribute:
+ title: Współpracuj
+ text: Idź i coś napraw! Jeśli twój commit zostanie zaakceptowany przez nadzorcę projektu, dostaniesz napiwek!
+ sign_in_text: "Wystarczy sprawdzić e-mail lub %{sign_in_link}."
+ button: Wspierane projekty
+ projects:
+ index:
+ find_project:
+ placeholder: Enter GitHub project URL to add a project or any keyword to find it...
+ button: Find or add project
+ repository: Repozytorium
+ description: Opis
+ watchers: Obserwujący
+ balance: Saldo
+ forked_from: "zforkowany" z
+ support: Pomoc
+ show:
+ title: "Współpracuj z %{project}"
+ edit_project: Zmień ustawienia projektu
+ decide_tip_amounts: Ustal rozmiary napiwków
+ disabled_notifications: "Nadzorcy projektów zdecydowali nie powiadamiac nowych współpracowników o napiwkach i prawdopodobnie nie lubią tego typu finansowania."
+ project_sponsors: Sponsorzy projektu
+ fee: "%{percentage} of deposited funds will be used to tip for new commits."
+ balance: Balance
+ deposits: deposits
+ custom_tip_size: (each new commit receives a percentage of available balance)
+ default_tip_size: "(each new commit receives %{percentage} of available balance)"
+ unconfirmed_amount: "(%{amount} unconfirmed)"
+ tipping_policies: Tipping policies
+ updated_by_user: "(Last updated by %{name} on %{date})"
+ updated_by_unknown: "(Last updated on %{date})"
+ tips_paid: Tips Paid
+ unclaimed_amount: "(%{amount} of this is unclaimed, and will be refunded to the project after being unclaimed for 1 month.)"
+ last_tips: Last Tips
+ see_all: see all
+ received: "received %{amount}"
+ will_receive: will receive a tip
+ for_commit: for commit
+ when_decided: when its amount is decided
+ next_tip: Next Tip
+ contribute_and_earn: Contribute and Earn
+ contribute_and_earn_description: "Donate bitcoins to this project or %{make_commits_link} and get tips for it. If your commit is accepted %{branch} by a project maintainer and there are bitcoins on its balance, you will get a tip!"
+ contribute_and_earn_branch: "to %{branch} branch"
+ make_commits_link: make commits
+ tell_us_bitcoin_address: "Just %{tell_us_link} your bitcoin address."
+ tell_us_link: tell us
+ sign_in: "Just check your email or %{sign_in_link}."
+ promote_project: Promote %{project}
+ embedding: Embedding
+ image_url: "Image URL:"
+ shield_title: tip for next commit
+ edit:
+ project_settings: "%{project} project settings"
+ branch: Branch
+ default_branch: Default branch
+ tipping_policies: Tipping policies
+ hold_tips: "Do not send the tips immediatly. Give collaborators the ability to modify the tips before they're sent"
+ save: Save the project settings
+ disable_notifications: Don't notify new contributors
+ decide_tip_amounts:
+ commit: Commit
+ author: Author
+ message: Message
+ tip: Tip (relative to the project balance)
+ submit: Send the selected tip amounts
+ tips:
+ index:
+ tips: Tips
+ project_tips: '%{project} tips'
+ user_tips: "%{user} tips"
+ created_at: Created At
+ commiter: Commiter
+ project: Project
+ commit: Commit
+ amount: Amount
+ refunded: Refunded to project's deposit
+ undecided: The amount of the tip has not been decided yet
+ no_bitcoin_address: User didn't specify withdrawal address
+ below_threshold: "User's balance is below withdrawal threshold"
+ waiting: Waiting for withdrawal
+ error: (error sending transaction)
+ deposits:
+ index:
+ project_deposits: '%{project} deposits'
+ deposits: Deposits
+ created_at: Created At
+ project: Project
+ amount: Amount
+ transaction: Transaction
+ confirmed: Confirmed
+ confirmed_yes: 'Yes'
+ confirmed_no: 'No'
+ users:
+ index:
+ title: Top Contributors
+ name: Name
+ commits_count: Commits tipped
+ withdrawn: Withdrawn
+ show:
+ balance: Balance
+ threshold: "You will get your money when your balance hits the threshold of %{threshold}"
+ see_all: see all
+ received: "%{time} received %{amount} for commit %{commit} in %{project}"
+ bitcoin_address_placeholder: Your bitcoin address
+ notify: Notify me about new tips (no more than one email per month)
+ submit_user: Update user info
+ change_password: Change your password
+ submit_password: Change my password
+ withdrawals:
+ index:
+ title: Last Withdrawals
+ created_at: Created At
+ transaction: Transaction
+ result: Result
+ error: Error
+ success: Success
+ devise:
+ sessions:
+ new:
+ title: Sign in
+ remember_me: Remember me
+ submit: Sign in
+ registrations:
+ new:
+ title: Sign up
+ submit: Sign up
+ passwords:
+ new:
+ title: Forgot your password?
+ submit: Send me reset password instructions
+ edit:
+ title: Change your password
+ submit: Change my password
+ confirmations:
+ new:
+ title: Resend confirmation instructions
+ submit: Resend confirmation instructions
+ links:
+ sign_in: Sign in
+ sign_up: Sign up
+ recover: Forgot your password?
+ confirm: Didn't receive confirmation instructions?
+ sign_in_with: "Sign in with %{provider}"
+ errors:
+ primary_email: your primary email address should be verified.
+ onmiauth_info: we were unable to fetch your information.
+ activerecord:
+ attributes:
+ user:
+ email: E-mail
+ bitcoin_address: Bitcoin address
+ password: Password
+ password_confirmation: Password confirmation
+ display_name: Display name
\ No newline at end of file
From 3a98f957a12409d90c043634763e3cd9fd03d66a Mon Sep 17 00:00:00 2001
From: kjanku1
Date: Sun, 19 Oct 2014 15:15:55 +0200
Subject: [PATCH 075/415] sign_up_text traslation
---
config/locales/pl.yml | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/config/locales/pl.yml b/config/locales/pl.yml
index 5e3023c6..83b67b7d 100644
--- a/config/locales/pl.yml
+++ b/config/locales/pl.yml
@@ -63,12 +63,13 @@ en:
title: Współpracuj
text: Idź i coś napraw! Jeśli twój commit zostanie zaakceptowany przez nadzorcę projektu, dostaniesz napiwek!
sign_in_text: "Wystarczy sprawdzić e-mail lub %{sign_in_link}."
+ sign_up_text: "Jeśli nadal nie otrzymałeś zaproszenia, możesz %{sign_up_link} za pomocą adresu e-mail lub przez GitHub."
button: Wspierane projekty
projects:
index:
find_project:
placeholder: Enter GitHub project URL to add a project or any keyword to find it...
- button: Find or add project
+ button: Znajdź lub dodaj projekt
repository: Repozytorium
description: Opis
watchers: Obserwujący
@@ -197,8 +198,8 @@ en:
title: Resend confirmation instructions
submit: Resend confirmation instructions
links:
- sign_in: Sign in
- sign_up: Sign up
+ sign_in: Zaloguj się
+ sign_up: Zarejestruj się
recover: Forgot your password?
confirm: Didn't receive confirmation instructions?
sign_in_with: "Sign in with %{provider}"
From 248084c04e8b0a440b37df37998b4f8e0db4b6c4 Mon Sep 17 00:00:00 2001
From: darthxjanus
Date: Wed, 15 Oct 2014 18:43:57 +0200
Subject: [PATCH 076/415] Added Croatian locale.
---
config/locales/hr.yml | 215 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 215 insertions(+)
create mode 100644 config/locales/hr.yml
diff --git a/config/locales/hr.yml b/config/locales/hr.yml
new file mode 100644
index 00000000..04c0404f
--- /dev/null
+++ b/config/locales/hr.yml
@@ -0,0 +1,215 @@
+en:
+ tip4commit: Tip4Commit
+ meta:
+ title: Doprinosite otvorenom izvoru
+ description: Donirajte bitcoine u otvoreni izvor projekata ili napravite cinove i dobite napojnice.
+ menu:
+ home: Pocetna stranica
+ projects: Podrzavani Projekti
+ footer:
+ text: "Izvorni kod dostupan na %{github_link} i mozete takoder %{support_link} razvoj."
+ github_link: GitHub
+ support_link: podrzi
+ follow_link: Follow @tip4commit
+ links:
+ sign_in: Prijava
+ sign_in_imp: prijava
+ sign_out: Odjava
+ errors:
+ project_not_found: Projekt nije nadjen.
+ access_denied: Pristup odbijen
+ can_assign_more_tips: "Ne mozete dodijeliti vise od 100% dostupnih sredstva."
+ wrong_bitcoin_address: Greska u updejtanju bitcoin adrese
+ user_not_found: Korisnik nije naden
+ access_denied: Niste ovlasteni da napravite ovu akciju!
+ notices:
+ project_updated: Postavke projekta su primijenjena
+ tips_decided: Broj napojnica je bio definiran
+ user_updated: Vasa informacija je sacuvana!
+ user_unsubscribed: "Maknuli ste vasu pretplatu! Zao nam je sto smo vam smetali. Svejedno mozete ostaviti vasu bitcoin adresu da dobite svoje napojnice."
+ tip_amounts:
+ undecided: "Neodluceno"
+ free: "Besplatno: 0%"
+ tiny: "Vrlo malo: 0.1%"
+ small: "Malo: 0.5%"
+ normal: "Normalno: 1%"
+ big: "Veliko: 2%"
+ huge: "Ogromno: 5%"
+ js:
+ errors:
+ value:
+ invalid: Vrijednost nevazeca
+ email:
+ invalid: Nezaveca email adresa
+ blank: Email je potreban i ne moze biti prazno
+ password:
+ blank: Lozinka je potrebna i ne moze biti prazno
+ invalid: Lozinka i njezina potvrda nisu isti
+ password_confirmation:
+ blank: Potvrda lozinke je potrebna i ne moze biti prazno
+ invalid: Lozinka i potvrda lozinke nisu isti
+ home:
+ index:
+ see_projects: Vidjeti projekte
+ how_does_it_work:
+ title: Kako ovo radi?
+ text: Ljudi doniraju bitcoine projektima. Kada se neciji cin potvrdi u repozitorij projekta, mi automatski posaljemo napojnicu autoru.
+ button: Nauciti o Bitcoin
+ donate:
+ title: Donirati
+ text: Pronadite projekt u koji zelite posvojiti svoje bitcoine. Vase donacije ce biti akumulirane sa fundovima ostalih donatora kao napojnice za nove cinove.
+ button: Pronaci ili dodati pojekt
+ contribute:
+ title: Doprinositi
+ text: Idite i popravite nesto! Ako je vas cin odobren od odrzavatelja projekta, dobiti cete napojnicu!
+ sign_in_text: "Samo provjerite vas email ili %{sign_in_link}."
+ button: Podrzavani projekti
+ projects:
+ index:
+ find_project:
+ placeholder: Upisite GitHub URL projekta kako biste dodati projekt ili bilo koju kljucnu rijec da biste je nasli...
+ button: Nadi ili dodaj projekt
+ repository: Repozitorij
+ description: Opis
+ watchers: Gledatelji
+ balance: Ravnoteza
+ forked_from: Odvojeno od
+ support: Podrzavaj
+ show:
+ title: "Doprinosi %{project}"
+ edit_project: Promijeni postavke projekta
+ decide_tip_amounts: Odredi kolicinu napojnica
+ disabled_notifications: "Odrzavatelji projekata su odlucili da nece obavjestiti nove doprinositelje o napojnicama i najvjerovatnije ne vole ovaj nacin isplate."
+ project_sponsors: Sponzori projekta
+ fee: "%{percentage} od polozenih isplata ce se koristiti kao napojnice za nove cinove."
+ balance: Ravnoteza
+ deposits: polozenja
+ custom_tip_size: (Svaki novi cin dobiva postotak dostune ravnoteze)
+ default_tip_size: "(Svaki novi cin dobiva %{percentage} dostupne ravnoteze)"
+ unconfirmed_amount: "(%{amount} nepotvrdeno)"
+ tipping_policies: Pravila o napojnicama
+ updated_by_user: "(Zadnje updejtao %{name} na %{date})"
+ updated_by_unknown: "(Zadnje updejtano %{date})"
+ tips_paid: Napojnice placene
+ unclaimed_amount: "(%{amount} od ovog neostvarenog, i biti ce natrag isplaceno u projekt nakon jednog mjeseca.)"
+ last_tips: Zadnje napojnice
+ see_all: Vidjeti sve
+ received: "dobiveno %{amount}"
+ will_receive: ce dobiti napojnicu
+ for_commit: za cin
+ when_decided: kada je kolicina odlucena
+ next_tip: Sljedeca Napojnica
+ contribute_and_earn: Contribute and Earn
+ contribute_and_earn_description: "Donate bitcoins to this project or %{make_commits_link} and get tips for it. If your commit is accepted %{branch} by a project maintainer and there are bitcoins on its balance, you will get a tip!"
+ contribute_and_earn_branch: "to %{branch} branch"
+ make_commits_link: make commits
+ tell_us_bitcoin_address: "Just %{tell_us_link} your bitcoin address."
+ tell_us_link: tell us
+ sign_in: "Just check your email or %{sign_in_link}."
+ promote_project: Promote %{project}
+ embedding: Embedding
+ image_url: "Image URL:"
+ shield_title: tip for next commit
+ edit:
+ project_settings: "%{project} project settings"
+ branch: Branch
+ default_branch: Default branch
+ tipping_policies: Tipping policies
+ hold_tips: "Do not send the tips immediatly. Give collaborators the ability to modify the tips before they're sent"
+ save: Save the project settings
+ disable_notifications: Don't notify new contributors
+ decide_tip_amounts:
+ commit: Commit
+ author: Author
+ message: Message
+ tip: Tip (relative to the project balance)
+ submit: Send the selected tip amounts
+ tips:
+ index:
+ tips: Tips
+ project_tips: '%{project} tips'
+ user_tips: "%{user} tips"
+ created_at: Created At
+ commiter: Commiter
+ project: Project
+ commit: Commit
+ amount: Amount
+ refunded: Refunded to project's deposit
+ undecided: The amount of the tip has not been decided yet
+ no_bitcoin_address: User didn't specify withdrawal address
+ below_threshold: "User's balance is below withdrawal threshold"
+ waiting: Waiting for withdrawal
+ error: (error sending transaction)
+ deposits:
+ index:
+ project_deposits: '%{project} deposits'
+ deposits: Deposits
+ created_at: Created At
+ project: Project
+ amount: Amount
+ transaction: Transaction
+ confirmed: Confirmed
+ confirmed_yes: 'Yes'
+ confirmed_no: 'No'
+ users:
+ index:
+ title: Top Contributors
+ name: Name
+ commits_count: Commits tipped
+ withdrawn: Withdrawn
+ show:
+ balance: Balance
+ threshold: "You will get your money when your balance hits the threshold of %{threshold}"
+ see_all: see all
+ received: "%{time} received %{amount} for commit %{commit} in %{project}"
+ bitcoin_address_placeholder: Your bitcoin address
+ notify: Notify me about new tips (no more than one email per month)
+ submit_user: Update user info
+ change_password: Change your password
+ submit_password: Change my password
+ withdrawals:
+ index:
+ title: Last Withdrawals
+ created_at: Created At
+ transaction: Transaction
+ result: Result
+ error: Error
+ success: Success
+ devise:
+ sessions:
+ new:
+ title: Sign in
+ remember_me: Remember me
+ submit: Sign in
+ registrations:
+ new:
+ title: Sign up
+ submit: Sign up
+ passwords:
+ new:
+ title: Forgot your password?
+ submit: Send me reset password instructions
+ edit:
+ title: Change your password
+ submit: Change my password
+ confirmations:
+ new:
+ title: Resend confirmation instructions
+ submit: Resend confirmation instructions
+ links:
+ sign_in: Sign in
+ sign_up: Sign up
+ recover: Forgot your password?
+ confirm: Didn't receive confirmation instructions?
+ sign_in_with: "Sign in with %{provider}"
+ errors:
+ primary_email: your primary email address should be verified.
+ onmiauth_info: we were unable to fetch your information.
+ activerecord:
+ attributes:
+ user:
+ email: E-mail
+ bitcoin_address: Bitcoin address
+ password: Password
+ password_confirmation: Password confirmation
+ display_name: Display name
From e9d007733232d98345b0ae23ec7f7a9dcd6d605a Mon Sep 17 00:00:00 2001
From: darthxjanus
Date: Sat, 18 Oct 2014 22:07:57 +0200
Subject: [PATCH 077/415] Added sign_up_text (#125) to Croatian locale.
---
config/locales/hr.yml | 1 +
1 file changed, 1 insertion(+)
diff --git a/config/locales/hr.yml b/config/locales/hr.yml
index 04c0404f..cc9fd081 100644
--- a/config/locales/hr.yml
+++ b/config/locales/hr.yml
@@ -63,6 +63,7 @@ en:
title: Doprinositi
text: Idite i popravite nesto! Ako je vas cin odobren od odrzavatelja projekta, dobiti cete napojnicu!
sign_in_text: "Samo provjerite vas email ili %{sign_in_link}."
+ sign_up_text: "Ako jos niste dobili pozivnicu, moze te se %{sign_up_link} sa valjanom email adresom ili GitHub-om."
button: Podrzavani projekti
projects:
index:
From fc9eede718ff648a9bcc0f95240c0f077f47d054 Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Tue, 21 Oct 2014 15:46:27 +0600
Subject: [PATCH 078/415] fixed locales
---
app/assets/javascripts/i18n/translations.js | 2 +-
config/locales/hr.yml | 2 +-
config/locales/pl.yml | 16 ++++++++--------
3 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/app/assets/javascripts/i18n/translations.js b/app/assets/javascripts/i18n/translations.js
index f62c41d8..029f45b8 100644
--- a/app/assets/javascripts/i18n/translations.js
+++ b/app/assets/javascripts/i18n/translations.js
@@ -1,2 +1,2 @@
var I18n = I18n || {};
-I18n.translations = {"en":{"js":{"errors":{"value":{"invalid":"Value is invalid"},"email":{"invalid":"Invalid Email Address","blank":"The Email is required and can't be empty"},"password":{"blank":"The password is required and can't be empty","invalid":"The password and its confirmation are not same"},"password_confirmation":{"blank":"The password confirmation is required and can't be empty","invalid":"The password and its confirmation are not same"}}}},"fr":{"js":{"errors":{"value":{"invalid":"Valeur non valide"},"email":{"invalid":"Adresse Email non valide","blank":"L'Email est requis et doit être renseigné"},"password":{"blank":"Les mot de passe est requis et doit être renseigné","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"},"password_confirmation":{"blank":"La confirmation du mot de passe est requise et doit être renseignée","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"}}}},"ru":{"js":{"errors":{"value":{"invalid":"Неверное значение"},"email":{"invalid":"Ошибка в Email адресе","blank":"Email не может быть пустым"},"password":{"blank":"Пароль не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"},"password_confirmation":{"blank":"Подтверждение пароля не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"}}}}},"pl":{"js":{"errors":{"value":{"invalid":"Niepoprawna wartość"},"email":{"invalid":"Niepoprawny adres E-mail","blank":"E-mail jest wymagany i nie może być pusty"},"password":{"blank":"Hasło jest wymagane i nie może być puste","invalid":"Hasła nie są takie same"},"password_confirmation":{"blank":"Potwierdzenie hasła jest wymagane i nie może być puste","invalid":"Hasło i potwierdzenie nie są takie same"}}}};
\ No newline at end of file
+I18n.translations = {"en":{"js":{"errors":{"value":{"invalid":"Value is invalid"},"email":{"invalid":"Invalid Email Address","blank":"The Email is required and can't be empty"},"password":{"blank":"The password is required and can't be empty","invalid":"The password and its confirmation are not same"},"password_confirmation":{"blank":"The password confirmation is required and can't be empty","invalid":"The password and its confirmation are not same"}}}},"fr":{"js":{"errors":{"value":{"invalid":"Valeur non valide"},"email":{"invalid":"Adresse Email non valide","blank":"L'Email est requis et doit être renseigné"},"password":{"blank":"Les mot de passe est requis et doit être renseigné","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"},"password_confirmation":{"blank":"La confirmation du mot de passe est requise et doit être renseignée","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"}}}},"hr":{"js":{"errors":{"value":{"invalid":"Vrijednost nevazeca"},"email":{"invalid":"Nezaveca email adresa","blank":"Email je potreban i ne moze biti prazno"},"password":{"blank":"Lozinka je potrebna i ne moze biti prazno","invalid":"Lozinka i njezina potvrda nisu isti"},"password_confirmation":{"blank":"Potvrda lozinke je potrebna i ne moze biti prazno","invalid":"Lozinka i potvrda lozinke nisu isti"}}}},"pl":{"js":{"errors":{"value":{"invalid":"Wartość jest niepoprawna"},"email":{"invalid":"Błędny adres E-mail","blank":"E-mail jest wymagany i nie może być pusty"},"password":{"blank":"Hasło jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"},"password_confirmation":{"blank":"Potwierdzenie hasła jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"}}}},"ru":{"js":{"errors":{"value":{"invalid":"Неверное значение"},"email":{"invalid":"Ошибка в Email адресе","blank":"Email не может быть пустым"},"password":{"blank":"Пароль не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"},"password_confirmation":{"blank":"Подтверждение пароля не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"}}}}};
\ No newline at end of file
diff --git a/config/locales/hr.yml b/config/locales/hr.yml
index cc9fd081..e4c614af 100644
--- a/config/locales/hr.yml
+++ b/config/locales/hr.yml
@@ -1,4 +1,4 @@
-en:
+hr:
tip4commit: Tip4Commit
meta:
title: Doprinosite otvorenom izvoru
diff --git a/config/locales/pl.yml b/config/locales/pl.yml
index 83b67b7d..4c3905c2 100644
--- a/config/locales/pl.yml
+++ b/config/locales/pl.yml
@@ -1,4 +1,4 @@
-en:
+pl:
tip4commit: Tip4Commit
meta:
title: Wspieraj Open Source
@@ -53,17 +53,17 @@ en:
see_projects: Zobacz projekty
how_does_it_work:
title: Jak to działa?
- text: Ludzie przesyłają bitcoiny. Kiedy kogoś "commit" zostanie zaakceptowany do repozytorium projektu, automatycznie płacimy autorowi.
+ text: 'Ludzie przesyłają bitcoiny. Kiedy kogoś "commit" zostanie zaakceptowany do repozytorium projektu, automatycznie płacimy autorowi.'
button: Dowiedz się więcej o Bitcoin
donate:
title: Podaruj
- text: Znajdź projekt, który ci się podoba i prześlij na niego bitcoiny. Twoje bitcoiny będzią zsumowana z innymi aby dać napiwki za nowe "commits".
- button: Znajdż lub dodaj projekt
+ text: 'Znajdź projekt, który ci się podoba i prześlij na niego bitcoiny. Twoje bitcoiny będzią zsumowana z innymi aby dać napiwki za nowe "commits".'
+ button: 'Znajdż lub dodaj projekt'
contribute:
- title: Współpracuj
- text: Idź i coś napraw! Jeśli twój commit zostanie zaakceptowany przez nadzorcę projektu, dostaniesz napiwek!
+ title: 'Współpracuj'
+ text: 'Idź i coś napraw! Jeśli twój commit zostanie zaakceptowany przez nadzorcę projektu, dostaniesz napiwek!'
sign_in_text: "Wystarczy sprawdzić e-mail lub %{sign_in_link}."
- sign_up_text: "Jeśli nadal nie otrzymałeś zaproszenia, możesz %{sign_up_link} za pomocą adresu e-mail lub przez GitHub."
+ sign_up_text: "Jeśli nadal nie otrzymałeś zaproszenia, możesz %{sign_up_link} za pomocą adresu e-mail lub przez GitHub."
button: Wspierane projekty
projects:
index:
@@ -74,7 +74,7 @@ en:
description: Opis
watchers: Obserwujący
balance: Saldo
- forked_from: "zforkowany" z
+ forked_from: "zforkowany"
support: Pomoc
show:
title: "Współpracuj z %{project}"
From 6a7c6b9af1a7a43db8521e5e3f53fe32ee41fb6e Mon Sep 17 00:00:00 2001
From: win32re
Date: Tue, 21 Oct 2014 17:56:20 +0200
Subject: [PATCH 079/415] Update en.yml
---
config/locales/en.yml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 441583a8..a496ef53 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -81,7 +81,7 @@ en:
edit_project: Change project settings
decide_tip_amounts: Decide tip amounts
disabled_notifications: "Project maintainers have decided not to notify new contributors about tips and they probably don't like this way of funding."
- project_sponsors: Project Sponsors
+ project_sponsors: Project sponsors
fee: "%{percentage} of deposited funds will be used to tip for new commits."
balance: Balance
deposits: deposits
@@ -116,7 +116,7 @@ en:
branch: Branch
default_branch: Default branch
tipping_policies: Tipping policies
- hold_tips: "Do not send the tips immediatly. Give collaborators the ability to modify the tips before they're sent"
+ hold_tips: "Do not send the tips immediately. Give collaborators the ability to modify the tips before they're sent"
save: Save the project settings
disable_notifications: Don't notify new contributors
decide_tip_amounts:
From 2c7eac5225e3594b1787c03415309d7f9cb9ceee Mon Sep 17 00:00:00 2001
From: win32re
Date: Tue, 21 Oct 2014 20:37:02 +0200
Subject: [PATCH 080/415] Fix Travis CI build
---
features/tip_modifier_interface.feature | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/features/tip_modifier_interface.feature b/features/tip_modifier_interface.feature
index 206cbfaa..b4fa3a0f 100644
--- a/features/tip_modifier_interface.feature
+++ b/features/tip_modifier_interface.feature
@@ -23,7 +23,7 @@ Feature: A project collaborator can change the tips of commits
Given I'm logged in as "seldon"
And I go to the project page
And I click on "Change project settings"
- And I check "Do not send the tips immediatly. Give collaborators the ability to modify the tips before they're sent"
+ And I check "Do not send the tips immediately. Give collaborators the ability to modify the tips before they're sent"
And I click on "Save the project settings"
Then I should see "The project settings have been updated"
From b051b0b01bcc4577f972b8011428ed287eef8874 Mon Sep 17 00:00:00 2001
From: bill auger
Date: Fri, 24 Oct 2014 22:01:00 +0000
Subject: [PATCH 081/415] allow users to define email domain in
config/config.yml
* removed the hard-coded default mail domain in config/environment/production.rb
that was explicitly over-riding the one defined in config/config.yml
---
config/environments/production.rb | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/config/environments/production.rb b/config/environments/production.rb
index 7dfac981..27cba157 100644
--- a/config/environments/production.rb
+++ b/config/environments/production.rb
@@ -61,15 +61,15 @@
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
# config.assets.precompile += %w( search.js )
- config.action_mailer.default_url_options = { :host => CONFIG['smtp_settings']['domain'] }
-
+ smtp_settings = CONFIG['smtp_settings']
+ domain = smtp_settings['domain']
config.action_mailer.delivery_method = :smtp
- config.action_mailer.smtp_settings = CONFIG['smtp_settings'].to_options
+ config.action_mailer.smtp_settings = smtp_settings.to_options
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true
- config.action_mailer.default_url_options = { :host => 'tip4commit.com', :protocol => 'https' }
- config.action_mailer.default_options = {from: 'no-reply@' + CONFIG['smtp_settings']['domain'] }
+ config.action_mailer.default_url_options = { :host => domain, :protocol => 'https' }
+ config.action_mailer.default_options = {from: 'no-reply@' + domain }
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation can not be found).
From 7dfeed31f7a37901b1312ddc3c9b3d033fb6785c Mon Sep 17 00:00:00 2001
From: bill auger
Date: Fri, 24 Oct 2014 22:42:40 +0000
Subject: [PATCH 082/415] add cross-development config skeletons
* added cross-fork config skeletons to config/cross-fork-dev/
* added cross-fork-dev-README.md to config/cross-fork-dev/
* add db/seeds.rb to .gitignore
---
.gitignore | 2 +
config/cross-fork-dev/config.yml.dev | 116 ++++++++++++++++++
.../cross-fork-dev/cross-fork-dev-REAMDE.md | 49 ++++++++
config/cross-fork-dev/database.yml.dev | 45 +++++++
4 files changed, 212 insertions(+)
create mode 100644 config/cross-fork-dev/config.yml.dev
create mode 100644 config/cross-fork-dev/cross-fork-dev-REAMDE.md
create mode 100644 config/cross-fork-dev/database.yml.dev
diff --git a/.gitignore b/.gitignore
index 69f75261..e55074aa 100644
--- a/.gitignore
+++ b/.gitignore
@@ -23,3 +23,5 @@
.rspec
coverage
+
+/db/seeds.rb
diff --git a/config/cross-fork-dev/config.yml.dev b/config/cross-fork-dev/config.yml.dev
new file mode 100644
index 00000000..8a96d72c
--- /dev/null
+++ b/config/cross-fork-dev/config.yml.dev
@@ -0,0 +1,116 @@
+
+<%
+# list local feature branches in their appropriate *_BRANCHES lists below
+MY_BRANCHES = %w{master}
+TIP4COMMIT_BRANCHES = %w{tip4commit-master tip4commit-new-feature}
+PEER4COMMIT_BRANCHES = %w{peer4commit-master peer4commit-new-feature}
+PRIME4COMMIT_BRANCHES = %w{prime4commit-master peer4commit-new-feature}
+BRANCHES_LISTS_FILENAME = 'config/config.yml' # DEBUG
+
+BRANCH_NAME = `git rev-parse --abbrev-ref HEAD`.strip
+IS_MYFORK = MY_BRANCHES.include? BRANCH_NAME
+IS_TIP4COMMIT_FORK = TIP4COMMIT_BRANCHES.include? BRANCH_NAME
+IS_PEER4COMMIT_FORK = PEER4COMMIT_BRANCHES.include? BRANCH_NAME
+IS_PRIME4COMMIT_FORK = PRIME4COMMIT_BRANCHES.include? BRANCH_NAME
+%>
+
+
+<% if IS_MY_FORK %>
+<% puts "no app config defined for local branch: '#{BRANCH_NAME}'" %>
+<% elsif IS_TIP4COMMIT_FORK %>
+github:
+ key: "111111111111"
+ secret: "111111111111"
+ auto_paginate: false
+ pages: 3
+ project_pages: {}
+
+blockchain_info:
+ guid: "111111111111"
+ password: "111111111111"
+ callback_secret: "111111111111"
+
+tip: 0.01
+min_payout: 100000
+our_fee: 0.05
+
+deposit_address: 1M4bS4gPyA6Kb8w7aXsgth9oUZWcRk73tQ
+
+address_versions: # 0/5 for bitcoin addresses, 111/196 for testnet, see chainparams.cpp
+ - 0
+ - 5
+
+
+<% elsif IS_PEER4COMMIT_FORK %>
+github:
+ key: "111111111111"
+ secret: "111111111111"
+
+daemon:
+ username: rpcuser
+ password: rpcpassword
+ host: localhost
+ port: 9904
+ path: /path/to/ppcoin/src/ppcoind
+
+tip: 0.01
+min_payout: 1.0 # in PPC
+our_fee: 0.05
+tipper_delay: "1.hour"
+
+address_versions: # 55/117 for peercoin, 111/196 for testnet, see base58.h
+ - 111
+ - 196
+
+# canonical_host: peer4commit.example.com # will redirect all other hostnames to this one
+
+
+<% elsif IS_PRIME4COMMIT_FORK %>
+github:
+ key: "111111111111"
+ secret: "111111111111"
+
+daemon:
+ username: rpcuser
+ password: rpcpassword
+ host: localhost
+ port: 9914
+ path: /path/to/primecoin/src/primecoind
+
+tip: 0.01
+min_payout: 1.0 # in XPM
+our_fee: 0.05
+tipper_delay: "1.hour"
+
+address_versions: # 23/83 for primecoin, 111/196 for testnet, see base58.h
+ - 111
+ - 196
+
+# canonical_host: prime4commit.example.com # will redirect all other hostnames to this one
+
+
+<% else %>
+<% puts "ERROR: config/config.yml - no app config defined for branch: '#{BRANCH_NAME}'" +
+ " - you must add it to one of the *_BRANCHES lists in #{BRANCHES_LISTS_FILENAME}" %>
+<% end %>
+
+
+devise:
+ secret: "111111111111"
+
+application:
+ secret: "111111111111"
+
+smtp_settings:
+ address: smtp.gmail.com
+ port: 587
+ domain: example.com
+ user_name: example@example.com
+ password: MY_PASSWORD
+ authentication: plain
+ enable_starttls_auto: true
+
+# Uncomment to use airbrake/errbit
+# airbrake:
+# api_key: 111111111111
+# host: errbit.tip4commit.com
diff --git a/config/cross-fork-dev/cross-fork-dev-REAMDE.md b/config/cross-fork-dev/cross-fork-dev-REAMDE.md
new file mode 100644
index 00000000..a8749b45
--- /dev/null
+++ b/config/cross-fork-dev/cross-fork-dev-REAMDE.md
@@ -0,0 +1,49 @@
+### cross-fork development
+
+the files in this directory exist to aid cross-fork development of the various tip4commit forks from within the same local clone - if you will be working on only one fork then use Gemfile, config/config.yml.sample, and config/database.yml.sample instead
+
+the various forks have drifted apart significantly and require different configuratons - these files will allow these all to be functional within in the same clone without manual config swapping - the only routine maintenance required is in adding new feature branches to the appropriate *_BRANCHES list in config.yml.dev and re-bundling when switching between forks
+
+
+#### config/cross-fork-dev/config.yml.dev
+
+ config.yml.dev includes a separate configuration for each known tip4commit variant - switched per the current git branch
+
+ config.yml.dev also defines which feature branches should share configurations - you will need to manually add each new branch to the appropriate *_BRANCHES list
+
+
+#### config/cross-fork-dev/database.yml.dev
+ database.yml.dev also includes a separate configuration for each known tip4commit variant - switched per the current git branch (requires the *_BRANCHES list in config.yml.dev)
+
+
+### setup
+
+ * fork any of the tip4commit forks then clone your fork
+ * copy config/cross-fork-dev/config.yml.dev to config/config.yml and
+ copy config/cross-fork-dev/database.yml.dev to config/database.yml
+```
+ cp config/cross-fork-dev/config.yml.dev config/config.yml
+ cp config/cross-fork-dev/database.yml.dev config/database.yml
+```
+ * customize config/config.yml and config/database.yml
+ * repeat the following flow for each fork including the one you forked from
+```
+ git remote add tip4commit https://github.com/tip4commit/tip4commit.git
+ git checkout -b tip4commit-master
+ git fetch tip4commit
+ git merge tip4commit/master
+```
+ * add each fork branch created above its corresponding *_BRANCHES list
+
+
+### maintenance
+ * add new local feature branches in their appropriate *_BRANCHES lists
+ (e.g. to reduce ambiguity use your local master branch for experimentaion only)
+ * re-bundle each time you switch to a new fork configuration
+```
+ # for tip4commit
+ bundle install --without production
+
+ # for peer4commit amd prime4commit
+ bundle install --without mysql postgresql
+```
diff --git a/config/cross-fork-dev/database.yml.dev b/config/cross-fork-dev/database.yml.dev
new file mode 100644
index 00000000..d22fc1f4
--- /dev/null
+++ b/config/cross-fork-dev/database.yml.dev
@@ -0,0 +1,45 @@
+
+development:
+ adapter: sqlite3
+ pool: 5
+ timeout: 5000
+<% if IS_MY_FORK %>
+ database: db/my_development.sqlite3
+<% elsif IS_TIP4COMMIT_FORK %>
+ database: db/tip4commit_development.sqlite3
+<% elsif IS_PEER4COMMIT_FORK %>
+ database: db/peer4commit_development.sqlite3
+<% elsif IS_PRIME4COMMIT_FORK %>
+ database: db/prime4commit_development.sqlite3
+<% else %>
+<% puts "ERROR: config/database.yml - no development db specified for branch: '#{branch_name}'"
+ +
+ " - you must add it to one of the *_BRANCHES lists in #{BRANCHES_LISTS_FILENAME}" %>
+<% end %>
+
+
+test:
+ adapter: sqlite3
+ pool: 5
+ timeout: 5000
+<% if IS_MY_FORK %>
+ database: db/my_test.sqlite3
+<% elsif IS_TIP4COMMIT_FORK %>
+ database: db/tip4commit_test.sqlite3
+<% elsif IS_PEER4COMMIT_FORK %>
+ database: db/peer4commit_test.sqlite3
+<% elsif IS_PRIME4COMMIT_FORK %>
+ database: db/prime4commit_test.sqlite3
+<% else %>
+<% puts "ERROR: config/database.yml - no test db specified for branch: '#{branch_name}'" +
+ " - you must add it to one of the *_BRANCHES lists in #{BRANCHES_LISTS_FILENAME}" %>
+<% end %>
+
+
+production:
+ adapter: mysql2
+ encoding: utf8
+ database: tip4commit
+ username: root
+ password:
+ socket: /var/run/mysqld/mysqld.sock
From e4980b6549fde4a6ec5eea3100fbb149ee693e1c Mon Sep 17 00:00:00 2001
From: win32re
Date: Tue, 21 Oct 2014 17:54:57 +0200
Subject: [PATCH 083/415] Update hr.yml
---
config/locales/hr.yml | 40 ++++++++++++++++++++--------------------
1 file changed, 20 insertions(+), 20 deletions(-)
diff --git a/config/locales/hr.yml b/config/locales/hr.yml
index e4c614af..c25c287c 100644
--- a/config/locales/hr.yml
+++ b/config/locales/hr.yml
@@ -99,17 +99,17 @@ hr:
will_receive: ce dobiti napojnicu
for_commit: za cin
when_decided: kada je kolicina odlucena
- next_tip: Sljedeca Napojnica
- contribute_and_earn: Contribute and Earn
- contribute_and_earn_description: "Donate bitcoins to this project or %{make_commits_link} and get tips for it. If your commit is accepted %{branch} by a project maintainer and there are bitcoins on its balance, you will get a tip!"
- contribute_and_earn_branch: "to %{branch} branch"
+ next_tip: Sljedeca napojnica
+ contribute_and_earn: Contribute and earn
+ contribute_and_earn_description: "Doniraj Bitcone u ovaj projekt ili %{make_commits_link} i dobij napojnicu. Ako je commit prihvacen %{branch} od strane voditelja projekta i ima Bitcoina na racunu, dobit ce te napojnicu."
+ contribute_and_earn_branch: "u %{branch} branch"
make_commits_link: make commits
- tell_us_bitcoin_address: "Just %{tell_us_link} your bitcoin address."
+ tell_us_bitcoin_address: "Samo %{tell_us_link} vasu bitcoin adresu."
tell_us_link: tell us
- sign_in: "Just check your email or %{sign_in_link}."
- promote_project: Promote %{project}
+ sign_in: "Samo provjerite vas email ili %{sign_in_link}."
+ promote_project: Promoviraj %{project}
embedding: Embedding
- image_url: "Image URL:"
+ image_url: "URL slike:"
shield_title: tip for next commit
edit:
project_settings: "%{project} project settings"
@@ -128,13 +128,13 @@ hr:
tips:
index:
tips: Tips
- project_tips: '%{project} tips'
- user_tips: "%{user} tips"
- created_at: Created At
+ project_tips: '%{project} napojnice'
+ user_tips: "%{user} napojnice"
+ created_at: Stvoreno na
commiter: Commiter
- project: Project
+ project: Projekt
commit: Commit
- amount: Amount
+ amount: Kolicina
refunded: Refunded to project's deposit
undecided: The amount of the tip has not been decided yet
no_bitcoin_address: User didn't specify withdrawal address
@@ -143,19 +143,19 @@ hr:
error: (error sending transaction)
deposits:
index:
- project_deposits: '%{project} deposits'
+ project_deposits: '%{project} uplate'
deposits: Deposits
- created_at: Created At
- project: Project
- amount: Amount
+ created_at: "Stvoreno na"
+ project: Projekt
+ amount: Kolicina
transaction: Transaction
confirmed: Confirmed
- confirmed_yes: 'Yes'
- confirmed_no: 'No'
+ confirmed_yes: 'Da'
+ confirmed_no: 'Ne'
users:
index:
title: Top Contributors
- name: Name
+ name: Ime
commits_count: Commits tipped
withdrawn: Withdrawn
show:
From 1340fda19b64ad2378953c27f7601e95a0e83f7d Mon Sep 17 00:00:00 2001
From: darthxjanus
Date: Tue, 21 Oct 2014 18:00:22 +0200
Subject: [PATCH 084/415] Update hr.yml
---
config/locales/hr.yml | 74 +++++++++++++++++++++----------------------
1 file changed, 37 insertions(+), 37 deletions(-)
diff --git a/config/locales/hr.yml b/config/locales/hr.yml
index c25c287c..9b65dff7 100644
--- a/config/locales/hr.yml
+++ b/config/locales/hr.yml
@@ -159,58 +159,58 @@ hr:
commits_count: Commits tipped
withdrawn: Withdrawn
show:
- balance: Balance
- threshold: "You will get your money when your balance hits the threshold of %{threshold}"
- see_all: see all
- received: "%{time} received %{amount} for commit %{commit} in %{project}"
- bitcoin_address_placeholder: Your bitcoin address
- notify: Notify me about new tips (no more than one email per month)
- submit_user: Update user info
- change_password: Change your password
- submit_password: Change my password
+ balance: Ravnoteza
+ threshold: "Dobiti ce te vase novce kada vasa ravnoteza prijede prag od %{threshold}"
+ see_all: vidjeti sve
+ received: "%{time} primljeno %{amount} za cin %{commit} u %{project}"
+ bitcoin_address_placeholder: Vasa bitcoin adresa
+ notify: Notificirati me o novim savjetima (ne vise od jednog emaila po mjesecu)
+ submit_user: Azurirati informaciju korisnika
+ change_password: Promijeniti vasu lozinku
+ submit_password: Promijeniti moju lozinku
withdrawals:
index:
- title: Last Withdrawals
- created_at: Created At
- transaction: Transaction
- result: Result
- error: Error
- success: Success
+ title: Zadnje povlacenje
+ created_at: Stvoreno
+ transaction: Transakcije
+ result: Rezultat
+ error: Greska
+ success: Uspjesno
devise:
sessions:
new:
- title: Sign in
- remember_me: Remember me
- submit: Sign in
+ title: Prijava
+ remember_me: Zapamti me
+ submit: Prijava
registrations:
new:
- title: Sign up
- submit: Sign up
+ title: Prijava
+ submit: Registracija
passwords:
new:
- title: Forgot your password?
- submit: Send me reset password instructions
+ title: Zaboravili ste vasu lozinku?
+ submit: Poslati mi uputstva za resetiranje lozinke
edit:
- title: Change your password
- submit: Change my password
+ title: Promijenite vasu lozinku
+ submit: Promijeniti svoju lozinku
confirmations:
new:
- title: Resend confirmation instructions
- submit: Resend confirmation instructions
+ title: Ponovno poslati uputstva za potvrdivanje
+ submit: Ponovno poslati uputstva za potvrdivanje
links:
- sign_in: Sign in
- sign_up: Sign up
- recover: Forgot your password?
- confirm: Didn't receive confirmation instructions?
- sign_in_with: "Sign in with %{provider}"
+ sign_in: Prijava
+ sign_up: Registracija
+ recover: Zaboravili ste vasu lozinku?
+ confirm: Niste primili uputstva za potvrdivanje?
+ sign_in_with: "Prijavi se sa %{provider}"
errors:
- primary_email: your primary email address should be verified.
- onmiauth_info: we were unable to fetch your information.
+ primary_email: vasa glavna email adresa bi trebala biti potvrdena.
+ onmiauth_info: Nismo bili u stanju dohvatiti vasu informaciju.
activerecord:
attributes:
user:
email: E-mail
- bitcoin_address: Bitcoin address
- password: Password
- password_confirmation: Password confirmation
- display_name: Display name
+ bitcoin_address: Bitcoin adresa
+ password: Lozinka
+ password_confirmation: Potvrda lozinke
+ display_name: Prikazno ime
From a2cafb44bab376efea6960fc193cbc3f3e3f5ac1 Mon Sep 17 00:00:00 2001
From: kjanku1
Date: Wed, 22 Oct 2014 22:06:30 +0200
Subject: [PATCH 085/415] Finished polish translation
---
config/locales/pl.yml | 202 +++++++++++++++++++++---------------------
1 file changed, 101 insertions(+), 101 deletions(-)
diff --git a/config/locales/pl.yml b/config/locales/pl.yml
index 4c3905c2..b65ef9ab 100644
--- a/config/locales/pl.yml
+++ b/config/locales/pl.yml
@@ -68,7 +68,7 @@ pl:
projects:
index:
find_project:
- placeholder: Enter GitHub project URL to add a project or any keyword to find it...
+ placeholder: Wpisz URL projektu GitHub aby dodać projekt lub słowo kluczowe aby go znaleźć...
button: Znajdź lub dodaj projekt
repository: Repozytorium
description: Opis
@@ -80,137 +80,137 @@ pl:
title: "Współpracuj z %{project}"
edit_project: Zmień ustawienia projektu
decide_tip_amounts: Ustal rozmiary napiwków
- disabled_notifications: "Nadzorcy projektów zdecydowali nie powiadamiac nowych współpracowników o napiwkach i prawdopodobnie nie lubią tego typu finansowania."
+ disabled_notifications: "Nadzorcy projektów zdecydowali nie powiadamiać nowych współpracowników o napiwkach i prawdopodobnie nie lubią tego typu finansowania."
project_sponsors: Sponsorzy projektu
- fee: "%{percentage} of deposited funds will be used to tip for new commits."
- balance: Balance
- deposits: deposits
- custom_tip_size: (each new commit receives a percentage of available balance)
- default_tip_size: "(each new commit receives %{percentage} of available balance)"
- unconfirmed_amount: "(%{amount} unconfirmed)"
- tipping_policies: Tipping policies
- updated_by_user: "(Last updated by %{name} on %{date})"
- updated_by_unknown: "(Last updated on %{date})"
- tips_paid: Tips Paid
- unclaimed_amount: "(%{amount} of this is unclaimed, and will be refunded to the project after being unclaimed for 1 month.)"
- last_tips: Last Tips
- see_all: see all
- received: "received %{amount}"
- will_receive: will receive a tip
- for_commit: for commit
- when_decided: when its amount is decided
- next_tip: Next Tip
- contribute_and_earn: Contribute and Earn
- contribute_and_earn_description: "Donate bitcoins to this project or %{make_commits_link} and get tips for it. If your commit is accepted %{branch} by a project maintainer and there are bitcoins on its balance, you will get a tip!"
- contribute_and_earn_branch: "to %{branch} branch"
- make_commits_link: make commits
- tell_us_bitcoin_address: "Just %{tell_us_link} your bitcoin address."
- tell_us_link: tell us
- sign_in: "Just check your email or %{sign_in_link}."
- promote_project: Promote %{project}
- embedding: Embedding
- image_url: "Image URL:"
- shield_title: tip for next commit
+ fee: "%{percentage} z salda zostanie użyte jako następny napiwek."
+ balance: saldo
+ deposits: wpłaty
+ custom_tip_size: (Każdy nowy "commit" dostaje część z dostępnego salda)
+ default_tip_size: "(Każdy nowy "commit" dostaje %{percentage} z dostępnego salda)"
+ unconfirmed_amount: "(%{amount} niepotwierdzone)"
+ tipping_policies: Zasady napiwków
+ updated_by_user: "(Ostatnio zaktualizowane przez %{name} w dniu %{date})"
+ updated_by_unknown: "(Ostatnia aktualizacja: %{date})"
+ tips_paid: Zapłacone napiwki
+ unclaimed_amount: "(%{amount} z tego jest niezebrane, i zostanie zwrócone do projektu po jednym miesiącu.)"
+ last_tips: Ostatnie napiwki
+ see_all: zobacz wszystko
+ received: "otrzymano %{amount}"
+ will_receive: dostanie napiwek
+ for_commit: za "commit"
+ when_decided: kiedy jego rozmiar zostanie określony
+ next_tip: Następny napiwek
+ contribute_and_earn: Pomagaj i zarabiaj
+ contribute_and_earn_description: "Wyślij bitcoiny na ten projekt lub %{make_commits_link} i otrzymaj za nie napiwki. Jeśli zostaną zaakceptowane %{branch} przez nadzorce projektu i jeśli są pieniądze na koncie projektu, otrzymasz napiwek!"
+ contribute_and_earn_branch: "do %{branch} gałęzi"
+ make_commits_link: twórz "commits"
+ tell_us_bitcoin_address: "Tylko %{tell_us_link} twój adres bitcoin."
+ tell_us_link: powiedz nam
+ sign_in: "Sprawdż e-mail lub %{sign_in_link}."
+ promote_project: Promuj %{project}
+ embedding: Umieść
+ image_url: "URL obrazka:"
+ shield_title: napiwek za następny "commit"
edit:
- project_settings: "%{project} project settings"
- branch: Branch
- default_branch: Default branch
- tipping_policies: Tipping policies
- hold_tips: "Do not send the tips immediatly. Give collaborators the ability to modify the tips before they're sent"
- save: Save the project settings
- disable_notifications: Don't notify new contributors
+ project_settings: "%{project} ustawienia projektu"
+ branch: Gałąź
+ default_branch: Domyślna gałąź
+ tipping_policies: Zasady napiwków
+ hold_tips: "Nie wysyłaj napiwków od razu. Daj współpracownikom możliwość zmiany napiwków zanim zostaną wysłane"
+ save: Zapisz ustawienia projektu
+ disable_notifications: Nie powiadamiaj nowych kontrybutorów
decide_tip_amounts:
commit: Commit
- author: Author
- message: Message
- tip: Tip (relative to the project balance)
- submit: Send the selected tip amounts
+ author: Autor
+ message: Wiadomość
+ tip: Napiwek (zależy od salda projektu)
+ submit: Wyślij wybrane ilości napiwków
tips:
index:
- tips: Tips
- project_tips: '%{project} tips'
- user_tips: "%{user} tips"
- created_at: Created At
+ tips: Napiwki
+ project_tips: '%{project} napiwki'
+ user_tips: "%{user} napiwki"
+ created_at: Utworzony Na
commiter: Commiter
- project: Project
+ project: Projekt
commit: Commit
- amount: Amount
- refunded: Refunded to project's deposit
- undecided: The amount of the tip has not been decided yet
- no_bitcoin_address: User didn't specify withdrawal address
- below_threshold: "User's balance is below withdrawal threshold"
- waiting: Waiting for withdrawal
- error: (error sending transaction)
+ amount: Ilość
+ refunded: Zwrócone do projektu
+ undecided: Rozmiar napiwku nie został jeszcze określony
+ no_bitcoin_address: Użytkownik nie sprecyzował adresu do wypłaty
+ below_threshold: "Saldo użytkownika jest poniżej wymaganego do wypłaty"
+ waiting: Oczekiwanie na wypłate
+ error: (błąd w wysyłaniu transakcji)
deposits:
index:
- project_deposits: '%{project} deposits'
- deposits: Deposits
- created_at: Created At
- project: Project
- amount: Amount
- transaction: Transaction
- confirmed: Confirmed
- confirmed_yes: 'Yes'
- confirmed_no: 'No'
+ project_deposits: '%{project} wpłaty'
+ deposits: Wpłaty
+ created_at: Utworzono Na
+ project: Projekt
+ amount: Ilość
+ transaction: Transakcja
+ confirmed: Potwierdzone
+ confirmed_yes: 'Tak'
+ confirmed_no: 'Nie'
users:
index:
- title: Top Contributors
- name: Name
- commits_count: Commits tipped
- withdrawn: Withdrawn
+ title: Najlepsi kontrybutorzy
+ name: Imie
+ commits_count: Opłacone "commity"
+ withdrawn: Wypłacone
show:
- balance: Balance
- threshold: "You will get your money when your balance hits the threshold of %{threshold}"
- see_all: see all
- received: "%{time} received %{amount} for commit %{commit} in %{project}"
- bitcoin_address_placeholder: Your bitcoin address
+ balance: Saldo
+ threshold: "Otrzymasz pieniądze kiedy twoje saldo przekroczy limit %{threshold}"
+ see_all: zobacz wszystko
+ received: "%{time} otrzymano %{amount} za commit %{commit} w %{project}"
+ bitcoin_address_placeholder: Twój adres bitcoin
notify: Notify me about new tips (no more than one email per month)
- submit_user: Update user info
- change_password: Change your password
- submit_password: Change my password
+ submit_user: Zaktualizuj dane użytkownika
+ change_password: Zmień Twoje hasło
+ submit_password: Zmień moje hasło
withdrawals:
index:
- title: Last Withdrawals
- created_at: Created At
- transaction: Transaction
- result: Result
- error: Error
- success: Success
+ title: Ostatnie wypłaty
+ created_at: Utworzono na
+ transaction: Transakcje
+ result: Wynik
+ error: Błąd
+ success: Sukces
devise:
sessions:
new:
- title: Sign in
- remember_me: Remember me
- submit: Sign in
+ title: Zaloguj się
+ remember_me: Zapamiętaj mnie
+ submit: Zaloguj się
registrations:
new:
- title: Sign up
- submit: Sign up
+ title: Zarejestruj się
+ submit: Zarejestruj się
passwords:
new:
- title: Forgot your password?
- submit: Send me reset password instructions
+ title: Zapomniałeś hasło?
+ submit: Wyślij mi instrukcje resetowania hasła
edit:
- title: Change your password
- submit: Change my password
+ title: Zmień Twoje hasło
+ submit: Zmień moje hasło
confirmations:
new:
- title: Resend confirmation instructions
- submit: Resend confirmation instructions
+ title: Ponownie wyślij instrukcje potwierdzenia
+ submit: Ponownie wyślij instrukcje potwierdzenia
links:
sign_in: Zaloguj się
sign_up: Zarejestruj się
- recover: Forgot your password?
- confirm: Didn't receive confirmation instructions?
- sign_in_with: "Sign in with %{provider}"
+ recover: Zapomniałeś hasło?
+ confirm: Nie otrzymałeś instrukcji potwierdzenia?
+ sign_in_with: "Zaloguj się za pomocą %{provider}"
errors:
- primary_email: your primary email address should be verified.
- onmiauth_info: we were unable to fetch your information.
+ primary_email: Twój główny e-mail musi być potwierdzony.
+ onmiauth_info: Nie byliśmy w stanie otrzymać twoich danych.
activerecord:
attributes:
user:
email: E-mail
- bitcoin_address: Bitcoin address
- password: Password
- password_confirmation: Password confirmation
- display_name: Display name
\ No newline at end of file
+ bitcoin_address: AAdres Bitcoin
+ password: Hasło
+ password_confirmation: Potwierdzenie hasła
+ display_name: Wyświetlana nazwa
\ No newline at end of file
From f285cf7b68da3e631e707cbcaf7e564817368b2d Mon Sep 17 00:00:00 2001
From: kjanku1
Date: Sun, 12 Oct 2014 03:19:31 +0200
Subject: [PATCH 086/415] pl flag
---
app/assets/images/flags/pl.png | Bin 0 -> 288 bytes
config/application.rb | 2 +-
2 files changed, 1 insertion(+), 1 deletion(-)
create mode 100644 app/assets/images/flags/pl.png
diff --git a/app/assets/images/flags/pl.png b/app/assets/images/flags/pl.png
new file mode 100644
index 0000000000000000000000000000000000000000..cca0e7dd46fd4254f58e7270800db7f4a1486b39
GIT binary patch
literal 288
zcmeAS@N?(olHy`uVBq!ia0vp^0zk~o!3HGD9`RZNDVB6cUq=Rp^(V|(yIunMoCO|{
z#S9F5M?jcysy3fAP*AeOHKHUqKdq!Zu_%?nF(p4KRlzeiF+DXXH8G{K@MNkDP|;jZ
z7sn8d;H8reavd_@X`9R^+U6dg`u@Mr?iWXIOK>!8GCX2t=$jSlvf(znV*TZ3?Nc6D
z7#(J3aq;w2vpsUFykcii^R8`db)St+?i4HLa5PrRdiPsVs$!kieEDe?O2Z2R&t%pu
zV)Ks3X>gyJaNWeAy;ke*`Ja>iEf8^H-+ndhs}8fe^@g4Nt3Goq{a|u%W$sypt96^E
fZK$njW&FT!)*xyAn_Cf}FktX>^>bP0l+XkKS*mH}
literal 0
HcmV?d00001
diff --git a/config/application.rb b/config/application.rb
index 86f72d3b..e801a593 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -27,7 +27,7 @@ class Application < Rails::Application
config.autoload_paths += %W(#{config.root}/lib)
config.assets.initialize_on_precompile = true
- config.available_locales = %w(en fr ru)
+ config.available_locales = %w(en fr ru pl)
end
end
From cedcf2476c294809e37bc56582f1f6e8d9a13c59 Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Tue, 28 Oct 2014 15:07:09 +0500
Subject: [PATCH 087/415] fixed locale file
---
config/locales/pl.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/config/locales/pl.yml b/config/locales/pl.yml
index b65ef9ab..319c60d9 100644
--- a/config/locales/pl.yml
+++ b/config/locales/pl.yml
@@ -86,7 +86,7 @@ pl:
balance: saldo
deposits: wpłaty
custom_tip_size: (Każdy nowy "commit" dostaje część z dostępnego salda)
- default_tip_size: "(Każdy nowy "commit" dostaje %{percentage} z dostępnego salda)"
+ default_tip_size: "(Każdy nowy \"commit\" dostaje %{percentage} z dostępnego salda)"
unconfirmed_amount: "(%{amount} niepotwierdzone)"
tipping_policies: Zasady napiwków
updated_by_user: "(Ostatnio zaktualizowane przez %{name} w dniu %{date})"
From 998b508790456ff032386ecd8ebb537221e868e9 Mon Sep 17 00:00:00 2001
From: bill auger
Date: Wed, 29 Oct 2014 07:37:03 +0000
Subject: [PATCH 088/415] add "sync pending" notice and more pretty urls
* "sync pending" notice appears initially in place of project management buttons
* project management buttons replace "sync pending" notice after worker syncs
* added pretty_project_edit_path and pretty_project_decide_tip_amounts_path
to ProjectHelper mostly to satisfy the new generalized "I visit ..." test paths
but also helps the app url scheme be more consistent
* refactored ProjectsController#show action
* refactored bitcoin address update procedure to split long lines
and abstract some magic numbers into config/initializers/constants.rb
* moved bitcoin address update procedure into Project#update_bitcoin_address
* defined blochain url constants in the CONFIG hash
---
app/assets/javascripts/i18n/translations.js | 2 +-
app/controllers/projects_controller.rb | 47 +++++++++++----------
app/helpers/projects_helper.rb | 8 ++++
app/models/project.rb | 13 ++++++
app/models/sendmany.rb | 2 +-
app/views/deposits/index.html.haml | 2 +-
app/views/projects/show.html.haml | 2 +
app/views/tips/index.html.haml | 2 +-
app/views/withdrawals/index.html.haml | 2 +-
config/application.rb | 8 ++++
config/routes.rb | 4 +-
11 files changed, 63 insertions(+), 29 deletions(-)
diff --git a/app/assets/javascripts/i18n/translations.js b/app/assets/javascripts/i18n/translations.js
index 029f45b8..ac0ec161 100644
--- a/app/assets/javascripts/i18n/translations.js
+++ b/app/assets/javascripts/i18n/translations.js
@@ -1,2 +1,2 @@
var I18n = I18n || {};
-I18n.translations = {"en":{"js":{"errors":{"value":{"invalid":"Value is invalid"},"email":{"invalid":"Invalid Email Address","blank":"The Email is required and can't be empty"},"password":{"blank":"The password is required and can't be empty","invalid":"The password and its confirmation are not same"},"password_confirmation":{"blank":"The password confirmation is required and can't be empty","invalid":"The password and its confirmation are not same"}}}},"fr":{"js":{"errors":{"value":{"invalid":"Valeur non valide"},"email":{"invalid":"Adresse Email non valide","blank":"L'Email est requis et doit être renseigné"},"password":{"blank":"Les mot de passe est requis et doit être renseigné","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"},"password_confirmation":{"blank":"La confirmation du mot de passe est requise et doit être renseignée","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"}}}},"hr":{"js":{"errors":{"value":{"invalid":"Vrijednost nevazeca"},"email":{"invalid":"Nezaveca email adresa","blank":"Email je potreban i ne moze biti prazno"},"password":{"blank":"Lozinka je potrebna i ne moze biti prazno","invalid":"Lozinka i njezina potvrda nisu isti"},"password_confirmation":{"blank":"Potvrda lozinke je potrebna i ne moze biti prazno","invalid":"Lozinka i potvrda lozinke nisu isti"}}}},"pl":{"js":{"errors":{"value":{"invalid":"Wartość jest niepoprawna"},"email":{"invalid":"Błędny adres E-mail","blank":"E-mail jest wymagany i nie może być pusty"},"password":{"blank":"Hasło jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"},"password_confirmation":{"blank":"Potwierdzenie hasła jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"}}}},"ru":{"js":{"errors":{"value":{"invalid":"Неверное значение"},"email":{"invalid":"Ошибка в Email адресе","blank":"Email не может быть пустым"},"password":{"blank":"Пароль не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"},"password_confirmation":{"blank":"Подтверждение пароля не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"}}}}};
\ No newline at end of file
+I18n.translations = {"en":{"js":{"errors":{"value":{"invalid":"Value is invalid"},"email":{"invalid":"Invalid Email Address","blank":"The Email is required and can't be empty"},"password":{"blank":"The password is required and can't be empty","invalid":"The password and its confirmation are not same"},"password_confirmation":{"blank":"The password confirmation is required and can't be empty","invalid":"The password and its confirmation are not same"}}}},"hr":{"js":{"errors":{"value":{"invalid":"Vrijednost nevazeca"},"email":{"invalid":"Nezaveca email adresa","blank":"Email je potreban i ne moze biti prazno"},"password":{"blank":"Lozinka je potrebna i ne moze biti prazno","invalid":"Lozinka i njezina potvrda nisu isti"},"password_confirmation":{"blank":"Potvrda lozinke je potrebna i ne moze biti prazno","invalid":"Lozinka i potvrda lozinke nisu isti"}}}},"ru":{"js":{"errors":{"value":{"invalid":"Неверное значение"},"email":{"invalid":"Ошибка в Email адресе","blank":"Email не может быть пустым"},"password":{"blank":"Пароль не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"},"password_confirmation":{"blank":"Подтверждение пароля не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"}}}},"pl":{"js":{"errors":{"value":{"invalid":"Wartość jest niepoprawna"},"email":{"invalid":"Błędny adres E-mail","blank":"E-mail jest wymagany i nie może być pusty"},"password":{"blank":"Hasło jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"},"password_confirmation":{"blank":"Potwierdzenie hasła jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"}}}},"fr":{"js":{"errors":{"value":{"invalid":"Valeur non valide"},"email":{"invalid":"Adresse Email non valide","blank":"L'Email est requis et doit être renseigné"},"password":{"blank":"Les mot de passe est requis et doit être renseigné","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"},"password_confirmation":{"blank":"La confirmation du mot de passe est requise et doit être renseignée","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"}}}}};
\ No newline at end of file
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index ee02fbfa..c39ee948 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -1,8 +1,10 @@
require 'net/http'
class ProjectsController < ApplicationController
+ include ProjectsHelper
- before_filter :load_project, only: [:show, :edit, :update, :decide_tip_amounts]
+ before_filter :load_project, only: [:show, :edit, :decide_tip_amounts, :update]
+ before_filter :redirect_to_pretty_url, only: [:show, :edit, :decide_tip_amounts]
def index
@projects = Project.order(projects_order).page(params[:page]).per(30)
@@ -17,29 +19,9 @@ def search
end
end
- # Redirect to pretty url for html format
- include ProjectsHelper
- before_filter only: [:show] do
- if params[:id].present?
- begin
- respond_to do |format|
- format.html { redirect_to pretty_project_path(@project) }
- end
- rescue ActionController::UnknownFormat
- end
- end
- end
-
def show
- if @project.bitcoin_address.nil?
- uri = URI("https://blockchain.info/merchant/#{CONFIG["blockchain_info"]["guid"]}/new_address")
- params = { password: CONFIG["blockchain_info"]["password"], label:"#{@project.full_name}@tip4commit" }
- uri.query = URI.encode_www_form(params)
- res = Net::HTTP.get_response(uri)
- if res.is_a?(Net::HTTPSuccess) && (bitcoin_address = JSON.parse(res.body)["address"])
- @project.update_attribute :bitcoin_address, bitcoin_address
- end
- end
+ @project.update_bitcoin_address if @project.bitcoin_address.nil?
+
@project_tips = @project.tips
@recent_tips = @project_tips.includes(:user).order(created_at: :desc).first(5)
end
@@ -108,4 +90,23 @@ def projects_order
'description' => {description: :asc, available_amount_cache: :desc, watchers_count: :desc, full_name: :asc}
}.[](params[:order] || 'balance')
end
+
+ def redirect_to_pretty_url
+ return unless request.get? && params[:id].present?
+
+ begin
+ respond_to do |format|
+ case action_name
+ when 'show'
+ path = pretty_project_path(@project)
+ when 'edit'
+ path = pretty_project_edit_path(@project)
+ when 'decide_tip_amounts'
+ path = pretty_project_decide_tip_amounts_path(@project)
+ end
+ format.html { redirect_to path }
+ end
+ rescue ActionController::UnknownFormat
+ end
+ end
end
diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb
index 6189890b..5911ecd9 100644
--- a/app/helpers/projects_helper.rb
+++ b/app/helpers/projects_helper.rb
@@ -22,6 +22,14 @@ def pretty_project_path project
"/#{project.host}/#{project.full_name}"
end
+ def pretty_project_edit_path project
+ "#{pretty_project_path project}/edit"
+ end
+
+ def pretty_project_decide_tip_amounts_path project
+ "#{pretty_project_path project}/decide_tip_amounts"
+ end
+
def pretty_project_url project
root_url.gsub(/\/$/,'') + pretty_project_path(project)
end
diff --git a/app/models/project.rb b/app/models/project.rb
index 5affe082..988406f9 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -19,6 +19,19 @@ class Project < ActiveRecord::Base
# before_save :check_tips_to_pay_against_avaiable_amount
+ def update_bitcoin_address
+ blockchain_uri = URI CONFIG["blockchain_info"]["new_url"]
+ blockchain_pass = CONFIG["blockchain_info"]["password"]
+ blockchain_label = "#{self.full_name}@tip4commit"
+ blockchain_params = { password: blockchain_pass, label: blockchain_label }
+ blockchain_uri.query = URI.encode_www_form blockchain_params
+ blockchain_resp = Net::HTTP.get_response blockchain_uri
+ if blockchain_resp.is_a? Net::HTTPSuccess
+ self.bitcoin_address = (JSON.parse blockchain_resp.body)["address"]
+ self.save! unless self.bitcoin_address.nil?
+ end
+ end
+
def update_repository_info repo
self.github_id = repo.id
self.name = repo.name
diff --git a/app/models/sendmany.rb b/app/models/sendmany.rb
index 6ef75fbc..169a5fd4 100644
--- a/app/models/sendmany.rb
+++ b/app/models/sendmany.rb
@@ -10,7 +10,7 @@ def send_transaction
update_attribute :is_error, true # it's a lock to prevent duplicates
- uri = URI("https://blockchain.info/merchant/#{CONFIG["blockchain_info"]["guid"]}/sendmany")
+ uri = URI CONFIG["blockchain_info"]["sendmany_url"]
params = { password: CONFIG["blockchain_info"]["password"], recipients: data }
uri.query = URI.encode_www_form(params)
res = Net::HTTP.get_response(uri)
diff --git a/app/views/deposits/index.html.haml b/app/views/deposits/index.html.haml
index 7950e74d..dfc3d5dd 100644
--- a/app/views/deposits/index.html.haml
+++ b/app/views/deposits/index.html.haml
@@ -22,7 +22,7 @@
%td= link_to(deposit.project.full_name, pretty_project_path(deposit.project))
%td= btc_human deposit.amount
%td= btc_human deposit.fee
- %td= link_to deposit.txid, "https://blockchain.info/tx/#{deposit.txid}", target: :blank
+ %td= link_to deposit.txid, "#{CONFIG["blockchain_info"]["transfer_url"]}/#{deposit.txid}", target: :blank
%td= deposit.confirmed? ? t('.confirmed_yes') : t('.confirmed_no')
= paginate @deposits
diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml
index 48043f1f..6786b191 100644
--- a/app/views/projects/show.html.haml
+++ b/app/views/projects/show.html.haml
@@ -10,6 +10,8 @@
= @project.full_name
%small= link_to glyph(:github), @project.github_url, target: '_blank'
.pull-right
+ - if @project.collaborators.empty?
+ = "(Pending initial sync)"
- if can? :update, @project
= link_to t('.edit_project'), edit_project_path(@project), class: "btn btn-primary"
- if can? :decide_tip_amounts, @project and @project.has_undecided_tips?
diff --git a/app/views/tips/index.html.haml b/app/views/tips/index.html.haml
index ded8f6e0..317bff72 100644
--- a/app/views/tips/index.html.haml
+++ b/app/views/tips/index.html.haml
@@ -45,7 +45,7 @@
= t('.waiting')
- else
- if tip.sendmany.txid.present?
- = link_to tip.sendmany.txid, "https://blockchain.info/tx/#{tip.sendmany.txid}", target: :blank
+ = link_to tip.sendmany.txid, "#{CONFIG["blockchain_info"]["transfer_url"]}/#{tip.sendmany.txid}", target: :blank
- else
= t('.waiting')
- if tip.sendmany.is_error
diff --git a/app/views/withdrawals/index.html.haml b/app/views/withdrawals/index.html.haml
index 9e0825e2..4b3e2c24 100644
--- a/app/views/withdrawals/index.html.haml
+++ b/app/views/withdrawals/index.html.haml
@@ -10,5 +10,5 @@
- @sendmanies.each do |sendmany|
%tr
%td= l(sendmany.created_at, format: :short)
- %td= link_to(sendmany.txid, "https://blockchain.info/tx/#{sendmany.txid}", target: '_blank')
+ %td= link_to(sendmany.txid, "#{CONFIG["blockchain_info"]["transfer_url"]}/#{sendmany.txid}", target: '_blank')
%td= sendmany.is_error ? t('.error') : t('.success')
diff --git a/config/application.rb b/config/application.rb
index e801a593..48be945c 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -8,6 +8,14 @@
# load config.yaml preprocessed
CONFIG ||= YAML::load(ERB.new(File.read("config/config.yml")).result)
+# define default blockchain urls
+merchant_url = "https://blockchain.info/merchant"
+transfer_url = "https://blockchain.info/tx"
+guid = CONFIG["blockchain_info"]["guid"]
+CONFIG["blockchain_info"]["merchant_url"] = merchant_url
+CONFIG["blockchain_info"]["transfer_url"] = transfer_url
+CONFIG["blockchain_info"]["new_url"] = "#{merchant_url}/#{guid}/new_address"
+CONFIG["blockchain_info"]["sendmany_url"] = "#{merchant_url}/#{guid}/sendmany"
module T4c
diff --git a/config/routes.rb b/config/routes.rb
index 16cdf7ad..0f2cbaee 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -4,7 +4,9 @@
get '/blockchain_info_callback' => "home#blockchain_info_callback", :as => "blockchain_info_callback"
- get '/:service/:repo' => 'projects#show', :constraints => {:service => /github/, :repo => /.+/}
+ get '/:service/:repo/:action' => 'projects#edit', :constraints => {:service => /github/, :repo => /.+/, :action => /edit/}
+ get '/:service/:repo/:action' => 'projects#decide_tip_amounts', :constraints => {:service => /github/, :repo => /.+/, :action => /decide_tip_amounts/}
+ get '/:service/:repo' => 'projects#show', :constraints => {:service => /github/, :repo => /.+/}
devise_for :users,
:controllers => {
From b7e6dc33d9ab854c3ac3bc530468f891f1f6f9cd Mon Sep 17 00:00:00 2001
From: bill auger
Date: Wed, 29 Oct 2014 08:56:11 +0000
Subject: [PATCH 089/415] add project avatar image to Project index and show
pages
* added :avatar_url field to Project table for efficiency
* project avatar image replaces octocat on Project show page
* project avatar url updates in Project#update_repository_info
---
app/assets/javascripts/i18n/translations.js | 2 +-
app/assets/stylesheets/application.css | 2 ++
app/assets/stylesheets/projects.css.scss | 8 +++++---
app/models/project.rb | 14 ++++++++------
app/views/projects/index.html.haml | 9 ++++++---
app/views/projects/show.html.haml | 6 +++---
.../20141029083726_add_avatar_to_projects.rb | 5 +++++
db/schema.rb | 3 ++-
8 files changed, 32 insertions(+), 17 deletions(-)
create mode 100644 db/migrate/20141029083726_add_avatar_to_projects.rb
diff --git a/app/assets/javascripts/i18n/translations.js b/app/assets/javascripts/i18n/translations.js
index 029f45b8..ac0ec161 100644
--- a/app/assets/javascripts/i18n/translations.js
+++ b/app/assets/javascripts/i18n/translations.js
@@ -1,2 +1,2 @@
var I18n = I18n || {};
-I18n.translations = {"en":{"js":{"errors":{"value":{"invalid":"Value is invalid"},"email":{"invalid":"Invalid Email Address","blank":"The Email is required and can't be empty"},"password":{"blank":"The password is required and can't be empty","invalid":"The password and its confirmation are not same"},"password_confirmation":{"blank":"The password confirmation is required and can't be empty","invalid":"The password and its confirmation are not same"}}}},"fr":{"js":{"errors":{"value":{"invalid":"Valeur non valide"},"email":{"invalid":"Adresse Email non valide","blank":"L'Email est requis et doit être renseigné"},"password":{"blank":"Les mot de passe est requis et doit être renseigné","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"},"password_confirmation":{"blank":"La confirmation du mot de passe est requise et doit être renseignée","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"}}}},"hr":{"js":{"errors":{"value":{"invalid":"Vrijednost nevazeca"},"email":{"invalid":"Nezaveca email adresa","blank":"Email je potreban i ne moze biti prazno"},"password":{"blank":"Lozinka je potrebna i ne moze biti prazno","invalid":"Lozinka i njezina potvrda nisu isti"},"password_confirmation":{"blank":"Potvrda lozinke je potrebna i ne moze biti prazno","invalid":"Lozinka i potvrda lozinke nisu isti"}}}},"pl":{"js":{"errors":{"value":{"invalid":"Wartość jest niepoprawna"},"email":{"invalid":"Błędny adres E-mail","blank":"E-mail jest wymagany i nie może być pusty"},"password":{"blank":"Hasło jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"},"password_confirmation":{"blank":"Potwierdzenie hasła jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"}}}},"ru":{"js":{"errors":{"value":{"invalid":"Неверное значение"},"email":{"invalid":"Ошибка в Email адресе","blank":"Email не может быть пустым"},"password":{"blank":"Пароль не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"},"password_confirmation":{"blank":"Подтверждение пароля не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"}}}}};
\ No newline at end of file
+I18n.translations = {"en":{"js":{"errors":{"value":{"invalid":"Value is invalid"},"email":{"invalid":"Invalid Email Address","blank":"The Email is required and can't be empty"},"password":{"blank":"The password is required and can't be empty","invalid":"The password and its confirmation are not same"},"password_confirmation":{"blank":"The password confirmation is required and can't be empty","invalid":"The password and its confirmation are not same"}}}},"hr":{"js":{"errors":{"value":{"invalid":"Vrijednost nevazeca"},"email":{"invalid":"Nezaveca email adresa","blank":"Email je potreban i ne moze biti prazno"},"password":{"blank":"Lozinka je potrebna i ne moze biti prazno","invalid":"Lozinka i njezina potvrda nisu isti"},"password_confirmation":{"blank":"Potvrda lozinke je potrebna i ne moze biti prazno","invalid":"Lozinka i potvrda lozinke nisu isti"}}}},"ru":{"js":{"errors":{"value":{"invalid":"Неверное значение"},"email":{"invalid":"Ошибка в Email адресе","blank":"Email не может быть пустым"},"password":{"blank":"Пароль не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"},"password_confirmation":{"blank":"Подтверждение пароля не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"}}}},"pl":{"js":{"errors":{"value":{"invalid":"Wartość jest niepoprawna"},"email":{"invalid":"Błędny adres E-mail","blank":"E-mail jest wymagany i nie może być pusty"},"password":{"blank":"Hasło jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"},"password_confirmation":{"blank":"Potwierdzenie hasła jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"}}}},"fr":{"js":{"errors":{"value":{"invalid":"Valeur non valide"},"email":{"invalid":"Adresse Email non valide","blank":"L'Email est requis et doit être renseigné"},"password":{"blank":"Les mot de passe est requis et doit être renseigné","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"},"password_confirmation":{"blank":"La confirmation du mot de passe est requise et doit être renseignée","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"}}}}};
\ No newline at end of file
diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css
index fce99d41..5c9d2b71 100644
--- a/app/assets/stylesheets/application.css
+++ b/app/assets/stylesheets/application.css
@@ -28,3 +28,5 @@
padding: 15px;
margin: 0 auto;
}
+
+.rjust { text-align: right ; }
diff --git a/app/assets/stylesheets/projects.css.scss b/app/assets/stylesheets/projects.css.scss
index 6d95023e..21bb2ec4 100644
--- a/app/assets/stylesheets/projects.css.scss
+++ b/app/assets/stylesheets/projects.css.scss
@@ -2,6 +2,8 @@
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
-.commit-sha {
- font-family: monospace;
-}
+.commit-sha { font-family: monospace; }
+
+.project_avatar_img { position: relative ; width: 32px ; height: 32px ; }
+#projects_table .project_avatar_img { top: 3px ; }
+#project_header .project_avatar_img { top: -5px ; }
diff --git a/app/models/project.rb b/app/models/project.rb
index 5affe082..a1afe9b9 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -20,13 +20,15 @@ class Project < ActiveRecord::Base
# before_save :check_tips_to_pay_against_avaiable_amount
def update_repository_info repo
- self.github_id = repo.id
- self.name = repo.name
- self.full_name = repo.full_name
+ self.github_id = repo.id
+ self.name = repo.name
+ self.full_name = repo.full_name
self.source_full_name = repo.source.full_name rescue ''
- self.description = repo.description
- self.watchers_count = repo.watchers_count
- self.language = repo.language
+ self.description = repo.description
+ self.watchers_count = repo.watchers_count
+ self.language = repo.language
+ self.avatar_url = repo.organization.rels[:avatar].href if repo.organization.present?
+
self.save!
end
diff --git a/app/views/projects/index.html.haml b/app/views/projects/index.html.haml
index a6c1445a..82c71486 100644
--- a/app/views/projects/index.html.haml
+++ b/app/views/projects/index.html.haml
@@ -11,9 +11,10 @@
= button_tag t('.find_project.button'), class: "btn btn-default", name: nil
%p
- if @projects.count > 0
- %table.table.table-striped
+ %table.table.table-striped#projects_table
%thead
%tr
+ %th
%th= link_to_unless_current t('.repository'), params.merge(:order => 'repository')
%th= link_to_unless_current t('.description'), params.merge(:order => 'description')
%th= link_to_unless_current t('.watchers'), params.merge(:order => 'watchers')
@@ -22,6 +23,8 @@
%tbody
- @projects.each do |project|
%tr
+ %td
+ = image_tag project.avatar_url , class: 'project_avatar_img' if project.avatar_url
%td
%strong= link_to project.full_name, pretty_project_path(project)
- if !project.source_full_name.blank?
@@ -31,8 +34,8 @@
= t('.forked_from')
= link_to project.source_full_name, project.source_github_url, target: '_blank'
%td= project.description
- %td= project.watchers_count
- %td= btc_human project.available_amount_cache
+ %td.rjust= project.watchers_count
+ %td.rjust= btc_human project.available_amount_cache
%td= link_to t('.support'), pretty_project_path(project), class: 'btn btn-xs btn-success'
= paginate @projects
- else
diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml
index 48043f1f..a2bf0e3a 100644
--- a/app/views/projects/show.html.haml
+++ b/app/views/projects/show.html.haml
@@ -6,9 +6,9 @@
- if @project.disable_notifications
.alert.alert-danger= t('.disabled_notifications')
-%h1
- = @project.full_name
- %small= link_to glyph(:github), @project.github_url, target: '_blank'
+%h1#project_header
+ = (@project.avatar_url.nil?)? (glyph :github) : (image_tag @project.avatar_url , class: 'project_avatar_img')
+ = link_to @project.full_name , @project.github_url, target: '_blank'
.pull-right
- if can? :update, @project
= link_to t('.edit_project'), edit_project_path(@project), class: "btn btn-primary"
diff --git a/db/migrate/20141029083726_add_avatar_to_projects.rb b/db/migrate/20141029083726_add_avatar_to_projects.rb
new file mode 100644
index 00000000..c4d9f893
--- /dev/null
+++ b/db/migrate/20141029083726_add_avatar_to_projects.rb
@@ -0,0 +1,5 @@
+class AddAvatarToProjects < ActiveRecord::Migration
+ def change
+ add_column :projects, :avatar_url, :string
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index b9683cf3..a75e768d 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 20140918051752) do
+ActiveRecord::Schema.define(version: 20141029083726) do
create_table "collaborators", force: true do |t|
t.integer "project_id"
@@ -53,6 +53,7 @@
t.datetime "info_updated_at"
t.string "branch"
t.boolean "disable_notifications"
+ t.string "avatar_url"
end
add_index "projects", ["full_name"], name: "index_projects_on_full_name", unique: true
From 11f1eed297a02d58225a5a832969a0aebb4bffed Mon Sep 17 00:00:00 2001
From: bill auger
Date: Wed, 29 Oct 2014 21:26:40 +0000
Subject: [PATCH 090/415] add backlog of feature tests and refactor existing
tests to use uniform url scheme
* added cucumber test for project management ability of collaborators/non-collaborators
* added cucumber tests for searching and adding projects (PR #140)
* add test for and searching/adding valid and invalid repos
* test also for organization avatar image
* added features/find_or_create_project.feature
* added features/project_steps.rb
* added cucumber tests for signup and sign-in links (PR #131)
* added features/signup_signin.feature
* added features/step_definitions/home_steps.rb
* added cucumber tests for "initial sync pending" notice (PR #141)
* added features/manage_project.feature
* added rspec controller and routing tests for most actions of all controllers
* added spec/controllers/tips_controller_spec.rb
* added spec/controllers/withdrawals_controller_spec.rb
* factored out commonality from some existing steps (ie. "When I visit ...")
* deferred loading of collaborators and commits until project actually "syncs"
* handles up to three test @project instances
NOTES:
this commit includes tests for the features implemented on other branches
they are not marked as 'pending' and will be failing before those
feature branches are merged - so it may be best to hold back this PR
unitl all of these are merged
PR #131 - fix inconsistent capitalization of signup/sign-in links
PR #140 - add project avatar image to Project index and show pages
PR #141 - add "sync pending" notice and more pretty urls
FAILING TESTS:
the steps in features/step_definitions/home_steps.rb
"I should see "Sign up" in the header" and
"I should see "Sign out" in the header"
and the steps in features/step_definitions/web.rb
"I'm not logged in"/"I log out"
are failing in this commit because they depend on the feature implemented in PR #131
the step in features/find_or_create_project.feature
"there should be a project avatar image"
is failing in this commit because it depends on the feature implemented in PR #140
the uniform pretty urls feature of project-management branch (PR #141)
is so intrinsic to the generalized "I visit ..." testing paths in this commit
that this branch incorperates it - as most existing tests would fail
without the uniform pretty url routing scheme - the project-management branch and
may even merge until all of the PR mentioned here are up to date -
in any case to minimize merge conflicts it probably best to merge this one last
---
app/assets/javascripts/i18n/translations.js | 2 +-
app/controllers/projects_controller.rb | 31 ++-
app/helpers/projects_helper.rb | 8 +
app/views/projects/show.html.haml | 2 +
config/routes.rb | 6 +-
features/find_or_create_project.feature | 75 +++++++
features/manage_project.feature | 54 +++++
features/notification_threshold.feature | 18 +-
features/sign_up_sign_in.feature | 62 ++++++
features/step_definitions/common.rb | 126 +++++++++---
features/step_definitions/home_steps.rb | 8 +
features/step_definitions/project_steps.rb | 21 ++
.../tip_modifier_interface.rb | 37 ++--
features/step_definitions/web.rb | 59 +++++-
features/support/finders.rb | 7 +-
features/tip_modifier_interface.feature | 190 ++++++++++--------
features/tipping_policies.feature | 30 +--
spec/controllers/deposits_controller_spec.rb | 8 +-
spec/controllers/home_controller_spec.rb | 8 +
spec/controllers/projects_controller_spec.rb | 167 ++++++++++++++-
spec/controllers/tips_controller_spec.rb | 18 ++
spec/controllers/users_controller_spec.rb | 60 ++++++
.../withdrawals_controller_spec.rb | 18 ++
23 files changed, 844 insertions(+), 171 deletions(-)
create mode 100644 features/find_or_create_project.feature
create mode 100644 features/manage_project.feature
create mode 100644 features/sign_up_sign_in.feature
create mode 100644 features/step_definitions/home_steps.rb
create mode 100644 features/step_definitions/project_steps.rb
create mode 100644 spec/controllers/tips_controller_spec.rb
create mode 100644 spec/controllers/withdrawals_controller_spec.rb
diff --git a/app/assets/javascripts/i18n/translations.js b/app/assets/javascripts/i18n/translations.js
index 029f45b8..ac0ec161 100644
--- a/app/assets/javascripts/i18n/translations.js
+++ b/app/assets/javascripts/i18n/translations.js
@@ -1,2 +1,2 @@
var I18n = I18n || {};
-I18n.translations = {"en":{"js":{"errors":{"value":{"invalid":"Value is invalid"},"email":{"invalid":"Invalid Email Address","blank":"The Email is required and can't be empty"},"password":{"blank":"The password is required and can't be empty","invalid":"The password and its confirmation are not same"},"password_confirmation":{"blank":"The password confirmation is required and can't be empty","invalid":"The password and its confirmation are not same"}}}},"fr":{"js":{"errors":{"value":{"invalid":"Valeur non valide"},"email":{"invalid":"Adresse Email non valide","blank":"L'Email est requis et doit être renseigné"},"password":{"blank":"Les mot de passe est requis et doit être renseigné","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"},"password_confirmation":{"blank":"La confirmation du mot de passe est requise et doit être renseignée","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"}}}},"hr":{"js":{"errors":{"value":{"invalid":"Vrijednost nevazeca"},"email":{"invalid":"Nezaveca email adresa","blank":"Email je potreban i ne moze biti prazno"},"password":{"blank":"Lozinka je potrebna i ne moze biti prazno","invalid":"Lozinka i njezina potvrda nisu isti"},"password_confirmation":{"blank":"Potvrda lozinke je potrebna i ne moze biti prazno","invalid":"Lozinka i potvrda lozinke nisu isti"}}}},"pl":{"js":{"errors":{"value":{"invalid":"Wartość jest niepoprawna"},"email":{"invalid":"Błędny adres E-mail","blank":"E-mail jest wymagany i nie może być pusty"},"password":{"blank":"Hasło jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"},"password_confirmation":{"blank":"Potwierdzenie hasła jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"}}}},"ru":{"js":{"errors":{"value":{"invalid":"Неверное значение"},"email":{"invalid":"Ошибка в Email адресе","blank":"Email не может быть пустым"},"password":{"blank":"Пароль не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"},"password_confirmation":{"blank":"Подтверждение пароля не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"}}}}};
\ No newline at end of file
+I18n.translations = {"en":{"js":{"errors":{"value":{"invalid":"Value is invalid"},"email":{"invalid":"Invalid Email Address","blank":"The Email is required and can't be empty"},"password":{"blank":"The password is required and can't be empty","invalid":"The password and its confirmation are not same"},"password_confirmation":{"blank":"The password confirmation is required and can't be empty","invalid":"The password and its confirmation are not same"}}}},"hr":{"js":{"errors":{"value":{"invalid":"Vrijednost nevazeca"},"email":{"invalid":"Nezaveca email adresa","blank":"Email je potreban i ne moze biti prazno"},"password":{"blank":"Lozinka je potrebna i ne moze biti prazno","invalid":"Lozinka i njezina potvrda nisu isti"},"password_confirmation":{"blank":"Potvrda lozinke je potrebna i ne moze biti prazno","invalid":"Lozinka i potvrda lozinke nisu isti"}}}},"ru":{"js":{"errors":{"value":{"invalid":"Неверное значение"},"email":{"invalid":"Ошибка в Email адресе","blank":"Email не может быть пустым"},"password":{"blank":"Пароль не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"},"password_confirmation":{"blank":"Подтверждение пароля не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"}}}},"pl":{"js":{"errors":{"value":{"invalid":"Wartość jest niepoprawna"},"email":{"invalid":"Błędny adres E-mail","blank":"E-mail jest wymagany i nie może być pusty"},"password":{"blank":"Hasło jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"},"password_confirmation":{"blank":"Potwierdzenie hasła jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"}}}},"fr":{"js":{"errors":{"value":{"invalid":"Valeur non valide"},"email":{"invalid":"Adresse Email non valide","blank":"L'Email est requis et doit être renseigné"},"password":{"blank":"Les mot de passe est requis et doit être renseigné","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"},"password_confirmation":{"blank":"La confirmation du mot de passe est requise et doit être renseignée","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"}}}}};
\ No newline at end of file
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index ee02fbfa..44fac396 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -2,7 +2,8 @@
class ProjectsController < ApplicationController
- before_filter :load_project, only: [:show, :edit, :update, :decide_tip_amounts]
+ before_filter :load_project, only: [:show, :edit, :update, :decide_tip_amounts,
+ :tips, :deposits]
def index
@projects = Project.order(projects_order).page(params[:page]).per(30)
@@ -19,11 +20,21 @@ def search
# Redirect to pretty url for html format
include ProjectsHelper
- before_filter only: [:show] do
+ before_filter only: [:show, :edit, :decide_tip_amounts] do |controller|
+ return unless request.get?
+
if params[:id].present?
begin
respond_to do |format|
- format.html { redirect_to pretty_project_path(@project) }
+ case controller.action_name
+ when 'show'
+ path = pretty_project_path(@project)
+ when 'edit'
+ path = pretty_project_edit_path(@project)
+ when 'decide_tip_amounts'
+ path = pretty_project_decide_tip_amounts_path(@project)
+ end
+ format.html { redirect_to path }
end
rescue ActionController::UnknownFormat
end
@@ -83,6 +94,20 @@ def decide_tip_amounts
end
end
+ def tips
+ @tips = @project.tips.includes(:user).order(created_at: :desc).
+ page(params[:page]).
+ per(params[:per_page] || 30)
+ render :template => 'tips/index'
+ end
+
+ def deposits
+ @deposits = @project.deposits.order(created_at: :desc).
+ page(params[:page]).
+ per(params[:per_page] || 30)
+ render :template => 'deposits/index'
+ end
+
private
def load_project
diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb
index 6189890b..5911ecd9 100644
--- a/app/helpers/projects_helper.rb
+++ b/app/helpers/projects_helper.rb
@@ -22,6 +22,14 @@ def pretty_project_path project
"/#{project.host}/#{project.full_name}"
end
+ def pretty_project_edit_path project
+ "#{pretty_project_path project}/edit"
+ end
+
+ def pretty_project_decide_tip_amounts_path project
+ "#{pretty_project_path project}/decide_tip_amounts"
+ end
+
def pretty_project_url project
root_url.gsub(/\/$/,'') + pretty_project_path(project)
end
diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml
index 48043f1f..6786b191 100644
--- a/app/views/projects/show.html.haml
+++ b/app/views/projects/show.html.haml
@@ -10,6 +10,8 @@
= @project.full_name
%small= link_to glyph(:github), @project.github_url, target: '_blank'
.pull-right
+ - if @project.collaborators.empty?
+ = "(Pending initial sync)"
- if can? :update, @project
= link_to t('.edit_project'), edit_project_path(@project), class: "btn btn-primary"
- if can? :decide_tip_amounts, @project and @project.has_undecided_tips?
diff --git a/config/routes.rb b/config/routes.rb
index 16cdf7ad..be386023 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -4,7 +4,11 @@
get '/blockchain_info_callback' => "home#blockchain_info_callback", :as => "blockchain_info_callback"
- get '/:service/:repo' => 'projects#show', :constraints => {:service => /github/, :repo => /.+/}
+ get '/:service/:repo/edit' => 'projects#edit', :constraints => {:service => /github/, :repo => /.+/}
+ get '/:service/:repo/decide_tip_amounts' => 'projects#decide_tip_amounts', :constraints => {:service => /github/, :repo => /.+/}
+ get '/:service/:repo/tips' => 'projects#tips', :constraints => {:service => /github/, :repo => /.+/}
+ get '/:service/:repo/deposits' => 'projects#deposits', :constraints => {:service => /github/, :repo => /.+/}
+ get '/:service/:repo' => 'projects#show', :constraints => {:service => /github/, :repo => /.+/}
devise_for :users,
:controllers => {
diff --git a/features/find_or_create_project.feature b/features/find_or_create_project.feature
new file mode 100644
index 00000000..3a2dc850
--- /dev/null
+++ b/features/find_or_create_project.feature
@@ -0,0 +1,75 @@
+Feature: Visitors may search for and add projects
+ Background:
+ Given a "github" project named "seldon/seldons-project" exists
+
+ Scenario: Visitors may find existing projects
+ Given I'm not logged in
+ And I visit the "projects" page
+ Then I should be on the "projects" page
+ When I fill "query" with: "seldons-project"
+ And I click on "Find or add project"
+ Then I should be on the "search" page
+ And I should see "seldon/seldons-project"
+ But I should not see "project not found"
+
+ Scenario: Visitors may not find non-existing projects
+ Given I'm not logged in
+ And I visit the "projects" page
+ Then I should be on the "projects" page
+ When I fill "query" with: "no-such-repo"
+ And I click on "Find or add project"
+ Then I should be on the "search" page
+ And I should see "Project not found"
+ But I should not see "seldon/seldons-project"
+
+ Scenario: Visitors may add new projects
+ Given I'm not logged in
+ And I visit the "projects" page
+ Then I should be on the "projects" page
+ When I fill "query" with: "https://github.com/tip4commit/tip4commit"
+ And I click on "Find or add project"
+ Then I should be on the "tip4commit/tip4commit github-project" page
+ And I should see "tip4commit/tip4commit"
+ But I should not see "seldon/seldons-project"
+
+ Scenario: Visitors may not add non-existing projects
+ Given I'm not logged in
+ And I visit the "projects" page
+ Then I should be on the "projects" page
+ When I fill "query" with: "https://github.com/xxx-no-such-user-xxx/xxx-no-such-repo-xxx"
+ And I click on "Find or add project"
+ Then I should be on the "search" page
+ And I should see "Project not found"
+ But I should not see "xxx-no-such-repo-xxx"
+ And I should not see "seldon/seldons-project"
+
+ Scenario: Visitors may not add bogus projects
+ Given I'm not logged in
+ And I visit the "projects" page
+ Then I should be on the "projects" page
+ When I fill "query" with: "https://shithub.com/nouser/norepo"
+ And I click on "Find or add project"
+ Then I should be on the "search" page
+ And I should see "Project not found"
+ But I should not see "norepo"
+ And I should not see "seldon/seldons-project"
+
+ Scenario: Projects with individual owner should not show project avatar
+ Given I'm not logged in
+ And I visit the "projects" page
+ Then I should be on the "projects" page
+ When I fill "query" with: "seldons-project"
+ And I click on "Find or add project"
+ Then I should be on the "search" page
+ And I should see "seldon/seldons-project"
+ And there should not be a project avatar image visible
+
+ Scenario: Projects owned by an organization should show project avatar
+ Given I'm not logged in
+ And I visit the "projects" page
+ Then I should be on the "projects" page
+ When I fill "query" with: "https://github.com/tip4commit/tip4commit"
+ And I click on "Find or add project"
+ Then I should be on the "tip4commit/tip4commit github-project" page
+ And I should see "tip4commit/tip4commit"
+ And there should be a project avatar image visible
diff --git a/features/manage_project.feature b/features/manage_project.feature
new file mode 100644
index 00000000..55f72f41
--- /dev/null
+++ b/features/manage_project.feature
@@ -0,0 +1,54 @@
+Feature: Collaborators may manage project
+ Background:
+ Given a "github" project named "seldon/seldons-project" exists
+
+ Scenario: Collaborators must be logged-in to manage project
+ Given I'm not logged in
+ When I visit the "seldon/seldons-project github-project" page
+ Then I should be on the "seldon/seldons-project github-project" page
+ And I should see "seldon/seldons-project"
+ And I should see "Pending initial sync"
+ But I should not see "Change project settings"
+ And I should not see "Decide tips"
+
+ When the project syncs with the remote repo
+ And I visit the "seldon/seldons-project github-project" page
+ Then I should be on the "seldon/seldons-project github-project" page
+ And I should see "seldon/seldons-project"
+ But I should not see "Pending initial sync"
+ And I should not see "Change project settings"
+ And I should not see "Decide tips"
+
+ Scenario: Non-collaborators should not be able to manage project
+ Given I'm logged in as "someone-else"
+ When I visit the "seldon/seldons-project github-project" page
+ Then I should be on the "seldon/seldons-project github-project" page
+ And I should see "seldon/seldons-project"
+ And I should see "Pending initial sync"
+ But I should not see "Change project settings"
+ And I should not see "Decide tips"
+
+ When the project syncs with the remote repo
+ And I visit the "seldon/seldons-project github-project" page
+ Then I should be on the "seldon/seldons-project github-project" page
+ And I should see "seldon/seldons-project"
+ But I should not see "Pending initial sync"
+ And I should not see "Change project settings"
+ And I should not see "Decide tips"
+
+ Scenario: New projects should show "Pending initial sync"
+ Given I'm logged in as "seldon"
+ When I visit the "seldon/seldons-project github-project" page
+ Then I should be on the "seldon/seldons-project github-project" page
+ And I should see "seldon/seldons-project"
+ And I should see "Pending initial sync"
+ But I should not see "Change project settings"
+ And I should not see "Decide tips"
+
+ When the project syncs with the remote repo
+ And I visit the "seldon/seldons-project github-project" page
+ Then I should be on the "seldon/seldons-project github-project" page
+ And I should see "seldon/seldons-project"
+ But I should not see "Pending initial sync"
+ And I should see "Change project settings"
+ But I should not see "Decide tips"
diff --git a/features/notification_threshold.feature b/features/notification_threshold.feature
index 5e613f6e..1426b015 100644
--- a/features/notification_threshold.feature
+++ b/features/notification_threshold.feature
@@ -1,19 +1,19 @@
Feature: Users should not be notified if their balance is small
Background:
- Given a project "django"
- And a deposit of "0.1"
- And 2 new commits
+ Given a "github" project named "seldon/seldon-project" exists
+ And a deposit of "0.1" is made
+ And 2 new commits are made
Scenario: Without big deposits
- When the new commits are read
+ When the project syncs with the remote repo
Then there should be 0 email sent
Scenario: User's balance hits threshold
- When 100 new commits
- And the new commits are read
+ When 100 new commits are made
+ And the project syncs with the remote repo
Then there should be 1 email sent
Scenario: With bigger donation
- When a deposit of "2"
- And the new commits are read
- Then there should be 1 email sent
\ No newline at end of file
+ When a deposit of "2" is made
+ And the project syncs with the remote repo
+ Then there should be 1 email sent
diff --git a/features/sign_up_sign_in.feature b/features/sign_up_sign_in.feature
new file mode 100644
index 00000000..62dabb8f
--- /dev/null
+++ b/features/sign_up_sign_in.feature
@@ -0,0 +1,62 @@
+Feature: Visitors should be able to sign_up and sign_in
+ Background:
+ Given a "github" project named "seldon/seldons-project" exists
+ And the project collaborators are:
+ | seldon |
+
+ Scenario Outline: Visitors should see sign_up and sign_in links on all pages
+ Given I'm not logged in
+ When I visit the page
+ Then I should be on the page
+ And I should see "Sign up" in the header
+ And I should see "Sign in" in the header
+ But I should not see "Sign out" in the header
+ Examples:
+ | page |
+ | "home" |
+ | "users" |
+ | "tips" |
+ | "deposits" |
+ | "withdrawals" |
+ | "projects" |
+ | "seldon/seldons-project github-project" |
+ | "seldon/seldons-project github-project tips" |
+ | "seldon/seldons-project github-project deposits" |
+
+
+ Scenario: Visitors should see sign_up but not sign_in links on sign_in page
+ Given I'm not logged in
+ When I visit the "sign_in" page
+ Then I should be on the "sign_in" page
+ And I should see "Sign up" in the header
+ But I should not see "Sign in" in the header
+ And I should not see "Sign out" in the header
+
+ Scenario: Visitors should see sign_in but not sign_up links on sign_up page
+ Given I'm not logged in
+ When I visit the "sign_up" page
+ Then I should be on the "sign_up" page
+ And I should not see "Sign up" in the header
+ But I should see "Sign in" in the header
+ And I should not see "Sign out" in the header
+
+ Scenario Outline: Logged in users should see only sign_out link on every page
+ Given I'm logged in as "seldon"
+ When I visit the page
+ Then I should be on the page
+ And I should not see "Sign up" in the header
+ And I should not see "Sign in" in the header
+ But I should see "Sign out" in the header
+ Examples:
+ | page |
+ | "home" |
+ | "users" |
+ | "tips" |
+ | "deposits" |
+ | "withdrawals" |
+ | "projects" |
+ | "seldon/seldons-project github-project" |
+ | "seldon/seldons-project github-project edit" |
+ | "seldon/seldons-project github-project decide_tip_amounts" |
+ | "seldon/seldons-project github-project tips" |
+ | "seldon/seldons-project github-project deposits" |
diff --git a/features/step_definitions/common.rb b/features/step_definitions/common.rb
index 28b359c9..0ab39c4f 100644
--- a/features/step_definitions/common.rb
+++ b/features/step_definitions/common.rb
@@ -13,7 +13,7 @@
ActionMailer::Base.deliveries.clear
end
-Given(/^the tip for commit is "(.*?)"$/) do |arg1|
+Given(/^the tip percentage per commit is "(.*?)"$/) do |arg1|
CONFIG["tip"] = arg1.to_f
end
@@ -21,26 +21,56 @@
CONFIG["our_fee"] = arg1.to_f
end
-Given(/^a project$/) do
- @project = Project.create!(full_name: "example/test", github_id: 123, bitcoin_address: 'mq4NtnmQoQoPfNWEPbhSvxvncgtGo6L8WY')
+def create_github_project project_name
+ if (@github_project_1.present? && (project_name.eql? @github_project_1.full_name)) ||
+ (@github_project_2.present? && (project_name.eql? @github_project_2.full_name))
+ raise "duplicate project_name '#{project_name}'"
+ elsif @github_project_3.present?
+ raise "the maximum of three test projects already exist"
+ end
+
+# @current_project is also assigned in the "considering the .. project named ..." step
+ @current_project = Project.create! :full_name => project_name , # e.g. "me/my-project"
+ :github_id => Digest::SHA1.hexdigest(project_name) ,
+ :bitcoin_address => 'mq4NtnmQoQoPfNWEPbhSvxvncgtGo6L8WY'
+ if @github_project_2.present? ; @github_project_3 = @current_project ;
+ elsif @github_project_1.present? ; @github_project_2 = @current_project ;
+ else @github_project_1 = @current_project ;
+ end
+end
+
+def create_bitbicket_project project_name
+ raise "unknown service" # nyi
+end
+
+When /^regarding the "(.*?)" project named "(.*?)"$/ do |service , project_name|
+# @current_project is also assigned in create_github_project and create_bitbucket_project
+
+ @current_project = find_project service , project_name
end
-Given(/^a project "(.*?)"$/) do |arg1|
- @project = Project.create!(full_name: "example/#{arg1}", github_id: Digest::SHA1.hexdigest(arg1), bitcoin_address: 'mq4NtnmQoQoPfNWEPbhSvxvncgtGo6L8WY')
+def service_do service , method_dict
+=begin e.g.
+ service_do 'github' , {'github' => lambda {create_github_project project_name} ,
+ 'bitbucket' => lambda {create_bitbicket_project project_name} }
+=end
+ (method_dict.has_key? service)? method_dict[service].call : (raise "unknown service")
end
-Given(/^a deposit of "(.*?)"$/) do |arg1|
- Deposit.create!(project: @project, amount: arg1.to_d * 1e8, confirmations: 2)
+Given(/^a "(.*?)" project named "(.*?)" exists$/) do |service , project_name|
+ service_do service , {'github' => lambda {create_github_project project_name} ,
+ 'bitbucket' => lambda {create_bitbicket_project project_name} }
end
-Given(/^the last known commit is "(.*?)"$/) do |arg1|
- @project.update!(last_commit: arg1)
+Given(/^a deposit of "(.*?)" is made$/) do |deposit|
+ Deposit.create!(project: @current_project, amount: deposit.to_d * 1e8, confirmations: 2)
end
-def add_new_commit(id, params = {})
- @new_commits ||= {}
+def add_new_commit commit_id , params = {}
+ raise "dplicate commit_id" if (find_new_commit commit_id).present?
+
defaults = {
- sha: id,
+ sha: commit_id,
commit: {
message: "Some changes",
author: {
@@ -48,11 +78,19 @@ def add_new_commit(id, params = {})
},
},
}
- @new_commits[id] = defaults.deep_merge(params)
+
+ project_id = @current_project.id
+ @new_commits ||= {}
+ @new_commits[project_id] ||= {}
+ @new_commits[project_id][commit_id] = defaults.deep_merge params
end
-def find_new_commit(id)
- @new_commits[id]
+def find_new_commit commit_id
+ (@new_commits || {}).each_value do |commits|
+ return commits[commit_id] unless commits[commit_id].nil?
+ end
+
+ nil
end
Given(/^a new commit "(.*?)" with parent "([^"]*?)"$/) do |arg1, arg2|
@@ -63,7 +101,7 @@ def find_new_commit(id)
add_new_commit(arg1, parents: [{sha: arg2}, {sha: arg3}], commit: {message: "Merge #{arg2} and #{arg3}"})
end
-Given(/^(\d+) new commits$/) do |arg1|
+Given(/^(\d+) new commit.? (?:is|are) made$/) do |arg1|
arg1.to_i.times do
add_new_commit(Digest::SHA1.hexdigest(SecureRandom.hex))
end
@@ -73,18 +111,36 @@ def find_new_commit(id)
add_new_commit(arg1)
end
-Given(/^the project holds tips$/) do
- @project.update(hold_tips: true)
+Given(/^the message of commit "(.*?)" is "(.*?)"$/) do |arg1, arg2|
+ commit = find_new_commit(arg1)
+ raise "no such commit" if commit.nil?
+
+ commit.deep_merge!(commit: {message: arg2})
end
-Given(/^the message of commit "(.*?)" is "(.*?)"$/) do |arg1, arg2|
- find_new_commit(arg1).deep_merge!(commit: {message: arg2})
+Given(/^the most recent commit is "(.*?)"$/) do |commit|
+ @current_project.update!(last_commit: commit)
+end
+
+Then(/^the most recent commit should be "(.*?)"$/) do |arg1|
+ @current_project.reload.last_commit.should eq(arg1)
+end
+
+When(/^the new commits are loaded$/) do
+ raise "no commits have been assigned" if @new_commits.nil?
+
+ [@github_project_1 , @github_project_2 , @github_project_3].each do |project|
+ next if project.nil?
+
+ project.reload
+ new_commits = @new_commits[project.id].values.map(&:to_ostruct)
+ project.should_receive(:new_commits).and_return(new_commits)
+ project.tip_commits
+ end
end
-When(/^the new commits are read$/) do
- @project.reload
- @project.should_receive(:new_commits).and_return(@new_commits.values.map(&:to_ostruct))
- @project.tip_commits
+Given(/^the project holds tips$/) do
+ @current_project.update(hold_tips: true)
end
Then(/^there should be no tip for commit "(.*?)"$/) do |arg1|
@@ -101,20 +157,26 @@ def find_new_commit(id)
Tip.find_by(commit: arg1).undecided?.should eq(true)
end
-Then(/^the new last known commit should be "(.*?)"$/) do |arg1|
- @project.reload.last_commit.should eq(arg1)
+Given(/^the project collaborators are:$/) do |table|
+ @collaborators = []
+ table.raw.each do |collaborator_name,|
+ @collaborators << collaborator_name unless @collaborators.include? collaborator_name
+ end
end
-Given(/^the project collaborators are:$/) do |table|
- @project.reload
- @project.collaborators.each(&:destroy)
- table.raw.each do |name,|
- @project.collaborators.create!(login: name)
+Given(/^the project collaborators are loaded$/) do
+ @current_project.reload
+ @current_project.collaborators.each(&:destroy)
+ @collaborators.each do |name,|
+ @current_project.collaborators.create!(login: name)
end
end
Given(/^the author of commit "(.*?)" is "(.*?)"$/) do |arg1, arg2|
- find_new_commit(arg1).deep_merge!(author: {login: arg2}, commit: {author: {email: "#{arg2}@example.com"}})
+ commit = find_new_commit(arg1)
+ raise "no such commit" if commit.nil?
+
+ commit.deep_merge!(author: {login: arg2}, commit: {author: {email: "#{arg2}@example.com"}})
end
Given(/^an illustration of the history is:$/) do |string|
diff --git a/features/step_definitions/home_steps.rb b/features/step_definitions/home_steps.rb
new file mode 100644
index 00000000..11dcaa36
--- /dev/null
+++ b/features/step_definitions/home_steps.rb
@@ -0,0 +1,8 @@
+
+Then(/^I should (.*)\s*see "(.*?)" in the header$/) do |should , text|
+ if should.eql? 'not '
+ page.find('.masthead').should have_no_content(text)
+ else
+ page.find('.masthead').should have_content(text)
+ end
+end
diff --git a/features/step_definitions/project_steps.rb b/features/step_definitions/project_steps.rb
new file mode 100644
index 00000000..084817bf
--- /dev/null
+++ b/features/step_definitions/project_steps.rb
@@ -0,0 +1,21 @@
+
+When /^the project syncs with the remote repo$/ do
+ # in the real world a project has no information regarding commits
+ # nor collaborators until the project initially syncs
+ project_owner_name = (@current_project.full_name.split '/').first
+ @new_commits ||= {@current_project.id => Hash.new}
+ @collaborators ||= [project_owner_name]
+ @collaborators << project_owner_name unless @collaborators.include? project_owner_name
+
+ step 'the new commits are loaded'
+ step "the project collaborators are loaded"
+end
+
+Then /^there should (.*)\s*be a project avatar image visible$/ do |should|
+ avatar_xpath = "//img[contains(@src, \"githubusercontent\")]"
+ if should.eql? 'not '
+ page.should_not have_xpath avatar_xpath
+ else
+ page.should have_xpath avatar_xpath
+ end
+end
diff --git a/features/step_definitions/tip_modifier_interface.rb b/features/step_definitions/tip_modifier_interface.rb
index 9ebc31da..d89eac8e 100644
--- a/features/step_definitions/tip_modifier_interface.rb
+++ b/features/step_definitions/tip_modifier_interface.rb
@@ -12,12 +12,8 @@
end
end
-When(/^I go to the edit page of the project$/) do
- visit edit_project_path(@project)
-end
-
When(/^I send a forged request to enable tip holding on the project$/) do
- page.driver.browser.process_and_follow_redirects(:patch, project_path(@project), project: {hold_tips: "1"})
+ page.driver.browser.process_and_follow_redirects(:patch, project_path(@current_project), project: {hold_tips: "1"})
end
Then(/^I should see an access denied$/) do
@@ -25,26 +21,26 @@
end
Then(/^the project should not hold tips$/) do
- @project.reload.hold_tips.should eq(false)
+ @current_project.reload.hold_tips.should eq(false)
end
Then(/^the project should hold tips$/) do
- @project.reload.hold_tips.should eq(true)
+ @current_project.reload.hold_tips.should eq(true)
end
Given(/^the project has undedided tips$/) do
- create(:undecided_tip, project: @project)
- @project.reload.should have_undecided_tips
+ create(:undecided_tip, project: @current_project)
+ @current_project.reload.should have_undecided_tips
end
Given(/^the project has (\d+) undecided tip$/) do |arg1|
- @project.tips.undecided.each(&:destroy)
- create(:undecided_tip, project: @project)
- @project.reload.should have_undecided_tips
+ @current_project.tips.undecided.each(&:destroy)
+ create(:undecided_tip, project: @current_project)
+ @current_project.reload.should have_undecided_tips
end
Given(/^I send a forged request to set the amount of the first undecided tip of the project$/) do
- tip = @project.tips.undecided.first
+ tip = @current_project.tips.undecided.first
tip.should_not be_nil
params = {
project: {
@@ -57,28 +53,27 @@
},
}
- page.driver.browser.process_and_follow_redirects(:patch, decide_tip_amounts_project_path(@project), params)
+ page.driver.browser.process_and_follow_redirects(:patch, decide_tip_amounts_project_path(@current_project), params)
end
-When(/^I send a forged request to change the percentage of commit "(.*?)" on project "(.*?)" to "(.*?)"$/) do |arg1, arg2, arg3|
- project = find_project(arg2)
- tip = project.tips.detect { |t| t.commit == arg1 }
+When(/^I send a forged request to change the percentage of commit "(.*?)" to "(.*?)"$/) do |commit , percentage|
+ tip = @current_project.tips.detect { |t| t.commit == commit }
tip.should_not be_nil
params = {
project: {
tips_attributes: {
"0" => {
id: tip.id,
- amount_percentage: arg3,
+ amount_percentage: percentage,
},
},
},
}
- page.driver.browser.process_and_follow_redirects(:patch, decide_tip_amounts_project_path(project), params)
+ path = decide_tip_amounts_project_path @current_project
+ page.driver.browser.process_and_follow_redirects :patch , path , params
end
Then(/^the project should have (\d+) undecided tips$/) do |arg1|
- @project.tips.undecided.size.should eq(arg1.to_i)
+ @current_project.tips.undecided.size.should eq(arg1.to_i)
end
-
diff --git a/features/step_definitions/web.rb b/features/step_definitions/web.rb
index c3a6c65c..0ec4001b 100644
--- a/features/step_definitions/web.rb
+++ b/features/step_definitions/web.rb
@@ -13,18 +13,64 @@
page.should have_content("Successfully authenticated")
end
-Given(/^I'm not logged in$/) do
+Given(/^I log out$/) do
visit root_path
- if page.has_content?("Sign Out")
- click_on "Sign Out"
+ if page.has_content?("Sign out")
+ click_on "Sign out"
page.should have_content("Signed out successfully")
else
page.should have_content("Sign in")
end
end
-Given(/^I go to the project page$/) do
- visit project_path(@project)
+Given(/^I'm not logged in$/) { step "I log out" }
+
+def parse_path_from_page_string page_string
+ path = nil
+
+ # explicit cases
+ tokens = page_string.split ' '
+ name = tokens[0]
+ model = tokens[1]
+ action = tokens[2] || ''
+ is_user = model.eql? 'user'
+ is_project = ['github-project' , 'bitbucket-project'].include? model
+ if is_project # e.g. "me/my-project github project edit"
+ projects_paths = ['' , 'edit' , 'decide_tip_amounts' , 'tips' , 'deposits'] # '' => 'show'
+ is_valid_path = projects_paths.include? action
+ service = model.split('-').first
+ path = "/#{service}/#{name}/#{action}" if is_valid_path
+ elsif is_user
+ projects_paths = ['show' , 'edit']
+ is_valid_path = projects_paths.include? action
+ path = "/users/#{name}/#{action}" if is_valid_path
+
+ # implicit cases
+ else case page_string
+ when 'home' ; path = root_path ;
+ when 'sign_up' ; path = new_user_registration_path ;
+ when 'sign_in' ; path = new_user_session_path ;
+ when 'users' ; path = users_path ;
+ when 'projects' ; path = projects_path ;
+ when 'search' ; path = search_projects_path ;
+ when 'tips' ; path = tips_path ;
+ when 'deposits' ; path = deposits_path ;
+ when 'withdrawals' ; path = withdrawals_path ;
+ end
+ end
+
+ path || (raise "unknown page")
+end
+
+Given(/^I visit the "(.*?)" page$/) do |page_string|
+ visit parse_path_from_page_string page_string
+end
+
+Then(/^I should be on the "(.*?)" page$/) do |page_string|
+ expected = parse_path_from_page_string page_string
+ actual = page.current_path
+
+ (expected.index actual).should eq 0 # ignore trailing '/'
end
Given(/^I click on "(.*?)"$/) do |arg1|
@@ -47,3 +93,6 @@
fill_in arg1, with: string
end
+Given(/^I fill "(.*?)" with: "(.*?)"$/) do |text_field, string|
+ fill_in text_field, with: string
+end
diff --git a/features/support/finders.rb b/features/support/finders.rb
index 47334b17..4d4b59c2 100644
--- a/features/support/finders.rb
+++ b/features/support/finders.rb
@@ -1,4 +1,5 @@
-def find_project(name)
- project = Project.where(full_name: "example/#{name}").first
- project or raise "Project #{name.inspect} not found"
+def find_project service , project_name
+# TODO: subclass GithubProject , BitbucketProject , etc. (:host becomes :type)
+ project = Project.where(:host => service , :full_name => project_name).first
+ project or raise "Project '#{project_name.inspect}' not found"
end
diff --git a/features/tip_modifier_interface.feature b/features/tip_modifier_interface.feature
index 206cbfaa..0d45b935 100644
--- a/features/tip_modifier_interface.feature
+++ b/features/tip_modifier_interface.feature
@@ -1,90 +1,114 @@
Feature: A project collaborator can change the tips of commits
Background:
- Given a project "a"
- And the project collaborators are:
+ Given a "github" project named "seldon/seldons-project" exists
+ And the project collaborators are:
| seldon |
| daneel |
- And our fee is "0"
- And a deposit of "500"
- And the last known commit is "AAA"
- And a new commit "BBB" with parent "AAA"
- And a new commit "CCC" with parent "BBB"
- And the author of commit "BBB" is "yugo"
- And the message of commit "BBB" is "Tiny change"
- And the author of commit "CCC" is "gaal"
+ And our fee is "0"
+ And a deposit of "500" is made
+ And the most recent commit is "AAA"
+ And a new commit "BBB" with parent "AAA"
+ And a new commit "CCC" with parent "BBB"
+ And the author of commit "BBB" is "yugo"
+ And the author of commit "CCC" is "gaal"
Scenario: Without anything modified
- When the new commits are read
+ When the project syncs with the remote repo
Then there should be a tip of "5" for commit "BBB"
- And there should be a tip of "4.95" for commit "CCC"
- And there should be 2 email sent
+ And there should be a tip of "4.95" for commit "CCC"
+ And there should be 2 email sent
Scenario: A collaborator wants to alter the tips
Given I'm logged in as "seldon"
- And I go to the project page
- And I click on "Change project settings"
- And I check "Do not send the tips immediatly. Give collaborators the ability to modify the tips before they're sent"
- And I click on "Save the project settings"
- Then I should see "The project settings have been updated"
-
- When the new commits are read
- Then the tip amount for commit "BBB" should be undecided
- And the tip amount for commit "CCC" should be undecided
- And there should be 0 email sent
-
- When I go to the project page
- And I click on "Decide tip amounts"
- Then I should see "BBB"
- And I should see "Tiny change"
- And I should see "CCC"
- And I should not see "AAA"
-
- When I choose the amount "Tiny: 0.1%" on commit "BBB"
- And I click on "Send the selected tip amounts"
- Then there should be a tip of "0.5" for commit "BBB"
- And the tip amount for commit "CCC" should be undecided
- And there should be 1 email sent
-
- When the email counters are reset
- And I choose the amount "Free: 0%" on commit "CCC"
- And I click on "Send the selected tip amounts"
- Then there should be a tip of "0.5" for commit "BBB"
- And there should be a tip of "0" for commit "CCC"
- And there should be 0 email sent
+ When the project syncs with the remote repo
+ And I visit the "seldon/seldons-project github-project" page
+ Then I should be on the "seldon/seldons-project github-project" page
+ When I click on "Change project settings"
+ Then I should be on the "seldon/seldons-project github-project edit" page
+ When I check "Do not send the tips immediatly."
+ And I click on "Save the project settings"
+ Then I should be on the "seldon/seldons-project github-project" page
+ And I should see "The project settings have been updated"
+
+ When a new commit "DDD" with parent "CCC"
+ And the author of commit "DDD" is "sumdood"
+ And the message of commit "DDD" is "sumdood's tiny commit DDD"
+ And a new commit "EEE" with parent "DDD"
+ And the author of commit "EEE" is "sumotherdood"
+ When the project syncs with the remote repo
+ Then there should be a tip of "5" for commit "BBB"
+ And there should be a tip of "4.95" for commit "CCC"
+ And the tip amount for commit "DDD" should be undecided
+ And there should be 2 email sent
+
+ When I visit the "seldon/seldons-project github-project" page
+ Then I should be on the "seldon/seldons-project github-project" page
+ When I click on "Decide tip amounts"
+ Then I should be on the "seldon/seldons-project github-project decide_tip_amounts" page
+ And I should not see "AAA"
+ And I should not see "BBB"
+ And I should not see "CCC"
+ But I should see "DDD"
+ And I should see "sumdood's tiny commit DDD"
+ And I should see "EEE"
+ And the most recent commit should be "EEE"
+
+ When I choose the amount "Tiny: 0.1%" on commit "DDD"
+ And I click on "Send the selected tip amounts"
+ Then I should be on the "seldon/seldons-project github-project decide_tip_amounts" page
+ And there should be a tip of "0.49005" for commit "DDD"
+ And the tip amount for commit "EEE" should be undecided
+ And there should be 3 email sent
+
+ When the email counters are reset
+ And I choose the amount "Free: 0%" on commit "EEE"
+ And I click on "Send the selected tip amounts"
+ Then I should be on the "seldon/seldons-project github-project decide_tip_amounts" page
+ And there should be a tip of "0.49005" for commit "DDD"
+ And there should be a tip of "0" for commit "EEE"
+ And there should be 0 email sent
Scenario: A non collaborator does not see the settings button
Given I'm logged in as "yugo"
- And I go to the project page
- Then I should not see "Change project settings"
+ And I visit the "seldon/seldons-project github-project" page
+ Then I should be on the "seldon/seldons-project github-project" page
+ And I should not see "Change project settings"
Scenario: A non collaborator does not see the decide tip amounts button
Given the project has undedided tips
- And I'm logged in as "yugo"
- And I go to the project page
- Then I should not see "Decide tip amounts"
+ And I'm logged in as "yugo"
+ And I visit the "seldon/seldons-project github-project" page
+ Then I should be on the "seldon/seldons-project github-project" page
+ And I should not see "Decide tip amounts"
Scenario: A non collaborator goes to the edit page of a project
Given I'm logged in as "yugo"
- When I go to the edit page of the project
- Then I should see an access denied
+ When I visit the "seldon/seldons-project github-project edit" page
+ Then I should be on the "home" page
+ And I should see "You are not authorized to perform this action!"
Scenario: A non collaborator sends a forged update on a project
Given I'm logged in as "yugo"
- When I send a forged request to enable tip holding on the project
- Then I should see an access denied
- And the project should not hold tips
+ When I send a forged request to enable tip holding on the project
+ Then I should be on the "home" page
+ And I should see "You are not authorized to perform this action!"
+ And the project should not hold tips
Scenario: A collaborator sends a forged update on a project
Given I'm logged in as "daneel"
- When I send a forged request to enable tip holding on the project
- Then the project should hold tips
+ When the project syncs with the remote repo
+ When I send a forged request to enable tip holding on the project
+ Then I should be on the "seldon/seldons-project github-project" page
+ And the project should hold tips
Scenario Outline: A user sends a forged request to set a tip amount
+ When the project syncs with the remote repo
Given the project has 1 undecided tip
- And I'm logged in as ""
- And I go to the project page
- And I send a forged request to set the amount of the first undecided tip of the project
- Then the project should have undecided tips
+ When I'm logged in as ""
+ And I visit the "seldon/seldons-project github-project" page
+ Then I should be on the "seldon/seldons-project github-project" page
+ And I send a forged request to set the amount of the first undecided tip of the project
+ And the project should have undecided tips
Examples:
| user | remaining undecided tips |
@@ -92,34 +116,38 @@ Feature: A project collaborator can change the tips of commits
| yugo | 1 |
Scenario: A collaborator sends large amounts in tips
- Given 20 new commits
- And a new commit "last"
- And the project holds tips
- When the new commits are read
- And I'm logged in as "seldon"
- And I go to the project page
- And I click on "Decide tip amounts"
- And I choose the amount "Huge: 5%" on all commits
- And I click on "Send the selected tip amounts"
- Then I should see "You can't assign more than 100% of available funds."
- And the tip amount for commit "BBB" should be undecided
- And the tip amount for commit "CCC" should be undecided
+ Given 20 new commits are made
+ And a new commit "last"
+ And the project holds tips
+ When the project syncs with the remote repo
+ And I'm logged in as "seldon"
+ And I visit the "seldon/seldons-project github-project" page
+ Then I should be on the "seldon/seldons-project github-project" page
+ And I should see "Decide tip amounts"
+ When I click on "Decide tip amounts"
+ Then I should be on the "seldon/seldons-project github-project decide_tip_amounts" page
+ When I choose the amount "Huge: 5%" on all commits
+ And I click on "Send the selected tip amounts"
+ Then I should be on the "seldon/seldons-project github-project decide_tip_amounts" page
+ And I should see "You can't assign more than 100% of available funds."
+ And the tip amount for commit "BBB" should be undecided
+ And the tip amount for commit "CCC" should be undecided
Scenario Outline: A collaborator changes the amount of a tip on another project
Given the project holds tips
- And the new commits are read
- And a project "fake"
- And the project collaborators are:
+ And the project syncs with the remote repo
+ And a "github" project named "fake/fake" exists
+ And the project collaborators are:
| bad guy |
- And a new commit "fake commit"
- And the project holds tips
- When the new commits are read
- And I'm logged in as ""
- And I send a forged request to change the percentage of commit "BBB" on project "a" to "5"
- Then
+ And a new commit "fake commit"
+ And the project holds tips
+ When the project syncs with the remote repo
+ And I'm logged in as ""
+ When regarding the "github" project named "seldon/seldons-project"
+ And I send a forged request to change the percentage of commit "BBB" to "5"
+ Then
Examples:
| user | consequences |
| seldon | there should be a tip of "25" for commit "BBB" |
| bad guy | the tip amount for commit "BBB" should be undecided |
-
diff --git a/features/tipping_policies.feature b/features/tipping_policies.feature
index 3b3c3e8a..02f1bd72 100644
--- a/features/tipping_policies.feature
+++ b/features/tipping_policies.feature
@@ -1,25 +1,29 @@
Feature: A project collaborator can display the tipping policies of the project
Background:
- Given a project
- And the project collaborators are:
+ Given a "github" project named "seldon/seldons-project" exists
+ And the project collaborators are:
| seldon |
| daneel |
+ And the project syncs with the remote repo
Scenario: A collaborator changes the tipping policies
- Given I'm logged in as "seldon"
- And I go to the project page
- And I click on "Change project settings"
- And I fill "Tipping policies" with:
+ Given I'm logged in as "daneel"
+ When I visit the "seldon/seldons-project github-project" page
+ Then I should be on the "seldon/seldons-project github-project" page
+ And I click on "Change project settings"
+ And I fill "Tipping policies" with:
"""
All commits are huge!
Blah blah
"""
- And I click on "Save the project settings"
- Then I should see "The project settings have been updated"
+ And I click on "Save the project settings"
+ Then I should be on the "seldon/seldons-project github-project" page
+ Then I should see "The project settings have been updated"
- Given I'm not logged in
- And I go to the project page
- Then I should see "All commits are huge!"
- And I should see "Blah blah"
- And I should see "seldon"
+ Given I log out
+ When I visit the "seldon/seldons-project github-project" page
+ Then I should be on the "seldon/seldons-project github-project" page
+ Then I should see "All commits are huge!"
+ And I should see "Blah blah"
+ And I should see "daneel"
diff --git a/spec/controllers/deposits_controller_spec.rb b/spec/controllers/deposits_controller_spec.rb
index 3180085e..d24745b4 100644
--- a/spec/controllers/deposits_controller_spec.rb
+++ b/spec/controllers/deposits_controller_spec.rb
@@ -1,7 +1,6 @@
require 'spec_helper'
describe DepositsController do
-
describe "GET 'index'" do
it "returns http success" do
get 'index'
@@ -9,4 +8,11 @@
end
end
+ describe "routing" do
+ it "routes GET / to Deposits#index" do
+ { :get => "/deposits" }.should route_to(
+ :controller => "deposits" ,
+ :action => "index" )
+ end
+ end
end
diff --git a/spec/controllers/home_controller_spec.rb b/spec/controllers/home_controller_spec.rb
index 10af3c4a..da4a82ee 100644
--- a/spec/controllers/home_controller_spec.rb
+++ b/spec/controllers/home_controller_spec.rb
@@ -12,4 +12,12 @@
expect(subject.status).to eq 200
end
end
+
+ describe "routing" do
+ it "routes GET / to Home#index" do
+ { :get => "/" }.should route_to(
+ :controller => "home" ,
+ :action => "index" )
+ end
+ end
end
diff --git a/spec/controllers/projects_controller_spec.rb b/spec/controllers/projects_controller_spec.rb
index 02c5bb9d..e03b8787 100644
--- a/spec/controllers/projects_controller_spec.rb
+++ b/spec/controllers/projects_controller_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe ProjectsController do
- describe '#index' do
+ describe 'GET #index' do
let(:subject) { get :index }
before do
allow(Project).to receive(:order).with(available_amount_cache: :desc, watchers_count: :desc, full_name: :asc).and_return(Project)
@@ -37,4 +37,169 @@
expect(assigns[:projects].name).to eq 'Project'
end
end
+
+ describe 'POST #search' do
+ it 'returns 200 status code' do
+ post :search
+ response.should be_success
+ end
+ end
+
+=begin TODO: NFG
+ describe '#update' do
+ it 'returns 200 status code' do
+ put :update
+ response.should be_success
+ end
+ end
+=end
+
+ describe 'GET #show' do
+ it 'returns 302 status code' do
+ get :show , :service => 'github' , :repo => 'test/test'
+ response.should be_redirect
+ end
+ end
+
+ describe 'GET #edit' do
+ it 'returns 302 status code' do
+ get :edit , :service => 'github' , :repo => 'test/test'
+ response.should be_redirect
+ end
+ end
+
+ describe 'GET #decide_tip_amounts' do
+ it 'returns 302 status code' do
+ get :decide_tip_amounts , :service => 'github' , :repo => 'test/test'
+ response.should be_redirect
+ end
+ end
+
+ describe 'PATCH #decide_tip_amounts' do
+ it 'returns 302 status code' do
+ patch :decide_tip_amounts , :service => 'github' , :repo => 'test/test'
+ response.should be_redirect
+ end
+ end
+
+ describe 'GET #tips' do
+ it 'returns 302 status code' do
+ get :tips , :service => 'github' , :repo => 'test/test'
+ response.should be_redirect
+ end
+ end
+
+ describe 'GET #deposits' do
+ it 'returns 302 status code' do
+ get :deposits , :service => 'github' , :repo => 'test/test'
+ response.should be_redirect
+ end
+ end
+
+ describe "routing" do
+ it "routes GET /projects to Project#index" do
+ { :get => "/projects" }.should route_to(
+ :controller => "projects" ,
+ :action => "index" )
+ end
+
+ it "routes GET /projects/search?query= to Project#search" do
+ { :get => "/projects/search?query=seldon&order=balance" }.should route_to(
+ :controller => "projects" ,
+ :action => "search" ,
+ :query => "seldon" ,
+ :order => "balance" )
+ end
+
+ it "routes GET /projects/1 to Project#show" do
+ { :get => "/projects/1" }.should route_to(
+ :controller => "projects" ,
+ :action => "show" ,
+ :id => "1" )
+ end
+
+ it "routes GET /projects/1/edit to Project#edit" do
+ { :get => "/projects/1/edit" }.should route_to(
+ :controller => "projects" ,
+ :action => "edit" ,
+ :id => "1" )
+ end
+
+ it "routes PUT /projects/1 to Project#update" do
+ { :put => "/projects/1" }.should route_to(
+ :controller => "projects" ,
+ :action => "update" ,
+ :id => "1" )
+ end
+
+ it "routes GET /projects/1/decide_tip_amounts to Project#decide_tip_amounts" do
+ { :get => "/projects/1/decide_tip_amounts" }.should route_to(
+ :controller => "projects" ,
+ :action => "decide_tip_amounts" ,
+ :id => "1" )
+ end
+
+ it "routes PATCH /projects/1/decide_tip_amounts to Project#decide_tip_amounts" do
+ { :patch => "/projects/1/decide_tip_amounts" }.should route_to(
+ :controller => "projects" ,
+ :action => "decide_tip_amounts" ,
+ :id => "1" )
+ end
+
+ it "routes GET /projects/1/tips to Tips#index" do
+ { :get => "/projects/1/tips" }.should route_to(
+ :controller => "tips" ,
+ :action => "index" ,
+ :project_id => "1" )
+ end
+
+ it "routes GET /projects/1/deposits to Deposits#index" do
+ { :get => "/projects/1/deposits" }.should route_to(
+ :controller => "deposits" ,
+ :action => "index" ,
+ :project_id => "1" )
+ end
+ end
+
+ describe "Project pretty url routing" do
+ it "routes GET /:provider/:repo to Project#show" do
+ { :get => "/github/test/test" }.should route_to(
+ :controller => "projects" ,
+ :action => "show" ,
+ :service => "github" ,
+ :repo => "test/test")
+ end
+
+ it "routes GET /:provider/:repo/edit to Project#edit" do
+ { :get => "/github/test/test/edit" }.should route_to(
+ :controller => "projects" ,
+ :action => "edit" ,
+ :service => "github" ,
+ :repo => "test/test")
+ end
+
+ it "routes GET /:provider/:repo/decide_tip_amounts to Project#decide_tip_amounts" do
+ { :get => "/github/test/test/decide_tip_amounts" }.should route_to(
+ :controller => "projects" ,
+ :action => "decide_tip_amounts" ,
+ :service => "github" ,
+ :repo => "test/test" )
+ end
+
+ it "routes GET /:provider/:repo/tips to Project#tips" do
+ { :get => "/github/test/test/tips" }.should route_to(
+ :controller => "projects" ,
+ :action => "tips" ,
+ :service => "github" ,
+ :repo => "test/test")
+ end
+
+ it "routes GET /:provider/:repo/deposits to Project#deposits" do
+ { :get => "/github/test/test/deposits" }.should route_to(
+ :controller => "projects" ,
+ :action => "deposits" ,
+ :service => "github" ,
+ :repo => "test/test")
+ end
+ end
end
diff --git a/spec/controllers/tips_controller_spec.rb b/spec/controllers/tips_controller_spec.rb
new file mode 100644
index 00000000..1159b37e
--- /dev/null
+++ b/spec/controllers/tips_controller_spec.rb
@@ -0,0 +1,18 @@
+require 'spec_helper'
+
+describe TipsController do
+ describe "GET 'index'" do
+ it "returns http success" do
+ get 'index'
+ expect(response).to be_success
+ end
+ end
+
+ describe "routing" do
+ it "routes GET / to Tips#index" do
+ { :get => "/tips" }.should route_to(
+ :controller => "tips" ,
+ :action => "index" )
+ end
+ end
+end
diff --git a/spec/controllers/users_controller_spec.rb b/spec/controllers/users_controller_spec.rb
index f5f09135..5097b6c2 100644
--- a/spec/controllers/users_controller_spec.rb
+++ b/spec/controllers/users_controller_spec.rb
@@ -1,6 +1,23 @@
require 'spec_helper'
describe UsersController do
+ describe '#index' do
+ let(:subject) { get :index }
+
+ it 'renders index template' do
+ expect(subject).to render_template :index
+ end
+
+ it 'returns 200 status code' do
+ expect(subject.status).to eq 200
+ end
+
+ it 'assigns @users' do
+ subject
+ expect(assigns[:users].name).to eq 'User'
+ end
+ end
+
describe '#show' do
let(:user) { mock_model User, id: 100000000 }
let(:subject) { get :show, id: user.id }
@@ -18,6 +35,21 @@
it 'returns 200 status code' do
expect(subject.status).to eq 200
end
+
+ it 'assigns @user' do
+ subject
+ expect(assigns[:user].name).to eq 'kd'
+ end
+
+ it 'assigns @user_tips' do
+ subject
+ expect(assigns[:user_tips].name).to eq 'Tip'
+ end
+
+ it 'assigns @recent_tips' do
+ subject
+ expect(assigns[:recent_tips].class).to eq Array
+ end
end
context 'when viewing other\'s page' do
@@ -58,4 +90,32 @@
end
end
end
+
+ describe "routing" do
+ it "routes GET /users to Project#index" do
+ { :get => "/users" }.should route_to(
+ :controller => "users" ,
+ :action => "index" )
+ end
+
+ it "routes GET /users to Project#show" do
+ { :get => "/users/1" }.should route_to(
+ :controller => "users" ,
+ :action => "show" ,
+ :id => "1" )
+ end
+
+ it "routes GET /login to Project#login" do
+ { :get => "/users/login" }.should route_to(
+ :controller => "users" ,
+ :action => "login" )
+ end
+
+ it "routes GET /users/1/tips to Tips#index" do
+ { :get => "/users/1/tips" }.should route_to(
+ :controller => "tips" ,
+ :action => "index" ,
+ :user_id => "1" )
+ end
+ end
end
diff --git a/spec/controllers/withdrawals_controller_spec.rb b/spec/controllers/withdrawals_controller_spec.rb
new file mode 100644
index 00000000..53af5ea4
--- /dev/null
+++ b/spec/controllers/withdrawals_controller_spec.rb
@@ -0,0 +1,18 @@
+require 'spec_helper'
+
+describe WithdrawalsController do
+ describe "GET 'index'" do
+ it "returns http success" do
+ get 'index'
+ expect(response).to be_success
+ end
+ end
+
+ describe "routing" do
+ it "routes GET / to Withdrawals#index" do
+ { :get => "/withdrawals" }.should route_to(
+ :controller => "withdrawals" ,
+ :action => "index" )
+ end
+ end
+end
From 824b259e4d9347a010a79adcf6f5209de9ce5581 Mon Sep 17 00:00:00 2001
From: bill auger
Date: Sat, 1 Nov 2014 07:52:04 +0000
Subject: [PATCH 091/415] fix inconsistent capitalization of sign-up/sign-in
links
* merged latest upstream master
* made consistent capitalization of all Sign-Up and Sign-in links
* added links:sign_up: translation placeholders for all languages (need translations)
* added general:or: transations for all languages
* all oauth providers are listed in Home#index 'Contribute' section
* added ApplicationHelper#list_friendly_text method for the previous feature
---
app/helpers/application_helper.rb | 10 ++++++++++
app/views/home/index.html.haml | 1 +
config/locales/en.yml | 10 ++++++++--
config/locales/fr.yml | 8 +++++++-
config/locales/hr.yml | 10 ++++++++--
config/locales/pl.yml | 10 ++++++++--
config/locales/ru.yml | 8 +++++++-
features/step_definitions/web.rb | 4 ++--
8 files changed, 51 insertions(+), 10 deletions(-)
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 9b58333c..a9f68c07 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -25,4 +25,14 @@ def render_flash_messages
def commit_tag(sha1)
content_tag(:span, truncate(sha1, length: 10, omission: ""), class: "commit-sha")
end
+
+ def list_friendly_text a_list , conjunction
+ # e.g. ['a'] => "a"
+ # ['a','b'] => "a or b"
+ # ['a','b','c'] => "a, b, or c"
+ list = a_list.map { |ea| ea.to_s } ; last = list.pop ;
+ (list.join ', ') +
+ ((list.size < 2) ? "" : ",") +
+ ((list.empty?) ? "" : " #{conjunction} ") + last
+ end
end
diff --git a/app/views/home/index.html.haml b/app/views/home/index.html.haml
index 76c75087..1622b605 100644
--- a/app/views/home/index.html.haml
+++ b/app/views/home/index.html.haml
@@ -27,6 +27,7 @@
= raw t('.contribute.sign_in_text', sign_in_link: link_to(t('links.sign_in'), new_user_session_path))
- if Devise.mappings[:user].registerable?
= raw t('.contribute.sign_up_text', sign_up_link: link_to(t('links.sign_up'), new_user_registration_path))
+ = raw " #{list_friendly_text (User.omniauth_providers.map { |provider| t(provider , scope: :omniauth_providers)}) , t('general.or')}."
%p
%a.btn.btn-primary{href: projects_path}
= t('.contribute.button')
diff --git a/config/locales/en.yml b/config/locales/en.yml
index a496ef53..f0196de5 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -12,9 +12,10 @@ en:
support_link: support
follow_link: Follow @tip4commit
links:
+ sign_up: Sign up
sign_in: Sign in
sign_in_imp: sign in
- sign_out: Sign Out
+ sign_out: Sign out
errors:
project_not_found: Project not found.
access_denied: Access denied
@@ -63,7 +64,7 @@ en:
title: Contribute
text: Go and fix something! If your commit is accepted by the project maintainer, you will get a tip!
sign_in_text: "Just check your email for an invitation or %{sign_in_link}."
- sign_up_text: "If you have not yet received an invitation, you can %{sign_up_link} with a valid email address or via GitHub."
+ sign_up_text: "If you have not yet received an invitation, you can %{sign_up_link} with a valid email address or via"
button: Supported projects
projects:
index:
@@ -214,3 +215,8 @@ en:
password: Password
password_confirmation: Password confirmation
display_name: Display name
+ omniauth_providers:
+ github: GitHub
+ bitbucket: BitBucket
+ general:
+ or: or
diff --git a/config/locales/fr.yml b/config/locales/fr.yml
index 861ad848..ac389f6e 100644
--- a/config/locales/fr.yml
+++ b/config/locales/fr.yml
@@ -12,6 +12,7 @@ fr:
support_link: subventionner
follow_link: Suivez @tip4commit
links:
+ sign_up: Sign up
sign_in: Se connecter
sign_in_imp: se connecter
sign_out: Se déconnecter
@@ -63,7 +64,7 @@ fr:
title: Contribuer
text: Améliorez un projet ! Si votre contribution est acceptée par le mainteneur du projet, vous recevrez un pourboire !
sign_in_text: "Vérifiez simplement vos emails ou %{sign_in_link}."
- sign_up_text: "Si vous n'avez pas encore reçu une invitation, vous pouvez %{sign_up_link} avec une adresse de courriel valide ou via GitHub."
+ sign_up_text: "Si vous n'avez pas encore reçu une invitation, vous pouvez %{sign_up_link} avec une adresse de courriel valide ou via"
button: Projets subventionnés
projects:
index:
@@ -214,3 +215,8 @@ fr:
password: Mot de passe
password_confirmation: Confirmation
display_name: Nom affiché
+ omniauth_providers:
+ github: GitHub
+ bitbucket: BitBucket
+ general:
+ or: ou
diff --git a/config/locales/hr.yml b/config/locales/hr.yml
index 9b65dff7..ffec3b58 100644
--- a/config/locales/hr.yml
+++ b/config/locales/hr.yml
@@ -12,13 +12,14 @@ hr:
support_link: podrzi
follow_link: Follow @tip4commit
links:
+ sign_up: Sign up
sign_in: Prijava
sign_in_imp: prijava
sign_out: Odjava
errors:
project_not_found: Projekt nije nadjen.
access_denied: Pristup odbijen
- can_assign_more_tips: "Ne mozete dodijeliti vise od 100% dostupnih sredstva."
+ can_assign_more_tips: "Ne mozete dodijeliti vise od 100% dostupnih sredstva."
wrong_bitcoin_address: Greska u updejtanju bitcoin adrese
user_not_found: Korisnik nije naden
access_denied: Niste ovlasteni da napravite ovu akciju!
@@ -63,7 +64,7 @@ hr:
title: Doprinositi
text: Idite i popravite nesto! Ako je vas cin odobren od odrzavatelja projekta, dobiti cete napojnicu!
sign_in_text: "Samo provjerite vas email ili %{sign_in_link}."
- sign_up_text: "Ako jos niste dobili pozivnicu, moze te se %{sign_up_link} sa valjanom email adresom ili GitHub-om."
+ sign_up_text: "Ako jos niste dobili pozivnicu, moze te se %{sign_up_link} sa valjanom email adresom ili"
button: Podrzavani projekti
projects:
index:
@@ -214,3 +215,8 @@ hr:
password: Lozinka
password_confirmation: Potvrda lozinke
display_name: Prikazno ime
+ omniauth_providers:
+ github: GitHub
+ bitbucket: BitBucket
+ general:
+ or: ili
diff --git a/config/locales/pl.yml b/config/locales/pl.yml
index 319c60d9..ee9dda71 100644
--- a/config/locales/pl.yml
+++ b/config/locales/pl.yml
@@ -12,6 +12,7 @@ pl:
support_link: wsparcie
follow_link: Obserwuj @tip4commit
links:
+ sign_up: Sign up
sign_in: Zaloguj się
sign_in_imp: zaloguj się
sign_out: Wyloguj się
@@ -63,7 +64,7 @@ pl:
title: 'Współpracuj'
text: 'Idź i coś napraw! Jeśli twój commit zostanie zaakceptowany przez nadzorcę projektu, dostaniesz napiwek!'
sign_in_text: "Wystarczy sprawdzić e-mail lub %{sign_in_link}."
- sign_up_text: "Jeśli nadal nie otrzymałeś zaproszenia, możesz %{sign_up_link} za pomocą adresu e-mail lub przez GitHub."
+ sign_up_text: "Jeśli nadal nie otrzymałeś zaproszenia, możesz %{sign_up_link} za pomocą adresu e-mail lub przez"
button: Wspierane projekty
projects:
index:
@@ -213,4 +214,9 @@ pl:
bitcoin_address: AAdres Bitcoin
password: Hasło
password_confirmation: Potwierdzenie hasła
- display_name: Wyświetlana nazwa
\ No newline at end of file
+ display_name: Wyświetlana nazwa
+ omniauth_providers:
+ github: GitHub
+ bitbucket: BitBucket
+ general:
+ or: czy
diff --git a/config/locales/ru.yml b/config/locales/ru.yml
index ce98929f..56866eea 100644
--- a/config/locales/ru.yml
+++ b/config/locales/ru.yml
@@ -12,6 +12,7 @@ ru:
support_link: поддержать
follow_link: Следите за @tip4commit
links:
+ sign_up: Sign up
sign_in: Войти
sign_in_imp: войдите
sign_out: Выйти
@@ -63,7 +64,7 @@ ru:
title: Участвуйте
text: Идите и почините что-нибудь! Если ваш коммит будет принят владельцами проекта, вам будут выплачены чаевые!
sign_in_text: "Просто проверьте ваш email или %{sign_in_link}."
- sign_up_text: "Если вы еще не получил приглашение, вы можете %{sign_up_link} с действительным адресом электронной почты или через GitHub."
+ sign_up_text: "Если вы еще не получил приглашение, вы можете %{sign_up_link} с действительным адресом электронной почты или через"
button: Проекты
projects:
index:
@@ -214,3 +215,8 @@ ru:
password: Пароль
password_confirmation: Пароль еще раз
display_name: Имя
+ omniauth_providers:
+ github: GitHub
+ bitbucket: BitBucket
+ general:
+ or: или
diff --git a/features/step_definitions/web.rb b/features/step_definitions/web.rb
index c3a6c65c..710ce0f7 100644
--- a/features/step_definitions/web.rb
+++ b/features/step_definitions/web.rb
@@ -15,8 +15,8 @@
Given(/^I'm not logged in$/) do
visit root_path
- if page.has_content?("Sign Out")
- click_on "Sign Out"
+ if page.has_content?("Sign out")
+ click_on "Sign out"
page.should have_content("Signed out successfully")
else
page.should have_content("Sign in")
From 20fceb8cac4734bb9a635fe27f41c46e17e9aa9b Mon Sep 17 00:00:00 2001
From: bill auger
Date: Sat, 1 Nov 2014 09:02:41 +0000
Subject: [PATCH 092/415] add cross-dev Gemfile
* added cross-dev Gemfile
* fixed some typos
* updated dev wiki link in README.md
* updated 'bootstrap_form' gem in Gemfile
the 'sigmike/bootstrap_form' gem added to the Gemfile in
https://github.com/tip4commit/tip4commit/pull/74
has been merged upstream
https://github.com/bootstrap-ruby/rails-bootstrap-forms/pull/76
it was added apparently as a bugfix but is now quite outdated
it was upgraded in the peer4commit repo in june
https://github.com/sigmike/peer4commit/commit/
608980f7bd7b9fde5366180142f050d7baaf27a1
---
Gemfile | 2 +-
README.md | 2 +-
config/cross-fork-dev/Gemfile.dev | 174 ++++++++++++++++++
config/cross-fork-dev/config.yml.dev | 2 +-
.../cross-fork-dev/cross-fork-dev-REAMDE.md | 45 +++--
5 files changed, 209 insertions(+), 16 deletions(-)
create mode 100644 config/cross-fork-dev/Gemfile.dev
diff --git a/Gemfile b/Gemfile
index 0108e6d9..49340961 100644
--- a/Gemfile
+++ b/Gemfile
@@ -23,7 +23,7 @@ gem 'octokit', '~> 2.7.0'
gem 'sawyer', '~> 0.5.2'
gem 'twitter_bootstrap_form_for', github: 'stouset/twitter_bootstrap_form_for'
gem 'twitter-bootstrap-rails', github: 'seyhunak/twitter-bootstrap-rails', branch: 'bootstrap3'
-gem 'bootstrap_form', github: 'sigmike/rails-bootstrap-forms', branch: 'removed_for_on_radio_label'
+gem 'bootstrap_form', github: 'bootstrap-ruby/rails-bootstrap-forms'
gem 'sdoc', group: :doc, require: false
gem 'cancancan'
gem 'dusen'
diff --git a/README.md b/README.md
index e045c2d0..49017eb5 100644
--- a/README.md
+++ b/README.md
@@ -17,7 +17,7 @@ Donate bitcoins to open source projects or receive tips for code contributions.
Developers
==========
-If you would like to contribute to the development of tip4commit, you can find the contribution guidelines and installation instructions on the [developer README](https://github.com/tip4commit/tip4commit/wiki/README---Developers)
+If you would like to contribute to the development of tip4commit, you can find the contribution guidelines and installation instructions on the [developer README](https://github.com/tip4commit/tip4commit/wiki/Developer-README)
License
diff --git a/config/cross-fork-dev/Gemfile.dev b/config/cross-fork-dev/Gemfile.dev
new file mode 100644
index 00000000..91f22eb4
--- /dev/null
+++ b/config/cross-fork-dev/Gemfile.dev
@@ -0,0 +1,174 @@
+=begin
+ ** DO NOT COMMIT THIS FILE IN THE RAILS ROOT DIR **
+ bundle then then restore the original
+ (see: config/cross-fork-dev/cross-fork-dev-REAMDE.md)
+ cd RAILS_ROOT
+ mv Gemfile ./Gemfile.bak
+ cp config/cross-fork-dev/Gemfile.dev ./Gemfile
+ bundle install --without production mysql postgresql
+ mv Gemfile.bak ./Gemfile
+=end
+
+
+source 'https://rubygems.org'
+
+ruby '2.0.0'
+
+gem 'rails', '4.0.2'
+gem 'mysql2', group: :production
+gem 'sass-rails', '~> 4.0.0'
+gem 'haml-rails', '~> 0.5.3'
+gem 'less-rails', '~> 2.4.2'
+gem 'kaminari', '~> 0.15.0'
+gem 'uglifier', '>= 1.3.0'
+gem 'coffee-rails', '~> 4.0.0'
+gem 'therubyracer', '~> 0.12.0', platforms: :ruby
+gem 'jquery-rails', '~> 3.0.4'
+gem 'turbolinks', '~> 2.2.0'
+gem 'jquery-turbolinks'
+gem 'jbuilder', '~> 1.5.3'
+gem 'airbrake', '~> 3.1.15'
+gem 'devise', '~> 3.2.2'
+gem 'omniauth', '~> 1.1.4'
+gem 'omniauth-github', github: 'alexandrz/omniauth-github', branch: 'provide_emails'
+gem 'octokit', '~> 2.7.0'
+gem 'sawyer', '~> 0.5.2'
+gem 'twitter_bootstrap_form_for', github: 'stouset/twitter_bootstrap_form_for'
+gem 'twitter-bootstrap-rails', github: 'seyhunak/twitter-bootstrap-rails', branch: 'bootstrap3'
+# sigmike 'bootstrap_form' bugfix added in https://github.com/tip4commit/tip4commit/pull/74
+# has been merged upstream https://github.com/bootstrap-ruby/rails-bootstrap-forms/pull/76
+#gem 'bootstrap_form', github: 'sigmike/rails-bootstrap-forms', branch: 'removed_for_on_radio_label'
+gem 'bootstrap_form', github: 'bootstrap-ruby/rails-bootstrap-forms'
+gem 'sdoc', group: :doc, require: false
+gem 'cancancan'
+gem 'dusen'
+gem 'render_csv'
+gem 'demoji'
+
+gem "http_accept_language"
+gem 'rails-i18n'
+gem "i18n-js"
+gem 'kaminari-i18n'
+gem 'devise-i18n'
+
+group :development do
+ gem 'capistrano', '~> 3.0.1'
+ gem 'capistrano-rvm', '~> 0.1.0', github: 'capistrano/rvm'
+ gem 'capistrano-bundler', '>= 1.1.0'
+ gem 'capistrano-rails', '~> 1.1.0'
+ gem 'debugger', '~> 1.6.5'
+end
+
+group :development, :test do
+ gem 'sqlite3', '~> 1.3.8'
+ gem 'factory_girl_rails', '~> 4.3.0'
+ gem 'rspec-rails', '~> 3.0.0.beta'
+end
+
+group :test do
+ gem 'simplecov'
+ gem 'shoulda-matchers', '~> 2.5.0'
+ gem 'cucumber-rails', require: false
+ gem 'database_cleaner'
+end
+
+
+
+
+
+
+
+# peer4commit
+
+source 'https://rubygems.org'
+
+# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
+gem 'rails', '4.0.2'
+
+# Databases
+gem 'sqlite3', '~> 1.3.8' , group: :development
+gem 'mysql2', group: :mysql
+gem 'pg', group: :postgresql
+
+# Use SCSS for stylesheets
+gem 'sass-rails', '~> 4.0.0'
+gem 'haml-rails', '~> 0.5.3'
+gem "less-rails", '~> 2.4.2'
+
+gem 'twitter-bootstrap-rails', github: 'seyhunak/twitter-bootstrap-rails', branch: 'bootstrap3'
+
+gem 'kaminari', '~> 0.15.0'
+
+# Use Uglifier as compressor for JavaScript assets
+gem 'uglifier', '>= 1.3.0'
+
+# Use CoffeeScript for .js.coffee assets and views
+gem 'coffee-rails', '~> 4.0.0'
+
+# See https://github.com/sstephenson/execjs#readme for more supported runtimes
+gem 'therubyracer', '~> 0.12.0', platforms: :ruby
+
+# Use jquery as the JavaScript library
+gem 'jquery-rails', '~> 3.0.4'
+
+# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
+gem 'turbolinks', '~> 2.2.0'
+
+# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
+gem 'jbuilder', '~> 1.5.3'
+
+group :doc do
+ # bundle exec rake doc:rails generates the API under doc/api.
+ gem 'sdoc', require: false
+end
+
+gem 'devise', '~> 3.2.2'
+gem 'omniauth', '~> 1.1.4'
+gem 'omniauth-github', github: 'alexandrz/omniauth-github', branch: 'provide_emails'
+gem 'cancancan'
+gem 'twitter_bootstrap_form_for', github: 'stouset/twitter_bootstrap_form_for'
+
+gem 'octokit', '~> 2.7.0'
+
+# Use ActiveModel has_secure_password
+# gem 'bcrypt-ruby', '~> 3.0.0'
+
+# Use unicorn as the app server
+# gem 'unicorn'
+
+# Use debugger
+# gem 'debugger', group: [:development, :test]
+
+group :development do
+ gem 'capistrano', '~> 3.0.1'
+ gem 'capistrano-rvm', '~> 0.1.0', github: 'capistrano/rvm'
+ gem 'capistrano-bundler', '>= 1.1.0'
+ gem 'capistrano-rails', '~> 1.1.0'
+ gem 'quiet_assets'
+end
+
+gem 'airbrake', '~> 3.1.15'
+gem 'httparty'
+gem 'whenever'
+gem 'rqrcode-rails3'
+gem 'exception_notification'
+gem 'rack-canonical-host'
+gem 'bootstrap_form', github: 'bootstrap-ruby/rails-bootstrap-forms'
+gem 'html_pipeline_rails'
+gem 'rails_autolink'
+gem 'redcarpet'
+gem 'sanitize'
+gem 'twitter-typeahead-rails'
+gem 'commontator', '~> 4.6.0'
+gem 'compass-rails'
+
+group :test do
+ gem 'cucumber-rails', :require => false
+ # database_cleaner is not required, but highly recommended
+ gem 'database_cleaner'
+ gem 'rspec-rails', '~> 3.0.0.beta'
+ gem 'factory_girl_rails', '~> 4.3.0'
+ gem 'poltergeist'
+ gem 'timecop'
+ gem 'capybara-screenshot'
+end
diff --git a/config/cross-fork-dev/config.yml.dev b/config/cross-fork-dev/config.yml.dev
index 8a96d72c..d9d65350 100644
--- a/config/cross-fork-dev/config.yml.dev
+++ b/config/cross-fork-dev/config.yml.dev
@@ -8,7 +8,7 @@ PRIME4COMMIT_BRANCHES = %w{prime4commit-master peer4commit-new-feature}
BRANCHES_LISTS_FILENAME = 'config/config.yml' # DEBUG
BRANCH_NAME = `git rev-parse --abbrev-ref HEAD`.strip
-IS_MYFORK = MY_BRANCHES.include? BRANCH_NAME
+IS_MY_FORK = MY_BRANCHES.include? BRANCH_NAME
IS_TIP4COMMIT_FORK = TIP4COMMIT_BRANCHES.include? BRANCH_NAME
IS_PEER4COMMIT_FORK = PEER4COMMIT_BRANCHES.include? BRANCH_NAME
IS_PRIME4COMMIT_FORK = PRIME4COMMIT_BRANCHES.include? BRANCH_NAME
diff --git a/config/cross-fork-dev/cross-fork-dev-REAMDE.md b/config/cross-fork-dev/cross-fork-dev-REAMDE.md
index a8749b45..fc418a23 100644
--- a/config/cross-fork-dev/cross-fork-dev-REAMDE.md
+++ b/config/cross-fork-dev/cross-fork-dev-REAMDE.md
@@ -2,7 +2,14 @@
the files in this directory exist to aid cross-fork development of the various tip4commit forks from within the same local clone - if you will be working on only one fork then use Gemfile, config/config.yml.sample, and config/database.yml.sample instead
-the various forks have drifted apart significantly and require different configuratons - these files will allow these all to be functional within in the same clone without manual config swapping - the only routine maintenance required is in adding new feature branches to the appropriate *_BRANCHES list in config.yml.dev and re-bundling when switching between forks
+the various forks have drifted apart significantly and require different configuratons - these files will allow these all to be functional within in the same clone without manual config swapping - the only routine maintenance required is in adding new feature branches to the appropriate *_BRANCHES list in config.yml.dev and re-bundling when Gemfiles change
+
+
+#### config/cross-fork-dev/Gemfile.dev
+
+Gemfile.dev is a concatenation of the Gemfiles from the tip4commit and peer4commit forks with some version conflicts resolved by favoring the more specific requirement
+
+this o/c is brittle and must be maintained and is not guaranteed 100% bug-free but has so far worked out well for development
#### config/cross-fork-dev/config.yml.dev
@@ -13,14 +20,25 @@ the various forks have drifted apart significantly and require different configu
#### config/cross-fork-dev/database.yml.dev
+
database.yml.dev also includes a separate configuration for each known tip4commit variant - switched per the current git branch (requires the *_BRANCHES list in config.yml.dev)
### setup
* fork any of the tip4commit forks then clone your fork
- * copy config/cross-fork-dev/config.yml.dev to config/config.yml and
- copy config/cross-fork-dev/database.yml.dev to config/database.yml
+ * backup Gemfile then copy Gemfile.dev to the rails root dir
+```
+ cd RAILS_ROOT
+ mv Gemfile ./Gemfile.bak
+ cp config/cross-fork-dev/Gemfile.dev ./Gemfile
+```
+ * bundle then restore Gemfile
+```
+ bundle install --without production mysql postgresql
+ mv Gemfile.bak ./Gemfile
+```
+ * copy config.yml.dev and database.yml.dev to config
```
cp config/cross-fork-dev/config.yml.dev config/config.yml
cp config/cross-fork-dev/database.yml.dev config/database.yml
@@ -28,22 +46,23 @@ the various forks have drifted apart significantly and require different configu
* customize config/config.yml and config/database.yml
* repeat the following flow for each fork including the one you forked from
```
- git remote add tip4commit https://github.com/tip4commit/tip4commit.git
- git checkout -b tip4commit-master
- git fetch tip4commit
- git merge tip4commit/master
+ git remote add tip4commit https://github.com/tip4commit/tip4commit.git
+ git checkout -b tip4commit-master
+ git fetch tip4commit
+ git merge tip4commit/master
```
* add each fork branch created above its corresponding *_BRANCHES list
### maintenance
+
* add new local feature branches in their appropriate *_BRANCHES lists
(e.g. to reduce ambiguity use your local master branch for experimentaion only)
- * re-bundle each time you switch to a new fork configuration
+ * re-bundle as above when any of the forked Gemfiles change (updating and committing config/cross-fork-dev/Gemfile.dev if necessary)
```
- # for tip4commit
- bundle install --without production
-
- # for peer4commit amd prime4commit
- bundle install --without mysql postgresql
+ cd RAILS_ROOT
+ mv Gemfile ./Gemfile.bak
+ cp config/cross-fork-dev/Gemfile.dev ./Gemfile
+ bundle install --without production mysql postgresql
+ mv Gemfile.bak ./Gemfile
```
From 89daf607c7d4ffa3b6b877d9c3ab5beea0954ddc Mon Sep 17 00:00:00 2001
From: arsenische
Date: Sat, 1 Nov 2014 21:48:48 +0500
Subject: [PATCH 093/415] *temporary* solution to #136, need to come up with a
better text and place
---
app/views/layouts/application.html.haml | 5 +++++
app/views/user_mailer/new_tip.html.haml | 3 +++
2 files changed, 8 insertions(+)
diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml
index 4caf47b9..fb318476 100644
--- a/app/views/layouts/application.html.haml
+++ b/app/views/layouts/application.html.haml
@@ -49,6 +49,7 @@
= link_to t('links.sign_in'), new_user_session_path
%h3.text-muted.code-pro= t('tip4commit')
+
= render 'common/menu'
%br
@@ -58,6 +59,10 @@
= yield
.footer
+ .alert.alert-warning
+ We are not affiliated with most of the projects, their owners might not endorse use of tip4commit.
+
+
%p.pull-right
- ::Rails.application.config.available_locales.each do |locale|
= link_to image_tag("flags/#{locale}.png"), "?locale=#{locale}", data: {no_turbolink: true}
diff --git a/app/views/user_mailer/new_tip.html.haml b/app/views/user_mailer/new_tip.html.haml
index 001c1072..cb7f9d30 100644
--- a/app/views/user_mailer/new_tip.html.haml
+++ b/app/views/user_mailer/new_tip.html.haml
@@ -15,3 +15,6 @@
%p
%small
= link_to "Don't notify me anymore, I don't need tips.", login_users_url(token: @user.login_token, unsubscribe: true)
+
+
+.alert.alert-warning We are not affiliated with most of the projects, their owners might not endorse use of tip4commit.
From 0bdf807cd8f58f154db3c34cc73518a907317507 Mon Sep 17 00:00:00 2001
From: arsenische
Date: Sun, 2 Nov 2014 01:50:01 +0500
Subject: [PATCH 094/415] temporary fix to comply with
https://help.github.com/articles/github-terms-of-service/
---
app/models/tip.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/models/tip.rb b/app/models/tip.rb
index 969bd19a..31085713 100644
--- a/app/models/tip.rb
+++ b/app/models/tip.rb
@@ -114,7 +114,7 @@ def amount_percentage=(percentage)
def notify_user
if amount && amount > 0 && user.bitcoin_address.blank? &&
!user.unsubscribed && !project.disable_notifications &&
- user.balance > 500000
+ user.balance > 21*1e8
if user.notified_at.nil? or user.notified_at < 30.days.ago
begin
UserMailer.new_tip(user, self).deliver
From 3f9ca27be098fbdcadbc415fba3ae599dae7bdf0 Mon Sep 17 00:00:00 2001
From: arsenische
Date: Sun, 2 Nov 2014 01:52:26 +0500
Subject: [PATCH 095/415] fixed the fix: 21000000*1e8 satoshis will never exist
---
app/models/tip.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/models/tip.rb b/app/models/tip.rb
index 31085713..4620d4e5 100644
--- a/app/models/tip.rb
+++ b/app/models/tip.rb
@@ -114,7 +114,7 @@ def amount_percentage=(percentage)
def notify_user
if amount && amount > 0 && user.bitcoin_address.blank? &&
!user.unsubscribed && !project.disable_notifications &&
- user.balance > 21*1e8
+ user.balance > 21000000*1e8
if user.notified_at.nil? or user.notified_at < 30.days.ago
begin
UserMailer.new_tip(user, self).deliver
From d28794db60411275602fcc18d92782ebd0f5bd61 Mon Sep 17 00:00:00 2001
From: Adam Tanner
Date: Sat, 1 Nov 2014 20:24:42 -0700
Subject: [PATCH 096/415] Developers must opt-in to receive tips.
---
app/models/project.rb | 4 +++-
app/models/user.rb | 14 ++++---------
features/developer_opt_in_for_tips.feature | 23 ++++++++++++++++++++++
features/step_definitions/common.rb | 17 ++++++++++++++++
features/step_definitions/web.rb | 6 ++++--
features/tip_modifier_interface.feature | 2 ++
6 files changed, 53 insertions(+), 13 deletions(-)
create mode 100644 features/developer_opt_in_for_tips.feature
diff --git a/app/models/project.rb b/app/models/project.rb
index 5affe082..ec4fdc8c 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -117,7 +117,9 @@ def tip_commits
def tip_for commit
if (next_tip_amount > 0) && !Tip.exists?(commit: commit.sha)
- user = User.find_or_create_with_commit commit
+ user = User.find_by_commit(commit)
+ return unless user
+
user.update(nickname: commit.author.login) if commit.author.try(:login)
if hold_tips
diff --git a/app/models/user.rb b/app/models/user.rb
index 90ec7df1..5d8a9ab5 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -50,17 +50,11 @@ def self.create_with_omniauth!(auth_info)
end
end
- def self.find_or_create_with_commit commit
- author = commit.commit.author
+ def self.find_by_commit(commit)
+ email = commit.commit.author.email
nickname = commit.author.try(:login)
- user = find_by(nickname: nickname) if nickname
- user || where(email: author.email).first_or_create do |user|
- user.email = author.email
- user.password = Devise.friendly_token.first(Devise.password_length.min)
- user.name = author.name
- user.nickname = nickname
- user.skip_confirmation!
- end
+
+ find_by(email: email) || find_by(nickname: nickname)
end
private
diff --git a/features/developer_opt_in_for_tips.feature b/features/developer_opt_in_for_tips.feature
new file mode 100644
index 00000000..f6fa0a0f
--- /dev/null
+++ b/features/developer_opt_in_for_tips.feature
@@ -0,0 +1,23 @@
+Feature: Developers must opt-in to create an account and receive tips
+ Background:
+ Given a project "my-project"
+ And our fee is "0"
+ And a deposit of "500"
+ And the last known commit is "COMMIT1"
+
+ Scenario: Tipping a opted-in developer
+ And a user "yugo" has opted-in
+ And a new commit "COMMIT2" with parent "COMMIT1"
+ And the author of commit "COMMIT2" is "yugo"
+ And the message of commit "COMMIT2" is "Tiny change"
+ When the new commits are read
+ Then there should be a tip of "5" for commit "COMMIT2"
+ And there should be 1 email sent
+
+ Scenario: Tipping a developer that has not opted-in
+ And a new commit "COMMIT2" with parent "COMMIT1"
+ And the author of commit "COMMIT2" is "yugo"
+ And the message of commit "COMMIT2" is "Tiny change"
+ When the new commits are read
+ Then there should be no tip for commit "COMMIT2"
+ And there should be 0 email sent
diff --git a/features/step_definitions/common.rb b/features/step_definitions/common.rb
index 28b359c9..3b284663 100644
--- a/features/step_definitions/common.rb
+++ b/features/step_definitions/common.rb
@@ -29,6 +29,15 @@
@project = Project.create!(full_name: "example/#{arg1}", github_id: Digest::SHA1.hexdigest(arg1), bitcoin_address: 'mq4NtnmQoQoPfNWEPbhSvxvncgtGo6L8WY')
end
+Given(/^a user "(.*?)" has opted\-in$/) do |arg1|
+ User.find_or_create_by!(nickname: arg1) do |user|
+ user.nickname = arg1
+ user.password = "password"
+ user.email = "#{arg1.parameterize}@example.com"
+ user.skip_confirmation!
+ end
+end
+
Given(/^a deposit of "(.*?)"$/) do |arg1|
Deposit.create!(project: @project, amount: arg1.to_d * 1e8, confirmations: 2)
end
@@ -48,6 +57,14 @@ def add_new_commit(id, params = {})
},
},
}
+
+ User.find_or_create_by(email: "anonymous@example.com") do |user|
+ user.nickname = "anonymous"
+ user.email = "anonymous@example.com"
+ user.password = "password"
+ user.skip_confirmation!
+ end
+
@new_commits[id] = defaults.deep_merge(params)
end
diff --git a/features/step_definitions/web.rb b/features/step_definitions/web.rb
index c3a6c65c..a317944d 100644
--- a/features/step_definitions/web.rb
+++ b/features/step_definitions/web.rb
@@ -1,10 +1,12 @@
Given(/^I'm logged in as "(.*?)"$/) do |arg1|
+ email = "#{arg1.parameterize}@example.com"
+
OmniAuth.config.test_mode = true
OmniAuth.config.mock_auth[:github] = {
"info" => {
"nickname" => arg1,
- "primary_email" => "#{arg1.gsub(/\s+/,'')}@example.com",
- "verified_emails" => [],
+ "primary_email" => email,
+ "verified_emails" => [email],
},
}.to_ostruct
visit root_path
diff --git a/features/tip_modifier_interface.feature b/features/tip_modifier_interface.feature
index b4fa3a0f..4c0788bc 100644
--- a/features/tip_modifier_interface.feature
+++ b/features/tip_modifier_interface.feature
@@ -1,6 +1,8 @@
Feature: A project collaborator can change the tips of commits
Background:
Given a project "a"
+ And a user "yugo" has opted-in
+ And a user "gaal" has opted-in
And the project collaborators are:
| seldon |
| daneel |
From 84ea2dd62ed7b5db1a2b590a22140d0042052787 Mon Sep 17 00:00:00 2001
From: Adam Tanner
Date: Sat, 1 Nov 2014 15:27:58 -0700
Subject: [PATCH 097/415] Allow projects to be blacklisted for tips.
---
app/controllers/projects_controller.rb | 17 ++++++--
app/models/project.rb | 2 -
app/views/projects/blacklisted.html.haml | 5 +++
config/blacklist.yml | 15 +++++++
config/initializers/blacklist.rb | 2 +
config/locales/en.yml | 3 ++
lib/blacklist.rb | 42 ++++++++++++++++++++
spec/controllers/projects_controller_spec.rb | 21 ++++++++++
spec/lib/blacklist_spec.rb | 29 ++++++++++++++
spec/models/project_spec.rb | 2 +-
10 files changed, 132 insertions(+), 6 deletions(-)
create mode 100644 app/views/projects/blacklisted.html.haml
create mode 100644 config/blacklist.yml
create mode 100644 config/initializers/blacklist.rb
create mode 100644 lib/blacklist.rb
create mode 100644 spec/lib/blacklist_spec.rb
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index ee02fbfa..b23115d7 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -6,14 +6,21 @@ class ProjectsController < ApplicationController
def index
@projects = Project.order(projects_order).page(params[:page]).per(30)
+
+ # This will cause pages not to always include 30 results, but... oh well.
+ @projects = @projects.to_a.reject! {|p| BLACKLIST.include?(p.github_url) }
end
def search
- if params[:query].present? && project = Project.find_or_create_by_url(params[:query])
+ if params[:query].present?
+ if BLACKLIST.include?(params[:query])
+ return render :blacklisted
+ end
+
+ project = Project.find_or_create_by_url(params[:query])
redirect_to pretty_project_path(project)
else
- @projects = Project.search(params[:query].to_s).order(projects_order).page(params[:page]).per(30)
- render :index
+ redirect_to :index
end
end
@@ -31,6 +38,10 @@ def search
end
def show
+ if BLACKLIST.include?(@project.github_url)
+ return render :blacklisted
+ end
+
if @project.bitcoin_address.nil?
uri = URI("https://blockchain.info/merchant/#{CONFIG["blockchain_info"]["guid"]}/new_address")
params = { password: CONFIG["blockchain_info"]["password"], label:"#{@project.full_name}@tip4commit" }
diff --git a/app/models/project.rb b/app/models/project.rb
index 5affe082..0084d6e0 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -203,13 +203,11 @@ def check_tips_to_pay_against_avaiable_amount
end
def self.find_or_create_by_url project_url
-
project_name = project_url.
gsub(/https?\:\/\/github.com\//, '').
gsub(/\#.+$/, '').
gsub(' ', '')
Github.new.find_or_create_project project_name
-
end
end
diff --git a/app/views/projects/blacklisted.html.haml b/app/views/projects/blacklisted.html.haml
new file mode 100644
index 00000000..095c0a8b
--- /dev/null
+++ b/app/views/projects/blacklisted.html.haml
@@ -0,0 +1,5 @@
+%h1= t(".title")
+
+.row
+ .col-md-12
+ .alert.alert-danger= t(".message")
diff --git a/config/blacklist.yml b/config/blacklist.yml
new file mode 100644
index 00000000..05eeddac
--- /dev/null
+++ b/config/blacklist.yml
@@ -0,0 +1,15 @@
+- https://github.com/adamtanner/*
+- https://github.com/f-list/*
+- https://github.com/gae-init/gae-init
+- https://github.com/ggreer/the_silver_searcher
+- https://github.com/iros/*
+- https://github.com/jsocol/*
+- https://github.com/libretro/*
+- https://github.com/lipis/*
+- https://github.com/meowy/*
+- https://github.com/misoproject/*
+- https://github.com/mitsuhiko/*
+- https://github.com/mplewis/*
+- https://github.com/sczizzo/*
+- https://github.com/tcrayford/*
+- https://github.com/unitaker/*
diff --git a/config/initializers/blacklist.rb b/config/initializers/blacklist.rb
new file mode 100644
index 00000000..c1b09c04
--- /dev/null
+++ b/config/initializers/blacklist.rb
@@ -0,0 +1,2 @@
+# Load the blacklist.
+BLACKLIST ||= Blacklist.new(YAML.load_file("config/blacklist.yml"))
diff --git a/config/locales/en.yml b/config/locales/en.yml
index a496ef53..82d2ef52 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -125,6 +125,9 @@ en:
message: Message
tip: Tip (relative to the project balance)
submit: Send the selected tip amounts
+ blacklisted:
+ title: Sorry, this project doesn't accept tips!
+ message: The author of this project has chosen to disallow tips for this project.
tips:
index:
tips: Tips
diff --git a/lib/blacklist.rb b/lib/blacklist.rb
new file mode 100644
index 00000000..c1ef8f2c
--- /dev/null
+++ b/lib/blacklist.rb
@@ -0,0 +1,42 @@
+require "set"
+
+class Blacklist
+ def initialize(urls)
+ urls = urls.map {|u| normalize_url(u) }
+
+ @urls = Set.new(urls)
+ end
+
+ def include?(url)
+ url = normalize_url(url)
+
+ if @urls.include?(url)
+ return true
+ end
+
+ # Check for the author path.
+ # https://github.com/author/*
+ url[url.rindex("/")..-1] = "/*"
+
+ @urls.include?(url)
+ end
+
+ private
+ def normalize_url(url)
+ url = url.clone
+
+ if !url.start_with?("http://", "https://", "//")
+ if !url.start_with?("github.com", "bitbucket.org")
+ # Assume it is a shortened "author/project" path and
+ # default to Github.
+ url.prepend("github.com/")
+ end
+ url.prepend("https://")
+ end
+
+ uri = URI.parse(url)
+
+ # Ignore irrelevant differences such as HTTP/HTTPS.
+ [uri.host, uri.path].join
+ end
+end
diff --git a/spec/controllers/projects_controller_spec.rb b/spec/controllers/projects_controller_spec.rb
index 02c5bb9d..576e717d 100644
--- a/spec/controllers/projects_controller_spec.rb
+++ b/spec/controllers/projects_controller_spec.rb
@@ -7,6 +7,8 @@
allow(Project).to receive(:order).with(available_amount_cache: :desc, watchers_count: :desc, full_name: :asc).and_return(Project)
allow(Project).to receive(:page).with(nil).and_return(Project)
allow(Project).to receive(:per).with(30).and_return(Project)
+ allow(Project).to receive(:to_a).and_return(Project)
+ allow(Project).to receive(:reject!).and_return(Project)
end
it 'renders index template' do
@@ -37,4 +39,23 @@
expect(assigns[:projects].name).to eq 'Project'
end
end
+
+ describe '#search' do
+ let(:subject) { get :search, query: "https://github.com/mitsuhiko/flask" }
+
+ it 'renders blacklisted template' do
+ expect(subject).to render_template :blacklisted
+ end
+ end
+
+ describe '#show' do
+ context 'with existing project that has been blacklisted' do
+ let(:blacklisted_project) { create(:project, host: "github", full_name: "mitsuhiko/flask") }
+ let(:subject) { get :show, service: "github", repo: blacklisted_project.full_name }
+
+ it 'renders blacklisted template' do
+ expect(subject).to render_template :blacklisted
+ end
+ end
+ end
end
diff --git a/spec/lib/blacklist_spec.rb b/spec/lib/blacklist_spec.rb
new file mode 100644
index 00000000..08ab8d61
--- /dev/null
+++ b/spec/lib/blacklist_spec.rb
@@ -0,0 +1,29 @@
+require 'spec_helper'
+
+describe Blacklist do
+ it 'handles blacklisted URLs' do
+ urls = [
+ "https://github.com/author/notips",
+ "https://bitbucket.org/author/notips",
+ "https://github.com/notips/*",
+ "https://bitbucket.org/notips/*",
+ ]
+
+ list = Blacklist.new(urls)
+
+ # Blacklisted projects.
+ expect(list.include?("https://github.com/author/notips")).to eq(true)
+ expect(list.include?("http://github.com/author/notips?tips=true")).to eq(true)
+ expect(list.include?("https://bitbucket.org/author/notips")).to eq(true)
+ expect(list.include?("github.com/author/notips")).to eq(true)
+ expect(list.include?("author/notips")).to eq(true)
+
+ # Non-blacklisted projects.
+ expect(list.include?("https://github.com/author/tipme")).to eq(false)
+ expect(list.include?("https://bitbucket.org/author/tipme")).to eq(false)
+
+ # Blacklisted authors.
+ expect(list.include?("https://github.com/notips/tipme")).to eq(true)
+ expect(list.include?("https://bitbucket.org/notips/tipme")).to eq(true)
+ end
+end
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb
index c1a604fb..594e378b 100644
--- a/spec/models/project_spec.rb
+++ b/spec/models/project_spec.rb
@@ -39,4 +39,4 @@
end
end
end
-end
\ No newline at end of file
+end
From ca6bac2d74adefdf945825cdcc55aaae8b5cc816 Mon Sep 17 00:00:00 2001
From: bill auger
Date: Sun, 2 Nov 2014 11:33:30 +0000
Subject: [PATCH 098/415] add pretty user urls
* rerouted Project#tips and Project#deposits to Tips#index and Deposits#index
* added TipsController#load_project method
* added pretty user paths for #tips and #show
* added pretty user paths tests
* added features/step_definitions/users_steps.rb
* added features/view_tips.feature
NOTE:
TipsController#load_project method is nearly identical to ProjectsController#load_project - they could probably be refactored into ApplicationController method
---
app/controllers/projects_controller.rb | 17 +-------
app/controllers/tips_controller.rb | 19 +++++++--
app/controllers/users_controller.rb | 2 +-
app/views/tips/index.html.haml | 2 -
config/routes.rb | 9 ++++-
features/step_definitions/users_steps.rb | 15 +++++++
features/step_definitions/web.rb | 11 +++--
features/view_tips.feature | 42 ++++++++++++++++++++
spec/controllers/projects_controller_spec.rb | 22 ++--------
spec/controllers/users_controller_spec.rb | 19 +++++++--
10 files changed, 109 insertions(+), 49 deletions(-)
create mode 100644 features/step_definitions/users_steps.rb
create mode 100644 features/view_tips.feature
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index 44fac396..a5c22e0a 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -51,8 +51,8 @@ def show
@project.update_attribute :bitcoin_address, bitcoin_address
end
end
- @project_tips = @project.tips
- @recent_tips = @project_tips.includes(:user).order(created_at: :desc).first(5)
+ @project_tips = @project.tips.with_address
+ @recent_tips = @project_tips.with_address.order(created_at: :desc).first(5)
end
def edit
@@ -94,19 +94,6 @@ def decide_tip_amounts
end
end
- def tips
- @tips = @project.tips.includes(:user).order(created_at: :desc).
- page(params[:page]).
- per(params[:per_page] || 30)
- render :template => 'tips/index'
- end
-
- def deposits
- @deposits = @project.deposits.order(created_at: :desc).
- page(params[:page]).
- per(params[:per_page] || 30)
- render :template => 'deposits/index'
- end
private
diff --git a/app/controllers/tips_controller.rb b/app/controllers/tips_controller.rb
index 99a91dfa..eb4481f7 100644
--- a/app/controllers/tips_controller.rb
+++ b/app/controllers/tips_controller.rb
@@ -3,12 +3,17 @@ class TipsController < ApplicationController
before_action :load_project
def index
- if params[:project_id]
- @tips = @project.tips.includes(:user)
+ if @project
+ @tips = @project.tips.includes(:user).with_address
elsif params[:user_id] && @user = User.find(params[:user_id])
+ if @user.nil? || @user.bitcoin_address.blank?
+ flash[:error] = I18n.t('errors.user_not_found')
+ redirect_to users_path and return
+ end
+
@tips = @user.tips.includes(:project)
else
- @tips = Tip.includes(:user, :project)
+ @tips = Tip.with_address.includes(:project)
end
@tips = @tips.order(created_at: :desc).
page(params[:page]).
@@ -19,9 +24,15 @@ def index
end
end
+
private
def load_project
- super(params[:project_id]) if params[:project_id].present?
+ if params[:project_id].present?
+ super params[:project_id]
+ elsif params[:service].present? && params[:repo].present?
+ super Project.where(host: params[:service]).
+ where('lower(`full_name`) = ?' , params[:repo].downcase).first
+ end
end
end
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index f3e5a8db..4286f7b1 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -8,7 +8,7 @@ def show
end
def index
- @users = User.order(withdrawn_amount: :desc, commits_count: :desc).where('commits_count > 0').page(params[:page]).per(30)
+ @users = User.order(withdrawn_amount: :desc, commits_count: :desc).where('commits_count > 0 AND withdrawn_amount > 0').page(params[:page]).per(30)
end
def update
diff --git a/app/views/tips/index.html.haml b/app/views/tips/index.html.haml
index ded8f6e0..0d66d4ec 100644
--- a/app/views/tips/index.html.haml
+++ b/app/views/tips/index.html.haml
@@ -37,8 +37,6 @@
= t('.refunded')
- elsif tip.undecided?
= t('.undecided')
- - elsif tip.user.bitcoin_address.blank?
- = t('.no_bitcoin_address')
- elsif tip.user.balance < CONFIG["min_payout"]
= t('.below_threshold')
- else
diff --git a/config/routes.rb b/config/routes.rb
index be386023..c5ef08e2 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -4,10 +4,15 @@
get '/blockchain_info_callback' => "home#blockchain_info_callback", :as => "blockchain_info_callback"
+ # reserved routes (rejected pertty url usernames)
+ RESERVED_USER_ROUTES_REGEX = /(^(?:(?!^\d+$|\b(sign_in|cancel|sign_up|edit|confirmation|login)\b).)*$)/
+ get '/users/:name/tips' => 'tips#index', :constraints => {:name => /\RESERVED_USER_ROUTES_REGEX/}
+ get '/users/:name' => 'users#show', :constraints => {:name => /\RESERVED_USER_ROUTES_REGEX/}
+
get '/:service/:repo/edit' => 'projects#edit', :constraints => {:service => /github/, :repo => /.+/}
get '/:service/:repo/decide_tip_amounts' => 'projects#decide_tip_amounts', :constraints => {:service => /github/, :repo => /.+/}
- get '/:service/:repo/tips' => 'projects#tips', :constraints => {:service => /github/, :repo => /.+/}
- get '/:service/:repo/deposits' => 'projects#deposits', :constraints => {:service => /github/, :repo => /.+/}
+ get '/:service/:repo/tips' => 'tips#index', :constraints => {:service => /github/, :repo => /.+/}
+ get '/:service/:repo/deposits' => 'deposits#index', :constraints => {:service => /github/, :repo => /.+/}
get '/:service/:repo' => 'projects#show', :constraints => {:service => /github/, :repo => /.+/}
devise_for :users,
diff --git a/features/step_definitions/users_steps.rb b/features/step_definitions/users_steps.rb
new file mode 100644
index 00000000..ff9576b2
--- /dev/null
+++ b/features/step_definitions/users_steps.rb
@@ -0,0 +1,15 @@
+
+def create_user nickname , has_bitcoiin_address
+ User.create do |user|
+ user.name = nickname
+ user.email = "#{nickname}@example.com"
+ user.bitcoin_address = '1AFgARu7e5d8Lox6P2DSFX3MW8BtsVXEn5' if has_bitcoiin_address
+ user.nickname = nickname
+ user.password = Devise.friendly_token.first(Devise.password_length.min)
+ user.skip_confirmation!
+ end
+end
+
+Given /^a user named "(.*?)" exists (with|without?) a bitcoin address$/ do |nickname , with|
+ (@users ||= {})[nickname] = (create_user nickname , (with.eql? 'with'))
+end
diff --git a/features/step_definitions/web.rb b/features/step_definitions/web.rb
index 0ec4001b..31249236 100644
--- a/features/step_definitions/web.rb
+++ b/features/step_definitions/web.rb
@@ -29,21 +29,24 @@ def parse_path_from_page_string page_string
path = nil
# explicit cases
+ # e.g. "a-user/a-project github project edit"
+ # e.g. "a-user user edit"
tokens = page_string.split ' '
name = tokens[0]
model = tokens[1]
action = tokens[2] || ''
is_user = model.eql? 'user'
is_project = ['github-project' , 'bitbucket-project'].include? model
- if is_project # e.g. "me/my-project github project edit"
+ if is_project
projects_paths = ['' , 'edit' , 'decide_tip_amounts' , 'tips' , 'deposits'] # '' => 'show'
is_valid_path = projects_paths.include? action
service = model.split('-').first
path = "/#{service}/#{name}/#{action}" if is_valid_path
elsif is_user
- projects_paths = ['show' , 'edit']
- is_valid_path = projects_paths.include? action
- path = "/users/#{name}/#{action}" if is_valid_path
+ user_paths = ['' , 'edit' , 'tips']
+ is_valid_path = user_paths.include? action
+# path = "/users/#{name}/#{action}" if is_valid_path # TODO: nyi
+ path = "/users/#{@users[name].id}/#{action}" if is_valid_path
# implicit cases
else case page_string
diff --git a/features/view_tips.feature b/features/view_tips.feature
new file mode 100644
index 00000000..97e94277
--- /dev/null
+++ b/features/view_tips.feature
@@ -0,0 +1,42 @@
+Feature: Visitors should be able to see claimed tips
+ Background:
+ Given a "github" project named "seldon/seldons-project" exists
+ And a user named "yugo" exists with a bitcoin address
+ And a user named "gaal" exists without a bitcoin address
+ And our fee is "0"
+ And a deposit of "500" is made
+ And the most recent commit is "AAA"
+ And a new commit "BBB" with parent "AAA"
+ And a new commit "CCC" with parent "BBB"
+ And the author of commit "BBB" is "yugo"
+ And the author of commit "CCC" is "gaal"
+ When the project syncs with the remote repo
+ Then there should be a tip of "5" for commit "BBB"
+ And there should be a tip of "4.95" for commit "CCC"
+ Given I'm not logged in
+
+ Scenario: Visitors should see all claimed tips but not unclaimed tips
+ When I visit the "tips" page
+ Then I should be on the "tips" page
+ And I should see "yugo"
+ But I should not see "gaal"
+
+ Scenario: Visitors should see all claimed tips per project but not unclaimed tips
+ When I visit the "seldon/seldons-project github-project" page
+ Then I should be on the "seldon/seldons-project github-project" page
+ And I should see "yugo"
+ But I should not see "gaal"
+ When I visit the "seldon/seldons-project github-project tips" page
+ Then I should be on the "seldon/seldons-project github-project tips" page
+ And I should see "yugo"
+ But I should not see "gaal"
+
+ Scenario: Visitors should see all claimed tips per user but not unclaimed tips
+ When I visit the "yugo user tips" page
+ Then I should be on the "yugo user tips" page
+ And I should see "yugo"
+ When I visit the "gaal user tips" page
+ Then I should be on the "users" page
+ And I should see "yugo"
+ And I should not see "gaal"
+ But I should see "User not found"
diff --git a/spec/controllers/projects_controller_spec.rb b/spec/controllers/projects_controller_spec.rb
index e03b8787..7e997c1a 100644
--- a/spec/controllers/projects_controller_spec.rb
+++ b/spec/controllers/projects_controller_spec.rb
@@ -82,20 +82,6 @@
end
end
- describe 'GET #tips' do
- it 'returns 302 status code' do
- get :tips , :service => 'github' , :repo => 'test/test'
- response.should be_redirect
- end
- end
-
- describe 'GET #deposits' do
- it 'returns 302 status code' do
- get :deposits , :service => 'github' , :repo => 'test/test'
- response.should be_redirect
- end
- end
-
describe "routing" do
it "routes GET /projects to Project#index" do
{ :get => "/projects" }.should route_to(
@@ -188,16 +174,16 @@
it "routes GET /:provider/:repo/tips to Project#tips" do
{ :get => "/github/test/test/tips" }.should route_to(
- :controller => "projects" ,
- :action => "tips" ,
+ :controller => "tips" ,
+ :action => "index" ,
:service => "github" ,
:repo => "test/test")
end
it "routes GET /:provider/:repo/deposits to Project#deposits" do
{ :get => "/github/test/test/deposits" }.should route_to(
- :controller => "projects" ,
- :action => "deposits" ,
+ :controller => "deposits" ,
+ :action => "index" ,
:service => "github" ,
:repo => "test/test")
end
diff --git a/spec/controllers/users_controller_spec.rb b/spec/controllers/users_controller_spec.rb
index 5097b6c2..1d8f59ee 100644
--- a/spec/controllers/users_controller_spec.rb
+++ b/spec/controllers/users_controller_spec.rb
@@ -92,20 +92,20 @@
end
describe "routing" do
- it "routes GET /users to Project#index" do
+ it "routes GET /users to User#index" do
{ :get => "/users" }.should route_to(
:controller => "users" ,
:action => "index" )
end
- it "routes GET /users to Project#show" do
+ it "routes GET /users to User#show" do
{ :get => "/users/1" }.should route_to(
:controller => "users" ,
:action => "show" ,
:id => "1" )
end
- it "routes GET /login to Project#login" do
+ it "routes GET /login to User#login" do
{ :get => "/users/login" }.should route_to(
:controller => "users" ,
:action => "login" )
@@ -118,4 +118,17 @@
:user_id => "1" )
end
end
+
+ describe "pretty user url routing" do
+ it "routes regex rejects reserved user paths" do
+ # accepted pertty url usernames
+ should_accept = %w{logi ogin s4c2 42x}
+ # reserved routes (rejected pertty url usernames)
+ should_reject = %w{sign_in cancel sign_up edit confirmation login}
+
+ accepted = should_accept.select {|ea| ea =~ RESERVED_USER_ROUTES_REGEX}
+ rejected = should_reject.select {|ea| (ea =~ RESERVED_USER_ROUTES_REGEX).nil? }
+ accepted.size.should eq should_accept.size and rejected.size.should eq should_reject.size
+ end
+ end
end
From a4a194a7da1165724c7707a36c22ecf5167ee626 Mon Sep 17 00:00:00 2001
From: bill auger
Date: Sun, 2 Nov 2014 11:40:59 +0000
Subject: [PATCH 099/415] supress visibility of unclaimed tips issue #146
* filtered all Tips relations through the Tips:with_address scope
except for UsersController#show (private page)
* filtered users with zero withdrawn_amount in UsersController#index
* removed :no_bitcoin_address message from Tips#index
NOTES:
i do not have a full setup (blockchain account , etc) so i could not test this feature manually - it was implemented driven by cucumber tests which are not included in this PR because they were implemented on the tip of my HEAD using an incompatible routing/testing scheme implemented in PR #141 and would cause travis to fail today - they are included in PR #142 along with tests for several other recent features pending merge of the new pretty url routing scheme
regarding the TipsController#index action switched on no params -
# the original query
Tip.includes(:user , :project)
# the replacement query
Tip.with_address.includes(:project)
the Tips:with_address scope joins(:user) so this should not have broken anything but unfortunately no tests exist for the Tips view so this should be verified manually on a staging system
rearding the UsersController#index action -
im a bit uncertain of the semantics here but the User :withdrawn_amount is based on the tips.paid scope which is based on the existence of a :sendmany_id - so im assuming that this means that a tip that was offered to someone without bitcoin_address would not have a sendmany_id and any so such user would have a zero withdrawn_amount
---
app/controllers/projects_controller.rb | 4 ++--
app/controllers/tips_controller.rb | 9 +++++++--
app/controllers/users_controller.rb | 2 +-
app/views/tips/index.html.haml | 2 --
4 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index ee02fbfa..eb1be713 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -40,8 +40,8 @@ def show
@project.update_attribute :bitcoin_address, bitcoin_address
end
end
- @project_tips = @project.tips
- @recent_tips = @project_tips.includes(:user).order(created_at: :desc).first(5)
+ @project_tips = @project.tips.with_address
+ @recent_tips = @project_tips.with_address.order(created_at: :desc).first(5)
end
def edit
diff --git a/app/controllers/tips_controller.rb b/app/controllers/tips_controller.rb
index 99a91dfa..3a0185bf 100644
--- a/app/controllers/tips_controller.rb
+++ b/app/controllers/tips_controller.rb
@@ -4,11 +4,16 @@ class TipsController < ApplicationController
def index
if params[:project_id]
- @tips = @project.tips.includes(:user)
+ @tips = @project.tips.includes(:user).with_address
elsif params[:user_id] && @user = User.find(params[:user_id])
+ if @user.nil? || @user.bitcoin_address.blank?
+ flash[:error] = I18n.t('errors.user_not_found')
+ redirect_to users_path and return
+ end
+
@tips = @user.tips.includes(:project)
else
- @tips = Tip.includes(:user, :project)
+ @tips = Tip.with_address.includes(:project)
end
@tips = @tips.order(created_at: :desc).
page(params[:page]).
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index f3e5a8db..4286f7b1 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -8,7 +8,7 @@ def show
end
def index
- @users = User.order(withdrawn_amount: :desc, commits_count: :desc).where('commits_count > 0').page(params[:page]).per(30)
+ @users = User.order(withdrawn_amount: :desc, commits_count: :desc).where('commits_count > 0 AND withdrawn_amount > 0').page(params[:page]).per(30)
end
def update
diff --git a/app/views/tips/index.html.haml b/app/views/tips/index.html.haml
index ded8f6e0..0d66d4ec 100644
--- a/app/views/tips/index.html.haml
+++ b/app/views/tips/index.html.haml
@@ -37,8 +37,6 @@
= t('.refunded')
- elsif tip.undecided?
= t('.undecided')
- - elsif tip.user.bitcoin_address.blank?
- = t('.no_bitcoin_address')
- elsif tip.user.balance < CONFIG["min_payout"]
= t('.below_threshold')
- else
From 3c2500e963ca35749ab20ae10ea9b4220d7a9187 Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Sun, 2 Nov 2014 17:45:47 +0500
Subject: [PATCH 100/415] fixed tests
---
features/developer_opt_in_for_tips.feature | 2 +-
features/notification_threshold.feature | 19 -------------------
features/tip_modifier_interface.feature | 4 ++--
3 files changed, 3 insertions(+), 22 deletions(-)
delete mode 100644 features/notification_threshold.feature
diff --git a/features/developer_opt_in_for_tips.feature b/features/developer_opt_in_for_tips.feature
index f6fa0a0f..de68e489 100644
--- a/features/developer_opt_in_for_tips.feature
+++ b/features/developer_opt_in_for_tips.feature
@@ -12,7 +12,7 @@ Feature: Developers must opt-in to create an account and receive tips
And the message of commit "COMMIT2" is "Tiny change"
When the new commits are read
Then there should be a tip of "5" for commit "COMMIT2"
- And there should be 1 email sent
+ And there should be 0 email sent
Scenario: Tipping a developer that has not opted-in
And a new commit "COMMIT2" with parent "COMMIT1"
diff --git a/features/notification_threshold.feature b/features/notification_threshold.feature
deleted file mode 100644
index 5e613f6e..00000000
--- a/features/notification_threshold.feature
+++ /dev/null
@@ -1,19 +0,0 @@
-Feature: Users should not be notified if their balance is small
- Background:
- Given a project "django"
- And a deposit of "0.1"
- And 2 new commits
-
- Scenario: Without big deposits
- When the new commits are read
- Then there should be 0 email sent
-
- Scenario: User's balance hits threshold
- When 100 new commits
- And the new commits are read
- Then there should be 1 email sent
-
- Scenario: With bigger donation
- When a deposit of "2"
- And the new commits are read
- Then there should be 1 email sent
\ No newline at end of file
diff --git a/features/tip_modifier_interface.feature b/features/tip_modifier_interface.feature
index 4c0788bc..cf8e9122 100644
--- a/features/tip_modifier_interface.feature
+++ b/features/tip_modifier_interface.feature
@@ -19,7 +19,7 @@ Feature: A project collaborator can change the tips of commits
When the new commits are read
Then there should be a tip of "5" for commit "BBB"
And there should be a tip of "4.95" for commit "CCC"
- And there should be 2 email sent
+ And there should be 0 email sent
Scenario: A collaborator wants to alter the tips
Given I'm logged in as "seldon"
@@ -45,7 +45,7 @@ Feature: A project collaborator can change the tips of commits
And I click on "Send the selected tip amounts"
Then there should be a tip of "0.5" for commit "BBB"
And the tip amount for commit "CCC" should be undecided
- And there should be 1 email sent
+ And there should be 0 email sent
When the email counters are reset
And I choose the amount "Free: 0%" on commit "CCC"
From 191a2fe49075bad70fdc6c5ef8407bb8bc1d98d5 Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Sun, 2 Nov 2014 19:50:13 +0500
Subject: [PATCH 101/415] fixed projects#index
---
app/controllers/projects_controller.rb | 3 ---
app/views/projects/index.html.haml | 2 +-
2 files changed, 1 insertion(+), 4 deletions(-)
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index 7384dc29..1963ce52 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -6,9 +6,6 @@ class ProjectsController < ApplicationController
def index
@projects = Project.order(projects_order).page(params[:page]).per(30)
-
- # This will cause pages not to always include 30 results, but... oh well.
- @projects = @projects.to_a.reject! {|p| BLACKLIST.include?(p.github_url) }
end
def search
diff --git a/app/views/projects/index.html.haml b/app/views/projects/index.html.haml
index a6c1445a..f0a17dcd 100644
--- a/app/views/projects/index.html.haml
+++ b/app/views/projects/index.html.haml
@@ -20,7 +20,7 @@
%th= link_to_unless params[:order].blank? || params[:order] == 'balance', t('.balance'), params.merge(:order => 'balance')
%th
%tbody
- - @projects.each do |project|
+ - @projects.to_a.reject{|p| BLACKLIST.include?(p.github_url) }.each do |project|
%tr
%td
%strong= link_to project.full_name, pretty_project_path(project)
From 5cfaeb1e839303e6b30c391be12b94ff837af488 Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Sun, 2 Nov 2014 20:01:42 +0500
Subject: [PATCH 102/415] fixed projects#search
---
app/controllers/projects_controller.rb | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index 1963ce52..1a4b6722 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -14,10 +14,14 @@ def search
return render :blacklisted
end
- project = Project.find_or_create_by_url(params[:query])
- redirect_to pretty_project_path(project)
+ if project = Project.find_or_create_by_url(params[:query])
+ redirect_to pretty_project_path(project)
+ else
+ @projects = Project.search(params[:query].to_s).order(projects_order).page(params[:page]).per(30)
+ render :index
+ end
else
- redirect_to :index
+ redirect_to projects_path
end
end
From 8d26f615bba6960a94c04baabc3830abd3a8a7c3 Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Sun, 2 Nov 2014 20:40:29 +0500
Subject: [PATCH 103/415] blacklisted joomla/joomla-cms, lavagetto/* and
jplana/python-etcd solved #169 and #170
---
config/blacklist.yml | 3 +++
1 file changed, 3 insertions(+)
diff --git a/config/blacklist.yml b/config/blacklist.yml
index 05eeddac..bc418c30 100644
--- a/config/blacklist.yml
+++ b/config/blacklist.yml
@@ -13,3 +13,6 @@
- https://github.com/sczizzo/*
- https://github.com/tcrayford/*
- https://github.com/unitaker/*
+- https://github.com/joomla/joomla-cms
+- https://github.com/lavagetto/*
+- https://github.com/jplana/python-etcd
\ No newline at end of file
From f9bb2f2239c1882dfebf9c4f3820d541ee3632aa Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Sun, 2 Nov 2014 20:43:09 +0500
Subject: [PATCH 104/415] typo. fixes #153
---
config/blacklist.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/config/blacklist.yml b/config/blacklist.yml
index bc418c30..191dc845 100644
--- a/config/blacklist.yml
+++ b/config/blacklist.yml
@@ -12,7 +12,7 @@
- https://github.com/mplewis/*
- https://github.com/sczizzo/*
- https://github.com/tcrayford/*
-- https://github.com/unitaker/*
+- https://github.com/untitaker/*
- https://github.com/joomla/joomla-cms
- https://github.com/lavagetto/*
- https://github.com/jplana/python-etcd
\ No newline at end of file
From 2430b8042fe76e5b7f88a0f49039fe97f0fb0b22 Mon Sep 17 00:00:00 2001
From: arsenische
Date: Sun, 2 Nov 2014 23:42:29 +0500
Subject: [PATCH 105/415] fixing #173
---
config/blacklist.yml | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/config/blacklist.yml b/config/blacklist.yml
index 191dc845..7b23cc88 100644
--- a/config/blacklist.yml
+++ b/config/blacklist.yml
@@ -15,4 +15,6 @@
- https://github.com/untitaker/*
- https://github.com/joomla/joomla-cms
- https://github.com/lavagetto/*
-- https://github.com/jplana/python-etcd
\ No newline at end of file
+- https://github.com/jplana/python-etcd
+- https://github.com/sitaramc/*
+- https://github.com/gitolite/*
\ No newline at end of file
From 013150aced915b22b9a62bdc16f5c9d54b5a225d Mon Sep 17 00:00:00 2001
From: arsenische
Date: Mon, 3 Nov 2014 02:55:29 +0500
Subject: [PATCH 106/415] fixing #174
---
config/blacklist.yml | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/config/blacklist.yml b/config/blacklist.yml
index 7b23cc88..ad89f735 100644
--- a/config/blacklist.yml
+++ b/config/blacklist.yml
@@ -17,4 +17,5 @@
- https://github.com/lavagetto/*
- https://github.com/jplana/python-etcd
- https://github.com/sitaramc/*
-- https://github.com/gitolite/*
\ No newline at end of file
+- https://github.com/gitolite/*
+- https://github.com/MarkusH/*
\ No newline at end of file
From bf0849e1cc6f1658f4539287aeddbecb5254638d Mon Sep 17 00:00:00 2001
From: Jonathan Rudenberg
Date: Sun, 2 Nov 2014 20:37:30 -0500
Subject: [PATCH 107/415] Add titanous/* and flynn/* to blacklist
---
config/blacklist.yml | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/config/blacklist.yml b/config/blacklist.yml
index ad89f735..6e5e42e1 100644
--- a/config/blacklist.yml
+++ b/config/blacklist.yml
@@ -18,4 +18,6 @@
- https://github.com/jplana/python-etcd
- https://github.com/sitaramc/*
- https://github.com/gitolite/*
-- https://github.com/MarkusH/*
\ No newline at end of file
+- https://github.com/MarkusH/*
+- https://github.com/titanous/*
+- https://github.com/flynn/*
From a12196ee05c8eb82109db0ca038d728d10929b69 Mon Sep 17 00:00:00 2001
From: Michael Babker
Date: Sun, 2 Nov 2014 21:06:46 -0500
Subject: [PATCH 108/415] Blacklist mbabker/*, BabDev/*/ and joomla*
---
config/blacklist.yml | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/config/blacklist.yml b/config/blacklist.yml
index ad89f735..00b4e6cb 100644
--- a/config/blacklist.yml
+++ b/config/blacklist.yml
@@ -13,9 +13,14 @@
- https://github.com/sczizzo/*
- https://github.com/tcrayford/*
- https://github.com/untitaker/*
-- https://github.com/joomla/joomla-cms
+- https://github.com/joomla/*
- https://github.com/lavagetto/*
- https://github.com/jplana/python-etcd
- https://github.com/sitaramc/*
- https://github.com/gitolite/*
-- https://github.com/MarkusH/*
\ No newline at end of file
+- https://github.com/MarkusH/*
+- https://github.com/mbabker/*
+- https://github.com/BabDev/*
+- https://github.com/joomla-framework/*
+- https://github.com/joomla-extensions/*
+- https://github.com/joomla-projects/*
From 321d3ff06469f385ac92fa6b649463fd4c2819e3 Mon Sep 17 00:00:00 2001
From: Baurzhan Muftakhidinov
Date: Mon, 3 Nov 2014 08:43:09 +0600
Subject: [PATCH 109/415] Fixes to Russian spelling.
---
config/locales/ru.yml | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/config/locales/ru.yml b/config/locales/ru.yml
index ce98929f..2380f392 100644
--- a/config/locales/ru.yml
+++ b/config/locales/ru.yml
@@ -19,14 +19,14 @@ ru:
project_not_found: Проект не найден.
access_denied: Доступ запрещен
can_assign_more_tips: "Нельзя использовать более чем 100% свободных средств."
- wrong_bitcoin_address: Ошибка обновления биткоин адреса
+ wrong_bitcoin_address: Ошибка обновления биткойн адреса
user_not_found: Пользователь не найден
access_denied: Вы не авторизованы для выполнения данного действия!
notices:
project_updated: Настройки проекта обновлены
tips_decided: Сумма чаевых определена
user_updated: Ваш профиль обновлен!
- user_unsubscribed: "Вы отписались! Приносим извинения за предоставленные неудобства. Однако, вы все равно можете оставить нам свой Биткоин адрес, чтобы получать вознагрождения"
+ user_unsubscribed: "Вы отписались! Приносим извинения за предоставленные неудобства. Однако, вы все равно можете оставить нам свой Биткойн адрес, чтобы получать вознаграждения"
tip_amounts:
undecided: "Не определено"
free: "Нет: 0%"
@@ -53,17 +53,17 @@ ru:
see_projects: Проекты
how_does_it_work:
title: Как это работает?
- text: Люди жертвуют биткоины на проекты. Если владелец проекта принимает коммит в репозиторий, мы автоматически начисляем чаевые автору этого коммита.
- button: Узнать о Биткоин
+ text: Люди жертвуют биткойны на проекты. Если владелец проекта принимает коммит в репозиторий, мы автоматически начисляем чаевые автору этого коммита.
+ button: Узнать о Биткойн
donate:
title: Жертвуйте
- text: Найдите проект который вам по душе и перечислите биткоины на него. Ваши пожертвования вместе с пожертвованиями других людей будут автоматически выплачиваться авторам новых коммитов в виде чаевых.
+ text: Найдите проект который вам по душе и перечислите биткойны на него. Ваши пожертвования вместе с пожертвованиями других людей будут автоматически выплачиваться авторам новых коммитов в виде чаевых.
button: Найти или добавить проект
contribute:
title: Участвуйте
text: Идите и почините что-нибудь! Если ваш коммит будет принят владельцами проекта, вам будут выплачены чаевые!
sign_in_text: "Просто проверьте ваш email или %{sign_in_link}."
- sign_up_text: "Если вы еще не получил приглашение, вы можете %{sign_up_link} с действительным адресом электронной почты или через GitHub."
+ sign_up_text: "Если вы еще не получили приглашение, вы можете %{sign_up_link} с действительным адресом электронной почты или через GitHub."
button: Проекты
projects:
index:
@@ -80,7 +80,7 @@ ru:
title: "Помогайте %{project}"
edit_project: Изменить настройки проекта
decide_tip_amounts: Установить сумму чаевых
- disabled_notifications: "Контрибьюторы проекта решили не уведомлять новых участников о чаевых и вероятно им не нравиться такой способ финансирования."
+ disabled_notifications: "Контрибьюторы проекта решили не уведомлять новых участников о чаевых и, вероятно, им не нравится такой способ финансирования."
project_sponsors: Спонсоры проекта
fee: "%{percentage} средств будет выплачено в качестве чаевых за новый коммит."
balance: Баланс
@@ -90,7 +90,7 @@ ru:
unconfirmed_amount: "(%{amount} не подтверждено)"
tipping_policies: Политика чаевых
updated_by_user: "(Последние изменения %{name} на %{date})"
- updated_by_unknown: "(Последния изменения на %{date})"
+ updated_by_unknown: "(Последние изменения на %{date})"
tips_paid: Выплаченные чаевые
unclaimed_amount: "(%{amount} от суммы являются невостребованными, и будут возвращены проекту через месяц.)"
last_tips: Недавние чаевые
@@ -104,7 +104,7 @@ ru:
contribute_and_earn_description: "Жертвуйте биткойны этому проекту или %{make_commits_link} и получайте чаевые за них. Если ваш коммит будет принят %{branch} владельцами проекта, а баланс этого проекта положительный, то вы получите чаевые!"
contribute_and_earn_branch: "в ветку %{branch}"
make_commits_link: создавайте коммиты
- tell_us_bitcoin_address: "Просто %{tell_us_link} ваш биткоин адрес."
+ tell_us_bitcoin_address: "Просто %{tell_us_link} ваш биткойн адрес."
tell_us_link: укажите
sign_in: "Просто проверьте ваш email или %{sign_in_link}."
promote_project: "Расскажите о %{project}"
@@ -116,7 +116,7 @@ ru:
branch: Ветка
default_branch: Ветка по умолчанию
tipping_policies: Чаевые
- hold_tips: "Не отправляйте чаевые сразу. Предоставьте владельцам проекта возможность изменить чаевые перед тем как они будут отправлены"
+ hold_tips: "Не отправляйте чаевые сразу. Предоставьте владельцам проекта возможность изменить чаевые перед тем как они будут отправлены."
save: Сохранить настройки проекта
disable_notifications: Не оповещать новых контрибьюторов
decide_tip_amounts:
@@ -154,7 +154,7 @@ ru:
confirmed_no: 'Нет'
users:
index:
- title: Топ Контрибьюторов
+ title: Топ контрибьюторов
name: Имя
commits_count: Количество коммитов
withdrawn: Выплачено
@@ -163,7 +163,7 @@ ru:
threshold: "Вы получите свои деньги, когда ваш баланс достигнет %{threshold}"
see_all: смотреть все
received: "%{time} получено %{amount} за коммит %{commit} в %{project}"
- bitcoin_address_placeholder: Ваш биткоин адрес
+ bitcoin_address_placeholder: Ваш биткойн адрес
notify: Сообщать мне о новых чаевых (не чаще чем одно сообщение в месяц)
submit_user: Обновить информацию пользователя
change_password: Смена пароля
@@ -195,7 +195,7 @@ ru:
submit: Сменить пароль
confirmations:
new:
- title: Выслать еще раз письмо с подтверждением
+ title: Выслать письмо с подтверждением еще раз
submit: Выслать
links:
sign_in: Вход
@@ -210,7 +210,7 @@ ru:
attributes:
user:
email: E-mail
- bitcoin_address: Биткоин адрес
+ bitcoin_address: Биткойн адрес
password: Пароль
- password_confirmation: Пароль еще раз
+ password_confirmation: Подтверждение пароля
display_name: Имя
From 0731f7c645ce223a12fad6a5852c0ac4bd408755 Mon Sep 17 00:00:00 2001
From: arsenische
Date: Mon, 3 Nov 2014 20:44:00 +0500
Subject: [PATCH 110/415] fixing #180
---
config/blacklist.yml | 1 +
1 file changed, 1 insertion(+)
diff --git a/config/blacklist.yml b/config/blacklist.yml
index 257fe774..7ea49980 100644
--- a/config/blacklist.yml
+++ b/config/blacklist.yml
@@ -26,3 +26,4 @@
- https://github.com/joomla-framework/*
- https://github.com/joomla-extensions/*
- https://github.com/joomla-projects/*
+- https://github.com/ForumPostAssistant/FPA
\ No newline at end of file
From 09c6748777c0b944d6efc4e5ca19faf37e393cdd Mon Sep 17 00:00:00 2001
From: arsenische
Date: Mon, 3 Nov 2014 21:05:43 +0500
Subject: [PATCH 111/415] fixing #175
---
config/blacklist.yml | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/config/blacklist.yml b/config/blacklist.yml
index 7ea49980..d3dbe16c 100644
--- a/config/blacklist.yml
+++ b/config/blacklist.yml
@@ -26,4 +26,5 @@
- https://github.com/joomla-framework/*
- https://github.com/joomla-extensions/*
- https://github.com/joomla-projects/*
-- https://github.com/ForumPostAssistant/FPA
\ No newline at end of file
+- https://github.com/ForumPostAssistant/FPA
+- https://github.com/ipython/*
\ No newline at end of file
From 7f2c5de4ea1b4109ff747d9a7f3a6eeb2759fbd3 Mon Sep 17 00:00:00 2001
From: bill auger
Date: Tue, 4 Nov 2014 08:30:29 +0000
Subject: [PATCH 112/415] merge the remainder of project-management branch
---
app/controllers/projects_controller.rb | 62 +++++++++++---------------
app/models/project.rb | 13 ++++++
app/models/sendmany.rb | 30 ++++++-------
app/views/deposits/index.html.haml | 2 +-
app/views/tips/index.html.haml | 2 +-
app/views/withdrawals/index.html.haml | 2 +-
config/application.rb | 9 ++++
7 files changed, 65 insertions(+), 55 deletions(-)
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index 681ad827..e0d7b219 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -1,9 +1,10 @@
require 'net/http'
class ProjectsController < ApplicationController
+ include ProjectsHelper
- before_filter :load_project, only: [:show, :edit, :update, :decide_tip_amounts,
- :tips, :deposits]
+ before_filter :load_project, only: [:show, :edit, :update, :decide_tip_amounts]
+ before_filter :redirect_to_pretty_url, only: [:show, :edit, :decide_tip_amounts]
def index
@projects = Project.order(projects_order).page(params[:page]).per(30)
@@ -22,43 +23,11 @@ def search
render :index
end
- # Redirect to pretty url for html format
- include ProjectsHelper
- before_filter only: [:show, :edit, :decide_tip_amounts] do |controller|
- return unless request.get?
-
- if params[:id].present?
- begin
- respond_to do |format|
- case controller.action_name
- when 'show'
- path = pretty_project_path(@project)
- when 'edit'
- path = pretty_project_edit_path(@project)
- when 'decide_tip_amounts'
- path = pretty_project_decide_tip_amounts_path(@project)
- end
- format.html { redirect_to path }
- end
- rescue ActionController::UnknownFormat
- end
- end
- end
-
def show
- if BLACKLIST.include?(@project.github_url)
- return render :blacklisted
- end
+ render :blacklisted and return if BLACKLIST.include? @project.github_url
+
+ @project.update_bitcoin_address if @project.bitcoin_address.nil?
- if @project.bitcoin_address.nil?
- uri = URI("https://blockchain.info/merchant/#{CONFIG["blockchain_info"]["guid"]}/new_address")
- params = { password: CONFIG["blockchain_info"]["password"], label:"#{@project.full_name}@tip4commit" }
- uri.query = URI.encode_www_form(params)
- res = Net::HTTP.get_response(uri)
- if res.is_a?(Net::HTTPSuccess) && (bitcoin_address = JSON.parse(res.body)["address"])
- @project.update_attribute :bitcoin_address, bitcoin_address
- end
- end
@project_tips = @project.tips.with_address
@recent_tips = @project_tips.with_address.order(created_at: :desc).first(5)
end
@@ -128,4 +97,23 @@ def projects_order
'description' => {description: :asc, available_amount_cache: :desc, watchers_count: :desc, full_name: :asc}
}.[](params[:order] || 'balance')
end
+
+ def redirect_to_pretty_url
+ return unless request.get? && params[:id].present?
+
+ begin
+ respond_to do |format|
+ case action_name
+ when 'show'
+ path = pretty_project_path(@project)
+ when 'edit'
+ path = pretty_project_edit_path(@project)
+ when 'decide_tip_amounts'
+ path = pretty_project_decide_tip_amounts_path(@project)
+ end
+ format.html { redirect_to path }
+ end
+ rescue ActionController::UnknownFormat
+ end
+ end
end
diff --git a/app/models/project.rb b/app/models/project.rb
index 56a8b2ee..82bd3ebb 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -19,6 +19,19 @@ class Project < ActiveRecord::Base
# before_save :check_tips_to_pay_against_avaiable_amount
+ def update_bitcoin_address
+ blockchain_uri = URI CONFIG["blockchain_info"]["new_url"]
+ blockchain_pass = CONFIG["blockchain_info"]["password"]
+ blockchain_label = "#{self.full_name}@tip4commit"
+ blockchain_params = { password: blockchain_pass, label: blockchain_label }
+ blockchain_uri.query = URI.encode_www_form blockchain_params
+ blockchain_resp = Net::HTTP.get_response blockchain_uri
+ if blockchain_resp.is_a? Net::HTTPSuccess
+ self.bitcoin_address = (JSON.parse blockchain_resp.body)["address"]
+ self.save! unless self.bitcoin_address.nil?
+ end
+ end
+
def update_repository_info repo
self.github_id = repo.id
self.name = repo.name
diff --git a/app/models/sendmany.rb b/app/models/sendmany.rb
index 6ef75fbc..63be4035 100644
--- a/app/models/sendmany.rb
+++ b/app/models/sendmany.rb
@@ -8,21 +8,21 @@ def total_amount
def send_transaction
return if txid || is_error
- update_attribute :is_error, true # it's a lock to prevent duplicates
+ update_attribute :is_error, true # it's a lock to prevent duplicates
- uri = URI("https://blockchain.info/merchant/#{CONFIG["blockchain_info"]["guid"]}/sendmany")
- params = { password: CONFIG["blockchain_info"]["password"], recipients: data }
- uri.query = URI.encode_www_form(params)
- res = Net::HTTP.get_response(uri)
- if res.is_a?(Net::HTTPSuccess) && (json = JSON.parse(res.body))
- Rails.logger.info res.body
- update_attribute :result, json
- if !(txid = json["tx_hash"]).blank?
- update_attribute :is_error, false
- update_attribute :txid, json["tx_hash"]
- end
- else
- Rails.logger.error "Failed to get correct response from blockchain.info"
+ uri = URI CONFIG["blockchain_info"]["sendmany_url"]
+ params = { password: CONFIG["blockchain_info"]["password"], recipients: data }
+ uri.query = URI.encode_www_form(params)
+ res = Net::HTTP.get_response(uri)
+ if res.is_a?(Net::HTTPSuccess) && (json = JSON.parse(res.body))
+ Rails.logger.info res.body
+ update_attribute :result, json
+ if !(txid = json["tx_hash"]).blank?
+ update_attribute :is_error, false
+ update_attribute :txid, json["tx_hash"]
end
- end
+ else
+ Rails.logger.error "Failed to get correct response from blockchain.info"
+ end
+ end
end
diff --git a/app/views/deposits/index.html.haml b/app/views/deposits/index.html.haml
index 7950e74d..dfc3d5dd 100644
--- a/app/views/deposits/index.html.haml
+++ b/app/views/deposits/index.html.haml
@@ -22,7 +22,7 @@
%td= link_to(deposit.project.full_name, pretty_project_path(deposit.project))
%td= btc_human deposit.amount
%td= btc_human deposit.fee
- %td= link_to deposit.txid, "https://blockchain.info/tx/#{deposit.txid}", target: :blank
+ %td= link_to deposit.txid, "#{CONFIG["blockchain_info"]["transfer_url"]}/#{deposit.txid}", target: :blank
%td= deposit.confirmed? ? t('.confirmed_yes') : t('.confirmed_no')
= paginate @deposits
diff --git a/app/views/tips/index.html.haml b/app/views/tips/index.html.haml
index 0d66d4ec..e5e4bb42 100644
--- a/app/views/tips/index.html.haml
+++ b/app/views/tips/index.html.haml
@@ -43,7 +43,7 @@
= t('.waiting')
- else
- if tip.sendmany.txid.present?
- = link_to tip.sendmany.txid, "https://blockchain.info/tx/#{tip.sendmany.txid}", target: :blank
+ = link_to tip.sendmany.txid, "#{CONFIG["blockchain_info"]["transfer_url"]}/#{tip.sendmany.txid}", target: :blank
- else
= t('.waiting')
- if tip.sendmany.is_error
diff --git a/app/views/withdrawals/index.html.haml b/app/views/withdrawals/index.html.haml
index 9e0825e2..00b2c671 100644
--- a/app/views/withdrawals/index.html.haml
+++ b/app/views/withdrawals/index.html.haml
@@ -10,5 +10,5 @@
- @sendmanies.each do |sendmany|
%tr
%td= l(sendmany.created_at, format: :short)
- %td= link_to(sendmany.txid, "https://blockchain.info/tx/#{sendmany.txid}", target: '_blank')
+ %td= link_to sendmany.txid, "#{CONFIG["blockchain_info"]["transfer_url"]}/#{sendmany.txid}", target: '_blank'
%td= sendmany.is_error ? t('.error') : t('.success')
diff --git a/config/application.rb b/config/application.rb
index e801a593..db09dd01 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -9,6 +9,15 @@
# load config.yaml preprocessed
CONFIG ||= YAML::load(ERB.new(File.read("config/config.yml")).result)
+# define default blockchain urls
+merchant_url = "https://blockchain.info/merchant"
+transfer_url = "https://blockchain.info/tx"
+guid = CONFIG["blockchain_info"]["guid"]
+CONFIG["blockchain_info"]["merchant_url"] = merchant_url
+CONFIG["blockchain_info"]["transfer_url"] = transfer_url
+CONFIG["blockchain_info"]["new_url"] = "#{merchant_url}/#{guid}/new_address"
+CONFIG["blockchain_info"]["sendmany_url"] = "#{merchant_url}/#{guid}/sendmany"
+
module T4c
class Application < Rails::Application
From 994ac47adf0230d4b3094411caf1a32daba2201b Mon Sep 17 00:00:00 2001
From: bill auger
Date: Tue, 4 Nov 2014 11:57:29 +0000
Subject: [PATCH 113/415] separate developer opt-in and tips visibility testing
concerns
* re-instate features/developer-opt-in.feature
it was realized that the original features/developer-opt-in-for-tips.feature
did indeed test an aspect that ./features/view-tips.feature did not
namely whether a tip actually exists for an unknown user
the view-tips feature only tests whether any such tip is visible or not
the original developer-opt-in scenarios were recreated and elaborated on
including what happens after a previously unknown user signs-up
---
app/models/project.rb | 4 +--
config/application.rb | 4 +--
features/developer-opt-in.feature | 33 +++++++++++++++++
features/sign_up_sign_in.feature | 1 -
features/step_definitions/common.rb | 45 +++++++++++++-----------
features/step_definitions/users_steps.rb | 2 +-
features/step_definitions/web.rb | 18 ++++++----
features/tip_modifier_interface.feature | 10 +++---
features/view_tips.feature | 4 +--
9 files changed, 80 insertions(+), 41 deletions(-)
create mode 100644 features/developer-opt-in.feature
diff --git a/app/models/project.rb b/app/models/project.rb
index 82bd3ebb..728fe7d1 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -129,9 +129,7 @@ def tip_commits
def tip_for commit
if (next_tip_amount > 0) && !Tip.exists?(commit: commit.sha)
-
- user = User.find_by_commit(commit)
- return unless user
+ return unless (user = User.find_by_commit commit)
user.update(nickname: commit.author.login) if commit.author.try(:login)
diff --git a/config/application.rb b/config/application.rb
index db09dd01..10122413 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -12,10 +12,10 @@
# define default blockchain urls
merchant_url = "https://blockchain.info/merchant"
transfer_url = "https://blockchain.info/tx"
-guid = CONFIG["blockchain_info"]["guid"]
+guid = CONFIG["blockchain_info"]["guid"]
CONFIG["blockchain_info"]["merchant_url"] = merchant_url
CONFIG["blockchain_info"]["transfer_url"] = transfer_url
-CONFIG["blockchain_info"]["new_url"] = "#{merchant_url}/#{guid}/new_address"
+CONFIG["blockchain_info"]["new_url"] = "#{merchant_url}/#{guid}/new_address"
CONFIG["blockchain_info"]["sendmany_url"] = "#{merchant_url}/#{guid}/sendmany"
diff --git a/features/developer-opt-in.feature b/features/developer-opt-in.feature
new file mode 100644
index 00000000..f02eec1c
--- /dev/null
+++ b/features/developer-opt-in.feature
@@ -0,0 +1,33 @@
+Feature: Developers may sign-up to receive tip offers
+ Background:
+ Given a "github" project named "seldon/seldons-project" exists
+ And a user named "yugo" exists with a bitcoin address
+ And our fee is "0"
+ And a deposit of "500" is made
+ And the most recent commit is "AAA"
+ And a new commit "BBB" is made with parent "AAA"
+ And a new commit "CCC" is made with parent "BBB"
+ And the author of commit "BBB" is "yugo"
+ And the author of commit "CCC" is "gaal"
+
+ Scenario: A commit is merged from an known developer
+ When the project syncs with the remote repo
+ Then there should be a tip of "5" for commit "BBB"
+ And there should be 0 email sent
+
+ Scenario: A commit is merged from an unknown developer
+ When the project syncs with the remote repo
+ Then there should be no tip for commit "CCC"
+ And there should be 0 email sent
+
+ Scenario: A developer signs-up to receive tip offers
+ When the project syncs with the remote repo
+ Then there should be no tip for commit "CCC"
+ And there should be 0 email sent
+
+ When I sign in as "gaal"
+ And a new commit "DDD" is made by a user named "gaal"
+ When the project syncs with the remote repo
+ Then there should be a tip of "4.95" for commit "CCC"
+ Then there should be a tip of "4.9005" for commit "DDD"
+ And there should be 0 email sent
diff --git a/features/sign_up_sign_in.feature b/features/sign_up_sign_in.feature
index 62dabb8f..422134ac 100644
--- a/features/sign_up_sign_in.feature
+++ b/features/sign_up_sign_in.feature
@@ -23,7 +23,6 @@ Feature: Visitors should be able to sign_up and sign_in
| "seldon/seldons-project github-project tips" |
| "seldon/seldons-project github-project deposits" |
-
Scenario: Visitors should see sign_up but not sign_in links on sign_in page
Given I'm not logged in
When I visit the "sign_in" page
diff --git a/features/step_definitions/common.rb b/features/step_definitions/common.rb
index 426f4104..b52971ad 100644
--- a/features/step_definitions/common.rb
+++ b/features/step_definitions/common.rb
@@ -66,7 +66,7 @@ def service_do service , method_dict
Deposit.create!(project: @current_project, amount: deposit.to_d * 1e8, confirmations: 2)
end
-def add_new_commit commit_id , author , params = {}
+def add_new_commit commit_id , nickname , params = {}
raise "duplicate commit_id" if (find_new_commit commit_id).present?
defaults = {
@@ -74,7 +74,7 @@ def add_new_commit commit_id , author , params = {}
commit: {
message: "Some changes",
author: {
- email: "#{author}@example.com",
+ email: "#{nickname}@example.com",
},
},
}
@@ -93,44 +93,49 @@ def find_new_commit commit_id
nil
end
-Given(/^a new commit "([^"]*?)" is made$/) do |arg1|
- add_new_commit arg1 , "anonymous"
+Given(/^a new commit "([^"]*?)" is made by a user named "(.*?)"$/) do |commit_id , nickname|
+ add_new_commit commit_id , nickname
end
-Given(/^(\d+) new commit.? (?:is|are) made by a user named "(.*?)"$/) do |n_commits , author|
+Given(/^(\d+) new commit.? (?:is|are) made by a user named "(.*?)"$/) do |n_commits , nickname|
n_commits.to_i.times do
- add_new_commit Digest::SHA1.hexdigest(SecureRandom.hex) , author
+ add_new_commit Digest::SHA1.hexdigest(SecureRandom.hex) , nickname
end
end
-Given(/^a new commit "(.*?)" with parent "([^"]*?)"$/) do |arg1, arg2|
- add_new_commit arg1 , "anonymous" , parents: [{sha: arg2}]
+Given(/^a new commit "([^"]*?)" is made$/) do |commit_id|
+ add_new_commit commit_id , "unknown-user"
end
-Given(/^a new commit "(.*?)" with parent "(.*?)" and "(.*?)"$/) do |arg1, arg2, arg3|
- add_new_commit arg1 , "anonymous" , { parents: [{sha: arg2}, {sha: arg3}], commit: {message: "Merge #{arg2} and #{arg3}"} }
+Given(/^a new commit "(.*?)" is made with parent "([^"]*?)"$/) do |commit_id, parent_commit_id|
+ add_new_commit commit_id , "unknown-user" , parents: [{sha: parent_commit_id}]
end
-Given(/^the author of commit "(.*?)" is "(.*?)"$/) do |arg1, arg2|
- commit = find_new_commit(arg1)
+Given(/^a new commit "(.*?)" is made with parent "(.*?)" and "(.*?)"$/) do |commit_id, parentA_commit_id, parentB_commit_id|
+ params = { parents: [{sha: parentA_commit_id}, {sha: parentB_commit_id}], commit: {message: "Merge #{parentA_commit_id} and #{parentB_commit_id}"} }
+ add_new_commit commit_id , "unknown-user" , params
+end
+
+Given(/^the author of commit "(.*?)" is "(.*?)"$/) do |commit_id , nickname|
+ commit = find_new_commit commit_id
raise "no such commit" if commit.nil?
- commit.deep_merge!(author: {login: arg2}, commit: {author: {email: "#{arg2}@example.com"}})
+ commit.deep_merge!(author: {login: nickname}, commit: {author: {email: "#{nickname}@example.com"}})
end
-Given(/^the message of commit "(.*?)" is "(.*?)"$/) do |arg1, arg2|
- commit = find_new_commit(arg1)
+Given(/^the message of commit "(.*?)" is "(.*?)"$/) do |commit_id , commit_msg|
+ commit = find_new_commit commit_id
raise "no such commit" if commit.nil?
- commit.deep_merge!(commit: {message: arg2})
+ commit.deep_merge!(commit: {message: commit_msg})
end
-Given(/^the most recent commit is "(.*?)"$/) do |commit|
- @current_project.update!(last_commit: commit)
+Given(/^the most recent commit is "(.*?)"$/) do |commit_id|
+ @current_project.update! last_commit: commit_id
end
-Then(/^the most recent commit should be "(.*?)"$/) do |arg1|
- @current_project.reload.last_commit.should eq(arg1)
+Then(/^the most recent commit should be "(.*?)"$/) do |commit_id|
+ @current_project.reload.last_commit.should eq commit_id
end
When(/^the new commits are loaded$/) do
diff --git a/features/step_definitions/users_steps.rb b/features/step_definitions/users_steps.rb
index ff9576b2..118a869a 100644
--- a/features/step_definitions/users_steps.rb
+++ b/features/step_definitions/users_steps.rb
@@ -11,5 +11,5 @@ def create_user nickname , has_bitcoiin_address
end
Given /^a user named "(.*?)" exists (with|without?) a bitcoin address$/ do |nickname , with|
- (@users ||= {})[nickname] = (create_user nickname , (with.eql? 'with'))
+ (@users ||= {})[nickname] ||= (create_user nickname , (with.eql? 'with'))
end
diff --git a/features/step_definitions/web.rb b/features/step_definitions/web.rb
index c9138ad6..5eec7462 100644
--- a/features/step_definitions/web.rb
+++ b/features/step_definitions/web.rb
@@ -1,21 +1,23 @@
-Given(/^I'm logged in as "(.*?)"$/) do |arg1|
- email = "#{arg1.parameterize}@example.com"
+Given /^I'm signed in as "(.*?)"$/ do |nickname|
+ email = "#{nickname.parameterize}@example.com"
OmniAuth.config.test_mode = true
OmniAuth.config.mock_auth[:github] = {
"info" => {
- "nickname" => arg1,
- "primary_email" => email,
- "verified_emails" => [email],
+ "nickname" => nickname ,
+ "primary_email" => email ,
+ "verified_emails" => [email] ,
},
}.to_ostruct
visit root_path
first(:link, "Sign in").click
click_on "Sign in with Github"
page.should have_content("Successfully authenticated")
+
+ step "a user named \"#{nickname}\" exists without a bitcoin address"
end
-Given(/^I log out$/) do
+Given /^I'm not signed in$/ do
visit root_path
if page.has_content?("Sign out")
click_on "Sign out"
@@ -25,7 +27,9 @@
end
end
-Given(/^I'm not logged in$/) { step "I log out" }
+Given (/^I sign in as "(.*?)"$/) { |nickname| step "I'm signed in as \"#{nickname}\"" }
+
+Given (/^I sign out$/) { step "I sign out" }
def parse_path_from_page_string page_string
path = nil
diff --git a/features/tip_modifier_interface.feature b/features/tip_modifier_interface.feature
index d246a561..74f95041 100644
--- a/features/tip_modifier_interface.feature
+++ b/features/tip_modifier_interface.feature
@@ -9,8 +9,8 @@ Feature: A project collaborator can change the tips of commits
And our fee is "0"
And a deposit of "500" is made
And the most recent commit is "AAA"
- And a new commit "BBB" with parent "AAA"
- And a new commit "CCC" with parent "BBB"
+ And a new commit "BBB" with parent "AAA" is made
+ And a new commit "CCC" with parent "BBB" is made
And the author of commit "BBB" is "yugo"
And the author of commit "CCC" is "gaal"
@@ -32,13 +32,13 @@ Feature: A project collaborator can change the tips of commits
Then I should be on the "seldon/seldons-project github-project" page
And I should see "The project settings have been updated"
- When a new commit "DDD" with parent "CCC"
+ When a new commit "DDD" with parent "CCC" is made
And the author of commit "DDD" is "yugo"
And the message of commit "DDD" is "yugo's trivial commit DDD"
- And a new commit "EEE" with parent "DDD"
+ And a new commit "EEE" with parent "DDD" is made
And the author of commit "EEE" is "gaal"
And the message of commit "EEE" is "gaal's tiny commit EEE"
- When a new commit "FFF" with parent "EEE"
+ When a new commit "FFF" with parent "EEE" is made
And the author of commit "FFF" is "newguy"
And the message of commit "FFF" is "newguy's unrewarded commit EEE"
When the project syncs with the remote repo
diff --git a/features/view_tips.feature b/features/view_tips.feature
index 13cf84e7..26d93252 100644
--- a/features/view_tips.feature
+++ b/features/view_tips.feature
@@ -6,8 +6,8 @@ Feature: Visitors should be able to see claimed tips
And our fee is "0"
And a deposit of "500" is made
And the most recent commit is "AAA"
- And a new commit "BBB" with parent "AAA"
- And a new commit "CCC" with parent "BBB"
+ And a new commit "BBB" with parent "AAA" is made
+ And a new commit "CCC" with parent "BBB" is made
And the author of commit "BBB" is "yugo"
And the author of commit "CCC" is "gaal"
When the project syncs with the remote repo
From fa25d715e255f16ddd9f9396ca4bebf0284754dd Mon Sep 17 00:00:00 2001
From: Maciej Pasternacki
Date: Tue, 4 Nov 2014 14:50:29 +0100
Subject: [PATCH 114/415] Blacklist my personal (mpasternacki) and my
organization's (3ofcoins) repos
---
config/blacklist.yml | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/config/blacklist.yml b/config/blacklist.yml
index d3dbe16c..7f289578 100644
--- a/config/blacklist.yml
+++ b/config/blacklist.yml
@@ -27,4 +27,6 @@
- https://github.com/joomla-extensions/*
- https://github.com/joomla-projects/*
- https://github.com/ForumPostAssistant/FPA
-- https://github.com/ipython/*
\ No newline at end of file
+- https://github.com/ipython/*
+- https://github.com/mpasternacki/*
+- https://github.com/3ofcoins/*
From 9d45fd456ba2798c09e5e519790cff95a0e2dfd0 Mon Sep 17 00:00:00 2001
From: nalesnikld
Date: Tue, 4 Nov 2014 17:07:32 +0100
Subject: [PATCH 115/415] fixed polish translation
---
config/locales/pl.yml | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/config/locales/pl.yml b/config/locales/pl.yml
index ee9dda71..246e8eda 100644
--- a/config/locales/pl.yml
+++ b/config/locales/pl.yml
@@ -12,7 +12,7 @@ pl:
support_link: wsparcie
follow_link: Obserwuj @tip4commit
links:
- sign_up: Sign up
+ sign_up: Rejestracja
sign_in: Zaloguj się
sign_in_imp: zaloguj się
sign_out: Wyloguj się
@@ -140,7 +140,7 @@ pl:
undecided: Rozmiar napiwku nie został jeszcze określony
no_bitcoin_address: Użytkownik nie sprecyzował adresu do wypłaty
below_threshold: "Saldo użytkownika jest poniżej wymaganego do wypłaty"
- waiting: Oczekiwanie na wypłate
+ waiting: Oczekiwanie na wypłatę
error: (błąd w wysyłaniu transakcji)
deposits:
index:
@@ -156,7 +156,7 @@ pl:
users:
index:
title: Najlepsi kontrybutorzy
- name: Imie
+ name: Imię
commits_count: Opłacone "commity"
withdrawn: Wypłacone
show:
@@ -165,7 +165,7 @@ pl:
see_all: zobacz wszystko
received: "%{time} otrzymano %{amount} za commit %{commit} w %{project}"
bitcoin_address_placeholder: Twój adres bitcoin
- notify: Notify me about new tips (no more than one email per month)
+ notify: Informuj mnie o nowych napiwkach (nie więcej niż jeden email na miesiąc)
submit_user: Zaktualizuj dane użytkownika
change_password: Zmień Twoje hasło
submit_password: Zmień moje hasło
@@ -211,7 +211,7 @@ pl:
attributes:
user:
email: E-mail
- bitcoin_address: AAdres Bitcoin
+ bitcoin_address: Adres Bitcoin
password: Hasło
password_confirmation: Potwierdzenie hasła
display_name: Wyświetlana nazwa
From 9afa8147b7f29325777816bf625dcb6b98308ff9 Mon Sep 17 00:00:00 2001
From: bill auger
Date: Tue, 4 Nov 2014 20:07:51 +0000
Subject: [PATCH 116/415] implement friendly user urls and more friendly
project urls
* routed Project#tips and Project#deposits to Tips#index and Deposits#index
* added ProjectsHelper#pretty_project_tips_path
* added ProjectsHelper#pretty_project_deposits_path
* added friendly routes for User#show and User#tips
* refactored ProjectsController#load_project into ApplicationController method
to be shared with TipsController and DepositsController
---
app/controllers/application_controller.rb | 27 ++++++--
app/controllers/deposits_controller.rb | 10 +--
app/controllers/projects_controller.rb | 45 ++++++-------
app/controllers/tips_controller.rb | 20 ++----
app/helpers/projects_helper.rb | 8 +++
app/models/project.rb | 6 +-
app/models/sendmany.rb | 30 ++++-----
app/views/withdrawals/index.html.haml | 2 +-
config/application.rb | 1 +
config/routes.rb | 79 +++++------------------
10 files changed, 94 insertions(+), 134 deletions(-)
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index d87ef354..04bf89af 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -22,13 +22,28 @@ def load_locale
end
end
- def load_project(project)
- if project.is_a? Project
- @project = project
- else
- @project = Project.where(id: project).first
+ def load_project params
+ (is_project = self.is_a? ProjectsController) ||
+ (is_tips = self.is_a? TipsController ) ||
+ (is_deposits = self.is_a? DepositsController)
+
+ if params[:project_id].present? || params[:id].present?
+ return unless project_id = (is_project && params[:id]) ||
+ ((is_tips || is_deposits) && params[:project_id])
+
+ @project = Project.where(:id => project_id).first
+
+ if is_tips
+ redirect_to project_tips_pretty_path @project.host , @project.full_name
+ elsif is_deposits
+ redirect_to project_deposits_pretty_path @project.host , @project.full_name
+ end
+ elsif params[:service].present? && params[:repo].present?
+ @project = Project.where(host: params[:service]).
+ where('lower(`full_name`) = ?' , params[:repo].downcase).first
end
- unless @project
+
+ if @project.nil? && is_project
flash[:error] = I18n.t('errors.project_not_found')
redirect_to projects_path
end
diff --git a/app/controllers/deposits_controller.rb b/app/controllers/deposits_controller.rb
index 67a2b25c..b0b15d93 100644
--- a/app/controllers/deposits_controller.rb
+++ b/app/controllers/deposits_controller.rb
@@ -1,8 +1,8 @@
class DepositsController < ApplicationController
- before_action :load_project
+ before_action { load_project params }
def index
- if params[:project_id]
+ if @project
@deposits = @project.deposits
else
@deposits = Deposit.includes(:project)
@@ -15,10 +15,4 @@ def index
format.csv { render csv: @deposits, except: [:updated_at, :confirmations, :fee_size], add_methods: [:project_name, :fee, :confirmed?] }
end
end
-
- private
-
- def load_project
- super(params[:project_id]) if params[:project_id].present?
- end
end
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index 1a8e95b9..8f63fcfa 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -3,8 +3,9 @@
class ProjectsController < ApplicationController
include ProjectsHelper
- before_filter :load_project, only: [:show, :edit, :decide_tip_amounts, :update]
- before_filter :redirect_to_pretty_url, only: [:show, :edit, :decide_tip_amounts]
+ before_filter :load_project, only: [:show, :edit, :update, :decide_tip_amounts]
+ before_filter :redirect_to_pretty_url, only: [:show, :edit, :decide_tip_amounts,
+ :tips, :deposits]
def index
@projects = Project.order(projects_order).page(params[:page]).per(30)
@@ -13,21 +14,19 @@ def index
def search
if params[:query].present?
if BLACKLIST.include?(params[:query])
- return render :blacklisted
+ render :blacklisted and return
+ elsif project = Project.find_or_create_by_url(params[:query])
+ redirect_to pretty_project_path(project) and return
end
-
- if project = Project.find_or_create_by_url(params[:query])
- redirect_to pretty_project_path(project)
- else
- @projects = Project.search(params[:query].to_s).order(projects_order).page(params[:page]).per(30)
- render :index
- end
- else
- redirect_to projects_path
end
+
+ @projects = Project.search(params[:query].to_s).order(projects_order).page(params[:page]).per(30)
+ render :index
end
def show
+ render :blacklisted and return if BLACKLIST.include? @project.github_url
+
@project.update_bitcoin_address if @project.bitcoin_address.nil?
@project_tips = @project.tips.with_address
@@ -73,18 +72,10 @@ def decide_tip_amounts
end
end
+
private
- def load_project
- if params[:id].present?
- super(params[:id])
- elsif params[:service].present? && params[:repo].present?
- super(
- Project.where(host: params[:service]).
- where('lower(`full_name`) = ?', params[:repo].downcase).first
- )
- end
- end
+ def load_project ; super params ; end ;
def project_params
params.require(:project).permit(:branch, :disable_notifications, :hold_tips, tipping_policies_text_attributes: [:text])
@@ -106,11 +97,15 @@ def redirect_to_pretty_url
respond_to do |format|
case action_name
when 'show'
- path = pretty_project_path(@project)
+ path = pretty_project_path @project
when 'edit'
- path = pretty_project_edit_path(@project)
+ path = pretty_project_edit_path @project
when 'decide_tip_amounts'
- path = pretty_project_decide_tip_amounts_path(@project)
+ path = pretty_project_decide_tip_amounts_path @project
+ when 'tips'
+ path = pretty_project_tips_path @project
+ when 'deposits'
+ path = pretty_project_deposits_path @project
end
format.html { redirect_to path }
end
diff --git a/app/controllers/tips_controller.rb b/app/controllers/tips_controller.rb
index 3a0185bf..46c52463 100644
--- a/app/controllers/tips_controller.rb
+++ b/app/controllers/tips_controller.rb
@@ -1,17 +1,17 @@
class TipsController < ApplicationController
-
- before_action :load_project
+ before_filter { load_project params }
def index
- if params[:project_id]
+ if @project
@tips = @project.tips.includes(:user).with_address
- elsif params[:user_id] && @user = User.find(params[:user_id])
- if @user.nil? || @user.bitcoin_address.blank?
+ elsif params[:user_id]
+ @user = User.find params[:user_id]
+ if @user.present? && @user.bitcoin_address.present?
+ @tips = @user.tips.includes(:project)
+ else
flash[:error] = I18n.t('errors.user_not_found')
redirect_to users_path and return
end
-
- @tips = @user.tips.includes(:project)
else
@tips = Tip.with_address.includes(:project)
end
@@ -23,10 +23,4 @@ def index
format.csv { render csv: @tips, except: [:updated_at, :commit, :commit_message, :refunded_at, :decided_at], add_methods: [:user_name, :project_name, :decided?, :claimed?, :paid?, :refunded?, :txid] }
end
end
-
- private
-
- def load_project
- super(params[:project_id]) if params[:project_id].present?
- end
end
diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb
index 5911ecd9..7d0376fd 100644
--- a/app/helpers/projects_helper.rb
+++ b/app/helpers/projects_helper.rb
@@ -30,6 +30,14 @@ def pretty_project_decide_tip_amounts_path project
"#{pretty_project_path project}/decide_tip_amounts"
end
+ def pretty_project_tips_path project
+ "#{pretty_project_path project}/tips"
+ end
+
+ def pretty_project_deposits_path project
+ "#{pretty_project_path project}/deposits"
+ end
+
def pretty_project_url project
root_url.gsub(/\/$/,'') + pretty_project_path(project)
end
diff --git a/app/models/project.rb b/app/models/project.rb
index 3b305c86..728fe7d1 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -20,7 +20,7 @@ class Project < ActiveRecord::Base
# before_save :check_tips_to_pay_against_avaiable_amount
def update_bitcoin_address
- blockchain_uri = URI CONFIG["blockchain_info"]["new_url"]
+ blockchain_uri = URI CONFIG["blockchain_info"]["new_url"]
blockchain_pass = CONFIG["blockchain_info"]["password"]
blockchain_label = "#{self.full_name}@tip4commit"
blockchain_params = { password: blockchain_pass, label: blockchain_label }
@@ -129,9 +129,7 @@ def tip_commits
def tip_for commit
if (next_tip_amount > 0) && !Tip.exists?(commit: commit.sha)
-
- user = User.find_by_commit(commit)
- return unless user
+ return unless (user = User.find_by_commit commit)
user.update(nickname: commit.author.login) if commit.author.try(:login)
diff --git a/app/models/sendmany.rb b/app/models/sendmany.rb
index 169a5fd4..63be4035 100644
--- a/app/models/sendmany.rb
+++ b/app/models/sendmany.rb
@@ -8,21 +8,21 @@ def total_amount
def send_transaction
return if txid || is_error
- update_attribute :is_error, true # it's a lock to prevent duplicates
+ update_attribute :is_error, true # it's a lock to prevent duplicates
- uri = URI CONFIG["blockchain_info"]["sendmany_url"]
- params = { password: CONFIG["blockchain_info"]["password"], recipients: data }
- uri.query = URI.encode_www_form(params)
- res = Net::HTTP.get_response(uri)
- if res.is_a?(Net::HTTPSuccess) && (json = JSON.parse(res.body))
- Rails.logger.info res.body
- update_attribute :result, json
- if !(txid = json["tx_hash"]).blank?
- update_attribute :is_error, false
- update_attribute :txid, json["tx_hash"]
- end
- else
- Rails.logger.error "Failed to get correct response from blockchain.info"
+ uri = URI CONFIG["blockchain_info"]["sendmany_url"]
+ params = { password: CONFIG["blockchain_info"]["password"], recipients: data }
+ uri.query = URI.encode_www_form(params)
+ res = Net::HTTP.get_response(uri)
+ if res.is_a?(Net::HTTPSuccess) && (json = JSON.parse(res.body))
+ Rails.logger.info res.body
+ update_attribute :result, json
+ if !(txid = json["tx_hash"]).blank?
+ update_attribute :is_error, false
+ update_attribute :txid, json["tx_hash"]
end
- end
+ else
+ Rails.logger.error "Failed to get correct response from blockchain.info"
+ end
+ end
end
diff --git a/app/views/withdrawals/index.html.haml b/app/views/withdrawals/index.html.haml
index 4b3e2c24..00b2c671 100644
--- a/app/views/withdrawals/index.html.haml
+++ b/app/views/withdrawals/index.html.haml
@@ -10,5 +10,5 @@
- @sendmanies.each do |sendmany|
%tr
%td= l(sendmany.created_at, format: :short)
- %td= link_to(sendmany.txid, "#{CONFIG["blockchain_info"]["transfer_url"]}/#{sendmany.txid}", target: '_blank')
+ %td= link_to sendmany.txid, "#{CONFIG["blockchain_info"]["transfer_url"]}/#{sendmany.txid}", target: '_blank'
%td= sendmany.is_error ? t('.error') : t('.success')
diff --git a/config/application.rb b/config/application.rb
index 48be945c..10122413 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -8,6 +8,7 @@
# load config.yaml preprocessed
CONFIG ||= YAML::load(ERB.new(File.read("config/config.yml")).result)
+
# define default blockchain urls
merchant_url = "https://blockchain.info/merchant"
transfer_url = "https://blockchain.info/tx"
diff --git a/config/routes.rb b/config/routes.rb
index 0f2cbaee..7c32ee7b 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -4,14 +4,21 @@
get '/blockchain_info_callback' => "home#blockchain_info_callback", :as => "blockchain_info_callback"
- get '/:service/:repo/:action' => 'projects#edit', :constraints => {:service => /github/, :repo => /.+/, :action => /edit/}
- get '/:service/:repo/:action' => 'projects#decide_tip_amounts', :constraints => {:service => /github/, :repo => /.+/, :action => /decide_tip_amounts/}
- get '/:service/:repo' => 'projects#show', :constraints => {:service => /github/, :repo => /.+/}
+ # reserved devise routes (rejected pertty url usernames)
+ RESERVED_USER_ROUTES_REGEX = /(^(?:(?!^\d+$|\b(sign_in|cancel|sign_up|edit|confirmation|login)\b).)*$)/
+ get '/users/:name/tips' => 'tips#index', :constraints => {:name => /\RESERVED_USER_ROUTES_REGEX/}
+ get '/users/:name' => 'users#show', :constraints => {:name => /\RESERVED_USER_ROUTES_REGEX/}
+
+ get '/projects/:project_id/tips' => 'tips#index', :constraints => {:project_id => /\d+/}, :as => 'project_tips'
+ get '/projects/:project_id/deposits' => 'deposits#index', :constraints => {:project_id => /\d+/}, :as => 'project_deposits'
+ get '/:service/:repo/edit' => 'projects#edit', :constraints => {:service => /github/, :repo => /.+/}
+ get '/:service/:repo/decide_tip_amounts' => 'projects#decide_tip_amounts', :constraints => {:service => /github/, :repo => /.+/}
+ get '/:service/:repo/tips' => 'tips#index', :constraints => {:service => /github/, :repo => /.+/}, :as => 'project_tips_pretty'
+ get '/:service/:repo/deposits' => 'deposits#index', :constraints => {:service => /github/, :repo => /.+/}, :as => 'project_deposits_pretty'
+ get '/:service/:repo' => 'projects#show', :constraints => {:service => /github/, :repo => /.+/}
devise_for :users,
- :controllers => {
- :omniauth_callbacks => "users/omniauth_callbacks"
- }
+ :controllers => { :omniauth_callbacks => "users/omniauth_callbacks" }
resources :users, :only => [:show, :update, :index] do
collection do
@@ -24,65 +31,13 @@
get 'search'
end
member do
- get :decide_tip_amounts
+ get :decide_tip_amounts
patch :decide_tip_amounts
end
- resources :tips, :only => [:index]
- resources :deposits, :only => [:index]
end
- resources :tips, :only => [:index]
- resources :deposits, :only => [:index]
+ resources :tips, :only => [:index]
+ resources :deposits, :only => [:index]
resources :withdrawals, :only => [:index]
- # The priority is based upon order of creation: first created -> highest priority.
- # See how all your routes lay out with "rake routes".
-
- # Example of regular route:
- # get 'products/:id' => 'catalog#view'
-
- # Example of named route that can be invoked with purchase_url(id: product.id)
- # get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
-
- # Example resource route (maps HTTP verbs to controller actions automatically):
- # resources :products
-
- # Example resource route with options:
- # resources :products do
- # member do
- # get 'short'
- # post 'toggle'
- # end
- #
- # collection do
- # get 'sold'
- # end
- # end
-
- # Example resource route with sub-resources:
- # resources :products do
- # resources :comments, :sales
- # resource :seller
- # end
-
- # Example resource route with more complex sub-resources:
- # resources :products do
- # resources :comments
- # resources :sales do
- # get 'recent', on: :collection
- # end
- # end
-
- # Example resource route with concerns:
- # concern :toggleable do
- # post 'toggle'
- # end
- # resources :posts, concerns: :toggleable
- # resources :photos, concerns: :toggleable
-
- # Example resource route within a namespace:
- # namespace :admin do
- # # Directs /admin/products/* to Admin::ProductsController
- # # (app/controllers/admin/products_controller.rb)
- # resources :products
- # end
+ get '*path' => 'home#index'
end
From 4172d9af50d0dccc812d91a105105392f6e028e2 Mon Sep 17 00:00:00 2001
From: bill auger
Date: Tue, 4 Nov 2014 20:16:56 +0000
Subject: [PATCH 117/415] seperate test concerns by model
* merge in the latest project-management branch PR #141
* seperated concerns out of features/step_definitions/common.rb into
features/step_definitions/project_steps.rb
features/step_definitions/tips_steps.rb
features/step_definitions/user_steps.rb
* merged features/step_definitions/web.rb into
features/step_definitions/common.rb
* merged features/step_definitions/tip_modifier_interface.rb into
features/step_definitions/tips_steps.rb
---
app/controllers/application_controller.rb | 27 +-
app/controllers/deposits_controller.rb | 10 +-
app/controllers/projects_controller.rb | 24 +-
app/controllers/tips_controller.rb | 15 +-
app/helpers/projects_helper.rb | 8 +
config/routes.rb | 82 +-----
features/find_or_create_project.feature | 14 +-
features/manage_project.feature | 8 +-
features/pretty_paths.feature | 45 ++++
features/sign_up_sign_in.feature | 8 +-
features/step_definitions/common.rb | 241 +++++++-----------
features/step_definitions/project_steps.rb | 56 ++++
.../tip_modifier_interface.rb | 79 ------
features/step_definitions/tips_steps.rb | 195 ++++++++++++++
features/step_definitions/web.rb | 107 --------
features/tip_modifier_interface.feature | 28 +-
features/tipping_policies.feature | 4 +-
features/view_tips.feature | 6 +-
spec/controllers/users_controller_spec.rb | 24 +-
19 files changed, 495 insertions(+), 486 deletions(-)
create mode 100644 features/pretty_paths.feature
delete mode 100644 features/step_definitions/tip_modifier_interface.rb
create mode 100644 features/step_definitions/tips_steps.rb
delete mode 100644 features/step_definitions/web.rb
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index d87ef354..04bf89af 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -22,13 +22,28 @@ def load_locale
end
end
- def load_project(project)
- if project.is_a? Project
- @project = project
- else
- @project = Project.where(id: project).first
+ def load_project params
+ (is_project = self.is_a? ProjectsController) ||
+ (is_tips = self.is_a? TipsController ) ||
+ (is_deposits = self.is_a? DepositsController)
+
+ if params[:project_id].present? || params[:id].present?
+ return unless project_id = (is_project && params[:id]) ||
+ ((is_tips || is_deposits) && params[:project_id])
+
+ @project = Project.where(:id => project_id).first
+
+ if is_tips
+ redirect_to project_tips_pretty_path @project.host , @project.full_name
+ elsif is_deposits
+ redirect_to project_deposits_pretty_path @project.host , @project.full_name
+ end
+ elsif params[:service].present? && params[:repo].present?
+ @project = Project.where(host: params[:service]).
+ where('lower(`full_name`) = ?' , params[:repo].downcase).first
end
- unless @project
+
+ if @project.nil? && is_project
flash[:error] = I18n.t('errors.project_not_found')
redirect_to projects_path
end
diff --git a/app/controllers/deposits_controller.rb b/app/controllers/deposits_controller.rb
index 67a2b25c..b0b15d93 100644
--- a/app/controllers/deposits_controller.rb
+++ b/app/controllers/deposits_controller.rb
@@ -1,8 +1,8 @@
class DepositsController < ApplicationController
- before_action :load_project
+ before_action { load_project params }
def index
- if params[:project_id]
+ if @project
@deposits = @project.deposits
else
@deposits = Deposit.includes(:project)
@@ -15,10 +15,4 @@ def index
format.csv { render csv: @deposits, except: [:updated_at, :confirmations, :fee_size], add_methods: [:project_name, :fee, :confirmed?] }
end
end
-
- private
-
- def load_project
- super(params[:project_id]) if params[:project_id].present?
- end
end
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index e0d7b219..8f63fcfa 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -4,7 +4,8 @@ class ProjectsController < ApplicationController
include ProjectsHelper
before_filter :load_project, only: [:show, :edit, :update, :decide_tip_amounts]
- before_filter :redirect_to_pretty_url, only: [:show, :edit, :decide_tip_amounts]
+ before_filter :redirect_to_pretty_url, only: [:show, :edit, :decide_tip_amounts,
+ :tips, :deposits]
def index
@projects = Project.order(projects_order).page(params[:page]).per(30)
@@ -74,16 +75,7 @@ def decide_tip_amounts
private
- def load_project
- if params[:id].present?
- super(params[:id])
- elsif params[:service].present? && params[:repo].present?
- super(
- Project.where(host: params[:service]).
- where('lower(`full_name`) = ?', params[:repo].downcase).first
- )
- end
- end
+ def load_project ; super params ; end ;
def project_params
params.require(:project).permit(:branch, :disable_notifications, :hold_tips, tipping_policies_text_attributes: [:text])
@@ -105,11 +97,15 @@ def redirect_to_pretty_url
respond_to do |format|
case action_name
when 'show'
- path = pretty_project_path(@project)
+ path = pretty_project_path @project
when 'edit'
- path = pretty_project_edit_path(@project)
+ path = pretty_project_edit_path @project
when 'decide_tip_amounts'
- path = pretty_project_decide_tip_amounts_path(@project)
+ path = pretty_project_decide_tip_amounts_path @project
+ when 'tips'
+ path = pretty_project_tips_path @project
+ when 'deposits'
+ path = pretty_project_deposits_path @project
end
format.html { redirect_to path }
end
diff --git a/app/controllers/tips_controller.rb b/app/controllers/tips_controller.rb
index 08d8fd35..46c52463 100644
--- a/app/controllers/tips_controller.rb
+++ b/app/controllers/tips_controller.rb
@@ -1,6 +1,5 @@
class TipsController < ApplicationController
-
- before_action :load_project
+ before_filter { load_project params }
def index
if @project
@@ -24,16 +23,4 @@ def index
format.csv { render csv: @tips, except: [:updated_at, :commit, :commit_message, :refunded_at, :decided_at], add_methods: [:user_name, :project_name, :decided?, :claimed?, :paid?, :refunded?, :txid] }
end
end
-
-
- private
-
- def load_project
- if params[:project_id].present?
- super params[:project_id]
- elsif params[:service].present? && params[:repo].present?
- super Project.where(host: params[:service]).
- where('lower(`full_name`) = ?' , params[:repo].downcase).first
- end
- end
end
diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb
index 5911ecd9..7d0376fd 100644
--- a/app/helpers/projects_helper.rb
+++ b/app/helpers/projects_helper.rb
@@ -30,6 +30,14 @@ def pretty_project_decide_tip_amounts_path project
"#{pretty_project_path project}/decide_tip_amounts"
end
+ def pretty_project_tips_path project
+ "#{pretty_project_path project}/tips"
+ end
+
+ def pretty_project_deposits_path project
+ "#{pretty_project_path project}/deposits"
+ end
+
def pretty_project_url project
root_url.gsub(/\/$/,'') + pretty_project_path(project)
end
diff --git a/config/routes.rb b/config/routes.rb
index a75c653e..7c32ee7b 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -4,21 +4,21 @@
get '/blockchain_info_callback' => "home#blockchain_info_callback", :as => "blockchain_info_callback"
- # reserved routes (rejected pertty url usernames)
+ # reserved devise routes (rejected pertty url usernames)
RESERVED_USER_ROUTES_REGEX = /(^(?:(?!^\d+$|\b(sign_in|cancel|sign_up|edit|confirmation|login)\b).)*$)/
- get '/users/:name/tips' => 'tips#index', :constraints => {:name => /\RESERVED_USER_ROUTES_REGEX/}
- get '/users/:name' => 'users#show', :constraints => {:name => /\RESERVED_USER_ROUTES_REGEX/}
+ get '/users/:name/tips' => 'tips#index', :constraints => {:name => /\RESERVED_USER_ROUTES_REGEX/}
+ get '/users/:name' => 'users#show', :constraints => {:name => /\RESERVED_USER_ROUTES_REGEX/}
- get '/:service/:repo/edit' => 'projects#edit', :constraints => {:service => /github/, :repo => /.+/}
- get '/:service/:repo/decide_tip_amounts' => 'projects#decide_tip_amounts', :constraints => {:service => /github/, :repo => /.+/}
- get '/:service/:repo/tips' => 'tips#index', :constraints => {:service => /github/, :repo => /.+/}
- get '/:service/:repo/deposits' => 'deposits#index', :constraints => {:service => /github/, :repo => /.+/}
- get '/:service/:repo' => 'projects#show', :constraints => {:service => /github/, :repo => /.+/}
+ get '/projects/:project_id/tips' => 'tips#index', :constraints => {:project_id => /\d+/}, :as => 'project_tips'
+ get '/projects/:project_id/deposits' => 'deposits#index', :constraints => {:project_id => /\d+/}, :as => 'project_deposits'
+ get '/:service/:repo/edit' => 'projects#edit', :constraints => {:service => /github/, :repo => /.+/}
+ get '/:service/:repo/decide_tip_amounts' => 'projects#decide_tip_amounts', :constraints => {:service => /github/, :repo => /.+/}
+ get '/:service/:repo/tips' => 'tips#index', :constraints => {:service => /github/, :repo => /.+/}, :as => 'project_tips_pretty'
+ get '/:service/:repo/deposits' => 'deposits#index', :constraints => {:service => /github/, :repo => /.+/}, :as => 'project_deposits_pretty'
+ get '/:service/:repo' => 'projects#show', :constraints => {:service => /github/, :repo => /.+/}
devise_for :users,
- :controllers => {
- :omniauth_callbacks => "users/omniauth_callbacks"
- }
+ :controllers => { :omniauth_callbacks => "users/omniauth_callbacks" }
resources :users, :only => [:show, :update, :index] do
collection do
@@ -31,67 +31,13 @@
get 'search'
end
member do
- get :decide_tip_amounts
+ get :decide_tip_amounts
patch :decide_tip_amounts
end
- resources :tips, :only => [:index]
- resources :deposits, :only => [:index]
end
- resources :tips, :only => [:index]
- resources :deposits, :only => [:index]
+ resources :tips, :only => [:index]
+ resources :deposits, :only => [:index]
resources :withdrawals, :only => [:index]
- # The priority is based upon order of creation: first created -> highest priority.
- # See how all your routes lay out with "rake routes".
-
- # Example of regular route:
- # get 'products/:id' => 'catalog#view'
-
- # Example of named route that can be invoked with purchase_url(id: product.id)
- # get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
-
- # Example resource route (maps HTTP verbs to controller actions automatically):
- # resources :products
-
- # Example resource route with options:
- # resources :products do
- # member do
- # get 'short'
- # post 'toggle'
- # end
- #
- # collection do
- # get 'sold'
- # end
- # end
-
- # Example resource route with sub-resources:
- # resources :products do
- # resources :comments, :sales
- # resource :seller
- # end
-
- # Example resource route with more complex sub-resources:
- # resources :products do
- # resources :comments
- # resources :sales do
- # get 'recent', on: :collection
- # end
- # end
-
- # Example resource route with concerns:
- # concern :toggleable do
- # post 'toggle'
- # end
- # resources :posts, concerns: :toggleable
- # resources :photos, concerns: :toggleable
-
- # Example resource route within a namespace:
- # namespace :admin do
- # # Directs /admin/products/* to Admin::ProductsController
- # # (app/controllers/admin/products_controller.rb)
- # resources :products
- # end
-
get '*path' => 'home#index'
end
diff --git a/features/find_or_create_project.feature b/features/find_or_create_project.feature
index 3a2dc850..bf77b2c5 100644
--- a/features/find_or_create_project.feature
+++ b/features/find_or_create_project.feature
@@ -3,7 +3,7 @@ Feature: Visitors may search for and add projects
Given a "github" project named "seldon/seldons-project" exists
Scenario: Visitors may find existing projects
- Given I'm not logged in
+ Given I'm not signed in
And I visit the "projects" page
Then I should be on the "projects" page
When I fill "query" with: "seldons-project"
@@ -13,7 +13,7 @@ Feature: Visitors may search for and add projects
But I should not see "project not found"
Scenario: Visitors may not find non-existing projects
- Given I'm not logged in
+ Given I'm not signed in
And I visit the "projects" page
Then I should be on the "projects" page
When I fill "query" with: "no-such-repo"
@@ -23,7 +23,7 @@ Feature: Visitors may search for and add projects
But I should not see "seldon/seldons-project"
Scenario: Visitors may add new projects
- Given I'm not logged in
+ Given I'm not signed in
And I visit the "projects" page
Then I should be on the "projects" page
When I fill "query" with: "https://github.com/tip4commit/tip4commit"
@@ -33,7 +33,7 @@ Feature: Visitors may search for and add projects
But I should not see "seldon/seldons-project"
Scenario: Visitors may not add non-existing projects
- Given I'm not logged in
+ Given I'm not signed in
And I visit the "projects" page
Then I should be on the "projects" page
When I fill "query" with: "https://github.com/xxx-no-such-user-xxx/xxx-no-such-repo-xxx"
@@ -44,7 +44,7 @@ Feature: Visitors may search for and add projects
And I should not see "seldon/seldons-project"
Scenario: Visitors may not add bogus projects
- Given I'm not logged in
+ Given I'm not signed in
And I visit the "projects" page
Then I should be on the "projects" page
When I fill "query" with: "https://shithub.com/nouser/norepo"
@@ -55,7 +55,7 @@ Feature: Visitors may search for and add projects
And I should not see "seldon/seldons-project"
Scenario: Projects with individual owner should not show project avatar
- Given I'm not logged in
+ Given I'm not signed in
And I visit the "projects" page
Then I should be on the "projects" page
When I fill "query" with: "seldons-project"
@@ -65,7 +65,7 @@ Feature: Visitors may search for and add projects
And there should not be a project avatar image visible
Scenario: Projects owned by an organization should show project avatar
- Given I'm not logged in
+ Given I'm not signed in
And I visit the "projects" page
Then I should be on the "projects" page
When I fill "query" with: "https://github.com/tip4commit/tip4commit"
diff --git a/features/manage_project.feature b/features/manage_project.feature
index 55f72f41..975e2f84 100644
--- a/features/manage_project.feature
+++ b/features/manage_project.feature
@@ -2,8 +2,8 @@ Feature: Collaborators may manage project
Background:
Given a "github" project named "seldon/seldons-project" exists
- Scenario: Collaborators must be logged-in to manage project
- Given I'm not logged in
+ Scenario: Collaborators must be signed in to manage project
+ Given I'm not signed in
When I visit the "seldon/seldons-project github-project" page
Then I should be on the "seldon/seldons-project github-project" page
And I should see "seldon/seldons-project"
@@ -20,7 +20,7 @@ Feature: Collaborators may manage project
And I should not see "Decide tips"
Scenario: Non-collaborators should not be able to manage project
- Given I'm logged in as "someone-else"
+ Given I'm signed in as "someone-else"
When I visit the "seldon/seldons-project github-project" page
Then I should be on the "seldon/seldons-project github-project" page
And I should see "seldon/seldons-project"
@@ -37,7 +37,7 @@ Feature: Collaborators may manage project
And I should not see "Decide tips"
Scenario: New projects should show "Pending initial sync"
- Given I'm logged in as "seldon"
+ Given I'm signed in as "seldon"
When I visit the "seldon/seldons-project github-project" page
Then I should be on the "seldon/seldons-project github-project" page
And I should see "seldon/seldons-project"
diff --git a/features/pretty_paths.feature b/features/pretty_paths.feature
new file mode 100644
index 00000000..c7606fb4
--- /dev/null
+++ b/features/pretty_paths.feature
@@ -0,0 +1,45 @@
+Feature: The site routes pretty paths uniformly
+ Background:
+ Given a "github" project named "seldon/seldons-project" exists
+ And a user named "yugo" exists with a bitcoin address
+
+
+ Scenario: Project show page is accessible via pretty path
+ When I visit the "seldon/seldons-project github-project" page
+ Then I should be on the "seldon/seldons-project github-project" page
+
+ Scenario: Project show page is accessible via id
+ When I browse to the explicit path "projects/1"
+ Then I should be on the "seldon/seldons-project github-project" page
+
+ Scenario: Project edit page is accessible via pretty path
+ When I visit the "seldon/seldons-project github-project edit" page
+ Then I should be on the "seldon/seldons-project github-project edit" page
+
+ Scenario: Project show page is accessible via id
+ When I browse to the explicit path "projects/1/edit"
+ Then I should be on the "seldon/seldons-project github-project edit" page
+
+ Scenario: Project decide_tip_amounts page is accessible via pretty path
+ When I visit the "seldon/seldons-project github-project decide_tip_amounts" page
+ Then I should be on the "seldon/seldons-project github-project decide_tip_amounts" page
+
+ Scenario: Project decide_tip_amounts page is accessible via id
+ When I browse to the explicit path "projects/1/decide_tip_amounts"
+ Then I should be on the "seldon/seldons-project github-project decide_tip_amounts" page
+
+ Scenario: Project tips page is accessible via pretty path
+ When I visit the "seldon/seldons-project github-project tips" page
+ Then I should be on the "seldon/seldons-project github-project tips" page
+
+ Scenario: Project tips page is accessible via id
+ When I browse to the explicit path "projects/1/tips"
+ Then I should be on the "seldon/seldons-project github-project tips" page
+
+ Scenario: Project deposits page is accessible via pretty path
+ When I visit the "seldon/seldons-project github-project deposits" page
+ Then I should be on the "seldon/seldons-project github-project deposits" page
+
+ Scenario: Project deposits page is accessible via id
+ When I browse to the explicit path "projects/1/deposits"
+ Then I should be on the "seldon/seldons-project github-project deposits" page
diff --git a/features/sign_up_sign_in.feature b/features/sign_up_sign_in.feature
index 422134ac..c88e6ead 100644
--- a/features/sign_up_sign_in.feature
+++ b/features/sign_up_sign_in.feature
@@ -5,7 +5,7 @@ Feature: Visitors should be able to sign_up and sign_in
| seldon |
Scenario Outline: Visitors should see sign_up and sign_in links on all pages
- Given I'm not logged in
+ Given I'm not signed in
When I visit the page
Then I should be on the page
And I should see "Sign up" in the header
@@ -24,7 +24,7 @@ Feature: Visitors should be able to sign_up and sign_in
| "seldon/seldons-project github-project deposits" |
Scenario: Visitors should see sign_up but not sign_in links on sign_in page
- Given I'm not logged in
+ Given I'm not signed in
When I visit the "sign_in" page
Then I should be on the "sign_in" page
And I should see "Sign up" in the header
@@ -32,7 +32,7 @@ Feature: Visitors should be able to sign_up and sign_in
And I should not see "Sign out" in the header
Scenario: Visitors should see sign_in but not sign_up links on sign_up page
- Given I'm not logged in
+ Given I'm not signed in
When I visit the "sign_up" page
Then I should be on the "sign_up" page
And I should not see "Sign up" in the header
@@ -40,7 +40,7 @@ Feature: Visitors should be able to sign_up and sign_in
And I should not see "Sign out" in the header
Scenario Outline: Logged in users should see only sign_out link on every page
- Given I'm logged in as "seldon"
+ Given I'm signed in as "seldon"
When I visit the page
Then I should be on the page
And I should not see "Sign up" in the header
diff --git a/features/step_definitions/common.rb b/features/step_definitions/common.rb
index b52971ad..b349a73d 100644
--- a/features/step_definitions/common.rb
+++ b/features/step_definitions/common.rb
@@ -5,185 +5,122 @@
Project.any_instance.stub(:branches).and_return(%w(master))
end
-Then(/^there should be (\d+) email sent$/) do |arg1|
- ActionMailer::Base.deliveries.size.should eq(arg1.to_i)
-end
-
-When(/^the email counters are reset$/) do
- ActionMailer::Base.deliveries.clear
-end
-
-Given(/^the tip percentage per commit is "(.*?)"$/) do |arg1|
- CONFIG["tip"] = arg1.to_f
-end
-
-Given(/^our fee is "(.*?)"$/) do |arg1|
- CONFIG["our_fee"] = arg1.to_f
-end
-
-def create_github_project project_name
- if (@github_project_1.present? && (project_name.eql? @github_project_1.full_name)) ||
- (@github_project_2.present? && (project_name.eql? @github_project_2.full_name))
- raise "duplicate project_name '#{project_name}'"
- elsif @github_project_3.present?
- raise "the maximum of three test projects already exist"
- end
-
-# @current_project is also assigned in the "considering the .. project named ..." step
- @current_project = Project.create! :full_name => project_name , # e.g. "me/my-project"
- :github_id => Digest::SHA1.hexdigest(project_name) ,
- :bitcoin_address => 'mq4NtnmQoQoPfNWEPbhSvxvncgtGo6L8WY'
- if @github_project_2.present? ; @github_project_3 = @current_project ;
- elsif @github_project_1.present? ; @github_project_2 = @current_project ;
- else @github_project_1 = @current_project ;
- end
-end
-
-def create_bitbicket_project project_name
- raise "unknown service" # nyi
-end
-
-When /^regarding the "(.*?)" project named "(.*?)"$/ do |service , project_name|
-# @current_project is also assigned in create_github_project and create_bitbucket_project
-
- @current_project = find_project service , project_name
-end
-
-def service_do service , method_dict
-=begin e.g.
- service_do 'github' , {'github' => lambda {create_github_project project_name} ,
- 'bitbucket' => lambda {create_bitbicket_project project_name} }
-=end
- (method_dict.has_key? service)? method_dict[service].call : (raise "unknown service")
-end
-
-Given(/^a "(.*?)" project named "(.*?)" exists$/) do |service , project_name|
- service_do service , {'github' => lambda {create_github_project project_name} ,
- 'bitbucket' => lambda {create_bitbicket_project project_name} }
-end
-
-Given(/^a deposit of "(.*?)" is made$/) do |deposit|
- Deposit.create!(project: @current_project, amount: deposit.to_d * 1e8, confirmations: 2)
-end
-
-def add_new_commit commit_id , nickname , params = {}
- raise "duplicate commit_id" if (find_new_commit commit_id).present?
-
- defaults = {
- sha: commit_id,
- commit: {
- message: "Some changes",
- author: {
- email: "#{nickname}@example.com",
- },
+Given /^I'm signed in as "(.*?)"$/ do |nickname|
+ email = "#{nickname.parameterize}@example.com"
+
+ OmniAuth.config.test_mode = true
+ OmniAuth.config.mock_auth[:github] = {
+ "info" => {
+ "nickname" => nickname ,
+ "primary_email" => email ,
+ "verified_emails" => [email] ,
},
- }
-
- project_id = @current_project.id
- @new_commits ||= {}
- @new_commits[project_id] ||= {}
- @new_commits[project_id][commit_id] = defaults.deep_merge params
-end
-
-def find_new_commit commit_id
- (@new_commits || {}).each_value do |commits|
- return commits[commit_id] unless commits[commit_id].nil?
+ }.to_ostruct
+ visit root_path
+ first(:link, "Sign in").click
+ click_on "Sign in with Github"
+ page.should have_content("Successfully authenticated")
+
+ step "a user named \"#{nickname}\" exists without a bitcoin address"
+end
+
+Given /^I'm not signed in$/ do
+ visit root_path
+ if page.has_content?("Sign out")
+ click_on "Sign out"
+ page.should have_content("Signed out successfully")
+ else
+ page.should have_content("Sign in")
end
-
- nil
end
-Given(/^a new commit "([^"]*?)" is made by a user named "(.*?)"$/) do |commit_id , nickname|
- add_new_commit commit_id , nickname
-end
-
-Given(/^(\d+) new commit.? (?:is|are) made by a user named "(.*?)"$/) do |n_commits , nickname|
- n_commits.to_i.times do
- add_new_commit Digest::SHA1.hexdigest(SecureRandom.hex) , nickname
+Given (/^I sign in as "(.*?)"$/) { |nickname| step "I'm signed in as \"#{nickname}\"" }
+
+Given (/^I sign out$/) { step "I'm not signed in" }
+
+def parse_path_from_page_string page_string
+ path = nil
+
+ # explicit cases
+ # e.g. "a-user/a-project github project edit"
+ # e.g. "a-user user edit"
+ tokens = page_string.split ' '
+ name = tokens[0]
+ model = tokens[1]
+ action = tokens[2] || '' # '' => 'show'
+ is_user = model.eql? 'user'
+ is_project = ['github-project' , 'bitbucket-project'].include? model
+ if is_project
+ projects_paths = ['' , 'edit' , 'decide_tip_amounts' , 'tips' , 'deposits']
+ is_valid_path = projects_paths.include? action
+ service = model.split('-').first
+ path = "/#{service}/#{name}/#{action}" if is_valid_path
+ elsif is_user
+ user_paths = ['' , 'tips']
+ is_valid_path = user_paths.include? action
+# path = "/users/#{name}/#{action}" if is_valid_path # TODO: nyi
+ path = "/users/#{@users[name].id}/#{action}" if is_valid_path
+
+ # implicit cases
+ else case page_string
+ when 'home' ; path = root_path ;
+ when 'sign_up' ; path = new_user_registration_path ;
+ when 'sign_in' ; path = new_user_session_path ;
+ when 'users' ; path = users_path ;
+ when 'projects' ; path = projects_path ;
+ when 'search' ; path = search_projects_path ;
+ when 'tips' ; path = tips_path ;
+ when 'deposits' ; path = deposits_path ;
+ when 'withdrawals' ; path = withdrawals_path ;
+ end
end
-end
-
-Given(/^a new commit "([^"]*?)" is made$/) do |commit_id|
- add_new_commit commit_id , "unknown-user"
-end
-
-Given(/^a new commit "(.*?)" is made with parent "([^"]*?)"$/) do |commit_id, parent_commit_id|
- add_new_commit commit_id , "unknown-user" , parents: [{sha: parent_commit_id}]
-end
-Given(/^a new commit "(.*?)" is made with parent "(.*?)" and "(.*?)"$/) do |commit_id, parentA_commit_id, parentB_commit_id|
- params = { parents: [{sha: parentA_commit_id}, {sha: parentB_commit_id}], commit: {message: "Merge #{parentA_commit_id} and #{parentB_commit_id}"} }
- add_new_commit commit_id , "unknown-user" , params
+ path || (raise "unknown page")
end
-Given(/^the author of commit "(.*?)" is "(.*?)"$/) do |commit_id , nickname|
- commit = find_new_commit commit_id
- raise "no such commit" if commit.nil?
-
- commit.deep_merge!(author: {login: nickname}, commit: {author: {email: "#{nickname}@example.com"}})
+Given(/^I visit the "(.*?)" page$/) do |page_string|
+ visit parse_path_from_page_string page_string
end
-Given(/^the message of commit "(.*?)" is "(.*?)"$/) do |commit_id , commit_msg|
- commit = find_new_commit commit_id
- raise "no such commit" if commit.nil?
-
- commit.deep_merge!(commit: {message: commit_msg})
+Given(/^I browse to the explicit path "(.*?)"$/) do |url|
+ visit url
end
-Given(/^the most recent commit is "(.*?)"$/) do |commit_id|
- @current_project.update! last_commit: commit_id
-end
+Then(/^I should be on the "(.*?)" page$/) do |page_string|
+ expected = parse_path_from_page_string page_string
+ actual = page.current_path
-Then(/^the most recent commit should be "(.*?)"$/) do |commit_id|
- @current_project.reload.last_commit.should eq commit_id
+ (expected.index actual).should eq 0 # ignore trailing '/'
end
-When(/^the new commits are loaded$/) do
- raise "no commits have been assigned" if @new_commits.nil?
-
- [@github_project_1 , @github_project_2 , @github_project_3].each do |project|
- next if project.nil?
-
- project.reload
- new_commits = @new_commits[project.id].values.map(&:to_ostruct)
- project.should_receive(:new_commits).and_return(new_commits)
- project.tip_commits
- end
+Given(/^I click on "(.*?)"$/) do |arg1|
+ click_on(arg1)
end
-Given(/^the project holds tips$/) do
- @current_project.update(hold_tips: true)
+Given(/^I check "(.*?)"$/) do |arg1|
+ check(arg1)
end
-Then(/^there should be no tip for commit "(.*?)"$/) do |arg1|
- Tip.where(commit: arg1).to_a.should eq([])
+Then(/^I should see "(.*?)"$/) do |arg1|
+ page.should have_content(arg1)
end
-Then(/^there should be a tip of "(.*?)" for commit "(.*?)"$/) do |arg1, arg2|
- amount = Tip.find_by(commit: arg2).amount
- amount.should_not be_nil
- (amount.to_d / 1e8).should eq(arg1.to_d)
+Then(/^I should not see "(.*?)"$/) do |arg1|
+ page.should have_no_content(arg1)
end
-Then(/^the tip amount for commit "(.*?)" should be undecided$/) do |arg1|
- Tip.find_by(commit: arg1).undecided?.should eq(true)
+Given(/^I fill "(.*?)" with:$/) do |arg1, string|
+ fill_in arg1, with: string
end
-Given(/^the project collaborators are:$/) do |table|
- @collaborators = []
- table.raw.each do |collaborator_name,|
- @collaborators << collaborator_name unless @collaborators.include? collaborator_name
- end
+Given(/^I fill "(.*?)" with: "(.*?)"$/) do |text_field, string|
+ fill_in text_field, with: string
end
-Given(/^the project collaborators are loaded$/) do
- @current_project.reload
- @current_project.collaborators.each(&:destroy)
- @collaborators.each do |name,|
- @current_project.collaborators.create!(login: name)
- end
+Then(/^there should be (\d+) email sent$/) do |arg1|
+ ActionMailer::Base.deliveries.size.should eq(arg1.to_i)
end
-Given(/^an illustration of the history is:$/) do |string|
- # not checked
+When(/^the email counters are reset$/) do
+ ActionMailer::Base.deliveries.clear
end
diff --git a/features/step_definitions/project_steps.rb b/features/step_definitions/project_steps.rb
index 084817bf..12f96c66 100644
--- a/features/step_definitions/project_steps.rb
+++ b/features/step_definitions/project_steps.rb
@@ -1,4 +1,45 @@
+def create_github_project project_name
+ if (@github_project_1.present? && (project_name.eql? @github_project_1.full_name)) ||
+ (@github_project_2.present? && (project_name.eql? @github_project_2.full_name))
+ raise "duplicate project_name '#{project_name}'"
+ elsif @github_project_3.present?
+ raise "the maximum of three test projects already exist"
+ end
+
+# @current_project is also assigned in the "considering the .. project named ..." step
+ @current_project = Project.create! :full_name => project_name , # e.g. "me/my-project"
+ :github_id => Digest::SHA1.hexdigest(project_name) ,
+ :bitcoin_address => 'mq4NtnmQoQoPfNWEPbhSvxvncgtGo6L8WY'
+ if @github_project_2.present? ; @github_project_3 = @current_project ;
+ elsif @github_project_1.present? ; @github_project_2 = @current_project ;
+ else @github_project_1 = @current_project ;
+ end
+end
+
+def create_bitbicket_project project_name
+ raise "unknown service" # nyi
+end
+
+When /^regarding the "(.*?)" project named "(.*?)"$/ do |service , project_name|
+# @current_project is also assigned in create_github_project and create_bitbucket_project
+
+ @current_project = find_project service , project_name
+end
+
+def service_do service , method_dict
+=begin e.g.
+ service_do 'github' , {'github' => lambda {create_github_project project_name} ,
+ 'bitbucket' => lambda {create_bitbicket_project project_name} }
+=end
+ (method_dict.has_key? service)? method_dict[service].call : (raise "unknown service")
+end
+
+Given(/^a "(.*?)" project named "(.*?)" exists$/) do |service , project_name|
+ service_do service , {'github' => lambda {create_github_project project_name} ,
+ 'bitbucket' => lambda {create_bitbicket_project project_name} }
+end
+
When /^the project syncs with the remote repo$/ do
# in the real world a project has no information regarding commits
# nor collaborators until the project initially syncs
@@ -19,3 +60,18 @@
page.should have_xpath avatar_xpath
end
end
+
+Given(/^the project collaborators are:$/) do |table|
+ @collaborators = []
+ table.raw.each do |collaborator_name,|
+ @collaborators << collaborator_name unless @collaborators.include? collaborator_name
+ end
+end
+
+Given(/^the project collaborators are loaded$/) do
+ @current_project.reload
+ @current_project.collaborators.each(&:destroy)
+ @collaborators.each do |name,|
+ @current_project.collaborators.create!(login: name)
+ end
+end
diff --git a/features/step_definitions/tip_modifier_interface.rb b/features/step_definitions/tip_modifier_interface.rb
deleted file mode 100644
index d89eac8e..00000000
--- a/features/step_definitions/tip_modifier_interface.rb
+++ /dev/null
@@ -1,79 +0,0 @@
-When(/^I choose the amount "(.*?)" on commit "(.*?)"$/) do |arg1, arg2|
- within find(".decide-tip-amounts-table tbody tr", text: arg2) do
- choose arg1
- end
-end
-
-When(/^I choose the amount "(.*?)" on all commits$/) do |arg1|
- all(".decide-tip-amounts-table tbody tr").each do |tr|
- within tr do
- choose arg1
- end
- end
-end
-
-When(/^I send a forged request to enable tip holding on the project$/) do
- page.driver.browser.process_and_follow_redirects(:patch, project_path(@current_project), project: {hold_tips: "1"})
-end
-
-Then(/^I should see an access denied$/) do
- page.should have_content("You are not authorized to perform this action!")
-end
-
-Then(/^the project should not hold tips$/) do
- @current_project.reload.hold_tips.should eq(false)
-end
-
-Then(/^the project should hold tips$/) do
- @current_project.reload.hold_tips.should eq(true)
-end
-
-Given(/^the project has undedided tips$/) do
- create(:undecided_tip, project: @current_project)
- @current_project.reload.should have_undecided_tips
-end
-
-Given(/^the project has (\d+) undecided tip$/) do |arg1|
- @current_project.tips.undecided.each(&:destroy)
- create(:undecided_tip, project: @current_project)
- @current_project.reload.should have_undecided_tips
-end
-
-Given(/^I send a forged request to set the amount of the first undecided tip of the project$/) do
- tip = @current_project.tips.undecided.first
- tip.should_not be_nil
- params = {
- project: {
- tips_attributes: {
- "0" => {
- id: tip.id,
- amount_percentage: "5",
- },
- },
- },
- }
-
- page.driver.browser.process_and_follow_redirects(:patch, decide_tip_amounts_project_path(@current_project), params)
-end
-
-When(/^I send a forged request to change the percentage of commit "(.*?)" to "(.*?)"$/) do |commit , percentage|
- tip = @current_project.tips.detect { |t| t.commit == commit }
- tip.should_not be_nil
- params = {
- project: {
- tips_attributes: {
- "0" => {
- id: tip.id,
- amount_percentage: percentage,
- },
- },
- },
- }
-
- path = decide_tip_amounts_project_path @current_project
- page.driver.browser.process_and_follow_redirects :patch , path , params
-end
-
-Then(/^the project should have (\d+) undecided tips$/) do |arg1|
- @current_project.tips.undecided.size.should eq(arg1.to_i)
-end
diff --git a/features/step_definitions/tips_steps.rb b/features/step_definitions/tips_steps.rb
new file mode 100644
index 00000000..a27fea9f
--- /dev/null
+++ b/features/step_definitions/tips_steps.rb
@@ -0,0 +1,195 @@
+
+Given(/^the tip percentage per commit is "(.*?)"$/) do |arg1|
+ CONFIG["tip"] = arg1.to_f
+end
+
+Given(/^our fee is "(.*?)"$/) do |arg1|
+ CONFIG["our_fee"] = arg1.to_f
+end
+
+Given(/^a deposit of "(.*?)" is made$/) do |deposit|
+ Deposit.create!(project: @current_project, amount: deposit.to_d * 1e8, confirmations: 2)
+end
+
+def add_new_commit commit_id , nickname , params = {}
+ raise "duplicate commit_id" if (find_new_commit commit_id).present?
+
+ defaults = {
+ sha: commit_id,
+ commit: {
+ message: "Some changes",
+ author: {
+ email: "#{nickname}@example.com",
+ },
+ },
+ }
+
+ project_id = @current_project.id
+ @new_commits ||= {}
+ @new_commits[project_id] ||= {}
+ @new_commits[project_id][commit_id] = defaults.deep_merge params
+end
+
+def find_new_commit commit_id
+ (@new_commits || {}).each_value do |commits|
+ return commits[commit_id] unless commits[commit_id].nil?
+ end
+
+ nil
+end
+
+Given(/^a new commit "([^"]*?)" is made by a user named "(.*?)"$/) do |commit_id , nickname|
+ add_new_commit commit_id , nickname
+end
+
+Given(/^(\d+) new commit.? (?:is|are) made by a user named "(.*?)"$/) do |n_commits , nickname|
+ n_commits.to_i.times do
+ add_new_commit Digest::SHA1.hexdigest(SecureRandom.hex) , nickname
+ end
+end
+
+Given(/^a new commit "([^"]*?)" is made$/) do |commit_id|
+ add_new_commit commit_id , "unknown-user"
+end
+
+Given(/^a new commit "(.*?)" is made with parent "([^"]*?)"$/) do |commit_id, parent_commit_id|
+ add_new_commit commit_id , "unknown-user" , parents: [{sha: parent_commit_id}]
+end
+
+Given(/^a new commit "(.*?)" is made with parent "(.*?)" and "(.*?)"$/) do |commit_id, parentA_commit_id, parentB_commit_id|
+ params = { parents: [{sha: parentA_commit_id}, {sha: parentB_commit_id}], commit: {message: "Merge #{parentA_commit_id} and #{parentB_commit_id}"} }
+ add_new_commit commit_id , "unknown-user" , params
+end
+
+Given(/^the author of commit "(.*?)" is "(.*?)"$/) do |commit_id , nickname|
+ commit = find_new_commit commit_id
+ raise "no such commit" if commit.nil?
+
+ commit.deep_merge!(author: {login: nickname}, commit: {author: {email: "#{nickname}@example.com"}})
+end
+
+Given(/^the message of commit "(.*?)" is "(.*?)"$/) do |commit_id , commit_msg|
+ commit = find_new_commit commit_id
+ raise "no such commit" if commit.nil?
+
+ commit.deep_merge!(commit: {message: commit_msg})
+end
+
+Given(/^the most recent commit is "(.*?)"$/) do |commit_id|
+ @current_project.update! last_commit: commit_id
+end
+
+Then(/^the most recent commit should be "(.*?)"$/) do |commit_id|
+ @current_project.reload.last_commit.should eq commit_id
+end
+
+When(/^the new commits are loaded$/) do
+ raise "no commits have been assigned" if @new_commits.nil?
+
+ [@github_project_1 , @github_project_2 , @github_project_3].each do |project|
+ next if project.nil?
+
+ project.reload
+ new_commits = @new_commits[project.id].values.map(&:to_ostruct)
+ project.should_receive(:new_commits).and_return(new_commits)
+ project.tip_commits
+ end
+end
+
+Given(/^the project holds tips$/) do
+ @current_project.update(hold_tips: true)
+end
+
+Then(/^there should be no tip for commit "(.*?)"$/) do |arg1|
+ Tip.where(commit: arg1).to_a.should eq([])
+end
+
+Then(/^there should be a tip of "(.*?)" for commit "(.*?)"$/) do |arg1, arg2|
+ amount = Tip.find_by(commit: arg2).amount
+ amount.should_not be_nil
+ (amount.to_d / 1e8).should eq(arg1.to_d)
+end
+
+Then(/^the tip amount for commit "(.*?)" should be undecided$/) do |arg1|
+ Tip.find_by(commit: arg1).undecided?.should eq(true)
+end
+
+When(/^I choose the amount "(.*?)" on commit "(.*?)"$/) do |arg1, arg2|
+ within find(".decide-tip-amounts-table tbody tr", text: arg2) do
+ choose arg1
+ end
+end
+
+When(/^I choose the amount "(.*?)" on all commits$/) do |arg1|
+ all(".decide-tip-amounts-table tbody tr").each do |tr|
+ within tr do
+ choose arg1
+ end
+ end
+end
+
+When(/^I send a forged request to enable tip holding on the project$/) do
+ page.driver.browser.process_and_follow_redirects(:patch, project_path(@current_project), project: {hold_tips: "1"})
+end
+
+Then(/^I should see an access denied$/) do
+ page.should have_content("You are not authorized to perform this action!")
+end
+
+Then(/^the project should not hold tips$/) do
+ @current_project.reload.hold_tips.should eq(false)
+end
+
+Then(/^the project should hold tips$/) do
+ @current_project.reload.hold_tips.should eq(true)
+end
+
+Given(/^the project has undedided tips$/) do
+ create(:undecided_tip, project: @current_project)
+ @current_project.reload.should have_undecided_tips
+end
+
+Given(/^the project has (\d+) undecided tip$/) do |arg1|
+ @current_project.tips.undecided.each(&:destroy)
+ create(:undecided_tip, project: @current_project)
+ @current_project.reload.should have_undecided_tips
+end
+
+Given(/^I send a forged request to set the amount of the first undecided tip of the project$/) do
+ tip = @current_project.tips.undecided.first
+ tip.should_not be_nil
+ params = {
+ project: {
+ tips_attributes: {
+ "0" => {
+ id: tip.id,
+ amount_percentage: "5",
+ },
+ },
+ },
+ }
+
+ page.driver.browser.process_and_follow_redirects(:patch, decide_tip_amounts_project_path(@current_project), params)
+end
+
+When(/^I send a forged request to change the percentage of commit "(.*?)" to "(.*?)"$/) do |commit , percentage|
+ tip = @current_project.tips.detect { |t| t.commit == commit }
+ tip.should_not be_nil
+ params = {
+ project: {
+ tips_attributes: {
+ "0" => {
+ id: tip.id,
+ amount_percentage: percentage,
+ },
+ },
+ },
+ }
+
+ path = decide_tip_amounts_project_path @current_project
+ page.driver.browser.process_and_follow_redirects :patch , path , params
+end
+
+Then(/^the project should have (\d+) undecided tips$/) do |arg1|
+ @current_project.tips.undecided.size.should eq(arg1.to_i)
+end
diff --git a/features/step_definitions/web.rb b/features/step_definitions/web.rb
deleted file mode 100644
index 5eec7462..00000000
--- a/features/step_definitions/web.rb
+++ /dev/null
@@ -1,107 +0,0 @@
-Given /^I'm signed in as "(.*?)"$/ do |nickname|
- email = "#{nickname.parameterize}@example.com"
-
- OmniAuth.config.test_mode = true
- OmniAuth.config.mock_auth[:github] = {
- "info" => {
- "nickname" => nickname ,
- "primary_email" => email ,
- "verified_emails" => [email] ,
- },
- }.to_ostruct
- visit root_path
- first(:link, "Sign in").click
- click_on "Sign in with Github"
- page.should have_content("Successfully authenticated")
-
- step "a user named \"#{nickname}\" exists without a bitcoin address"
-end
-
-Given /^I'm not signed in$/ do
- visit root_path
- if page.has_content?("Sign out")
- click_on "Sign out"
- page.should have_content("Signed out successfully")
- else
- page.should have_content("Sign in")
- end
-end
-
-Given (/^I sign in as "(.*?)"$/) { |nickname| step "I'm signed in as \"#{nickname}\"" }
-
-Given (/^I sign out$/) { step "I sign out" }
-
-def parse_path_from_page_string page_string
- path = nil
-
- # explicit cases
- # e.g. "a-user/a-project github project edit"
- # e.g. "a-user user edit"
- tokens = page_string.split ' '
- name = tokens[0]
- model = tokens[1]
- action = tokens[2] || ''
- is_user = model.eql? 'user'
- is_project = ['github-project' , 'bitbucket-project'].include? model
- if is_project
- projects_paths = ['' , 'edit' , 'decide_tip_amounts' , 'tips' , 'deposits'] # '' => 'show'
- is_valid_path = projects_paths.include? action
- service = model.split('-').first
- path = "/#{service}/#{name}/#{action}" if is_valid_path
- elsif is_user
- user_paths = ['' , 'tips']
- is_valid_path = user_paths.include? action
-# path = "/users/#{name}/#{action}" if is_valid_path # TODO: nyi
- path = "/users/#{@users[name].id}/#{action}" if is_valid_path
-
- # implicit cases
- else case page_string
- when 'home' ; path = root_path ;
- when 'sign_up' ; path = new_user_registration_path ;
- when 'sign_in' ; path = new_user_session_path ;
- when 'users' ; path = users_path ;
- when 'projects' ; path = projects_path ;
- when 'search' ; path = search_projects_path ;
- when 'tips' ; path = tips_path ;
- when 'deposits' ; path = deposits_path ;
- when 'withdrawals' ; path = withdrawals_path ;
- end
- end
-
- path || (raise "unknown page")
-end
-
-Given(/^I visit the "(.*?)" page$/) do |page_string|
- visit parse_path_from_page_string page_string
-end
-
-Then(/^I should be on the "(.*?)" page$/) do |page_string|
- expected = parse_path_from_page_string page_string
- actual = page.current_path
-
- (expected.index actual).should eq 0 # ignore trailing '/'
-end
-
-Given(/^I click on "(.*?)"$/) do |arg1|
- click_on(arg1)
-end
-
-Given(/^I check "(.*?)"$/) do |arg1|
- check(arg1)
-end
-
-Then(/^I should see "(.*?)"$/) do |arg1|
- page.should have_content(arg1)
-end
-
-Then(/^I should not see "(.*?)"$/) do |arg1|
- page.should have_no_content(arg1)
-end
-
-Given(/^I fill "(.*?)" with:$/) do |arg1, string|
- fill_in arg1, with: string
-end
-
-Given(/^I fill "(.*?)" with: "(.*?)"$/) do |text_field, string|
- fill_in text_field, with: string
-end
diff --git a/features/tip_modifier_interface.feature b/features/tip_modifier_interface.feature
index 74f95041..c5c06313 100644
--- a/features/tip_modifier_interface.feature
+++ b/features/tip_modifier_interface.feature
@@ -9,8 +9,8 @@ Feature: A project collaborator can change the tips of commits
And our fee is "0"
And a deposit of "500" is made
And the most recent commit is "AAA"
- And a new commit "BBB" with parent "AAA" is made
- And a new commit "CCC" with parent "BBB" is made
+ And a new commit "BBB" is made with parent "AAA"
+ And a new commit "CCC" is made with parent "BBB"
And the author of commit "BBB" is "yugo"
And the author of commit "CCC" is "gaal"
@@ -21,7 +21,7 @@ Feature: A project collaborator can change the tips of commits
And there should be 0 email sent
Scenario: A collaborator wants to alter the tips
- Given I'm logged in as "seldon"
+ Given I'm signed in as "seldon"
When the project syncs with the remote repo
And I visit the "seldon/seldons-project github-project" page
Then I should be on the "seldon/seldons-project github-project" page
@@ -32,13 +32,13 @@ Feature: A project collaborator can change the tips of commits
Then I should be on the "seldon/seldons-project github-project" page
And I should see "The project settings have been updated"
- When a new commit "DDD" with parent "CCC" is made
+ When a new commit "DDD" is made with parent "CCC"
And the author of commit "DDD" is "yugo"
And the message of commit "DDD" is "yugo's trivial commit DDD"
- And a new commit "EEE" with parent "DDD" is made
+ And a new commit "EEE" is made with parent "DDD"
And the author of commit "EEE" is "gaal"
And the message of commit "EEE" is "gaal's tiny commit EEE"
- When a new commit "FFF" with parent "EEE" is made
+ When a new commit "FFF" is made with parent "EEE"
And the author of commit "FFF" is "newguy"
And the message of commit "FFF" is "newguy's unrewarded commit EEE"
When the project syncs with the remote repo
@@ -82,33 +82,33 @@ Feature: A project collaborator can change the tips of commits
And there should be 0 email sent
Scenario: A non collaborator does not see the settings button
- Given I'm logged in as "yugo"
+ Given I'm signed in as "yugo"
And I visit the "seldon/seldons-project github-project" page
Then I should be on the "seldon/seldons-project github-project" page
And I should not see "Change project settings"
Scenario: A non collaborator does not see the decide tip amounts button
Given the project has undedided tips
- And I'm logged in as "yugo"
+ And I'm signed in as "yugo"
And I visit the "seldon/seldons-project github-project" page
Then I should be on the "seldon/seldons-project github-project" page
And I should not see "Decide tip amounts"
Scenario: A non collaborator goes to the edit page of a project
- Given I'm logged in as "yugo"
+ Given I'm signed in as "yugo"
When I visit the "seldon/seldons-project github-project edit" page
Then I should be on the "home" page
And I should see "You are not authorized to perform this action!"
Scenario: A non collaborator sends a forged update on a project
- Given I'm logged in as "yugo"
+ Given I'm signed in as "yugo"
When I send a forged request to enable tip holding on the project
Then I should be on the "home" page
And I should see "You are not authorized to perform this action!"
And the project should not hold tips
Scenario: A collaborator sends a forged update on a project
- Given I'm logged in as "daneel"
+ Given I'm signed in as "daneel"
When the project syncs with the remote repo
When I send a forged request to enable tip holding on the project
Then I should be on the "seldon/seldons-project github-project" page
@@ -117,7 +117,7 @@ Feature: A project collaborator can change the tips of commits
Scenario Outline: A user sends a forged request to set a tip amount
When the project syncs with the remote repo
Given the project has 1 undecided tip
- When I'm logged in as ""
+ When I'm signed in as ""
And I visit the "seldon/seldons-project github-project" page
Then I should be on the "seldon/seldons-project github-project" page
And I send a forged request to set the amount of the first undecided tip of the project
@@ -133,7 +133,7 @@ Feature: A project collaborator can change the tips of commits
And a new commit "last" is made
And the project holds tips
When the project syncs with the remote repo
- And I'm logged in as "seldon"
+ And I'm signed in as "seldon"
And I visit the "seldon/seldons-project github-project" page
Then I should be on the "seldon/seldons-project github-project" page
And I should see "Decide tip amounts"
@@ -155,7 +155,7 @@ Feature: A project collaborator can change the tips of commits
And a new commit "fake commit" is made
And the project holds tips
When the project syncs with the remote repo
- And I'm logged in as ""
+ And I'm signed in as ""
When regarding the "github" project named "seldon/seldons-project"
And I send a forged request to change the percentage of commit "BBB" to "5"
Then
diff --git a/features/tipping_policies.feature b/features/tipping_policies.feature
index 02f1bd72..6d0b0ed5 100644
--- a/features/tipping_policies.feature
+++ b/features/tipping_policies.feature
@@ -7,7 +7,7 @@ Feature: A project collaborator can display the tipping policies of the project
And the project syncs with the remote repo
Scenario: A collaborator changes the tipping policies
- Given I'm logged in as "daneel"
+ Given I'm signed in as "daneel"
When I visit the "seldon/seldons-project github-project" page
Then I should be on the "seldon/seldons-project github-project" page
And I click on "Change project settings"
@@ -21,7 +21,7 @@ Feature: A project collaborator can display the tipping policies of the project
Then I should be on the "seldon/seldons-project github-project" page
Then I should see "The project settings have been updated"
- Given I log out
+ Given I sign out
When I visit the "seldon/seldons-project github-project" page
Then I should be on the "seldon/seldons-project github-project" page
Then I should see "All commits are huge!"
diff --git a/features/view_tips.feature b/features/view_tips.feature
index 26d93252..0084e3da 100644
--- a/features/view_tips.feature
+++ b/features/view_tips.feature
@@ -6,14 +6,14 @@ Feature: Visitors should be able to see claimed tips
And our fee is "0"
And a deposit of "500" is made
And the most recent commit is "AAA"
- And a new commit "BBB" with parent "AAA" is made
- And a new commit "CCC" with parent "BBB" is made
+ And a new commit "BBB" is made with parent "AAA"
+ And a new commit "CCC" is made with parent "BBB"
And the author of commit "BBB" is "yugo"
And the author of commit "CCC" is "gaal"
When the project syncs with the remote repo
Then there should be a tip of "5" for commit "BBB"
And there should be a tip of "4.95" for commit "CCC"
- Given I'm not logged in
+ Given I'm not signed in
Scenario: Visitors should see all claimed tips but not unclaimed tips
When I visit the "tips" page
diff --git a/spec/controllers/users_controller_spec.rb b/spec/controllers/users_controller_spec.rb
index 1d8f59ee..32e0acfb 100644
--- a/spec/controllers/users_controller_spec.rb
+++ b/spec/controllers/users_controller_spec.rb
@@ -98,14 +98,14 @@
:action => "index" )
end
- it "routes GET /users to User#show" do
+ it "routes GET /users/1 to User#show" do
{ :get => "/users/1" }.should route_to(
:controller => "users" ,
:action => "show" ,
:id => "1" )
end
- it "routes GET /login to User#login" do
+ it "routes GET /users/login to User#login" do
{ :get => "/users/login" }.should route_to(
:controller => "users" ,
:action => "login" )
@@ -119,8 +119,10 @@
end
end
- describe "pretty user url routing" do
- it "routes regex rejects reserved user paths" do
+ describe "pretty url routing" do
+ let(:user) { create(:user) }
+
+ it "regex rejects reserved user paths" do
# accepted pertty url usernames
should_accept = %w{logi ogin s4c2 42x}
# reserved routes (rejected pertty url usernames)
@@ -130,5 +132,19 @@
rejected = should_reject.select {|ea| (ea =~ RESERVED_USER_ROUTES_REGEX).nil? }
accepted.size.should eq should_accept.size and rejected.size.should eq should_reject.size
end
+
+ it "routes GET /users/friendly-name to User#show" do
+ { :get => "/users/#{user.nickname}" }.should route_to(
+ :controller => "users" ,
+ :action => "show" ,
+ :id => "kd" )
+ end
+
+ it "routes GET /users/friendly-name/tips to Tips#index" do
+ { :get => "/users/#{user.nickname}/tips" }.should route_to(
+ :controller => "tips" ,
+ :action => "index" ,
+ :user_id => "kd" )
+ end
end
end
From 2e87fa6cc8dfc05d7438ed73d6f5566a0d2922e6 Mon Sep 17 00:00:00 2001
From: arsenische
Date: Wed, 5 Nov 2014 04:39:52 +0500
Subject: [PATCH 118/415] fixing #182; also added some text to warning to
prevent further confusion
---
app/views/layouts/application.html.haml | 8 +++++++-
config/blacklist.yml | 1 +
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml
index fb318476..3c0fade0 100644
--- a/app/views/layouts/application.html.haml
+++ b/app/views/layouts/application.html.haml
@@ -60,8 +60,14 @@
.footer
.alert.alert-warning
- We are not affiliated with most of the projects, their owners might not endorse use of tip4commit.
+ %p
+ We are not affiliated with most of the projects, their owners may be unaware of or actively against using tip4commit. Due to potential ethical and legal issues we may remove any project from the list by request of project maintainers.
+ %p
+ Also we are not notifying developers about their tips anymore. Thus we can't guarantee that donated funds will really reach them.
+
+ %p
+ By donating funds you agree that they can be sent to Free Software Foundation or elsewhere at Tip4Commit's discretion.
%p.pull-right
- ::Rails.application.config.available_locales.each do |locale|
diff --git a/config/blacklist.yml b/config/blacklist.yml
index 7f289578..266d412f 100644
--- a/config/blacklist.yml
+++ b/config/blacklist.yml
@@ -30,3 +30,4 @@
- https://github.com/ipython/*
- https://github.com/mpasternacki/*
- https://github.com/3ofcoins/*
+- https://github.com/ggventurini/python-deltasigma
\ No newline at end of file
From 28058022e5bcc2aebe3848c657c737e3e4b80f79 Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Wed, 5 Nov 2014 10:57:31 +0500
Subject: [PATCH 119/415] updated Gemfile.lock
---
Gemfile.lock | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/Gemfile.lock b/Gemfile.lock
index d9dcf137..94dfdf35 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -7,6 +7,12 @@ GIT
omniauth (~> 1.0)
omniauth-oauth2 (~> 1.1)
+GIT
+ remote: git://github.com/bootstrap-ruby/rails-bootstrap-forms.git
+ revision: bb5e1ca8b8fdb6405feb162338e45468dac83c30
+ specs:
+ bootstrap_form (2.2.0)
+
GIT
remote: git://github.com/capistrano/rvm.git
revision: 19e8d15ae3d705499c610370f159d523bbedbd94
@@ -26,13 +32,6 @@ GIT
rails (>= 3.1)
railties (>= 3.1)
-GIT
- remote: git://github.com/sigmike/rails-bootstrap-forms.git
- revision: a1c8420ab999df56b13d3de8a097528b77a02217
- branch: removed_for_on_radio_label
- specs:
- bootstrap_form (2.0.1)
-
GIT
remote: git://github.com/stouset/twitter_bootstrap_form_for.git
revision: 830dbfd439ebb1194e1ae025100fc0e790be37cf
From 8449fdb6875cf91832cbd49daf4a3698f547dde2 Mon Sep 17 00:00:00 2001
From: win32re
Date: Wed, 5 Nov 2014 17:30:40 +0100
Subject: [PATCH 120/415] Update hr.yml
---
config/locales/hr.yml | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/config/locales/hr.yml b/config/locales/hr.yml
index ffec3b58..87339483 100644
--- a/config/locales/hr.yml
+++ b/config/locales/hr.yml
@@ -10,7 +10,7 @@ hr:
text: "Izvorni kod dostupan na %{github_link} i mozete takoder %{support_link} razvoj."
github_link: GitHub
support_link: podrzi
- follow_link: Follow @tip4commit
+ follow_link: Prati @tip4commit
links:
sign_up: Sign up
sign_in: Prijava
@@ -70,7 +70,7 @@ hr:
index:
find_project:
placeholder: Upisite GitHub URL projekta kako biste dodati projekt ili bilo koju kljucnu rijec da biste je nasli...
- button: Nadi ili dodaj projekt
+ button: Nadji ili dodaj projekt
repository: Repozitorij
description: Opis
watchers: Gledatelji
@@ -101,12 +101,12 @@ hr:
for_commit: za cin
when_decided: kada je kolicina odlucena
next_tip: Sljedeca napojnica
- contribute_and_earn: Contribute and earn
+ contribute_and_earn: Doprinesi i zaradi
contribute_and_earn_description: "Doniraj Bitcone u ovaj projekt ili %{make_commits_link} i dobij napojnicu. Ako je commit prihvacen %{branch} od strane voditelja projekta i ima Bitcoina na racunu, dobit ce te napojnicu."
contribute_and_earn_branch: "u %{branch} branch"
make_commits_link: make commits
tell_us_bitcoin_address: "Samo %{tell_us_link} vasu bitcoin adresu."
- tell_us_link: tell us
+ tell_us_link: recite nam
sign_in: "Samo provjerite vas email ili %{sign_in_link}."
promote_project: Promoviraj %{project}
embedding: Embedding
@@ -122,13 +122,13 @@ hr:
disable_notifications: Don't notify new contributors
decide_tip_amounts:
commit: Commit
- author: Author
- message: Message
- tip: Tip (relative to the project balance)
- submit: Send the selected tip amounts
+ author: Autor
+ message: Poruka
+ tip: Napojnica (relativna iznosu na racunu)
+ submit: Posaljite odabrane iznose napojnica
tips:
index:
- tips: Tips
+ tips: Napojnice
project_tips: '%{project} napojnice'
user_tips: "%{user} napojnice"
created_at: Stvoreno na
@@ -145,12 +145,12 @@ hr:
deposits:
index:
project_deposits: '%{project} uplate'
- deposits: Deposits
+ deposits: Uplate
created_at: "Stvoreno na"
project: Projekt
amount: Kolicina
- transaction: Transaction
- confirmed: Confirmed
+ transaction: Transakcija
+ confirmed: Potvrdjeno
confirmed_yes: 'Da'
confirmed_no: 'Ne'
users:
@@ -165,7 +165,7 @@ hr:
see_all: vidjeti sve
received: "%{time} primljeno %{amount} za cin %{commit} u %{project}"
bitcoin_address_placeholder: Vasa bitcoin adresa
- notify: Notificirati me o novim savjetima (ne vise od jednog emaila po mjesecu)
+ notify: Obavjesti me o novim savjetima (ne vise od jednog emaila po mjesecu)
submit_user: Azurirati informaciju korisnika
change_password: Promijeniti vasu lozinku
submit_password: Promijeniti moju lozinku
From b09992e8dfd5280946bd5210385dfe38868b00b4 Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Thu, 6 Nov 2014 14:35:55 +0500
Subject: [PATCH 121/415] Admins can set minimum tip amount in the
configuration file
---
app/models/project.rb | 6 ++++--
config/config.yml.sample | 1 +
features/min_tip_amount.feature | 17 +++++++++++++++++
features/step_definitions/common.rb | 4 ++++
features/tip_modifier_interface.feature | 1 +
5 files changed, 27 insertions(+), 2 deletions(-)
create mode 100644 features/min_tip_amount.feature
diff --git a/app/models/project.rb b/app/models/project.rb
index 56a8b2ee..785f4bb0 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -134,7 +134,7 @@ def tip_for commit
commit: commit.sha,
commit_message: commit.commit.message })
- tip.notify_user
+ # tip.notify_user
Rails.logger.info " Tip created #{tip.inspect}"
end
@@ -161,7 +161,9 @@ def tips_paid_unclaimed_amount
end
def next_tip_amount
- (CONFIG["tip"]*available_amount).ceil
+ next_tip_amount = (CONFIG["tip"]*available_amount).ceil
+ next_tip_amount = [next_tip_amount, CONFIG["min_tip"]].max if CONFIG["min_tip"]
+ next_tip_amount = [next_tip_amount, available_amount].min
end
def update_cache
diff --git a/config/config.yml.sample b/config/config.yml.sample
index 6d292b47..ba0b5573 100644
--- a/config/config.yml.sample
+++ b/config/config.yml.sample
@@ -35,6 +35,7 @@ smtp_settings:
tip: 0.01
min_payout: 100000
our_fee: 0.05
+min_tip: 50000 # optional
deposit_address: 1M4bS4gPyA6Kb8w7aXsgth9oUZWcRk73tQ
diff --git a/features/min_tip_amount.feature b/features/min_tip_amount.feature
new file mode 100644
index 00000000..1ea889fb
--- /dev/null
+++ b/features/min_tip_amount.feature
@@ -0,0 +1,17 @@
+Feature: Admins can set minimum tip amount in the configuration file
+ Background:
+ Given a project "my-project"
+ And our fee is "0"
+ And min tip amount is "300"
+ And a deposit of "500"
+ And the last known commit is "COMMIT1"
+
+ Scenario: Developer gets more than 1% of funds, but less than available_amount
+ And a user "yugo" has opted-in
+ And a new commit "COMMIT2" with parent "COMMIT1"
+ And the author of commit "COMMIT2" is "yugo"
+ And a new commit "COMMIT3" with parent "COMMIT2"
+ And the author of commit "COMMIT3" is "yugo"
+ When the new commits are read
+ Then there should be a tip of "300" for commit "COMMIT2"
+ And there should be a tip of "200" for commit "COMMIT3"
\ No newline at end of file
diff --git a/features/step_definitions/common.rb b/features/step_definitions/common.rb
index 3b284663..343c734e 100644
--- a/features/step_definitions/common.rb
+++ b/features/step_definitions/common.rb
@@ -21,6 +21,10 @@
CONFIG["our_fee"] = arg1.to_f
end
+Given(/^min tip amount is "(.*?)"$/) do |arg1|
+ CONFIG["min_tip"] = arg1.to_f * 1e8
+end
+
Given(/^a project$/) do
@project = Project.create!(full_name: "example/test", github_id: 123, bitcoin_address: 'mq4NtnmQoQoPfNWEPbhSvxvncgtGo6L8WY')
end
diff --git a/features/tip_modifier_interface.feature b/features/tip_modifier_interface.feature
index cf8e9122..2026fb6c 100644
--- a/features/tip_modifier_interface.feature
+++ b/features/tip_modifier_interface.feature
@@ -7,6 +7,7 @@ Feature: A project collaborator can change the tips of commits
| seldon |
| daneel |
And our fee is "0"
+ And min tip amount is "0"
And a deposit of "500"
And the last known commit is "AAA"
And a new commit "BBB" with parent "AAA"
From 3fc56f97669367d1355264b2aa56182d056fd700 Mon Sep 17 00:00:00 2001
From: bill auger
Date: Fri, 7 Nov 2014 22:58:00 +0000
Subject: [PATCH 122/415] complete friendly user and project routes fetaure
* fixed buggy routing
* added named routes to all custom routes
* removed ProjectsHelper#pretty_project_tips_path in favor of named route
* removed ProjectsHelper#pretty_project_deposits_path in favor of named route
* refactored UserController#load_user into ApplicationController#load_user
to be shared with TipsController
* added project:fetch_pending to locales (translation required)
* fixed bug in 'I should be on the "" page' step that matchd '/' to everything
---
app/controllers/application_controller.rb | 49 +++++++++++++++++------
app/controllers/deposits_controller.rb | 2 +-
app/controllers/projects_controller.rb | 7 +---
app/controllers/tips_controller.rb | 8 ++--
app/controllers/users_controller.rb | 39 +++++++++++-------
app/helpers/projects_helper.rb | 8 ----
app/views/projects/show.html.haml | 2 +-
config/locales/en.yml | 1 +
config/locales/fr.yml | 1 +
config/locales/hr.yml | 1 +
config/locales/pl.yml | 1 +
config/locales/ru.yml | 1 +
config/routes.rb | 43 +++++++++-----------
spec/controllers/users_controller_spec.rb | 12 ++++--
14 files changed, 101 insertions(+), 74 deletions(-)
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 04bf89af..0c334652 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -23,29 +23,54 @@ def load_locale
end
def load_project params
- (is_project = self.is_a? ProjectsController) ||
- (is_tips = self.is_a? TipsController ) ||
- (is_deposits = self.is_a? DepositsController)
+ return unless (is_via_project = self.is_a? ProjectsController) ||
+ (is_via_tips = self.is_a? TipsController ) ||
+ (is_via_deposits = self.is_a? DepositsController)
- if params[:project_id].present? || params[:id].present?
- return unless project_id = (is_project && params[:id]) ||
- ((is_tips || is_deposits) && params[:project_id])
+ is_standard_path = params[:id] .present? && is_via_project
+ is_association_path = params[:project_id].present?
+ is_pretty_path = params[:service] .present? && params[:repo].present?
+ return unless is_standard_path || is_association_path || is_pretty_path
- @project = Project.where(:id => project_id).first
-
- if is_tips
+ if (is_standard_path || is_association_path) &&
+ (project_id = (is_via_project)? params[:id] : params[:project_id]) &&
+ (@project = (Project.where :id => project_id).first)
+ if is_via_tips
redirect_to project_tips_pretty_path @project.host , @project.full_name
- elsif is_deposits
+ elsif is_via_deposits
redirect_to project_deposits_pretty_path @project.host , @project.full_name
end
- elsif params[:service].present? && params[:repo].present?
+ elsif is_pretty_path
@project = Project.where(host: params[:service]).
where('lower(`full_name`) = ?' , params[:repo].downcase).first
end
- if @project.nil? && is_project
+ if @project.nil?
flash[:error] = I18n.t('errors.project_not_found')
redirect_to projects_path
end
end
+
+ def load_user params
+ return unless (is_via_user = self.is_a? UsersController) ||
+ (is_via_tips = self.is_a? TipsController)
+
+ return unless (is_standard_path = params[:id] .present? && is_via_user) ||
+ (is_association_path = params[:user_id] .present?) ||
+ (is_pretty_path = params[:nickname].present?)
+
+ if (is_standard_path || is_association_path) &&
+ (user_id = (is_via_user && params[:id]) ||
+ (is_via_tips && params[:user_id])) &&
+ (@user = User.where(:id => user_id).first)
+ redirect_to user_tips_pretty_path @user.nickname if is_via_tips
+ elsif is_pretty_path
+ @user = User.where('lower(`nickname`) = ?' , params[:nickname].downcase).first
+ end
+
+ if @user.nil?
+ flash[:error] = I18n.t('errors.user_not_found')
+ redirect_to users_path
+ end
+ end
end
diff --git a/app/controllers/deposits_controller.rb b/app/controllers/deposits_controller.rb
index b0b15d93..39c77758 100644
--- a/app/controllers/deposits_controller.rb
+++ b/app/controllers/deposits_controller.rb
@@ -2,7 +2,7 @@ class DepositsController < ApplicationController
before_action { load_project params }
def index
- if @project
+ if @project.present?
@deposits = @project.deposits
else
@deposits = Deposit.includes(:project)
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index 8f63fcfa..b3f12d7f 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -4,8 +4,7 @@ class ProjectsController < ApplicationController
include ProjectsHelper
before_filter :load_project, only: [:show, :edit, :update, :decide_tip_amounts]
- before_filter :redirect_to_pretty_url, only: [:show, :edit, :decide_tip_amounts,
- :tips, :deposits]
+ before_filter :redirect_to_pretty_url, only: [:show, :edit, :decide_tip_amounts]
def index
@projects = Project.order(projects_order).page(params[:page]).per(30)
@@ -102,10 +101,6 @@ def redirect_to_pretty_url
path = pretty_project_edit_path @project
when 'decide_tip_amounts'
path = pretty_project_decide_tip_amounts_path @project
- when 'tips'
- path = pretty_project_tips_path @project
- when 'deposits'
- path = pretty_project_deposits_path @project
end
format.html { redirect_to path }
end
diff --git a/app/controllers/tips_controller.rb b/app/controllers/tips_controller.rb
index 46c52463..333fcf22 100644
--- a/app/controllers/tips_controller.rb
+++ b/app/controllers/tips_controller.rb
@@ -1,12 +1,12 @@
class TipsController < ApplicationController
before_filter { load_project params }
+ before_filter { load_user params }
def index
- if @project
+ if @project.present?
@tips = @project.tips.includes(:user).with_address
- elsif params[:user_id]
- @user = User.find params[:user_id]
- if @user.present? && @user.bitcoin_address.present?
+ elsif @user.present?
+ if @user.bitcoin_address.present?
@tips = @user.tips.includes(:project)
else
flash[:error] = I18n.t('errors.user_not_found')
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index 4286f7b1..2dfbc84d 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -1,6 +1,6 @@
class UsersController < ApplicationController
-
before_action :authenticate_user!, :load_user, :valid_user!, except: [:login, :index]
+ before_filter :redirect_to_pretty_url, only: [:show]
def show
@user_tips = @user.tips
@@ -34,23 +34,34 @@ def login
end
end
+
private
- def users_params
- params.require(:user).permit(:bitcoin_address, :password, :password_confirmation, :unsubscribed, :display_name)
- end
- def load_user
- @user = User.where(id: params[:id]).first
- unless @user
- flash[:error] = I18n.t('errors.user_not_found')
- redirect_to root_path and return
- end
+ def users_params
+ params.require(:user).permit(:bitcoin_address, :password, :password_confirmation, :unsubscribed, :display_name)
+ end
+
+ def load_user ; super params ; end ;
+
+ def valid_user!
+ if current_user != @user
+ flash[:error] = I18n.t('errors.access_denied')
+ redirect_to root_path and return
end
+ end
- def valid_user!
- if current_user != @user
- flash[:error] = I18n.t('errors.access_denied')
- redirect_to root_path and return
+ def redirect_to_pretty_url
+ return unless request.get? && params[:id].present? && @user.nickname.present?
+
+ begin
+ respond_to do |format|
+ case action_name
+ when 'show'
+ path = user_pretty_path @user.nickname
+ end
+ format.html { redirect_to path }
end
+ rescue ActionController::UnknownFormat
end
+ end
end
diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb
index 7d0376fd..5911ecd9 100644
--- a/app/helpers/projects_helper.rb
+++ b/app/helpers/projects_helper.rb
@@ -30,14 +30,6 @@ def pretty_project_decide_tip_amounts_path project
"#{pretty_project_path project}/decide_tip_amounts"
end
- def pretty_project_tips_path project
- "#{pretty_project_path project}/tips"
- end
-
- def pretty_project_deposits_path project
- "#{pretty_project_path project}/deposits"
- end
-
def pretty_project_url project
root_url.gsub(/\/$/,'') + pretty_project_path(project)
end
diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml
index 6786b191..4793efed 100644
--- a/app/views/projects/show.html.haml
+++ b/app/views/projects/show.html.haml
@@ -11,7 +11,7 @@
%small= link_to glyph(:github), @project.github_url, target: '_blank'
.pull-right
- if @project.collaborators.empty?
- = "(Pending initial sync)"
+ = t('.fetch_pending')
- if can? :update, @project
= link_to t('.edit_project'), edit_project_path(@project), class: "btn btn-primary"
- if can? :decide_tip_amounts, @project and @project.has_undecided_tips?
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 7c951c67..58c23604 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -79,6 +79,7 @@ en:
support: Support project
show:
title: "Contribute to %{project}"
+ fetch_pending: (Pending initial fetch)
edit_project: Change project settings
decide_tip_amounts: Decide tip amounts
disabled_notifications: "Project maintainers have decided not to notify new contributors about tips and they probably don't like this way of funding."
diff --git a/config/locales/fr.yml b/config/locales/fr.yml
index ac389f6e..fbda1b23 100644
--- a/config/locales/fr.yml
+++ b/config/locales/fr.yml
@@ -79,6 +79,7 @@ fr:
support: Subventionner
show:
title: "Contribuer à %{project}"
+ fetch_pending: (Pending initial fetch)
edit_project: Changer les paramètres du projet
decide_tip_amounts: Choisir un montant de pourboire
disabled_notifications: "Les responsables du projet ont décidé de ne pas prévenir les nouveaux contributeurs au sujet des pourboires, et n'apprécient probablement pas ce type de rémunération."
diff --git a/config/locales/hr.yml b/config/locales/hr.yml
index 87339483..ebfdb6c7 100644
--- a/config/locales/hr.yml
+++ b/config/locales/hr.yml
@@ -79,6 +79,7 @@ hr:
support: Podrzavaj
show:
title: "Doprinosi %{project}"
+ fetch_pending: (Pending initial fetch)
edit_project: Promijeni postavke projekta
decide_tip_amounts: Odredi kolicinu napojnica
disabled_notifications: "Odrzavatelji projekata su odlucili da nece obavjestiti nove doprinositelje o napojnicama i najvjerovatnije ne vole ovaj nacin isplate."
diff --git a/config/locales/pl.yml b/config/locales/pl.yml
index 246e8eda..d47796a5 100644
--- a/config/locales/pl.yml
+++ b/config/locales/pl.yml
@@ -79,6 +79,7 @@ pl:
support: Pomoc
show:
title: "Współpracuj z %{project}"
+ fetch_pending: (Pending initial fetch)
edit_project: Zmień ustawienia projektu
decide_tip_amounts: Ustal rozmiary napiwków
disabled_notifications: "Nadzorcy projektów zdecydowali nie powiadamiać nowych współpracowników o napiwkach i prawdopodobnie nie lubią tego typu finansowania."
diff --git a/config/locales/ru.yml b/config/locales/ru.yml
index 8bb708d0..77692d4d 100644
--- a/config/locales/ru.yml
+++ b/config/locales/ru.yml
@@ -79,6 +79,7 @@ ru:
support: "Поддержать проект"
show:
title: "Помогайте %{project}"
+ fetch_pending: (Pending initial fetch)
edit_project: Изменить настройки проекта
decide_tip_amounts: Установить сумму чаевых
disabled_notifications: "Контрибьюторы проекта решили не уведомлять новых участников о чаевых и, вероятно, им не нравится такой способ финансирования."
diff --git a/config/routes.rb b/config/routes.rb
index 7c32ee7b..3e841aa4 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -2,31 +2,29 @@
root 'home#index'
- get '/blockchain_info_callback' => "home#blockchain_info_callback", :as => "blockchain_info_callback"
+ devise_for :users,
+ :controllers => { :omniauth_callbacks => 'users/omniauth_callbacks' }
- # reserved devise routes (rejected pertty url usernames)
- RESERVED_USER_ROUTES_REGEX = /(^(?:(?!^\d+$|\b(sign_in|cancel|sign_up|edit|confirmation|login)\b).)*$)/
- get '/users/:name/tips' => 'tips#index', :constraints => {:name => /\RESERVED_USER_ROUTES_REGEX/}
- get '/users/:name' => 'users#show', :constraints => {:name => /\RESERVED_USER_ROUTES_REGEX/}
+ get '/blockchain_info_callback' => 'home#blockchain_info_callback' , :as => 'blockchain_info_callback'
- get '/projects/:project_id/tips' => 'tips#index', :constraints => {:project_id => /\d+/}, :as => 'project_tips'
- get '/projects/:project_id/deposits' => 'deposits#index', :constraints => {:project_id => /\d+/}, :as => 'project_deposits'
- get '/:service/:repo/edit' => 'projects#edit', :constraints => {:service => /github/, :repo => /.+/}
- get '/:service/:repo/decide_tip_amounts' => 'projects#decide_tip_amounts', :constraints => {:service => /github/, :repo => /.+/}
- get '/:service/:repo/tips' => 'tips#index', :constraints => {:service => /github/, :repo => /.+/}, :as => 'project_tips_pretty'
- get '/:service/:repo/deposits' => 'deposits#index', :constraints => {:service => /github/, :repo => /.+/}, :as => 'project_deposits_pretty'
- get '/:service/:repo' => 'projects#show', :constraints => {:service => /github/, :repo => /.+/}
+ get '/users/login' => 'users#login' , :as => 'login_users'
+ get '/users/:user_id/tips' => 'tips#index' , :constraints => {:user_id => /\d+/} , :as => 'user_tips'
+ get '/users/:nickname/tips' => 'tips#index' , :constraints => {:nickname => /\D+/} , :as => 'user_tips_pretty'
+ get '/users/:nickname' => 'users#show' , :constraints => {:nickname => /\D+/} , :as => 'user_pretty'
- devise_for :users,
- :controllers => { :omniauth_callbacks => "users/omniauth_callbacks" }
+ get '/projects/:project_id/tips' => 'tips#index' , :constraints => {:project_id => /\d+/} , :as => 'project_tips'
+ get '/projects/:project_id/deposits' => 'deposits#index' , :constraints => {:project_id => /\d+/} , :as => 'project_deposits'
+ get '/:service/:repo/edit' => 'projects#edit' , :constraints => {:service => /github/ , :repo => /.+/} , :as => 'project_edit_pretty'
+ get '/:service/:repo/decide_tip_amounts' => 'projects#decide_tip_amounts' , :constraints => {:service => /github/ , :repo => /.+/} , :as => 'project_decide_tips_pretty'
+ get '/:service/:repo/tips' => 'tips#index' , :constraints => {:service => /github/ , :repo => /.+/} , :as => 'project_tips_pretty'
+ get '/:service/:repo/deposits' => 'deposits#index' , :constraints => {:service => /github/ , :repo => /.+/} , :as => 'project_deposits_pretty'
+ get '/:service/:repo' => 'projects#show' , :constraints => {:service => /github/ , :repo => /.+/} , :as => 'project_pretty'
- resources :users, :only => [:show, :update, :index] do
- collection do
- get :login
- end
- resources :tips, :only => [:index]
- end
- resources :projects, :only => [:show, :index, :edit, :update] do
+ resources :tips , :only => [:index]
+ resources :deposits , :only => [:index]
+ resources :withdrawals , :only => [:index]
+ resources :users , :only => [:index , :show , :update]
+ resources :projects , :only => [:index , :show , :update , :edit ] do
collection do
get 'search'
end
@@ -35,9 +33,6 @@
patch :decide_tip_amounts
end
end
- resources :tips, :only => [:index]
- resources :deposits, :only => [:index]
- resources :withdrawals, :only => [:index]
get '*path' => 'home#index'
end
diff --git a/spec/controllers/users_controller_spec.rb b/spec/controllers/users_controller_spec.rb
index f5f09135..b1cb90cd 100644
--- a/spec/controllers/users_controller_spec.rb
+++ b/spec/controllers/users_controller_spec.rb
@@ -2,8 +2,10 @@
describe UsersController do
describe '#show' do
- let(:user) { mock_model User, id: 100000000 }
- let(:subject) { get :show, id: user.id }
+# let(:user) { mock_model User, id: 100000000 }
+# let(:subject) { get :show, id: user.id }
+ let(:user) { create(:user) }
+ let(:subject) { get :show , :nickname => user.nickname }
context 'when logged in' do
login_user
@@ -36,8 +38,10 @@
end
context 'when user not found' do
- it 'redirect to root_path' do
- expect(subject).to redirect_to root_path
+ let(:subject) { get :show , :nickname => 'unknown-user' }
+
+ it 'redirect to users_path' do
+ expect(subject).to redirect_to users_path
end
it 'sets flash error message' do
From bae2c1b45527afd4aa558f454c6a696410477cec Mon Sep 17 00:00:00 2001
From: bill auger
Date: Sat, 8 Nov 2014 00:26:43 +0000
Subject: [PATCH 123/415] add more tests
* merged latest project-management branch
* added more examples to spec/controllers/users_controller_spec.rb
* added more examples to spec/controllers/projects_controller_spec.rb
* added more scenarios to features/manage_project.feature
* added more scenarios to features/pretty_paths.feature
* added more scenarios to features/sign_up_sign_in.feature
---
app/assets/javascripts/i18n/translations.js | 2 +-
app/controllers/application_controller.rb | 49 +++--
app/controllers/deposits_controller.rb | 2 +-
app/controllers/projects_controller.rb | 7 +-
app/controllers/tips_controller.rb | 8 +-
app/controllers/users_controller.rb | 39 ++--
app/helpers/projects_helper.rb | 8 -
app/views/projects/show.html.haml | 2 +-
config/locales/en.yml | 1 +
config/locales/fr.yml | 1 +
config/locales/hr.yml | 1 +
config/locales/pl.yml | 1 +
config/locales/ru.yml | 1 +
config/routes.rb | 43 ++---
features/find_or_create_project.feature | 14 +-
features/manage_project.feature | 29 ++-
features/pretty_paths.feature | 192 ++++++++++++++++---
features/sign_up_sign_in.feature | 138 +++++++++++--
features/step_definitions/common.rb | 66 +++++--
features/step_definitions/home_steps.rb | 9 +-
features/tip_modifier_interface.feature | 18 +-
features/tipping_policies.feature | 4 +-
spec/controllers/projects_controller_spec.rb | 68 +++++--
spec/controllers/users_controller_spec.rb | 31 +--
24 files changed, 553 insertions(+), 181 deletions(-)
diff --git a/app/assets/javascripts/i18n/translations.js b/app/assets/javascripts/i18n/translations.js
index ac0ec161..e07bd2ae 100644
--- a/app/assets/javascripts/i18n/translations.js
+++ b/app/assets/javascripts/i18n/translations.js
@@ -1,2 +1,2 @@
var I18n = I18n || {};
-I18n.translations = {"en":{"js":{"errors":{"value":{"invalid":"Value is invalid"},"email":{"invalid":"Invalid Email Address","blank":"The Email is required and can't be empty"},"password":{"blank":"The password is required and can't be empty","invalid":"The password and its confirmation are not same"},"password_confirmation":{"blank":"The password confirmation is required and can't be empty","invalid":"The password and its confirmation are not same"}}}},"hr":{"js":{"errors":{"value":{"invalid":"Vrijednost nevazeca"},"email":{"invalid":"Nezaveca email adresa","blank":"Email je potreban i ne moze biti prazno"},"password":{"blank":"Lozinka je potrebna i ne moze biti prazno","invalid":"Lozinka i njezina potvrda nisu isti"},"password_confirmation":{"blank":"Potvrda lozinke je potrebna i ne moze biti prazno","invalid":"Lozinka i potvrda lozinke nisu isti"}}}},"ru":{"js":{"errors":{"value":{"invalid":"Неверное значение"},"email":{"invalid":"Ошибка в Email адресе","blank":"Email не может быть пустым"},"password":{"blank":"Пароль не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"},"password_confirmation":{"blank":"Подтверждение пароля не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"}}}},"pl":{"js":{"errors":{"value":{"invalid":"Wartość jest niepoprawna"},"email":{"invalid":"Błędny adres E-mail","blank":"E-mail jest wymagany i nie może być pusty"},"password":{"blank":"Hasło jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"},"password_confirmation":{"blank":"Potwierdzenie hasła jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"}}}},"fr":{"js":{"errors":{"value":{"invalid":"Valeur non valide"},"email":{"invalid":"Adresse Email non valide","blank":"L'Email est requis et doit être renseigné"},"password":{"blank":"Les mot de passe est requis et doit être renseigné","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"},"password_confirmation":{"blank":"La confirmation du mot de passe est requise et doit être renseignée","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"}}}}};
\ No newline at end of file
+I18n.translations = {"en":{"js":{"errors":{"value":{"invalid":"Value is invalid"},"email":{"invalid":"Invalid Email Address","blank":"The Email is required and can't be empty"},"password":{"blank":"The password is required and can't be empty","invalid":"The password and its confirmation are not same"},"password_confirmation":{"blank":"The password confirmation is required and can't be empty","invalid":"The password and its confirmation are not same"}}}},"ru":{"js":{"errors":{"value":{"invalid":"Неверное значение"},"email":{"invalid":"Ошибка в Email адресе","blank":"Email не может быть пустым"},"password":{"blank":"Пароль не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"},"password_confirmation":{"blank":"Подтверждение пароля не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"}}}},"hr":{"js":{"errors":{"value":{"invalid":"Vrijednost nevazeca"},"email":{"invalid":"Nezaveca email adresa","blank":"Email je potreban i ne moze biti prazno"},"password":{"blank":"Lozinka je potrebna i ne moze biti prazno","invalid":"Lozinka i njezina potvrda nisu isti"},"password_confirmation":{"blank":"Potvrda lozinke je potrebna i ne moze biti prazno","invalid":"Lozinka i potvrda lozinke nisu isti"}}}},"fr":{"js":{"errors":{"value":{"invalid":"Valeur non valide"},"email":{"invalid":"Adresse Email non valide","blank":"L'Email est requis et doit être renseigné"},"password":{"blank":"Les mot de passe est requis et doit être renseigné","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"},"password_confirmation":{"blank":"La confirmation du mot de passe est requise et doit être renseignée","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"}}}},"pl":{"js":{"errors":{"value":{"invalid":"Wartość jest niepoprawna"},"email":{"invalid":"Błędny adres E-mail","blank":"E-mail jest wymagany i nie może być pusty"},"password":{"blank":"Hasło jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"},"password_confirmation":{"blank":"Potwierdzenie hasła jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"}}}}};
\ No newline at end of file
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 04bf89af..0c334652 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -23,29 +23,54 @@ def load_locale
end
def load_project params
- (is_project = self.is_a? ProjectsController) ||
- (is_tips = self.is_a? TipsController ) ||
- (is_deposits = self.is_a? DepositsController)
+ return unless (is_via_project = self.is_a? ProjectsController) ||
+ (is_via_tips = self.is_a? TipsController ) ||
+ (is_via_deposits = self.is_a? DepositsController)
- if params[:project_id].present? || params[:id].present?
- return unless project_id = (is_project && params[:id]) ||
- ((is_tips || is_deposits) && params[:project_id])
+ is_standard_path = params[:id] .present? && is_via_project
+ is_association_path = params[:project_id].present?
+ is_pretty_path = params[:service] .present? && params[:repo].present?
+ return unless is_standard_path || is_association_path || is_pretty_path
- @project = Project.where(:id => project_id).first
-
- if is_tips
+ if (is_standard_path || is_association_path) &&
+ (project_id = (is_via_project)? params[:id] : params[:project_id]) &&
+ (@project = (Project.where :id => project_id).first)
+ if is_via_tips
redirect_to project_tips_pretty_path @project.host , @project.full_name
- elsif is_deposits
+ elsif is_via_deposits
redirect_to project_deposits_pretty_path @project.host , @project.full_name
end
- elsif params[:service].present? && params[:repo].present?
+ elsif is_pretty_path
@project = Project.where(host: params[:service]).
where('lower(`full_name`) = ?' , params[:repo].downcase).first
end
- if @project.nil? && is_project
+ if @project.nil?
flash[:error] = I18n.t('errors.project_not_found')
redirect_to projects_path
end
end
+
+ def load_user params
+ return unless (is_via_user = self.is_a? UsersController) ||
+ (is_via_tips = self.is_a? TipsController)
+
+ return unless (is_standard_path = params[:id] .present? && is_via_user) ||
+ (is_association_path = params[:user_id] .present?) ||
+ (is_pretty_path = params[:nickname].present?)
+
+ if (is_standard_path || is_association_path) &&
+ (user_id = (is_via_user && params[:id]) ||
+ (is_via_tips && params[:user_id])) &&
+ (@user = User.where(:id => user_id).first)
+ redirect_to user_tips_pretty_path @user.nickname if is_via_tips
+ elsif is_pretty_path
+ @user = User.where('lower(`nickname`) = ?' , params[:nickname].downcase).first
+ end
+
+ if @user.nil?
+ flash[:error] = I18n.t('errors.user_not_found')
+ redirect_to users_path
+ end
+ end
end
diff --git a/app/controllers/deposits_controller.rb b/app/controllers/deposits_controller.rb
index b0b15d93..39c77758 100644
--- a/app/controllers/deposits_controller.rb
+++ b/app/controllers/deposits_controller.rb
@@ -2,7 +2,7 @@ class DepositsController < ApplicationController
before_action { load_project params }
def index
- if @project
+ if @project.present?
@deposits = @project.deposits
else
@deposits = Deposit.includes(:project)
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index 8f63fcfa..b3f12d7f 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -4,8 +4,7 @@ class ProjectsController < ApplicationController
include ProjectsHelper
before_filter :load_project, only: [:show, :edit, :update, :decide_tip_amounts]
- before_filter :redirect_to_pretty_url, only: [:show, :edit, :decide_tip_amounts,
- :tips, :deposits]
+ before_filter :redirect_to_pretty_url, only: [:show, :edit, :decide_tip_amounts]
def index
@projects = Project.order(projects_order).page(params[:page]).per(30)
@@ -102,10 +101,6 @@ def redirect_to_pretty_url
path = pretty_project_edit_path @project
when 'decide_tip_amounts'
path = pretty_project_decide_tip_amounts_path @project
- when 'tips'
- path = pretty_project_tips_path @project
- when 'deposits'
- path = pretty_project_deposits_path @project
end
format.html { redirect_to path }
end
diff --git a/app/controllers/tips_controller.rb b/app/controllers/tips_controller.rb
index 46c52463..333fcf22 100644
--- a/app/controllers/tips_controller.rb
+++ b/app/controllers/tips_controller.rb
@@ -1,12 +1,12 @@
class TipsController < ApplicationController
before_filter { load_project params }
+ before_filter { load_user params }
def index
- if @project
+ if @project.present?
@tips = @project.tips.includes(:user).with_address
- elsif params[:user_id]
- @user = User.find params[:user_id]
- if @user.present? && @user.bitcoin_address.present?
+ elsif @user.present?
+ if @user.bitcoin_address.present?
@tips = @user.tips.includes(:project)
else
flash[:error] = I18n.t('errors.user_not_found')
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index 4286f7b1..2dfbc84d 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -1,6 +1,6 @@
class UsersController < ApplicationController
-
before_action :authenticate_user!, :load_user, :valid_user!, except: [:login, :index]
+ before_filter :redirect_to_pretty_url, only: [:show]
def show
@user_tips = @user.tips
@@ -34,23 +34,34 @@ def login
end
end
+
private
- def users_params
- params.require(:user).permit(:bitcoin_address, :password, :password_confirmation, :unsubscribed, :display_name)
- end
- def load_user
- @user = User.where(id: params[:id]).first
- unless @user
- flash[:error] = I18n.t('errors.user_not_found')
- redirect_to root_path and return
- end
+ def users_params
+ params.require(:user).permit(:bitcoin_address, :password, :password_confirmation, :unsubscribed, :display_name)
+ end
+
+ def load_user ; super params ; end ;
+
+ def valid_user!
+ if current_user != @user
+ flash[:error] = I18n.t('errors.access_denied')
+ redirect_to root_path and return
end
+ end
- def valid_user!
- if current_user != @user
- flash[:error] = I18n.t('errors.access_denied')
- redirect_to root_path and return
+ def redirect_to_pretty_url
+ return unless request.get? && params[:id].present? && @user.nickname.present?
+
+ begin
+ respond_to do |format|
+ case action_name
+ when 'show'
+ path = user_pretty_path @user.nickname
+ end
+ format.html { redirect_to path }
end
+ rescue ActionController::UnknownFormat
end
+ end
end
diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb
index 7d0376fd..5911ecd9 100644
--- a/app/helpers/projects_helper.rb
+++ b/app/helpers/projects_helper.rb
@@ -30,14 +30,6 @@ def pretty_project_decide_tip_amounts_path project
"#{pretty_project_path project}/decide_tip_amounts"
end
- def pretty_project_tips_path project
- "#{pretty_project_path project}/tips"
- end
-
- def pretty_project_deposits_path project
- "#{pretty_project_path project}/deposits"
- end
-
def pretty_project_url project
root_url.gsub(/\/$/,'') + pretty_project_path(project)
end
diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml
index 6786b191..4793efed 100644
--- a/app/views/projects/show.html.haml
+++ b/app/views/projects/show.html.haml
@@ -11,7 +11,7 @@
%small= link_to glyph(:github), @project.github_url, target: '_blank'
.pull-right
- if @project.collaborators.empty?
- = "(Pending initial sync)"
+ = t('.fetch_pending')
- if can? :update, @project
= link_to t('.edit_project'), edit_project_path(@project), class: "btn btn-primary"
- if can? :decide_tip_amounts, @project and @project.has_undecided_tips?
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 7c951c67..58c23604 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -79,6 +79,7 @@ en:
support: Support project
show:
title: "Contribute to %{project}"
+ fetch_pending: (Pending initial fetch)
edit_project: Change project settings
decide_tip_amounts: Decide tip amounts
disabled_notifications: "Project maintainers have decided not to notify new contributors about tips and they probably don't like this way of funding."
diff --git a/config/locales/fr.yml b/config/locales/fr.yml
index ac389f6e..fbda1b23 100644
--- a/config/locales/fr.yml
+++ b/config/locales/fr.yml
@@ -79,6 +79,7 @@ fr:
support: Subventionner
show:
title: "Contribuer à %{project}"
+ fetch_pending: (Pending initial fetch)
edit_project: Changer les paramètres du projet
decide_tip_amounts: Choisir un montant de pourboire
disabled_notifications: "Les responsables du projet ont décidé de ne pas prévenir les nouveaux contributeurs au sujet des pourboires, et n'apprécient probablement pas ce type de rémunération."
diff --git a/config/locales/hr.yml b/config/locales/hr.yml
index ffec3b58..6250d53f 100644
--- a/config/locales/hr.yml
+++ b/config/locales/hr.yml
@@ -79,6 +79,7 @@ hr:
support: Podrzavaj
show:
title: "Doprinosi %{project}"
+ fetch_pending: (Pending initial fetch)
edit_project: Promijeni postavke projekta
decide_tip_amounts: Odredi kolicinu napojnica
disabled_notifications: "Odrzavatelji projekata su odlucili da nece obavjestiti nove doprinositelje o napojnicama i najvjerovatnije ne vole ovaj nacin isplate."
diff --git a/config/locales/pl.yml b/config/locales/pl.yml
index 246e8eda..d47796a5 100644
--- a/config/locales/pl.yml
+++ b/config/locales/pl.yml
@@ -79,6 +79,7 @@ pl:
support: Pomoc
show:
title: "Współpracuj z %{project}"
+ fetch_pending: (Pending initial fetch)
edit_project: Zmień ustawienia projektu
decide_tip_amounts: Ustal rozmiary napiwków
disabled_notifications: "Nadzorcy projektów zdecydowali nie powiadamiać nowych współpracowników o napiwkach i prawdopodobnie nie lubią tego typu finansowania."
diff --git a/config/locales/ru.yml b/config/locales/ru.yml
index 8bb708d0..77692d4d 100644
--- a/config/locales/ru.yml
+++ b/config/locales/ru.yml
@@ -79,6 +79,7 @@ ru:
support: "Поддержать проект"
show:
title: "Помогайте %{project}"
+ fetch_pending: (Pending initial fetch)
edit_project: Изменить настройки проекта
decide_tip_amounts: Установить сумму чаевых
disabled_notifications: "Контрибьюторы проекта решили не уведомлять новых участников о чаевых и, вероятно, им не нравится такой способ финансирования."
diff --git a/config/routes.rb b/config/routes.rb
index 7c32ee7b..3e841aa4 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -2,31 +2,29 @@
root 'home#index'
- get '/blockchain_info_callback' => "home#blockchain_info_callback", :as => "blockchain_info_callback"
+ devise_for :users,
+ :controllers => { :omniauth_callbacks => 'users/omniauth_callbacks' }
- # reserved devise routes (rejected pertty url usernames)
- RESERVED_USER_ROUTES_REGEX = /(^(?:(?!^\d+$|\b(sign_in|cancel|sign_up|edit|confirmation|login)\b).)*$)/
- get '/users/:name/tips' => 'tips#index', :constraints => {:name => /\RESERVED_USER_ROUTES_REGEX/}
- get '/users/:name' => 'users#show', :constraints => {:name => /\RESERVED_USER_ROUTES_REGEX/}
+ get '/blockchain_info_callback' => 'home#blockchain_info_callback' , :as => 'blockchain_info_callback'
- get '/projects/:project_id/tips' => 'tips#index', :constraints => {:project_id => /\d+/}, :as => 'project_tips'
- get '/projects/:project_id/deposits' => 'deposits#index', :constraints => {:project_id => /\d+/}, :as => 'project_deposits'
- get '/:service/:repo/edit' => 'projects#edit', :constraints => {:service => /github/, :repo => /.+/}
- get '/:service/:repo/decide_tip_amounts' => 'projects#decide_tip_amounts', :constraints => {:service => /github/, :repo => /.+/}
- get '/:service/:repo/tips' => 'tips#index', :constraints => {:service => /github/, :repo => /.+/}, :as => 'project_tips_pretty'
- get '/:service/:repo/deposits' => 'deposits#index', :constraints => {:service => /github/, :repo => /.+/}, :as => 'project_deposits_pretty'
- get '/:service/:repo' => 'projects#show', :constraints => {:service => /github/, :repo => /.+/}
+ get '/users/login' => 'users#login' , :as => 'login_users'
+ get '/users/:user_id/tips' => 'tips#index' , :constraints => {:user_id => /\d+/} , :as => 'user_tips'
+ get '/users/:nickname/tips' => 'tips#index' , :constraints => {:nickname => /\D+/} , :as => 'user_tips_pretty'
+ get '/users/:nickname' => 'users#show' , :constraints => {:nickname => /\D+/} , :as => 'user_pretty'
- devise_for :users,
- :controllers => { :omniauth_callbacks => "users/omniauth_callbacks" }
+ get '/projects/:project_id/tips' => 'tips#index' , :constraints => {:project_id => /\d+/} , :as => 'project_tips'
+ get '/projects/:project_id/deposits' => 'deposits#index' , :constraints => {:project_id => /\d+/} , :as => 'project_deposits'
+ get '/:service/:repo/edit' => 'projects#edit' , :constraints => {:service => /github/ , :repo => /.+/} , :as => 'project_edit_pretty'
+ get '/:service/:repo/decide_tip_amounts' => 'projects#decide_tip_amounts' , :constraints => {:service => /github/ , :repo => /.+/} , :as => 'project_decide_tips_pretty'
+ get '/:service/:repo/tips' => 'tips#index' , :constraints => {:service => /github/ , :repo => /.+/} , :as => 'project_tips_pretty'
+ get '/:service/:repo/deposits' => 'deposits#index' , :constraints => {:service => /github/ , :repo => /.+/} , :as => 'project_deposits_pretty'
+ get '/:service/:repo' => 'projects#show' , :constraints => {:service => /github/ , :repo => /.+/} , :as => 'project_pretty'
- resources :users, :only => [:show, :update, :index] do
- collection do
- get :login
- end
- resources :tips, :only => [:index]
- end
- resources :projects, :only => [:show, :index, :edit, :update] do
+ resources :tips , :only => [:index]
+ resources :deposits , :only => [:index]
+ resources :withdrawals , :only => [:index]
+ resources :users , :only => [:index , :show , :update]
+ resources :projects , :only => [:index , :show , :update , :edit ] do
collection do
get 'search'
end
@@ -35,9 +33,6 @@
patch :decide_tip_amounts
end
end
- resources :tips, :only => [:index]
- resources :deposits, :only => [:index]
- resources :withdrawals, :only => [:index]
get '*path' => 'home#index'
end
diff --git a/features/find_or_create_project.feature b/features/find_or_create_project.feature
index bf77b2c5..dccda37f 100644
--- a/features/find_or_create_project.feature
+++ b/features/find_or_create_project.feature
@@ -7,7 +7,7 @@ Feature: Visitors may search for and add projects
And I visit the "projects" page
Then I should be on the "projects" page
When I fill "query" with: "seldons-project"
- And I click on "Find or add project"
+ And I click "Find or add project"
Then I should be on the "search" page
And I should see "seldon/seldons-project"
But I should not see "project not found"
@@ -17,7 +17,7 @@ Feature: Visitors may search for and add projects
And I visit the "projects" page
Then I should be on the "projects" page
When I fill "query" with: "no-such-repo"
- And I click on "Find or add project"
+ And I click "Find or add project"
Then I should be on the "search" page
And I should see "Project not found"
But I should not see "seldon/seldons-project"
@@ -27,7 +27,7 @@ Feature: Visitors may search for and add projects
And I visit the "projects" page
Then I should be on the "projects" page
When I fill "query" with: "https://github.com/tip4commit/tip4commit"
- And I click on "Find or add project"
+ And I click "Find or add project"
Then I should be on the "tip4commit/tip4commit github-project" page
And I should see "tip4commit/tip4commit"
But I should not see "seldon/seldons-project"
@@ -37,7 +37,7 @@ Feature: Visitors may search for and add projects
And I visit the "projects" page
Then I should be on the "projects" page
When I fill "query" with: "https://github.com/xxx-no-such-user-xxx/xxx-no-such-repo-xxx"
- And I click on "Find or add project"
+ And I click "Find or add project"
Then I should be on the "search" page
And I should see "Project not found"
But I should not see "xxx-no-such-repo-xxx"
@@ -48,7 +48,7 @@ Feature: Visitors may search for and add projects
And I visit the "projects" page
Then I should be on the "projects" page
When I fill "query" with: "https://shithub.com/nouser/norepo"
- And I click on "Find or add project"
+ And I click "Find or add project"
Then I should be on the "search" page
And I should see "Project not found"
But I should not see "norepo"
@@ -59,7 +59,7 @@ Feature: Visitors may search for and add projects
And I visit the "projects" page
Then I should be on the "projects" page
When I fill "query" with: "seldons-project"
- And I click on "Find or add project"
+ And I click "Find or add project"
Then I should be on the "search" page
And I should see "seldon/seldons-project"
And there should not be a project avatar image visible
@@ -69,7 +69,7 @@ Feature: Visitors may search for and add projects
And I visit the "projects" page
Then I should be on the "projects" page
When I fill "query" with: "https://github.com/tip4commit/tip4commit"
- And I click on "Find or add project"
+ And I click "Find or add project"
Then I should be on the "tip4commit/tip4commit github-project" page
And I should see "tip4commit/tip4commit"
And there should be a project avatar image visible
diff --git a/features/manage_project.feature b/features/manage_project.feature
index 975e2f84..25ef620c 100644
--- a/features/manage_project.feature
+++ b/features/manage_project.feature
@@ -1,8 +1,10 @@
Feature: Collaborators may manage project
Background:
Given a "github" project named "seldon/seldons-project" exists
+ # NOTE: "seldon" is automatically a collaborator
- Scenario: Collaborators must be signed in to manage project
+
+ Scenario: Visitors may not manage projects
Given I'm not signed in
When I visit the "seldon/seldons-project github-project" page
Then I should be on the "seldon/seldons-project github-project" page
@@ -19,6 +21,10 @@ Feature: Collaborators may manage project
And I should not see "Change project settings"
And I should not see "Decide tips"
+ When I visit the "seldon/seldons-project github-project edit" page
+ Then I should be on the "home" page
+ And I should see "You are not authorized to perform this action"
+
Scenario: Non-collaborators should not be able to manage project
Given I'm signed in as "someone-else"
When I visit the "seldon/seldons-project github-project" page
@@ -36,6 +42,10 @@ Feature: Collaborators may manage project
And I should not see "Change project settings"
And I should not see "Decide tips"
+ When I visit the "seldon/seldons-project github-project edit" page
+ Then I should be on the "home" page
+ And I should see "You are not authorized to perform this action"
+
Scenario: New projects should show "Pending initial sync"
Given I'm signed in as "seldon"
When I visit the "seldon/seldons-project github-project" page
@@ -52,3 +62,20 @@ Feature: Collaborators may manage project
But I should not see "Pending initial sync"
And I should see "Change project settings"
But I should not see "Decide tips"
+
+ Scenario: Collaborators may sign in to manage project
+ Given I'm signed in as "seldon"
+ When the project syncs with the remote repo
+ And I visit the "seldon/seldons-project github-project" page
+ Then I should be on the "seldon/seldons-project github-project" page
+ And I should see "seldon/seldons-project"
+ And I should see "Change project settings"
+ But I should not see "Pending initial sync"
+ And I should not see "Decide tips"
+
+ When I click "Change project settings"
+ Then I should be on the "seldon/seldons-project github-project edit" page
+ And I should see "seldon/seldons-project project settings"
+ When I click "Save the project settings"
+ Then I should be on the "seldon/seldons-project github-project" page
+ And I should see "The project settings have been updated"
diff --git a/features/pretty_paths.feature b/features/pretty_paths.feature
index c7606fb4..343952d7 100644
--- a/features/pretty_paths.feature
+++ b/features/pretty_paths.feature
@@ -1,45 +1,175 @@
Feature: The site routes pretty paths uniformly
Background:
Given a "github" project named "seldon/seldons-project" exists
- And a user named "yugo" exists with a bitcoin address
+ And a user named "seldon" exists with a bitcoin address
+ And a user named "yugo" exists without a bitcoin address
- Scenario: Project show page is accessible via pretty path
- When I visit the "seldon/seldons-project github-project" page
- Then I should be on the "seldon/seldons-project github-project" page
+ ### Project routes ###
- Scenario: Project show page is accessible via id
- When I browse to the explicit path "projects/1"
- Then I should be on the "seldon/seldons-project github-project" page
+ Scenario: Project index page is accessible via standard path
+ When I visit the "projects" page
+ Then I should be on the "projects" page
- Scenario: Project edit page is accessible via pretty path
- When I visit the "seldon/seldons-project github-project edit" page
- Then I should be on the "seldon/seldons-project github-project edit" page
+ Scenario: Project show page is accessible via project name
+ When I visit the "seldon/seldons-project github-project" page
+ Then I should be on the "seldon/seldons-project github-project" page
- Scenario: Project show page is accessible via id
- When I browse to the explicit path "projects/1/edit"
- Then I should be on the "seldon/seldons-project github-project edit" page
+ Scenario: Project show page is accessible via project id
+ When I browse to the explicit path "projects/1"
+ Then I should be on the "seldon/seldons-project github-project" page
- Scenario: Project decide_tip_amounts page is accessible via pretty path
- When I visit the "seldon/seldons-project github-project decide_tip_amounts" page
- Then I should be on the "seldon/seldons-project github-project decide_tip_amounts" page
+ Scenario: Project edit page is accessible via project name
+ Given I'm signed in as "seldon"
+ When the project syncs with the remote repo
+ And I visit the "seldon/seldons-project github-project edit" page
+ Then I should be on the "seldon/seldons-project github-project edit" page
- Scenario: Project decide_tip_amounts page is accessible via id
- When I browse to the explicit path "projects/1/decide_tip_amounts"
- Then I should be on the "seldon/seldons-project github-project decide_tip_amounts" page
+ Scenario: Project edit page is accessible via project id
+ Given I'm signed in as "seldon"
+ When the project syncs with the remote repo
+ And I browse to the explicit path "projects/1/edit"
+ Then I should be on the "seldon/seldons-project github-project edit" page
- Scenario: Project tips page is accessible via pretty path
- When I visit the "seldon/seldons-project github-project tips" page
- Then I should be on the "seldon/seldons-project github-project tips" page
+ Scenario: Project decide_tip_amounts page is accessible via project name
+ Given I'm signed in as "seldon"
+ When the project syncs with the remote repo
+ When I visit the "seldon/seldons-project github-project decide_tip_amounts" page
+ Then I should be on the "seldon/seldons-project github-project decide_tip_amounts" page
- Scenario: Project tips page is accessible via id
- When I browse to the explicit path "projects/1/tips"
- Then I should be on the "seldon/seldons-project github-project tips" page
+ Scenario: Project decide_tip_amounts page is accessible via project id
+ Given I'm signed in as "seldon"
+ When the project syncs with the remote repo
+ When I browse to the explicit path "projects/1/decide_tip_amounts"
+ Then I should be on the "seldon/seldons-project github-project decide_tip_amounts" page
- Scenario: Project deposits page is accessible via pretty path
- When I visit the "seldon/seldons-project github-project deposits" page
- Then I should be on the "seldon/seldons-project github-project deposits" page
+ Scenario: Project tips page is accessible via project name
+ When I visit the "seldon/seldons-project github-project tips" page
+ Then I should be on the "seldon/seldons-project github-project tips" page
- Scenario: Project deposits page is accessible via id
- When I browse to the explicit path "projects/1/deposits"
- Then I should be on the "seldon/seldons-project github-project deposits" page
+ Scenario: Project tips page is accessible via project id
+ When I browse to the explicit path "projects/1/tips"
+ Then I should be on the "seldon/seldons-project github-project tips" page
+
+ Scenario: Project deposits page is accessible via project name
+ When I visit the "seldon/seldons-project github-project deposits" page
+ Then I should be on the "seldon/seldons-project github-project deposits" page
+
+ Scenario: Project deposits page is accessible via project id
+ When I browse to the explicit path "projects/1/deposits"
+ Then I should be on the "seldon/seldons-project github-project deposits" page
+
+ Scenario: Unknown project show page via project name redirects to projects page
+ When I visit the "yugo/yugos-project github-project" page
+ Then I should be on the "projects" page
+
+ Scenario: Unknown project show page via project id redirects to projects page
+ When I browse to the explicit path "projects/999999"
+ Then I should be on the "projects" page
+
+ Scenario: Unknown project edit page via project name redirects to projects page
+ When I visit the "yugo/yugos-project github-project edit" page
+ Then I should be on the "projects" page
+
+ Scenario: Unknown project edit page via project id redirects to projects page
+ When I browse to the explicit path "projects/999999/edit"
+ Then I should be on the "projects" page
+
+ Scenario: Unknown project decide_tip_amounts page via project name redirects to projects page
+ When I visit the "yugo/yugos-project github-project decide_tip_amounts" page
+ Then I should be on the "projects" page
+
+ Scenario: Unknown project decide_tip_amounts page via project id redirects to projects page
+ When I browse to the explicit path "projects/999999/decide_tip_amounts"
+ Then I should be on the "projects" page
+
+ Scenario: Unknown project tips page via project name redirects to projects page
+ When I visit the "yugo/yugos-project github-project tips" page
+ Then I should be on the "projects" page
+
+ Scenario: Unknown project tips page via project id redirects to projects page
+ When I browse to the explicit path "projects/999999/tips"
+ Then I should be on the "projects" page
+
+ Scenario: Unknown project deposits page via project name redirects to projects page
+ When I visit the "yugo/yugos-project github-project deposits" page
+ Then I should be on the "projects" page
+
+ Scenario: Unknown project deposits page via project id redirects to projects page
+ When I browse to the explicit path "projects/999999/deposits"
+ Then I should be on the "projects" page
+
+
+ ### User routes ###
+
+ Scenario: User index page is accessible via standard path
+ When I visit the "users" page
+ Then I should be on the "users" page
+
+ Scenario: User show page is inaccessible via user name when not signed in
+ When I visit the "seldon user" page
+ Then I should be on the "sign_in" page
+ And I should see "You need to sign in or sign up before continuing"
+
+ Scenario: User show page is inaccessible via user id when not signed in
+ When I browse to the explicit path "users/1"
+ Then I should be on the "sign_in" page
+ And I should see "You need to sign in or sign up before continuing"
+
+ Scenario: User show page is inaccessible via user name to other users
+ Given I'm signed in as "yugo"
+ When I visit the "seldon user" page
+ Then I should be on the "home" page
+ And I should see "You are not authorized to perform this action"
+
+ Scenario: User show page is inaccessible via user id to other users
+ Given I'm signed in as "yugo"
+ When I browse to the explicit path "users/1"
+ Then I should be on the "home" page
+ And I should see "You are not authorized to perform this action"
+
+ Scenario: User show page is accessible via user name to that user
+ Given I'm signed in as "seldon"
+ When I visit the "seldon user" page
+ Then I should be on the "seldon user" page
+ And I should see "seldon Balance 0.00000000 Ƀ"
+ And I should see "E-mail seldon@example.com"
+ And I should see "Bitcoin address"
+
+ Scenario: User show page is accessible via user id to that user
+ Given I'm signed in as "seldon"
+ When I browse to the explicit path "users/1"
+ Then I should be on the "seldon user" page
+ And I should see "seldon Balance 0.00000000 Ƀ"
+ And I should see "E-mail seldon@example.com"
+ And I should see "Bitcoin address"
+
+ Scenario: Unknown user tips page user name redirects to users page
+ When I visit the "unknown-user user tips" page
+ Then I should be on the "users" page
+ And I should see "User not found"
+
+ Scenario: Unknown user tips page pretty id redirects to users page
+ When I browse to the explicit path "users/999999/tips"
+ Then I should be on the "users" page
+ And I should see "User not found"
+
+ Scenario: User without bitcoin address tips page via user name redirects to users page
+ When I visit the "yugo user tips" page
+ Then I should be on the "users" page
+ And I should see "User not found"
+
+ Scenario: User without bitcoin address tips page via user id redirects to users page
+ When I browse to the explicit path "users/2/tips"
+ Then I should be on the "users" page
+ And I should see "User not found"
+
+ Scenario: User with bitcoin address tips page is accessible via user name
+ When I visit the "seldon user tips" page
+ Then I should be on the "seldon user tips" page
+ And I should see "seldon tips"
+
+ Scenario: User with bitcoin address tips page is accessible via user id
+ When I browse to the explicit path "users/1/tips"
+ Then I should be on the "seldon user tips" page
+ And I should see "seldon tips"
diff --git a/features/sign_up_sign_in.feature b/features/sign_up_sign_in.feature
index c88e6ead..00c83c17 100644
--- a/features/sign_up_sign_in.feature
+++ b/features/sign_up_sign_in.feature
@@ -1,16 +1,16 @@
Feature: Visitors should be able to sign_up and sign_in
Background:
Given a "github" project named "seldon/seldons-project" exists
- And the project collaborators are:
- | seldon |
+ And a user named "seldon" exists without a bitcoin address
+
Scenario Outline: Visitors should see sign_up and sign_in links on all pages
Given I'm not signed in
When I visit the page
Then I should be on the page
- And I should see "Sign up" in the header
- And I should see "Sign in" in the header
- But I should not see "Sign out" in the header
+ And I should see "Sign up" in the "header" area
+ And I should see "Sign in" in the "header" area
+ But I should not see "Sign out" in the "header" area
Examples:
| page |
| "home" |
@@ -27,25 +27,26 @@ Feature: Visitors should be able to sign_up and sign_in
Given I'm not signed in
When I visit the "sign_in" page
Then I should be on the "sign_in" page
- And I should see "Sign up" in the header
- But I should not see "Sign in" in the header
- And I should not see "Sign out" in the header
+ And I should see "Sign up" in the "header" area
+ But I should not see "Sign in" in the "header" area
+ And I should not see "Sign out" in the "header" area
Scenario: Visitors should see sign_in but not sign_up links on sign_up page
Given I'm not signed in
When I visit the "sign_up" page
Then I should be on the "sign_up" page
- And I should not see "Sign up" in the header
- But I should see "Sign in" in the header
- And I should not see "Sign out" in the header
+ And I should not see "Sign up" in the "header" area
+ But I should see "Sign in" in the "header" area
+ And I should not see "Sign out" in the "header" area
Scenario Outline: Logged in users should see only sign_out link on every page
Given I'm signed in as "seldon"
- When I visit the page
+ When the project syncs with the remote repo
+ And I visit the page
Then I should be on the page
- And I should not see "Sign up" in the header
- And I should not see "Sign in" in the header
- But I should see "Sign out" in the header
+ And I should not see "Sign up" in the "header" area
+ And I should not see "Sign in" in the "header" area
+ But I should see "Sign out" in the "header" area
Examples:
| page |
| "home" |
@@ -59,3 +60,110 @@ Feature: Visitors should be able to sign_up and sign_in
| "seldon/seldons-project github-project decide_tip_amounts" |
| "seldon/seldons-project github-project tips" |
| "seldon/seldons-project github-project deposits" |
+
+ Scenario: Devise rejects invalid logins
+ Given I'm not signed in
+ When I visit the "sign_in" page
+ Then I should be on the "sign_in" page
+ And I should see "Sign in E-mail Password Remember me"
+ When I fill "E-mail" with: "unknown-user@somehost.net"
+ And I fill "Password" with: "unknown-users-password"
+ And I click "Sign in"
+ Then I should be on the "sign_in" page
+ And I should see "Invalid email or password"
+ When I fill "E-mail" with: "seldon@example.com"
+ And I fill "Password" with: "incorrect-password"
+ And I click "Sign in"
+ Then I should be on the "sign_in" page
+ And I should see "Invalid email or password"
+
+ Scenario: Visitors should be able to sign up with an email address
+ Given I'm not signed in
+ When I visit the "home" page
+ When I click "Sign up" within the "header" area
+ Then I should be on the "sign_up" page
+ And I should see "Sign up E-mail Password Password confirmation"
+
+ When I fill "E-mail" with: "new-guy@example.com"
+ And I fill "Password" with: "new-guys-password"
+ And I fill "Password confirmation" with: "NOT-new-guys-password"
+ And I click "Sign up"
+# NOTE: this is not the actual behavior of the app
+# validations are client-side and prevent the button from being pressed
+# (this applies to the next two clauses as well)
+ Then I should be on the "users" page
+ And I should see "Password confirmation doesn't match Password"
+# if we were testing with javascript support - this is the actual behavior
+# Then I should be on the "sign_up" page
+# And I should see "The password and its confirmation are not same"
+
+ When I fill "E-mail" with: "new-guy@example.com"
+ And I fill "Password" with: "new-guys-password"
+ And I click "Sign up"
+ Then I should be on the "users" page
+ And I should see "Password confirmation doesn't match Password"
+# Then I should be on the "sign_up" page
+# And I should see "The password and its confirmation are not same"
+# And I should see "The password confirmation is required and can't be empty"
+
+ When I fill "E-mail" with: "new-guy@example.com"
+ And I fill "Password confirmation" with: "new-guys-password"
+ And I click "Sign up"
+ Then I should be on the "users" page
+ And I should see "Password confirmation doesn't match Password"
+# Then I should be on the "sign_up" page
+# And I should see "The password and its confirmation are not same"
+# And I should see "The password is required and can't be empty"
+
+ When I fill "E-mail" with: "seldon@example.com"
+ And I fill "Password" with: "new-guys-password"
+ And I fill "Password confirmation" with: "new-guys-password"
+ And I click "Sign up"
+ Then I should be on the "users" page
+ And I should see "E-mail has already been taken"
+ And there should be 0 email sent
+
+ When I fill "E-mail" with: "new-guy@example.com"
+ And I fill "Password" with: "new-guys-password"
+ And I fill "Password confirmation" with: "new-guys-password"
+ And I click "Sign up"
+ Then I should be on the "home" page
+ And I should see "Sign up or Sign in"
+ And I should see "A message with a confirmation link has been sent"
+ And there should be 1 email sent
+
+ When I visit the "sign_in" page
+ Then I should be on the "sign_in" page
+ And I should see "Sign in E-mail Password Remember me"
+ When I fill "E-mail" with: "new-guy@example.com"
+ And I fill "Password" with: "new-guys-password"
+ And I click "Sign in"
+ Then I should be on the "sign_in" page
+ And I should see "You have to confirm your account before continuing"
+
+ When I confirm the email address: "new-guy@example.com"
+ Then I should be on the "sign_in" page
+ And I should see "Your account was successfully confirmed"
+ When I fill "E-mail" with: "new-guy@example.com"
+ And I fill "Password" with: "new-guys-password"
+ And I click "Sign in"
+ Then I should be on the "home" page
+ And I should see "new-guy@example.com / 0.00000000 Ƀ / Sign out"
+ And I should see "Signed in successfully"
+
+ Scenario: Visitors should be able to sign up with GitHub oauth
+ Given I'm not signed in
+ When I visit the "sign_up" page
+ And I click "Sign in with Github"
+ Then I should be on the "/login/oauth/authorize" page
+ Then some magic stuff happens in the cloud
+
+ Given a GitHib user named "seldon" exists
+ When I visit the "sign_in" page
+ And I click "Sign in with Github"
+ Then I should be on the "home" page
+ And I should see "seldon / 0.00000000 Ƀ / Sign out"
+ And I should see "Successfully authenticated from GitHub account"
+
+# TODO:
+# Scenario: Users signed up via email should be able to merge via GitHub oauth
diff --git a/features/step_definitions/common.rb b/features/step_definitions/common.rb
index b349a73d..66ddd16f 100644
--- a/features/step_definitions/common.rb
+++ b/features/step_definitions/common.rb
@@ -5,7 +5,12 @@
Project.any_instance.stub(:branches).and_return(%w(master))
end
-Given /^I'm signed in as "(.*?)"$/ do |nickname|
+After do |scenario|
+# Cucumber.wants_to_quit = true if scenario.failed?
+ OmniAuth.config.test_mode = false
+end
+
+def mock_github_user nickname
email = "#{nickname.parameterize}@example.com"
OmniAuth.config.test_mode = true
@@ -16,12 +21,20 @@
"verified_emails" => [email] ,
},
}.to_ostruct
+
+ step "a user named \"#{nickname}\" exists without a bitcoin address"
+end
+
+Given /^a GitHib user named "(.*?)" exists$/ do |nickname|
+ mock_github_user nickname
+end
+
+Given /^I'm signed in as "(.*?)"$/ do |nickname|
+ mock_github_user nickname
visit root_path
first(:link, "Sign in").click
click_on "Sign in with Github"
page.should have_content("Successfully authenticated")
-
- step "a user named \"#{nickname}\" exists without a bitcoin address"
end
Given /^I'm not signed in$/ do
@@ -32,6 +45,8 @@
else
page.should have_content("Sign in")
end
+
+ OmniAuth.config.test_mode = false
end
Given (/^I sign in as "(.*?)"$/) { |nickname| step "I'm signed in as \"#{nickname}\"" }
@@ -42,14 +57,14 @@ def parse_path_from_page_string page_string
path = nil
# explicit cases
- # e.g. "a-user/a-project github project edit"
+ # e.g. "a-user/a-project github-project edit"
# e.g. "a-user user edit"
- tokens = page_string.split ' '
- name = tokens[0]
- model = tokens[1]
- action = tokens[2] || '' # '' => 'show'
- is_user = model.eql? 'user'
- is_project = ['github-project' , 'bitbucket-project'].include? model
+ tokens = page_string.split ' '
+ name = tokens[0]
+ model = tokens[1]
+ action = tokens[2] || '' # '' => 'show'
+ is_user = model.eql? 'user'
+ is_project = ['github-project' , 'bitbucket-project'].include? model
if is_project
projects_paths = ['' , 'edit' , 'decide_tip_amounts' , 'tips' , 'deposits']
is_valid_path = projects_paths.include? action
@@ -58,8 +73,7 @@ def parse_path_from_page_string page_string
elsif is_user
user_paths = ['' , 'tips']
is_valid_path = user_paths.include? action
-# path = "/users/#{name}/#{action}" if is_valid_path # TODO: nyi
- path = "/users/#{@users[name].id}/#{action}" if is_valid_path
+ path = "/users/#{name}/#{action}" if is_valid_path # TODO: nyi
# implicit cases
else case page_string
@@ -87,16 +101,29 @@ def parse_path_from_page_string page_string
end
Then(/^I should be on the "(.*?)" page$/) do |page_string|
- expected = parse_path_from_page_string page_string
+ expected = parse_path_from_page_string page_string rescue expected = page_string
actual = page.current_path
- (expected.index actual).should eq 0 # ignore trailing '/'
+ expected.chop! if (expected.end_with? '/') && (expected.size > 1)
+ actual .chop! if (actual .end_with? '/') && (actual .size > 1)
+
+ actual.should eq expected
+end
+
+def find_element node_name
+ case node_name
+ when "header" ; page.find '.masthead'
+ end
end
-Given(/^I click on "(.*?)"$/) do |arg1|
+Given(/^I click "(.*?)"$/) do |arg1|
click_on(arg1)
end
+Given(/^I click "(.*?)" within the "(.*?)" area$/) do |link_text , node_name|
+ within (find_element node_name) { click_on link_text }
+end
+
Given(/^I check "(.*?)"$/) do |arg1|
check(arg1)
end
@@ -124,3 +151,12 @@ def parse_path_from_page_string page_string
When(/^the email counters are reset$/) do
ActionMailer::Base.deliveries.clear
end
+
+When(/^I confirm the email address: "(.*?)"$/) do |email|
+ mail = ActionMailer::Base.deliveries.select {|ea| ea.to.first.eql? email}.first
+ mail_body = mail.body.raw_source
+ token = mail_body.split('?confirmation_token=')[1].split('">Confirm my account').first
+ visit "/users/confirmation?confirmation_token=#{token}"
+end
+
+Then /^some magic stuff happens in the cloud$/ do ; true ; end ;
diff --git a/features/step_definitions/home_steps.rb b/features/step_definitions/home_steps.rb
index 11dcaa36..ce685958 100644
--- a/features/step_definitions/home_steps.rb
+++ b/features/step_definitions/home_steps.rb
@@ -1,8 +1,5 @@
-Then(/^I should (.*)\s*see "(.*?)" in the header$/) do |should , text|
- if should.eql? 'not '
- page.find('.masthead').should have_no_content(text)
- else
- page.find('.masthead').should have_content(text)
- end
+Then(/^I should (.*)\s*see "(.*?)" in the "(.*?)" area$/) do |should , text , node_name|
+ element = find_element node_name
+ element.should ((should.eql? 'not ')? (have_no_content text) : (have_content text))
end
diff --git a/features/tip_modifier_interface.feature b/features/tip_modifier_interface.feature
index c5c06313..ee675e28 100644
--- a/features/tip_modifier_interface.feature
+++ b/features/tip_modifier_interface.feature
@@ -25,10 +25,10 @@ Feature: A project collaborator can change the tips of commits
When the project syncs with the remote repo
And I visit the "seldon/seldons-project github-project" page
Then I should be on the "seldon/seldons-project github-project" page
- When I click on "Change project settings"
+ When I click "Change project settings"
Then I should be on the "seldon/seldons-project github-project edit" page
When I check "Do not send the tips immediately. Give collaborators the ability to modify the tips before they're sent"
- And I click on "Save the project settings"
+ And I click "Save the project settings"
Then I should be on the "seldon/seldons-project github-project" page
And I should see "The project settings have been updated"
@@ -51,7 +51,7 @@ Feature: A project collaborator can change the tips of commits
When I visit the "seldon/seldons-project github-project" page
Then I should be on the "seldon/seldons-project github-project" page
- When I click on "Decide tip amounts"
+ When I click "Decide tip amounts"
Then I should be on the "seldon/seldons-project github-project decide_tip_amounts" page
And I should not see "AAA"
And I should not see "BBB"
@@ -65,8 +65,9 @@ Feature: A project collaborator can change the tips of commits
And the most recent commit should be "FFF"
When I choose the amount "Free: 0%" on commit "DDD"
- And I click on "Send the selected tip amounts"
+ And I click "Send the selected tip amounts"
Then I should be on the "seldon/seldons-project github-project decide_tip_amounts" page
+ And I should see "The tip amounts have been defined"
And there should be a tip of "0" for commit "DDD"
And the tip amount for commit "EEE" should be undecided
But there should be no tip for commit "FFF"
@@ -74,8 +75,9 @@ Feature: A project collaborator can change the tips of commits
When the email counters are reset
And I choose the amount "Tiny: 0.1%" on commit "EEE"
- And I click on "Send the selected tip amounts"
- Then I should be on the "seldon/seldons-project github-project decide_tip_amounts" page
+ And I click "Send the selected tip amounts"
+ Then I should be on the "seldon/seldons-project github-project" page
+ And I should see "The tip amounts have been defined"
And there should be a tip of "0" for commit "DDD"
And there should be a tip of "0.49005" for commit "EEE"
But there should be no tip for commit "FFF"
@@ -137,10 +139,10 @@ Feature: A project collaborator can change the tips of commits
And I visit the "seldon/seldons-project github-project" page
Then I should be on the "seldon/seldons-project github-project" page
And I should see "Decide tip amounts"
- When I click on "Decide tip amounts"
+ When I click "Decide tip amounts"
Then I should be on the "seldon/seldons-project github-project decide_tip_amounts" page
When I choose the amount "Huge: 5%" on all commits
- And I click on "Send the selected tip amounts"
+ And I click "Send the selected tip amounts"
Then I should be on the "seldon/seldons-project github-project decide_tip_amounts" page
And I should see "You can't assign more than 100% of available funds."
And the tip amount for commit "BBB" should be undecided
diff --git a/features/tipping_policies.feature b/features/tipping_policies.feature
index 6d0b0ed5..cdfe45f8 100644
--- a/features/tipping_policies.feature
+++ b/features/tipping_policies.feature
@@ -10,14 +10,14 @@ Feature: A project collaborator can display the tipping policies of the project
Given I'm signed in as "daneel"
When I visit the "seldon/seldons-project github-project" page
Then I should be on the "seldon/seldons-project github-project" page
- And I click on "Change project settings"
+ And I click "Change project settings"
And I fill "Tipping policies" with:
"""
All commits are huge!
Blah blah
"""
- And I click on "Save the project settings"
+ And I click "Save the project settings"
Then I should be on the "seldon/seldons-project github-project" page
Then I should see "The project settings have been updated"
diff --git a/spec/controllers/projects_controller_spec.rb b/spec/controllers/projects_controller_spec.rb
index 8feabba1..b0064169 100644
--- a/spec/controllers/projects_controller_spec.rb
+++ b/spec/controllers/projects_controller_spec.rb
@@ -40,6 +40,16 @@
end
end
+ describe 'GET #search' do
+ context 'with existing repo that has been blacklisted' do
+ let(:subject) { get :search, query: "https://github.com/mitsuhiko/flask" }
+
+ it 'renders blacklisted template' do
+ expect(subject).to render_template :blacklisted
+ end
+ end
+ end
+
describe 'POST #search' do
it 'returns 200 status code' do
post :search
@@ -56,25 +66,52 @@
end
=end
- describe 'GET #show' do
- it 'returns 302 status code' do
- get :show , :service => 'github' , :repo => 'test/test'
- response.should be_redirect
+ shared_context 'accessing_project' do |verb , action|
+ let(:a_project) { create :project , :host => 'github' , :full_name => "test/test" }
+
+ context 'existing_project' do
+ it 'via project id returns 302 status code' do
+ case verb
+ when :get ; get action , :id => a_project.id
+ when :patch ; patch action , :id => a_project.id
+ end
+ response.should be_redirect
+ end
+
+ it 'via project name returns 200 status code' do
+ case verb
+ when :get ; get action , :service => 'github' , :repo => a_project.full_name
+ when :patch ; patch action , :service => 'github' , :repo => a_project.full_name
+ end
+ response.should be_success
+ end
end
- context 'with existing repo that has been blacklisted' do
- let(:blacklisted_repo) { create(:project, host: "github", full_name: "mitsuhiko/flask") }
- let(:subject) { get :show, service: "github", repo: blacklisted_repo.full_name }
+ context 'nonexisting_project' do
+ it 'via project id returns 302 status code' do
+ case verb
+ when :get ; get action , :id => 999999
+ when :patch ; patch action , :id => 999999
+ end
+ response.should be_redirect
+ end
- it 'renders blacklisted template' do
- expect(subject).to render_template :blacklisted
+ it 'via project name returns 200 status code' do
+ case verb
+ when :get ; get action , :service => 'github' , :repo => 'no-such/project' ;
+ when :patch ; patch action , :service => 'github' , :repo => 'no-such/project' ;
+ end
+ response.should be_redirect
end
end
end
- describe 'GET #search' do
+ describe 'GET #show' do
+ include_context 'accessing_project' , :get , :show
+
context 'with existing repo that has been blacklisted' do
- let(:subject) { get :search, query: "https://github.com/mitsuhiko/flask" }
+ let(:blacklisted_repo) { create(:project, host: "github", full_name: "mitsuhiko/flask") }
+ let(:subject) { get :show, service: "github", repo: blacklisted_repo.full_name }
it 'renders blacklisted template' do
expect(subject).to render_template :blacklisted
@@ -84,12 +121,18 @@
describe 'GET #edit' do
it 'returns 302 status code' do
+# TODO: requires logged in user who is project collaborator
+# include_context 'accessing_project' , :get , :edit
+
get :edit , :service => 'github' , :repo => 'test/test'
response.should be_redirect
end
end
describe 'GET #decide_tip_amounts' do
+# TODO: requires logged in user who is project collaborator and some tips
+# include_context 'accessing_project' , :get , :decide_tip_amounts
+
it 'returns 302 status code' do
get :decide_tip_amounts , :service => 'github' , :repo => 'test/test'
response.should be_redirect
@@ -97,6 +140,9 @@
end
describe 'PATCH #decide_tip_amounts' do
+# TODO: requires logged in user who is project collaborator and some tips
+# include_context 'accessing_project' , :patch , :decide_tip_amounts
+
it 'returns 302 status code' do
patch :decide_tip_amounts , :service => 'github' , :repo => 'test/test'
response.should be_redirect
diff --git a/spec/controllers/users_controller_spec.rb b/spec/controllers/users_controller_spec.rb
index 32e0acfb..afa57358 100644
--- a/spec/controllers/users_controller_spec.rb
+++ b/spec/controllers/users_controller_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe UsersController do
- describe '#index' do
+ describe 'GET #index' do
let(:subject) { get :index }
it 'renders index template' do
@@ -19,8 +19,8 @@
end
describe '#show' do
- let(:user) { mock_model User, id: 100000000 }
- let(:subject) { get :show, id: user.id }
+ let(:user) { create(:user) }
+ let(:subject) { get :show , :nickname => user.nickname }
context 'when logged in' do
login_user
@@ -68,8 +68,10 @@
end
context 'when user not found' do
- it 'redirect to root_path' do
- expect(subject).to redirect_to root_path
+ let(:subject) { get :show , :nickname => 'unknown-user' }
+
+ it 'redirect to users_path' do
+ expect(subject).to redirect_to users_path
end
it 'sets flash error message' do
@@ -124,27 +126,28 @@
it "regex rejects reserved user paths" do
# accepted pertty url usernames
- should_accept = %w{logi ogin s4c2 42x}
+ should_accept = [' ' , 'logi' , 'ogin' , 's4c2' , '42x' , 'nick name' , 'kd']
# reserved routes (rejected pertty url usernames)
- should_reject = %w{sign_in cancel sign_up edit confirmation login}
+ should_reject = ['' , '1' , '42']
- accepted = should_accept.select {|ea| ea =~ RESERVED_USER_ROUTES_REGEX}
- rejected = should_reject.select {|ea| (ea =~ RESERVED_USER_ROUTES_REGEX).nil? }
- accepted.size.should eq should_accept.size and rejected.size.should eq should_reject.size
+ accepted = should_accept.select {|ea| ea =~ /\D+/}
+ rejected = should_reject.select {|ea| (ea =~ /\D+/).nil? }
+ (accepted.size.should eq should_accept.size) &&
+ (rejected.size.should eq should_reject.size)
end
- it "routes GET /users/friendly-name to User#show" do
+ it "routes GET /users/:nickname to User#show" do
{ :get => "/users/#{user.nickname}" }.should route_to(
:controller => "users" ,
:action => "show" ,
- :id => "kd" )
+ :nickname => "kd" )
end
- it "routes GET /users/friendly-name/tips to Tips#index" do
+ it "routes GET /users/:nickname/tips to Tips#index" do
{ :get => "/users/#{user.nickname}/tips" }.should route_to(
:controller => "tips" ,
:action => "index" ,
- :user_id => "kd" )
+ :nickname => "kd" )
end
end
end
From d0e77c4e4534ffd35b1726851ce242966a0758e4 Mon Sep 17 00:00:00 2001
From: Drew DeVault
Date: Sat, 8 Nov 2014 23:01:28 -0700
Subject: [PATCH 124/415] Blacklist several projects
---
config/blacklist.yml | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/config/blacklist.yml b/config/blacklist.yml
index 266d412f..19f7c9d6 100644
--- a/config/blacklist.yml
+++ b/config/blacklist.yml
@@ -30,4 +30,8 @@
- https://github.com/ipython/*
- https://github.com/mpasternacki/*
- https://github.com/3ofcoins/*
-- https://github.com/ggventurini/python-deltasigma
\ No newline at end of file
+- https://github.com/ggventurini/python-deltasigma
+- https://github.com/SirCmpwn/*
+- https://github.com/MediaCrush/*
+- https://github.com/KnightOS/*
+- https://github.com/KerbalStuff/*
From c69353929a5cba55b6ed225f1297e9287ea4007b Mon Sep 17 00:00:00 2001
From: IreuN
Date: Sun, 9 Nov 2014 22:25:56 +0100
Subject: [PATCH 125/415] Update pl.yml
---
config/locales/pl.yml | 3 +++
1 file changed, 3 insertions(+)
diff --git a/config/locales/pl.yml b/config/locales/pl.yml
index 246e8eda..3820698e 100644
--- a/config/locales/pl.yml
+++ b/config/locales/pl.yml
@@ -126,6 +126,9 @@ pl:
message: Wiadomość
tip: Napiwek (zależy od salda projektu)
submit: Wyślij wybrane ilości napiwków
+ blacklisted:
+ title: Wybacz, ten projekt nie akceptuje napiwków!
+ message: Autor tego projektu zdecydował o wyłączeniu napiwków dla tego projektu.
tips:
index:
tips: Napiwki
From 5d01078396eea6dd8ab190283e17d84854f761f2 Mon Sep 17 00:00:00 2001
From: IreuN
Date: Mon, 10 Nov 2014 23:48:59 +0100
Subject: [PATCH 126/415] Polished up Polish translation :)
---
config/locales/pl.yml | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/config/locales/pl.yml b/config/locales/pl.yml
index 3820698e..bbd49ca6 100644
--- a/config/locales/pl.yml
+++ b/config/locales/pl.yml
@@ -2,14 +2,14 @@ pl:
tip4commit: Tip4Commit
meta:
title: Wspieraj Open Source
- description: Podaruj Bitcoiny na projekty Open Source lub współpracuj tworząc nowe "commits" i otrzymuj napiwki.
+ description: Podaruj Bitcoiny na projekty Open Source lub współpracuj tworząc nowe commity i otrzymuj napiwki.
menu:
home: Strona Główna
projects: Wspierane Projekty
footer:
text: "Kod żródłowy dostępny jest na %{github_link} możesz także %{support_link} jego rozwój."
github_link: GitHub
- support_link: wsparcie
+ support_link: wesprzeć
follow_link: Obserwuj @tip4commit
links:
sign_up: Rejestracja
@@ -54,11 +54,11 @@ pl:
see_projects: Zobacz projekty
how_does_it_work:
title: Jak to działa?
- text: 'Ludzie przesyłają bitcoiny. Kiedy kogoś "commit" zostanie zaakceptowany do repozytorium projektu, automatycznie płacimy autorowi.'
- button: Dowiedz się więcej o Bitcoin
+ text: 'Ludzie przesyłają bitcoiny. Kiedy czyiś commit zostanie zaakceptowany do repozytorium projektu, automatycznie płacimy autorowi.'
+ button: Dowiedz się więcej o Bitcoinie
donate:
title: Podaruj
- text: 'Znajdź projekt, który ci się podoba i prześlij na niego bitcoiny. Twoje bitcoiny będzią zsumowana z innymi aby dać napiwki za nowe "commits".'
+ text: 'Znajdź projekt, który ci się podoba i prześlij na niego bitcoiny. Twoje bitcoiny zostaną zsumowane z innymi aby dać napiwki za nowe commity.'
button: 'Znajdż lub dodaj projekt'
contribute:
title: 'Współpracuj'
@@ -96,7 +96,7 @@ pl:
unclaimed_amount: "(%{amount} z tego jest niezebrane, i zostanie zwrócone do projektu po jednym miesiącu.)"
last_tips: Ostatnie napiwki
see_all: zobacz wszystko
- received: "otrzymano %{amount}"
+ received: "otrzymał %{amount}"
will_receive: dostanie napiwek
for_commit: za "commit"
when_decided: kiedy jego rozmiar zostanie określony
@@ -104,7 +104,7 @@ pl:
contribute_and_earn: Pomagaj i zarabiaj
contribute_and_earn_description: "Wyślij bitcoiny na ten projekt lub %{make_commits_link} i otrzymaj za nie napiwki. Jeśli zostaną zaakceptowane %{branch} przez nadzorce projektu i jeśli są pieniądze na koncie projektu, otrzymasz napiwek!"
contribute_and_earn_branch: "do %{branch} gałęzi"
- make_commits_link: twórz "commits"
+ make_commits_link: twórz "commity"
tell_us_bitcoin_address: "Tylko %{tell_us_link} twój adres bitcoin."
tell_us_link: powiedz nam
sign_in: "Sprawdż e-mail lub %{sign_in_link}."
From 7aa6198ddf0478391a8fda91bd04ed8d8ae7f844 Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Tue, 11 Nov 2014 15:52:38 +0500
Subject: [PATCH 127/415] fixed collobarators
---
app/assets/javascripts/i18n/translations.js | 2 +-
app/services/github.rb | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/assets/javascripts/i18n/translations.js b/app/assets/javascripts/i18n/translations.js
index ac0ec161..029f45b8 100644
--- a/app/assets/javascripts/i18n/translations.js
+++ b/app/assets/javascripts/i18n/translations.js
@@ -1,2 +1,2 @@
var I18n = I18n || {};
-I18n.translations = {"en":{"js":{"errors":{"value":{"invalid":"Value is invalid"},"email":{"invalid":"Invalid Email Address","blank":"The Email is required and can't be empty"},"password":{"blank":"The password is required and can't be empty","invalid":"The password and its confirmation are not same"},"password_confirmation":{"blank":"The password confirmation is required and can't be empty","invalid":"The password and its confirmation are not same"}}}},"hr":{"js":{"errors":{"value":{"invalid":"Vrijednost nevazeca"},"email":{"invalid":"Nezaveca email adresa","blank":"Email je potreban i ne moze biti prazno"},"password":{"blank":"Lozinka je potrebna i ne moze biti prazno","invalid":"Lozinka i njezina potvrda nisu isti"},"password_confirmation":{"blank":"Potvrda lozinke je potrebna i ne moze biti prazno","invalid":"Lozinka i potvrda lozinke nisu isti"}}}},"ru":{"js":{"errors":{"value":{"invalid":"Неверное значение"},"email":{"invalid":"Ошибка в Email адресе","blank":"Email не может быть пустым"},"password":{"blank":"Пароль не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"},"password_confirmation":{"blank":"Подтверждение пароля не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"}}}},"pl":{"js":{"errors":{"value":{"invalid":"Wartość jest niepoprawna"},"email":{"invalid":"Błędny adres E-mail","blank":"E-mail jest wymagany i nie może być pusty"},"password":{"blank":"Hasło jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"},"password_confirmation":{"blank":"Potwierdzenie hasła jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"}}}},"fr":{"js":{"errors":{"value":{"invalid":"Valeur non valide"},"email":{"invalid":"Adresse Email non valide","blank":"L'Email est requis et doit être renseigné"},"password":{"blank":"Les mot de passe est requis et doit être renseigné","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"},"password_confirmation":{"blank":"La confirmation du mot de passe est requise et doit être renseignée","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"}}}}};
\ No newline at end of file
+I18n.translations = {"en":{"js":{"errors":{"value":{"invalid":"Value is invalid"},"email":{"invalid":"Invalid Email Address","blank":"The Email is required and can't be empty"},"password":{"blank":"The password is required and can't be empty","invalid":"The password and its confirmation are not same"},"password_confirmation":{"blank":"The password confirmation is required and can't be empty","invalid":"The password and its confirmation are not same"}}}},"fr":{"js":{"errors":{"value":{"invalid":"Valeur non valide"},"email":{"invalid":"Adresse Email non valide","blank":"L'Email est requis et doit être renseigné"},"password":{"blank":"Les mot de passe est requis et doit être renseigné","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"},"password_confirmation":{"blank":"La confirmation du mot de passe est requise et doit être renseignée","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"}}}},"hr":{"js":{"errors":{"value":{"invalid":"Vrijednost nevazeca"},"email":{"invalid":"Nezaveca email adresa","blank":"Email je potreban i ne moze biti prazno"},"password":{"blank":"Lozinka je potrebna i ne moze biti prazno","invalid":"Lozinka i njezina potvrda nisu isti"},"password_confirmation":{"blank":"Potvrda lozinke je potrebna i ne moze biti prazno","invalid":"Lozinka i potvrda lozinke nisu isti"}}}},"pl":{"js":{"errors":{"value":{"invalid":"Wartość jest niepoprawna"},"email":{"invalid":"Błędny adres E-mail","blank":"E-mail jest wymagany i nie może być pusty"},"password":{"blank":"Hasło jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"},"password_confirmation":{"blank":"Potwierdzenie hasła jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"}}}},"ru":{"js":{"errors":{"value":{"invalid":"Неверное значение"},"email":{"invalid":"Ошибка в Email адресе","blank":"Email не может быть пустым"},"password":{"blank":"Пароль не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"},"password_confirmation":{"blank":"Подтверждение пароля не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"}}}}};
\ No newline at end of file
diff --git a/app/services/github.rb b/app/services/github.rb
index 103c3cb9..2f3fb92d 100644
--- a/app/services/github.rb
+++ b/app/services/github.rb
@@ -62,7 +62,7 @@ def find_or_create_project project_name
end
def collaborators_info project
- client.get("/repos/#{project.full_name}/collaborators") +
+ (client.get("/repos/#{project.full_name}/collaborators") rescue []) +
(client.get("/orgs/#{project.full_name.split('/').first}/members") rescue [])
end
From 07e7e46a46929c4e72b773becb8e8a4208e6bf61 Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Tue, 11 Nov 2014 15:53:10 +0500
Subject: [PATCH 128/415] update info for 100 projects per iteration
---
lib/bitcoin_tipper.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/bitcoin_tipper.rb b/lib/bitcoin_tipper.rb
index 0c61921a..2034f8ff 100644
--- a/lib/bitcoin_tipper.rb
+++ b/lib/bitcoin_tipper.rb
@@ -15,7 +15,7 @@ def self.work withdraw = true
end
Rails.logger.info "Updating projects info..."
- Project.order(:info_updated_at => :desc).last(20).each do |project|
+ Project.order(:info_updated_at => :desc).last(100).each do |project|
Rails.logger.info " Project #{project.id} #{project.full_name}"
project.update_info
project.touch(:info_updated_at)
From 37fdeef3d0e14510e2d7f143d0537b1d1e25c644 Mon Sep 17 00:00:00 2001
From: arsenische
Date: Tue, 11 Nov 2014 17:48:30 +0500
Subject: [PATCH 129/415] hint regarding min tip size
---
app/assets/javascripts/application.js.coffee | 3 +++
app/assets/javascripts/bootstrap.js.coffee | 4 ++--
app/assets/javascripts/i18n/translations.js | 2 +-
app/views/projects/show.html.haml | 8 +++++++-
config/config.yml.sample | 2 +-
config/locales/en.yml | 1 +
config/locales/ru.yml | 1 +
7 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/app/assets/javascripts/application.js.coffee b/app/assets/javascripts/application.js.coffee
index a2a76b69..1f23d93f 100644
--- a/app/assets/javascripts/application.js.coffee
+++ b/app/assets/javascripts/application.js.coffee
@@ -16,3 +16,6 @@ $(document).on "ready page:change", ->
# Finally, load addthis
$.getScript "//s7.addthis.com/js/250/addthis_widget.js#pubid=ra-526425ac0ea0780b"
+
+ $('.noclick').click () ->
+ return false
\ No newline at end of file
diff --git a/app/assets/javascripts/bootstrap.js.coffee b/app/assets/javascripts/bootstrap.js.coffee
index 94406798..f617be7e 100644
--- a/app/assets/javascripts/bootstrap.js.coffee
+++ b/app/assets/javascripts/bootstrap.js.coffee
@@ -1,3 +1,3 @@
-jQuery ->
+$(document).on "ready page:change", () ->
$("a[rel~=popover], .has-popover").popover()
- $("a[rel~=tooltip], .has-tooltip").tooltip()
+ $("a[rel~=tooltip], .has-tooltip").tooltip()
\ No newline at end of file
diff --git a/app/assets/javascripts/i18n/translations.js b/app/assets/javascripts/i18n/translations.js
index 029f45b8..3448b4af 100644
--- a/app/assets/javascripts/i18n/translations.js
+++ b/app/assets/javascripts/i18n/translations.js
@@ -1,2 +1,2 @@
var I18n = I18n || {};
-I18n.translations = {"en":{"js":{"errors":{"value":{"invalid":"Value is invalid"},"email":{"invalid":"Invalid Email Address","blank":"The Email is required and can't be empty"},"password":{"blank":"The password is required and can't be empty","invalid":"The password and its confirmation are not same"},"password_confirmation":{"blank":"The password confirmation is required and can't be empty","invalid":"The password and its confirmation are not same"}}}},"fr":{"js":{"errors":{"value":{"invalid":"Valeur non valide"},"email":{"invalid":"Adresse Email non valide","blank":"L'Email est requis et doit être renseigné"},"password":{"blank":"Les mot de passe est requis et doit être renseigné","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"},"password_confirmation":{"blank":"La confirmation du mot de passe est requise et doit être renseignée","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"}}}},"hr":{"js":{"errors":{"value":{"invalid":"Vrijednost nevazeca"},"email":{"invalid":"Nezaveca email adresa","blank":"Email je potreban i ne moze biti prazno"},"password":{"blank":"Lozinka je potrebna i ne moze biti prazno","invalid":"Lozinka i njezina potvrda nisu isti"},"password_confirmation":{"blank":"Potvrda lozinke je potrebna i ne moze biti prazno","invalid":"Lozinka i potvrda lozinke nisu isti"}}}},"pl":{"js":{"errors":{"value":{"invalid":"Wartość jest niepoprawna"},"email":{"invalid":"Błędny adres E-mail","blank":"E-mail jest wymagany i nie może być pusty"},"password":{"blank":"Hasło jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"},"password_confirmation":{"blank":"Potwierdzenie hasła jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"}}}},"ru":{"js":{"errors":{"value":{"invalid":"Неверное значение"},"email":{"invalid":"Ошибка в Email адресе","blank":"Email не может быть пустым"},"password":{"blank":"Пароль не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"},"password_confirmation":{"blank":"Подтверждение пароля не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"}}}}};
\ No newline at end of file
+I18n.translations = {"en":{"js":{"errors":{"value":{"invalid":"Value is invalid"},"email":{"invalid":"Invalid Email Address","blank":"The Email is required and can't be empty"},"password":{"blank":"The password is required and can't be empty","invalid":"The password and its confirmation are not same"},"password_confirmation":{"blank":"The password confirmation is required and can't be empty","invalid":"The password and its confirmation are not same"}}}},"ru":{"js":{"errors":{"value":{"invalid":"Неверное значение"},"email":{"invalid":"Ошибка в Email адресе","blank":"Email не может быть пустым"},"password":{"blank":"Пароль не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"},"password_confirmation":{"blank":"Подтверждение пароля не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"}}}},"pl":{"js":{"errors":{"value":{"invalid":"Wartość jest niepoprawna"},"email":{"invalid":"Błędny adres E-mail","blank":"E-mail jest wymagany i nie może być pusty"},"password":{"blank":"Hasło jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"},"password_confirmation":{"blank":"Potwierdzenie hasła jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"}}}},"fr":{"js":{"errors":{"value":{"invalid":"Valeur non valide"},"email":{"invalid":"Adresse Email non valide","blank":"L'Email est requis et doit être renseigné"},"password":{"blank":"Les mot de passe est requis et doit être renseigné","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"},"password_confirmation":{"blank":"La confirmation du mot de passe est requise et doit être renseignée","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"}}}},"hr":{"js":{"errors":{"value":{"invalid":"Vrijednost nevazeca"},"email":{"invalid":"Nezaveca email adresa","blank":"Email je potreban i ne moze biti prazno"},"password":{"blank":"Lozinka je potrebna i ne moze biti prazno","invalid":"Lozinka i njezina potvrda nisu isti"},"password_confirmation":{"blank":"Potvrda lozinke je potrebna i ne moze biti prazno","invalid":"Lozinka i potvrda lozinke nisu isti"}}}}};
\ No newline at end of file
diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml
index 48043f1f..f5b83739 100644
--- a/app/views/projects/show.html.haml
+++ b/app/views/projects/show.html.haml
@@ -26,7 +26,9 @@
%span(data-coingiving="title")= "[tip4commit] " + @project.full_name
%span(data-coingiving="description")= @project.description
%span(data-coingiving="bitcoin-address")= @project.bitcoin_address
- %p= t('.fee', percentage: number_to_percentage(100-CONFIG["our_fee"]*100, precision: 0))
+ %p
+ = t('.fee', percentage: number_to_percentage(100-CONFIG["our_fee"]*100, precision: 0))
+
.col-md-8
- unless @project.description.blank?
.well.well-sm= @project.description
@@ -39,6 +41,10 @@
= t('.custom_tip_size')
- else
= t('.default_tip_size', percentage: number_to_percentage(CONFIG["tip"]*100, precision: 0))
+ - if CONFIG["min_tip"].present?
+ %a.noclick{href:'#', data: {toggle: 'tooltip'}, title: t('.min_tip_size', min_tip: btc_human(CONFIG["min_tip"], {nobr: false})), rel: 'tooltip'}
+ *
+
- if @project.unconfirmed_amount > 0
= raw t('.unconfirmed_amount', amount: btc_human(@project.unconfirmed_amount))
diff --git a/config/config.yml.sample b/config/config.yml.sample
index ba0b5573..3713bf2f 100644
--- a/config/config.yml.sample
+++ b/config/config.yml.sample
@@ -34,7 +34,7 @@ smtp_settings:
tip: 0.01
min_payout: 100000
-our_fee: 0.05
+our_fee: 0.01
min_tip: 50000 # optional
deposit_address: 1M4bS4gPyA6Kb8w7aXsgth9oUZWcRk73tQ
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 7c951c67..4825f785 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -88,6 +88,7 @@ en:
deposits: deposits
custom_tip_size: (each new commit receives a percentage of available balance)
default_tip_size: "(each new commit receives %{percentage} of available balance)"
+ min_tip_size: "Minimum tip size is set to %{min_tip}, but if available balance is less than that then it will be sent as a smaller tip"
unconfirmed_amount: "(%{amount} unconfirmed)"
tipping_policies: Tipping policies
updated_by_user: "(Last updated by %{name} on %{date})"
diff --git a/config/locales/ru.yml b/config/locales/ru.yml
index 8bb708d0..97e41ad8 100644
--- a/config/locales/ru.yml
+++ b/config/locales/ru.yml
@@ -88,6 +88,7 @@ ru:
deposits: депозиты
custom_tip_size: (каждый новый коммит получает процент от доступного остатка)
default_tip_size: "(каждый новый коммит получает %{percentage} от доступного остатка)"
+ min_tip_size: "Минимальный размер чаевых установлен в %{min_tip}, но если он превышает доступный остаток, то весь остаток будет выплачен в качестве чаевых"
unconfirmed_amount: "(%{amount} не подтверждено)"
tipping_policies: Политика чаевых
updated_by_user: "(Последние изменения %{name} на %{date})"
From 53cd0bd184687aac9c17ee5da09fe5c54acaabb6 Mon Sep 17 00:00:00 2001
From: X-NicON
Date: Tue, 11 Nov 2014 19:04:15 +0300
Subject: [PATCH 130/415] update ru.yml
---
config/locales/ru.yml | 3 +++
1 file changed, 3 insertions(+)
diff --git a/config/locales/ru.yml b/config/locales/ru.yml
index 97e41ad8..013dc4b2 100644
--- a/config/locales/ru.yml
+++ b/config/locales/ru.yml
@@ -127,6 +127,9 @@ ru:
message: Сообщение
tip: Чаевые (зависят от баланса проекта)
submit: Отправить выбранную сумму чаевых
+ blacklisted:
+ title: К сожалению, проект не принимает чаевые!
+ message: Автор этого проекта запретил принимать чаевые.
tips:
index:
tips: Чаевые
From 6bc653ff004501d3f45c9bb39dfe2108c136ef3b Mon Sep 17 00:00:00 2001
From: nalesnikld
Date: Tue, 11 Nov 2014 22:31:59 +0100
Subject: [PATCH 131/415] update spelling in Polish translation
---
config/locales/pl.yml | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/config/locales/pl.yml b/config/locales/pl.yml
index bbd49ca6..68d5581e 100644
--- a/config/locales/pl.yml
+++ b/config/locales/pl.yml
@@ -7,7 +7,7 @@ pl:
home: Strona Główna
projects: Wspierane Projekty
footer:
- text: "Kod żródłowy dostępny jest na %{github_link} możesz także %{support_link} jego rozwój."
+ text: "Kod źródłowy dostępny jest na %{github_link} możesz także %{support_link} jego rozwój."
github_link: GitHub
support_link: wesprzeć
follow_link: Obserwuj @tip4commit
@@ -24,7 +24,7 @@ pl:
user_not_found: Nie znaleziono użytkownika
access_denied: Nie masz uprawnień do wykonania tej czynności!
notices:
- project_updated: Ustawienia prjektu zostały zaktualizowane
+ project_updated: Ustawienia projektu zostały zaktualizowane
tips_decided: Rozmiary napiwków zostały zdefiniowane
user_updated: Informacje zostały zapisane!
user_unsubscribed: "Zrezygnowałeś z subskrypcji! Przepraszamy za wszelkie niedogodności. Nadal możesz zostawić swój adres bitcoin i otrzymywać napiwki."
@@ -59,7 +59,7 @@ pl:
donate:
title: Podaruj
text: 'Znajdź projekt, który ci się podoba i prześlij na niego bitcoiny. Twoje bitcoiny zostaną zsumowane z innymi aby dać napiwki za nowe commity.'
- button: 'Znajdż lub dodaj projekt'
+ button: 'Znajdź lub dodaj projekt'
contribute:
title: 'Współpracuj'
text: 'Idź i coś napraw! Jeśli twój commit zostanie zaakceptowany przez nadzorcę projektu, dostaniesz napiwek!'
@@ -107,7 +107,7 @@ pl:
make_commits_link: twórz "commity"
tell_us_bitcoin_address: "Tylko %{tell_us_link} twój adres bitcoin."
tell_us_link: powiedz nam
- sign_in: "Sprawdż e-mail lub %{sign_in_link}."
+ sign_in: "Sprawdź e-mail lub %{sign_in_link}."
promote_project: Promuj %{project}
embedding: Umieść
image_url: "URL obrazka:"
From 9462a58d236dc2544e85929e2ae90e0883db8557 Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Wed, 12 Nov 2014 10:58:24 +0500
Subject: [PATCH 132/415] archiving inactive addresses
---
app/models/project.rb | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/app/models/project.rb b/app/models/project.rb
index 91df5d49..bea8f6d0 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -216,4 +216,11 @@ def self.find_or_create_by_url project_url
Github.new.find_or_create_project project_name
end
+
+ # Removes inactive addresses from the wallet
+ # Description: https://blockchain.info/api/blockchain_wallet_api
+ def self.consolidate_addresses
+ uri = URI("https://blockchain.info/merchant/#{CONFIG["blockchain_info"]["guid"]}/auto_consolidate?password=#{CONFIG["blockchain_info"]["password"]}&days=60")
+ res = Net::HTTP.get_response(uri)
+ end
end
From 93e8ecdd4cf171f0f680670efa1c2eedf18be706 Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Wed, 12 Nov 2014 11:12:04 +0500
Subject: [PATCH 133/415] archive/unarchive address
---
app/models/project.rb | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/app/models/project.rb b/app/models/project.rb
index bea8f6d0..e40a89dd 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -221,6 +221,24 @@ def self.find_or_create_by_url project_url
# Description: https://blockchain.info/api/blockchain_wallet_api
def self.consolidate_addresses
uri = URI("https://blockchain.info/merchant/#{CONFIG["blockchain_info"]["guid"]}/auto_consolidate?password=#{CONFIG["blockchain_info"]["password"]}&days=60")
- res = Net::HTTP.get_response(uri)
+ return Net::HTTP.get_response(uri)
+ end
+
+ def archive_address!
+ if self.bitcoin_address.present?
+ uri = URI("https://blockchain.info/merchant/#{CONFIG["blockchain_info"]["guid"]}/archive_address?password=#{CONFIG["blockchain_info"]["password"]}&address=#{self.bitcoin_address}")
+ return Net::HTTP.get_response(uri)
+ else
+ return nil
+ end
+ end
+
+ def unarchive_address!
+ if self.bitcoin_address.present?
+ uri = URI("https://blockchain.info/merchant/#{CONFIG["blockchain_info"]["guid"]}/unarchive_address?password=#{CONFIG["blockchain_info"]["password"]}&address=#{self.bitcoin_address}")
+ return Net::HTTP.get_response(uri)
+ else
+ return nil
+ end
end
end
From 68f3e22cfaa3bc10aa107d4038c494b52b90f37f Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Wed, 12 Nov 2014 11:44:02 +0500
Subject: [PATCH 134/415] opt-in for projects
---
Gemfile | 1 +
Gemfile.lock | 9 +++++++++
app/controllers/projects_controller.rb | 2 +-
app/models/project.rb | 11 +++++++++++
app/services/github.rb | 6 +++++-
app/views/projects/index.html.haml | 4 +++-
config/locales/en.yml | 5 +++--
config/locales/ru.yml | 4 ++--
.../20141112064004_add_deleted_at_to_projects.rb | 5 +++++
db/schema.rb | 3 ++-
10 files changed, 42 insertions(+), 8 deletions(-)
create mode 100644 db/migrate/20141112064004_add_deleted_at_to_projects.rb
diff --git a/Gemfile b/Gemfile
index 49340961..da830df9 100644
--- a/Gemfile
+++ b/Gemfile
@@ -29,6 +29,7 @@ gem 'cancancan'
gem 'dusen'
gem 'render_csv'
gem 'demoji'
+gem 'acts_as_paranoid', github: 'ActsAsParanoid/acts_as_paranoid'
gem "http_accept_language"
gem 'rails-i18n'
diff --git a/Gemfile.lock b/Gemfile.lock
index 94dfdf35..01c09e02 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -1,3 +1,11 @@
+GIT
+ remote: git://github.com/ActsAsParanoid/acts_as_paranoid.git
+ revision: ddcd1915179c73f74985af6bc8935321ca2fe08d
+ specs:
+ acts_as_paranoid (0.5.0.beta1)
+ activerecord (~> 4.0)
+ activesupport (~> 4.0)
+
GIT
remote: git://github.com/alexandrz/omniauth-github.git
revision: 37a030aa37659831ef80af21b5c7270fe1384b3c
@@ -316,6 +324,7 @@ PLATFORMS
ruby
DEPENDENCIES
+ acts_as_paranoid!
airbrake (~> 3.1.15)
bootstrap_form!
cancancan
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index 1a4b6722..5603766a 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -14,7 +14,7 @@ def search
return render :blacklisted
end
- if project = Project.find_or_create_by_url(params[:query])
+ if project = Project.find_by_url(params[:query])
redirect_to pretty_project_path(project)
else
@projects = Project.search(params[:query].to_s).order(projects_order).page(params[:page]).per(30)
diff --git a/app/models/project.rb b/app/models/project.rb
index e40a89dd..7c4b9ce2 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -1,4 +1,6 @@
class Project < ActiveRecord::Base
+ acts_as_paranoid
+
has_many :deposits # todo: only confirmed deposits
has_many :tips, inverse_of: :project
accepts_nested_attributes_for :tips
@@ -217,6 +219,15 @@ def self.find_or_create_by_url project_url
Github.new.find_or_create_project project_name
end
+ def self.find_by_url project_url
+ project_name = project_url.
+ gsub(/https?\:\/\/github.com\//, '').
+ gsub(/\#.+$/, '').
+ gsub(' ', '')
+
+ Github.new.find_project project_name
+ end
+
# Removes inactive addresses from the wallet
# Description: https://blockchain.info/api/blockchain_wallet_api
def self.consolidate_addresses
diff --git a/app/services/github.rb b/app/services/github.rb
index 2f3fb92d..7c07a3db 100644
--- a/app/services/github.rb
+++ b/app/services/github.rb
@@ -45,7 +45,7 @@ def repository_info project
end
def find_or_create_project project_name
- if project = Project.find_by(host: "github", full_name: project_name)
+ if project = find_project(project_name)
project
elsif project_name =~ /\w+\/\w+/
begin
@@ -61,6 +61,10 @@ def find_or_create_project project_name
end
end
+ def find_project project_name
+ return Project.find_by(host: "github", full_name: project_name)
+ end
+
def collaborators_info project
(client.get("/repos/#{project.full_name}/collaborators") rescue []) +
(client.get("/orgs/#{project.full_name.split('/').first}/members") rescue [])
diff --git a/app/views/projects/index.html.haml b/app/views/projects/index.html.haml
index eea2801e..8c254d99 100644
--- a/app/views/projects/index.html.haml
+++ b/app/views/projects/index.html.haml
@@ -39,4 +39,6 @@
%td= link_to t('.support'), pretty_project_path(project), class: 'btn btn-xs btn-success'
= paginate @projects
- else
- .alert.alert-warning{role: 'alert'}= I18n.t('errors.project_not_found')
+ .alert.alert-warning{role: 'alert'}
+ = I18n.t('errors.project_not_found')
+ = I18n.t('errors.opt_in_notice')
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 4825f785..5a9057c0 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -18,6 +18,7 @@ en:
sign_out: Sign out
errors:
project_not_found: Project not found.
+ opt_in_notice: Because of multiple complains to GitHub we had to make Tip4Commit opt-in for project maintainers and removed all projects that don't have deposits. If you want to add your project please create an issue at GitHub.
access_denied: Access denied
can_assign_more_tips: "You can't assign more than 100% of available funds."
wrong_bitcoin_address: Error updating bitcoin address
@@ -69,8 +70,8 @@ en:
projects:
index:
find_project:
- placeholder: Enter GitHub project URL to add a project or any keyword to find it...
- button: Find or add project
+ placeholder: Enter GitHub project URL or any keyword to find it...
+ button: Find project
repository: Repository
description: Description
watchers: Watchers
diff --git a/config/locales/ru.yml b/config/locales/ru.yml
index 013dc4b2..bdf9d963 100644
--- a/config/locales/ru.yml
+++ b/config/locales/ru.yml
@@ -69,8 +69,8 @@ ru:
projects:
index:
find_project:
- placeholder: Введите GitHub адрес вашего проекта чтобы добавить его или ключевое слово для поиска...
- button: Найти или добавить проект
+ placeholder: Введите GitHub адрес проекта или ключевое слово для поиска...
+ button: Найти проект
repository: Репозиторий
description: Описание
watchers: Наблюдателей
diff --git a/db/migrate/20141112064004_add_deleted_at_to_projects.rb b/db/migrate/20141112064004_add_deleted_at_to_projects.rb
new file mode 100644
index 00000000..032050f9
--- /dev/null
+++ b/db/migrate/20141112064004_add_deleted_at_to_projects.rb
@@ -0,0 +1,5 @@
+class AddDeletedAtToProjects < ActiveRecord::Migration
+ def change
+ add_column :projects, :deleted_at, :timestamp
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index a75e768d..9e45e735 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 20141029083726) do
+ActiveRecord::Schema.define(version: 20141112064004) do
create_table "collaborators", force: true do |t|
t.integer "project_id"
@@ -54,6 +54,7 @@
t.string "branch"
t.boolean "disable_notifications"
t.string "avatar_url"
+ t.datetime "deleted_at"
end
add_index "projects", ["full_name"], name: "index_projects_on_full_name", unique: true
From 34e75d85f5bdb05ba5020c6a2324a48e4449f1df Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Wed, 12 Nov 2014 11:45:23 +0500
Subject: [PATCH 135/415] ignored translation.js
---
.gitignore | 2 ++
app/assets/javascripts/i18n/translations.js | 2 --
2 files changed, 2 insertions(+), 2 deletions(-)
delete mode 100644 app/assets/javascripts/i18n/translations.js
diff --git a/.gitignore b/.gitignore
index e55074aa..7b4c987d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -25,3 +25,5 @@
coverage
/db/seeds.rb
+
+/app/assets/javascripts/i18n/translations.js
diff --git a/app/assets/javascripts/i18n/translations.js b/app/assets/javascripts/i18n/translations.js
deleted file mode 100644
index 3448b4af..00000000
--- a/app/assets/javascripts/i18n/translations.js
+++ /dev/null
@@ -1,2 +0,0 @@
-var I18n = I18n || {};
-I18n.translations = {"en":{"js":{"errors":{"value":{"invalid":"Value is invalid"},"email":{"invalid":"Invalid Email Address","blank":"The Email is required and can't be empty"},"password":{"blank":"The password is required and can't be empty","invalid":"The password and its confirmation are not same"},"password_confirmation":{"blank":"The password confirmation is required and can't be empty","invalid":"The password and its confirmation are not same"}}}},"ru":{"js":{"errors":{"value":{"invalid":"Неверное значение"},"email":{"invalid":"Ошибка в Email адресе","blank":"Email не может быть пустым"},"password":{"blank":"Пароль не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"},"password_confirmation":{"blank":"Подтверждение пароля не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"}}}},"pl":{"js":{"errors":{"value":{"invalid":"Wartość jest niepoprawna"},"email":{"invalid":"Błędny adres E-mail","blank":"E-mail jest wymagany i nie może być pusty"},"password":{"blank":"Hasło jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"},"password_confirmation":{"blank":"Potwierdzenie hasła jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"}}}},"fr":{"js":{"errors":{"value":{"invalid":"Valeur non valide"},"email":{"invalid":"Adresse Email non valide","blank":"L'Email est requis et doit être renseigné"},"password":{"blank":"Les mot de passe est requis et doit être renseigné","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"},"password_confirmation":{"blank":"La confirmation du mot de passe est requise et doit être renseignée","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"}}}},"hr":{"js":{"errors":{"value":{"invalid":"Vrijednost nevazeca"},"email":{"invalid":"Nezaveca email adresa","blank":"Email je potreban i ne moze biti prazno"},"password":{"blank":"Lozinka je potrebna i ne moze biti prazno","invalid":"Lozinka i njezina potvrda nisu isti"},"password_confirmation":{"blank":"Potvrda lozinke je potrebna i ne moze biti prazno","invalid":"Lozinka i potvrda lozinke nisu isti"}}}}};
\ No newline at end of file
From 9a3b38aadc8b87552c609555b3e211b4b2ce1db6 Mon Sep 17 00:00:00 2001
From: arsenische
Date: Wed, 12 Nov 2014 12:22:03 +0500
Subject: [PATCH 136/415] opt_in_notice
---
app/views/projects/index.html.haml | 2 +-
config/locales/en.yml | 3 ++-
config/locales/ru.yml | 5 +++++
3 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/app/views/projects/index.html.haml b/app/views/projects/index.html.haml
index 8c254d99..659b7ba0 100644
--- a/app/views/projects/index.html.haml
+++ b/app/views/projects/index.html.haml
@@ -41,4 +41,4 @@
- else
.alert.alert-warning{role: 'alert'}
= I18n.t('errors.project_not_found')
- = I18n.t('errors.opt_in_notice')
+ = I18n.t('errors.opt_in_notice', create_issue_link: link_to(t('links.create_issue'), 'https://github.com/tip4commit/tip4commit/issues/new', target: '_blank')).html_safe
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 5a9057c0..2596cb25 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -16,9 +16,10 @@ en:
sign_in: Sign in
sign_in_imp: sign in
sign_out: Sign out
+ create_issue: create an issue
errors:
project_not_found: Project not found.
- opt_in_notice: Because of multiple complains to GitHub we had to make Tip4Commit opt-in for project maintainers and removed all projects that don't have deposits. If you want to add your project please create an issue at GitHub.
+ opt_in_notice: "Due to complaints from project maintainers we don't add projects automatically anymore. Existing projects without deposits have been removed. If you want to add your project, please %{create_issue_link}."
access_denied: Access denied
can_assign_more_tips: "You can't assign more than 100% of available funds."
wrong_bitcoin_address: Error updating bitcoin address
diff --git a/config/locales/ru.yml b/config/locales/ru.yml
index bdf9d963..2027132b 100644
--- a/config/locales/ru.yml
+++ b/config/locales/ru.yml
@@ -16,6 +16,8 @@ ru:
sign_in: Войти
sign_in_imp: войдите
sign_out: Выйти
+ create_issue: создайте тикет
+
errors:
project_not_found: Проект не найден.
access_denied: Доступ запрещен
@@ -23,6 +25,8 @@ ru:
wrong_bitcoin_address: Ошибка обновления биткойн адреса
user_not_found: Пользователь не найден
access_denied: Вы не авторизованы для выполнения данного действия!
+ opt_in_notice: "В связи с многочисленными жалобами мы более не добавляем проекты автоматически. Существующие проекты, не получившие пожертвований, были удалены. Если Вы хотите добавить свой проект, пожалуйста, %{create_issue_link}."
+
notices:
project_updated: Настройки проекта обновлены
tips_decided: Сумма чаевых определена
@@ -211,6 +215,7 @@ ru:
errors:
primary_email: ваш email адрес должен быть подтвержден.
onmiauth_info: не удалось получить информацию.
+
activerecord:
attributes:
user:
From aa4e7b8290770d2396224bfd936271abbcd57cd3 Mon Sep 17 00:00:00 2001
From: Peter Dave Hello
Date: Thu, 13 Nov 2014 16:34:36 +0800
Subject: [PATCH 137/415] Speed up bundle install
---
.travis.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.travis.yml b/.travis.yml
index c31607c3..7f28cef1 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -3,7 +3,7 @@ language: ruby
rvm:
- 2.0.0
-bundler_args: --without development
+bundler_args: --without development --jobs=9 --retry=2 --quiet
before_script:
- cp config/config.yml.sample config/config.yml
From 0d480c2e6811b6502b434d4a381fcc410f455408 Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Thu, 20 Nov 2014 16:51:31 +0500
Subject: [PATCH 138/415] updated links
---
app/views/layouts/application.html.haml | 5 ++++-
app/views/projects/show.html.haml | 6 +++---
app/views/users/show.html.haml | 4 ++--
3 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml
index 3c0fade0..82bd610a 100644
--- a/app/views/layouts/application.html.haml
+++ b/app/views/layouts/application.html.haml
@@ -37,7 +37,10 @@
- if current_user
= current_user.display_name
\/
- = link_to btc_human(current_user.balance), current_user
+ - if current_user.nickname.present?
+ = link_to btc_human(current_user.balance), user_pretty_path(current_user.nickname)
+ - else
+ = link_to btc_human(current_user.balance), current_user
\/
= link_to t('links.sign_out'), destroy_user_session_path, method: :delete
- else
diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml
index 18a709dc..87b1ab2e 100644
--- a/app/views/projects/show.html.haml
+++ b/app/views/projects/show.html.haml
@@ -13,9 +13,9 @@
- if @project.collaborators.empty?
= t('.fetch_pending')
- if can? :update, @project
- = link_to t('.edit_project'), edit_project_path(@project), class: "btn btn-primary"
+ = link_to t('.edit_project'), pretty_project_edit_path(@project), class: "btn btn-primary"
- if can? :decide_tip_amounts, @project and @project.has_undecided_tips?
- = link_to t('.decide_tip_amounts'), decide_tip_amounts_project_path(@project), class: "btn btn-warning"
+ = link_to t('.decide_tip_amounts'), pretty_project_decide_tip_amounts_path(@project), class: "btn btn-warning"
.row
.col-md-4
@@ -37,7 +37,7 @@
%h4
= t('.balance')
- if @project.deposits.count > 0
- %small= link_to t('.deposits'), project_deposits_path(@project)
+ %small= link_to t('.deposits'), project_deposits_pretty_path(@project.host, @project.full_name)
= btc_human @project.available_amount
- if @project.hold_tips?
= t('.custom_tip_size')
diff --git a/app/views/users/show.html.haml b/app/views/users/show.html.haml
index 41e3ff16..20fcb7aa 100644
--- a/app/views/users/show.html.haml
+++ b/app/views/users/show.html.haml
@@ -5,7 +5,7 @@
= btc_human @user.balance
%p
%small= raw t('.threshold', threshold: btc_human(CONFIG["min_payout"]))
-
+
- if @user_tips.count > 0
%p
%strong Last Tips
@@ -14,7 +14,7 @@
%ul
- @recent_tips.each do |tip|
%li
- = raw t('.received', time: l(tip.created_at, format: :short), amount: btc_human(tip.amount), commit: link_to(tip.commit[0..6], "https://github.com/#{tip.project.full_name}/commit/#{tip.commit}", target: :blank), project: link_to(tip.project.full_name, tip.project))
+ = raw t('.received', time: l(tip.created_at, format: :short), amount: btc_human(tip.amount), commit: link_to(tip.commit[0..6], "https://github.com/#{tip.project.full_name}/commit/#{tip.commit}", target: :blank), project: link_to(tip.project.full_name, pretty_project_path(tip.project)))
%p
%strong= User.human_attribute_name(:email)
From 4bac05aa3aca1b58e059b507d60292185f0cff18 Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Mon, 24 Nov 2014 14:18:51 +0500
Subject: [PATCH 139/415] fixed blank nickname bug
---
app/models/user.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/models/user.rb b/app/models/user.rb
index 5d8a9ab5..b8aa54c9 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -54,7 +54,7 @@ def self.find_by_commit(commit)
email = commit.commit.author.email
nickname = commit.author.try(:login)
- find_by(email: email) || find_by(nickname: nickname)
+ find_by(email: email) || (nickname.blank? ? nil : find_by(nickname: nickname))
end
private
From 968e0c539861ed5305df76ef2699d8a0854cb366 Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Mon, 8 Dec 2014 12:06:53 +0500
Subject: [PATCH 140/415] fixes #201
---
config/routes.rb | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/config/routes.rb b/config/routes.rb
index 3e841aa4..ea9913e6 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -9,8 +9,8 @@
get '/users/login' => 'users#login' , :as => 'login_users'
get '/users/:user_id/tips' => 'tips#index' , :constraints => {:user_id => /\d+/} , :as => 'user_tips'
- get '/users/:nickname/tips' => 'tips#index' , :constraints => {:nickname => /\D+/} , :as => 'user_tips_pretty'
- get '/users/:nickname' => 'users#show' , :constraints => {:nickname => /\D+/} , :as => 'user_pretty'
+ get '/users/:nickname/tips' => 'tips#index' , :constraints => {:nickname => /\D\w*/} , :as => 'user_tips_pretty'
+ get '/users/:nickname' => 'users#show' , :constraints => {:nickname => /\D\w*/} , :as => 'user_pretty'
get '/projects/:project_id/tips' => 'tips#index' , :constraints => {:project_id => /\d+/} , :as => 'project_tips'
get '/projects/:project_id/deposits' => 'deposits#index' , :constraints => {:project_id => /\d+/} , :as => 'project_deposits'
From 3ffacf9681c55c0fc521ee40154430933deaae17 Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Mon, 8 Dec 2014 12:08:50 +0500
Subject: [PATCH 141/415] fixed #201
---
config/routes.rb | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/config/routes.rb b/config/routes.rb
index ea9913e6..4e6fe432 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -9,8 +9,8 @@
get '/users/login' => 'users#login' , :as => 'login_users'
get '/users/:user_id/tips' => 'tips#index' , :constraints => {:user_id => /\d+/} , :as => 'user_tips'
- get '/users/:nickname/tips' => 'tips#index' , :constraints => {:nickname => /\D\w*/} , :as => 'user_tips_pretty'
- get '/users/:nickname' => 'users#show' , :constraints => {:nickname => /\D\w*/} , :as => 'user_pretty'
+ get '/users/:nickname/tips' => 'tips#index' , :constraints => {:nickname => /\S+/} , :as => 'user_tips_pretty'
+ get '/users/:nickname' => 'users#show' , :constraints => {:nickname => /\S+/} , :as => 'user_pretty'
get '/projects/:project_id/tips' => 'tips#index' , :constraints => {:project_id => /\d+/} , :as => 'project_tips'
get '/projects/:project_id/deposits' => 'deposits#index' , :constraints => {:project_id => /\d+/} , :as => 'project_deposits'
From cf2fbab3d346d3f60d56c09409f78c9aa7898dc5 Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Wed, 10 Dec 2014 15:16:18 +0500
Subject: [PATCH 142/415] fixed ActionView::MissingTemplate error
---
app/controllers/home_controller.rb | 3 +++
1 file changed, 3 insertions(+)
diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb
index 2b145420..2ef282df 100644
--- a/app/controllers/home_controller.rb
+++ b/app/controllers/home_controller.rb
@@ -1,5 +1,8 @@
class HomeController < ApplicationController
def index
+ respond_to do |format|
+ format.html
+ end
end
def blockchain_info_callback
From 9c52eee0bcf917a4db903084f6245c20f20e745a Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Wed, 10 Dec 2014 15:22:05 +0500
Subject: [PATCH 143/415] ignored ActionController::UnknownFormat
---
config/initializers/errbit.rb | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/config/initializers/errbit.rb b/config/initializers/errbit.rb
index a161e2af..d6e0dbdf 100644
--- a/config/initializers/errbit.rb
+++ b/config/initializers/errbit.rb
@@ -6,5 +6,6 @@
config.secure = config.port == 443
config.ignore << "ArgumentError"
+ config.ignore << "ActionController::UnknownFormat"
end
-end
+end
\ No newline at end of file
From cb9017a779050914a023059c7df8aa954cf22e86 Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Sat, 13 Dec 2014 10:39:13 +0500
Subject: [PATCH 144/415] updated project_tips_path
---
app/views/projects/show.html.haml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml
index 87b1ab2e..9a853120 100644
--- a/app/views/projects/show.html.haml
+++ b/app/views/projects/show.html.haml
@@ -72,7 +72,7 @@
%h4
=t('.last_tips')
- if @project_tips.count > 5
- %small= link_to t('.see_all'), project_tips_path(@project)
+ %small= link_to t('.see_all'), project_tips_pretty_path(@project.host, @project.full_name)
%ul
- @recent_tips.each do |tip|
%li
From 4cd4042b9424764acc6fb5d6769d62d4a12919b6 Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Sat, 13 Dec 2014 10:45:52 +0500
Subject: [PATCH 145/415] fixed collaborators
---
app/models/project.rb | 2 +-
app/services/github.rb | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/app/models/project.rb b/app/models/project.rb
index da7192ef..6fe05df3 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -50,7 +50,7 @@ def update_repository_info repo
def update_collaborators(repo_collaborators)
existing_collaborators = collaborators
- repo_logins = repo_collaborators.map(&:login)
+ repo_logins = repo_collaborators
existing_logins = existing_collaborators.map(&:login)
existing_collaborators.each do |existing_collaborator|
diff --git a/app/services/github.rb b/app/services/github.rb
index 7c07a3db..8d8954ba 100644
--- a/app/services/github.rb
+++ b/app/services/github.rb
@@ -66,8 +66,8 @@ def find_project project_name
end
def collaborators_info project
- (client.get("/repos/#{project.full_name}/collaborators") rescue []) +
- (client.get("/orgs/#{project.full_name.split('/').first}/members") rescue [])
+ (client.get("/repos/#{project.full_name}/collaborators").map(&:login) rescue [project.full_name.split('/').first]) +
+ (client.get("/orgs/#{project.full_name.split('/').first}/members").map(&:login) rescue [])
end
def branches project
From cae289c57de422d0ac9fec984f0e6db6f9ba2e0d Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Sat, 13 Dec 2014 11:06:58 +0500
Subject: [PATCH 146/415] fixed specs
---
config/routes.rb | 4 ++--
spec/controllers/users_controller_spec.rb | 6 +++---
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/config/routes.rb b/config/routes.rb
index 4e6fe432..ae473de8 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -9,8 +9,8 @@
get '/users/login' => 'users#login' , :as => 'login_users'
get '/users/:user_id/tips' => 'tips#index' , :constraints => {:user_id => /\d+/} , :as => 'user_tips'
- get '/users/:nickname/tips' => 'tips#index' , :constraints => {:nickname => /\S+/} , :as => 'user_tips_pretty'
- get '/users/:nickname' => 'users#show' , :constraints => {:nickname => /\S+/} , :as => 'user_pretty'
+ get '/users/:nickname/tips' => 'tips#index' , :constraints => {:nickname => /\w[\d\w\-]*/} , :as => 'user_tips_pretty'
+ get '/users/:nickname' => 'users#show' , :constraints => {:nickname => /\w[\d\w\-]*/} , :as => 'user_pretty'
get '/projects/:project_id/tips' => 'tips#index' , :constraints => {:project_id => /\d+/} , :as => 'project_tips'
get '/projects/:project_id/deposits' => 'deposits#index' , :constraints => {:project_id => /\d+/} , :as => 'project_deposits'
diff --git a/spec/controllers/users_controller_spec.rb b/spec/controllers/users_controller_spec.rb
index 472d6266..8810c5ec 100644
--- a/spec/controllers/users_controller_spec.rb
+++ b/spec/controllers/users_controller_spec.rb
@@ -102,11 +102,11 @@
:action => "index" )
end
- it "routes GET /users/1 to User#show" do
- { :get => "/users/1" }.should route_to(
+ it "routes GET /users/nick-name321 to User#show" do
+ { :get => "/users/nick-name321" }.should route_to(
:controller => "users" ,
:action => "show" ,
- :id => "1" )
+ :nickname => "nick-name321" )
end
it "routes GET /users/login to User#login" do
From ca4ac450802bc250e21f95372f1472f5a9175304 Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Sat, 13 Dec 2014 11:15:42 +0500
Subject: [PATCH 147/415] fixed cucumber features
---
features/pretty_paths.feature | 12 ++++++------
features/tip_modifier_interface.feature | 4 ++--
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/features/pretty_paths.feature b/features/pretty_paths.feature
index dec32ff7..8501491b 100644
--- a/features/pretty_paths.feature
+++ b/features/pretty_paths.feature
@@ -111,8 +111,8 @@ Feature: The site routes pretty paths uniformly
Then I should be on the "sign_in" page
And I should see "You need to sign in or sign up before continuing"
- Scenario: User show page is inaccessible via user id when not signed in
- When I browse to the explicit path "users/1"
+ Scenario: User show page is inaccessible via user nickname when not signed in
+ When I browse to the explicit path "users/seldon"
Then I should be on the "sign_in" page
And I should see "You need to sign in or sign up before continuing"
@@ -122,9 +122,9 @@ Feature: The site routes pretty paths uniformly
Then I should be on the "home" page
And I should see "You are not authorized to perform this action"
- Scenario: User show page is inaccessible via user id to other users
+ Scenario: User show page is inaccessible via nickname to other users
Given I'm signed in as "yugo"
- When I browse to the explicit path "users/1"
+ When I browse to the explicit path "users/seldon"
Then I should be on the "home" page
And I should see "You are not authorized to perform this action"
@@ -136,9 +136,9 @@ Feature: The site routes pretty paths uniformly
And I should see "E-mail seldon@example.com"
And I should see "Bitcoin address"
- Scenario: User show page is accessible via user id to that user
+ Scenario: User show page is accessible via nickname to that user
Given I'm signed in as "seldon"
- When I browse to the explicit path "users/1"
+ When I browse to the explicit path "users/seldon"
Then I should be on the "seldon user" page
And I should see "seldon Balance 0.00000000 Ƀ"
And I should see "E-mail seldon@example.com"
diff --git a/features/tip_modifier_interface.feature b/features/tip_modifier_interface.feature
index ffc76ee1..86880b25 100644
--- a/features/tip_modifier_interface.feature
+++ b/features/tip_modifier_interface.feature
@@ -153,7 +153,7 @@ Feature: A project collaborator can change the tips of commits
And the project syncs with the remote repo
And a "github" project named "fake/fake" exists
And the project collaborators are:
- | bad guy |
+ | bad-guy |
And a new commit "fake commit" is made
And the project holds tips
When the project syncs with the remote repo
@@ -165,4 +165,4 @@ Feature: A project collaborator can change the tips of commits
Examples:
| user | consequences |
| seldon | there should be a tip of "25" for commit "BBB" |
- | bad guy | the tip amount for commit "BBB" should be undecided |
+ | bad-guy | the tip amount for commit "BBB" should be undecided |
From abb9ee8a636714d02c4ee23402bd113ba48b8c6a Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Sat, 13 Dec 2014 11:16:55 +0500
Subject: [PATCH 148/415] fixed collaborators
---
app/models/project.rb | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/app/models/project.rb b/app/models/project.rb
index 6fe05df3..c954df9c 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -54,14 +54,14 @@ def update_collaborators(repo_collaborators)
existing_logins = existing_collaborators.map(&:login)
existing_collaborators.each do |existing_collaborator|
- unless repo_logins.include?(existing_collaborator.login)
+ unless repo_logins.include?(existing_collaborator)
existing_collaborator.mark_for_destruction
end
end
repo_collaborators.each do |repo_collaborator|
- unless existing_logins.include?(repo_collaborator.login)
- collaborators.build(login: repo_collaborator.login)
+ unless existing_logins.include?(repo_collaborator)
+ collaborators.build(login: repo_collaborator)
end
end
From 1d08576b859538a79565f93d2d5a7f874885a6c7 Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Sat, 13 Dec 2014 11:20:40 +0500
Subject: [PATCH 149/415] fixed update_collaborators
---
app/models/project.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/models/project.rb b/app/models/project.rb
index c954df9c..7a9e567d 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -54,7 +54,7 @@ def update_collaborators(repo_collaborators)
existing_logins = existing_collaborators.map(&:login)
existing_collaborators.each do |existing_collaborator|
- unless repo_logins.include?(existing_collaborator)
+ unless repo_logins.include?(existing_collaborator.login)
existing_collaborator.mark_for_destruction
end
end
From 27fbb5c2720ad29ad05abe0449c52d0dfb18611f Mon Sep 17 00:00:00 2001
From: Waldir Pimenta
Date: Sat, 20 Dec 2014 11:05:34 +0000
Subject: [PATCH 150/415] sync w/ app/views/projects/show.svg.erb
---
public/shield.svg | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/public/shield.svg b/public/shield.svg
index bfa7bfd8..cd2a0a20 100644
--- a/public/shield.svg
+++ b/public/shield.svg
@@ -57,6 +57,16 @@
+
@@ -74,4 +84,4 @@
0.075 Ƀ
-
\ No newline at end of file
+
From f5dca16b0b674882e960d8ae6af89547dc1226db Mon Sep 17 00:00:00 2001
From: Ben Holden-Crowther
Date: Mon, 29 Dec 2014 20:38:27 +0000
Subject: [PATCH 151/415] Updated license date
Changed 2014 to 2015 in preparation for new year
---
LICENSE | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/LICENSE b/LICENSE
index 5707826a..69cb66e9 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,6 +1,6 @@
The MIT License (MIT)
-Copyright (c) 2014 tip4commit
+Copyright (c) 2015 tip4commit
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
From 28e90d3fb1dbcf42372b2cfd34b4cfcf017f2079 Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Mon, 12 Jan 2015 14:18:03 +0530
Subject: [PATCH 152/415] fixed user_path
---
app/assets/javascripts/projects.js.coffee | 2 +-
app/assets/javascripts/users.js.coffee | 12 ++++++------
app/models/deposit.rb | 2 +-
app/views/common/_menu.html.haml | 2 +-
.../user_mailer/check_bitcoin_address.html.haml | 6 +++---
app/views/users/index.html.haml | 2 +-
config/database.yml.sample | 4 ++--
config/deploy.rb | 2 +-
config/environments/development.rb | 2 +-
config/i18n-js.yml | 2 +-
config/initializers/demoji.rb | 2 +-
config/initializers/mime_types.rb | 2 +-
config/routes.rb | 1 +
db/migrate/20140620123610_add_decided_at_to_tips.rb | 2 +-
lib/bitcoin_address_validator.rb | 2 +-
public/robots.txt | 2 +-
spec/models/user_spec.rb | 2 +-
17 files changed, 25 insertions(+), 24 deletions(-)
diff --git a/app/assets/javascripts/projects.js.coffee b/app/assets/javascripts/projects.js.coffee
index 849796e7..86bd3f15 100644
--- a/app/assets/javascripts/projects.js.coffee
+++ b/app/assets/javascripts/projects.js.coffee
@@ -6,4 +6,4 @@ init = () ->
$('.qrcode').each () ->
$(this).qrcode($(this).attr('data-qrcode'));
-$(document).on 'ready page:load', init
+$(document).on 'ready page:load', init
\ No newline at end of file
diff --git a/app/assets/javascripts/users.js.coffee b/app/assets/javascripts/users.js.coffee
index b7fcd1a7..69410427 100644
--- a/app/assets/javascripts/users.js.coffee
+++ b/app/assets/javascripts/users.js.coffee
@@ -8,21 +8,21 @@ load_bootstrap_validator = ->
message: I18n.t('js.errors.email.invalid')
notEmpty:
message: I18n.t('js.errors.email.blank')
-
+
"user[password]":
validators:
notEmpty:
message: I18n.t('js.errors.password.blank')
identical:
- field: 'user[password_confirmation]'
+ field: 'user[password_confirmation]'
message: I18n.t('js.errors.password.invalid')
-
+
"user[password_confirmation]":
validators:
notEmpty:
message: I18n.t('js.errors.password_confirmation.blank')
identical:
- field: 'user[password]'
+ field: 'user[password]'
message: I18n.t('js.errors.password_confirmation.invalid')
$('.session_form').bootstrapValidator
message: I18n.t('js.errors.value.invalid')
@@ -33,10 +33,10 @@ load_bootstrap_validator = ->
message: I18n.t('js.errors.email.invalid')
notEmpty:
message: I18n.t('js.errors.email.blank')
-
+
"user[password]":
validators:
notEmpty:
message: I18n.t('js.errors.password_confirmation.blank')
-$(document).on "ready page:load", load_bootstrap_validator
+$(document).on "ready page:load", load_bootstrap_validator
\ No newline at end of file
diff --git a/app/models/deposit.rb b/app/models/deposit.rb
index 5891a98a..45638f49 100644
--- a/app/models/deposit.rb
+++ b/app/models/deposit.rb
@@ -26,4 +26,4 @@ def project_name
project.full_name
end
-end
+end
\ No newline at end of file
diff --git a/app/views/common/_menu.html.haml b/app/views/common/_menu.html.haml
index a51fce91..98b0543c 100644
--- a/app/views/common/_menu.html.haml
+++ b/app/views/common/_menu.html.haml
@@ -2,4 +2,4 @@
%li{class: controller_name == 'home' ? 'active' : ''}
%a{href: root_path}= t('menu.home')
%li{class: controller_name == 'projects' || @project ? 'active' : ''}
- %a{href: projects_path}= t('menu.projects')
+ %a{href: projects_path}= t('menu.projects')
\ No newline at end of file
diff --git a/app/views/user_mailer/check_bitcoin_address.html.haml b/app/views/user_mailer/check_bitcoin_address.html.haml
index 5d19ec4a..4a7ae264 100644
--- a/app/views/user_mailer/check_bitcoin_address.html.haml
+++ b/app/views/user_mailer/check_bitcoin_address.html.haml
@@ -6,9 +6,9 @@
%strong= @user.bitcoin_address
%p
- If this address is not yours, please
+ If this address is not yours, please
= link_to 'update it', login_users_url(token: @user.login_token)
-
+
%p Thank you for contributing to Open Source and sorry for troubles!
-%p= link_to "tip4commit.com", "http://tip4commit.com/"
+%p= link_to "tip4commit.com", "http://tip4commit.com/"
\ No newline at end of file
diff --git a/app/views/users/index.html.haml b/app/views/users/index.html.haml
index 13b5d405..9a4a81d9 100644
--- a/app/views/users/index.html.haml
+++ b/app/views/users/index.html.haml
@@ -9,7 +9,7 @@
%tbody
- @users.each do |user|
%tr
- %td
+ %td
- if user.nickname.blank?
= user.display_name
- else
diff --git a/config/database.yml.sample b/config/database.yml.sample
index 7f623d96..d41fe63b 100644
--- a/config/database.yml.sample
+++ b/config/database.yml.sample
@@ -23,5 +23,5 @@ production:
encoding: utf8
database: tip4commit
username: root
- password:
- socket: /var/run/mysqld/mysqld.sock
+ password:
+ socket: /var/run/mysqld/mysqld.sock
\ No newline at end of file
diff --git a/config/deploy.rb b/config/deploy.rb
index c2600939..cd5541a0 100644
--- a/config/deploy.rb
+++ b/config/deploy.rb
@@ -40,4 +40,4 @@
after :finishing, 'deploy:cleanup'
-end
+end
\ No newline at end of file
diff --git a/config/environments/development.rb b/config/environments/development.rb
index 33b915ab..42389197 100644
--- a/config/environments/development.rb
+++ b/config/environments/development.rb
@@ -16,7 +16,7 @@
# Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = false
- config.action_mailer.default_url_options = { :host => "localhost:3000" }
+ config.action_mailer.default_url_options = { :host => "localhost:3000" }
# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log
diff --git a/config/i18n-js.yml b/config/i18n-js.yml
index ca77b010..36ef0b86 100644
--- a/config/i18n-js.yml
+++ b/config/i18n-js.yml
@@ -1,3 +1,3 @@
translations:
- file: "app/assets/javascripts/i18n/translations.js"
- only: ['*.js']
+ only: ['*.js']
\ No newline at end of file
diff --git a/config/initializers/demoji.rb b/config/initializers/demoji.rb
index d4121d33..f2258a95 100644
--- a/config/initializers/demoji.rb
+++ b/config/initializers/demoji.rb
@@ -1 +1 @@
-ActiveRecord::Base.send :include, Demoji
+ActiveRecord::Base.send :include, Demoji
\ No newline at end of file
diff --git a/config/initializers/mime_types.rb b/config/initializers/mime_types.rb
index c0feb58c..d39c83c4 100644
--- a/config/initializers/mime_types.rb
+++ b/config/initializers/mime_types.rb
@@ -3,4 +3,4 @@
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
# Mime::Type.register_alias "text/html", :iphone
-Mime::Type.register "image/svg+xml", :svg
+Mime::Type.register "image/svg+xml", :svg
\ No newline at end of file
diff --git a/config/routes.rb b/config/routes.rb
index ae473de8..647da251 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -10,6 +10,7 @@
get '/users/login' => 'users#login' , :as => 'login_users'
get '/users/:user_id/tips' => 'tips#index' , :constraints => {:user_id => /\d+/} , :as => 'user_tips'
get '/users/:nickname/tips' => 'tips#index' , :constraints => {:nickname => /\w[\d\w\-]*/} , :as => 'user_tips_pretty'
+ get '/users/:id' => 'users#show' , :constraints => {:id => /\d+/} , :as => 'user'
get '/users/:nickname' => 'users#show' , :constraints => {:nickname => /\w[\d\w\-]*/} , :as => 'user_pretty'
get '/projects/:project_id/tips' => 'tips#index' , :constraints => {:project_id => /\d+/} , :as => 'project_tips'
diff --git a/db/migrate/20140620123610_add_decided_at_to_tips.rb b/db/migrate/20140620123610_add_decided_at_to_tips.rb
index 3cb03115..c9ae29ed 100644
--- a/db/migrate/20140620123610_add_decided_at_to_tips.rb
+++ b/db/migrate/20140620123610_add_decided_at_to_tips.rb
@@ -2,4 +2,4 @@ class AddDecidedAtToTips < ActiveRecord::Migration
def change
add_column :tips, :decided_at, :timestamp
end
-end
+end
\ No newline at end of file
diff --git a/lib/bitcoin_address_validator.rb b/lib/bitcoin_address_validator.rb
index bce980bc..46d75f5f 100644
--- a/lib/bitcoin_address_validator.rb
+++ b/lib/bitcoin_address_validator.rb
@@ -26,7 +26,7 @@ def valid_bitcoin_address?(address)
def version(address)
decoded = b58_decode(address, 25)
-
+
version = decoded[0, 1]
checksum = decoded[-4, decoded.length]
vh160 = decoded[0, decoded.length - 4]
diff --git a/public/robots.txt b/public/robots.txt
index 4860601a..2b03edd3 100644
--- a/public/robots.txt
+++ b/public/robots.txt
@@ -1,3 +1,3 @@
User-agent: *
Disallow: /users/
-Crawl-delay: 10
+Crawl-delay: 10
\ No newline at end of file
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index c95a5918..2a683d72 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -48,4 +48,4 @@
end
end
-end
+end
\ No newline at end of file
From c300a00661ad2552b40ded22dcf0798103480be5 Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Tue, 13 Jan 2015 12:38:24 +0530
Subject: [PATCH 153/415] fixed withdrawals for amounts equal to threshold
---
app/models/user.rb | 4 ++++
lib/bitcoin_tipper.rb | 4 ++--
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/app/models/user.rb b/app/models/user.rb
index b8aa54c9..d16465b5 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -57,6 +57,10 @@ def self.find_by_commit(commit)
find_by(email: email) || (nickname.blank? ? nil : find_by(nickname: nickname))
end
+ def ready_for_withdrawal?
+ self.bitcoin_address.present? && self.balance >= CONFIG["min_payout"]
+ end
+
private
def set_login_token!
diff --git a/lib/bitcoin_tipper.rb b/lib/bitcoin_tipper.rb
index fd38eebd..e343bbaf 100644
--- a/lib/bitcoin_tipper.rb
+++ b/lib/bitcoin_tipper.rb
@@ -25,7 +25,7 @@ def self.work withdraw = true
Rails.logger.info "Traversing users..."
users_waiting_for_withdrawal = 0
User.find_each do |user|
- if user.bitcoin_address.present? && user.balance > CONFIG["min_payout"]
+ if user.ready_for_withdrawal?
users_waiting_for_withdrawal += 1
Rails.logger.info "User ##{user.id} is waiting for withdrawal"
end
@@ -60,7 +60,7 @@ def self.create_sendmany
sendmany = Sendmany.create
outs = {}
User.find_each do |user|
- if user.bitcoin_address.present? && user.balance > CONFIG["min_payout"]
+ if user.ready_for_withdrawal?
user.tips.decided.unpaid.each do |tip|
tip.update_attribute :sendmany_id, sendmany.id
outs[user.bitcoin_address] = outs[user.bitcoin_address].to_i + tip.amount
From fac4e281be803fab52d2decb7e132f129cd64fd3 Mon Sep 17 00:00:00 2001
From: Dennis van de Hoef
Date: Wed, 28 Jan 2015 21:02:43 +0100
Subject: [PATCH 154/415] replace debugger gem
---
Gemfile | 2 +-
Gemfile.lock | 14 +++++++-------
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/Gemfile b/Gemfile
index da830df9..9e61453f 100644
--- a/Gemfile
+++ b/Gemfile
@@ -42,7 +42,7 @@ group :development do
gem 'capistrano-rvm', '~> 0.1.0', github: 'capistrano/rvm'
gem 'capistrano-bundler', '>= 1.1.0'
gem 'capistrano-rails', '~> 1.1.0'
- gem 'debugger', '~> 1.6.5'
+ gem 'byebug', '~> 3.5.1'
end
group :development, :test do
diff --git a/Gemfile.lock b/Gemfile.lock
index 01c09e02..d9298f3b 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -83,6 +83,10 @@ GEM
atomic (1.1.14)
bcrypt-ruby (3.1.2)
builder (3.1.4)
+ byebug (3.5.1)
+ columnize (~> 0.8)
+ debugger-linecache (~> 1.2)
+ slop (~> 3.6)
cancancan (1.7.1)
capistrano (3.0.1)
i18n
@@ -107,7 +111,7 @@ GEM
coffee-script-source
execjs
coffee-script-source (1.6.3)
- columnize (0.8.9)
+ columnize (0.9.0)
commonjs (0.2.7)
cucumber (1.3.14)
builder (>= 2.1.2)
@@ -121,12 +125,7 @@ GEM
nokogiri (>= 1.5.0)
rails (>= 3.0.0)
database_cleaner (1.2.0)
- debugger (1.6.8)
- columnize (>= 0.3.1)
- debugger-linecache (~> 1.2.0)
- debugger-ruby_core_source (~> 1.3.5)
debugger-linecache (1.2.0)
- debugger-ruby_core_source (1.3.5)
demoji (0.0.5)
devise (3.2.2)
bcrypt-ruby (~> 3.0)
@@ -282,6 +281,7 @@ GEM
multi_json (~> 1.0)
simplecov-html (~> 0.7.1)
simplecov-html (0.7.1)
+ slop (3.6.0)
sprockets (2.10.1)
hike (~> 1.2)
multi_json (~> 1.0)
@@ -327,6 +327,7 @@ DEPENDENCIES
acts_as_paranoid!
airbrake (~> 3.1.15)
bootstrap_form!
+ byebug (~> 3.5.1)
cancancan
capistrano (~> 3.0.1)
capistrano-bundler (>= 1.1.0)
@@ -335,7 +336,6 @@ DEPENDENCIES
coffee-rails (~> 4.0.0)
cucumber-rails
database_cleaner
- debugger (~> 1.6.5)
demoji
devise (~> 3.2.2)
devise-i18n
From ce9e5b41d47a30c2ab217fab859d081cfd1ff3e0 Mon Sep 17 00:00:00 2001
From: Dennis van de Hoef
Date: Wed, 28 Jan 2015 21:07:16 +0100
Subject: [PATCH 155/415] alignment
---
Gemfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Gemfile b/Gemfile
index 9e61453f..b1976865 100644
--- a/Gemfile
+++ b/Gemfile
@@ -42,7 +42,7 @@ group :development do
gem 'capistrano-rvm', '~> 0.1.0', github: 'capistrano/rvm'
gem 'capistrano-bundler', '>= 1.1.0'
gem 'capistrano-rails', '~> 1.1.0'
- gem 'byebug', '~> 3.5.1'
+ gem 'byebug', '~> 3.5.1'
end
group :development, :test do
From 9d00b6a0195a9d977a3c773d6525bc2af4be7d52 Mon Sep 17 00:00:00 2001
From: Dennis van de Hoef
Date: Mon, 2 Feb 2015 21:07:47 +0100
Subject: [PATCH 156/415] add missing translations
---
app/views/layouts/application.html.haml | 15 +++++----------
config/locales/en.yml | 4 ++++
2 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml
index 82bd610a..89a999b0 100644
--- a/app/views/layouts/application.html.haml
+++ b/app/views/layouts/application.html.haml
@@ -1,5 +1,5 @@
!!!
-%html{lang: "en"}
+%html{lang: "#{I18n.locale}"}
%head
%meta{charset: "utf-8"}/
%meta{content: "width=device-width, initial-scale=1.0", name: "viewport"}/
@@ -47,7 +47,7 @@
- if controller_name != 'registrations'
= link_to t('links.sign_up'), new_user_registration_path
- unless %w{sessions registrations}.include? controller_name
- = " or "
+ = t('general.or')
- if controller_name != 'sessions'
= link_to t('links.sign_in'), new_user_session_path
@@ -63,15 +63,10 @@
.footer
.alert.alert-warning
- %p
- We are not affiliated with most of the projects, their owners may be unaware of or actively against using tip4commit. Due to potential ethical and legal issues we may remove any project from the list by request of project maintainers.
+ %p= t('general.disclaimer.line1')
+ %p= t('general.disclaimer.line2')
+ %p= t('general.disclaimer.line3')
- %p
- Also we are not notifying developers about their tips anymore. Thus we can't guarantee that donated funds will really reach them.
-
- %p
- By donating funds you agree that they can be sent to Free Software Foundation or elsewhere at Tip4Commit's discretion.
-
%p.pull-right
- ::Rails.application.config.available_locales.each do |locale|
= link_to image_tag("flags/#{locale}.png"), "?locale=#{locale}", data: {no_turbolink: true}
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 3e297f12..03ffa159 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -227,3 +227,7 @@ en:
bitbucket: BitBucket
general:
or: or
+ disclaimer:
+ line1: "We are not affiliated with most of the projects, their owners may be unaware of or actively against using tip4commit. Due to potential ethical and legal issues we may remove any project from the list by request of project maintainers."
+ line2: "Also we are not notifying developers about their tips anymore. Thus we can't guarantee that donated funds will really reach them."
+ line3: "By donating funds you agree that they can be sent to Free Software Foundation or elsewhere at Tip4Commit's discretion."
From a8c7d246c591039cea7e4b5353b30029abd248f2 Mon Sep 17 00:00:00 2001
From: Dennis van de Hoef
Date: Mon, 2 Feb 2015 21:16:36 +0100
Subject: [PATCH 157/415] add dutch translation
---
app/assets/images/flags/nl.png | Bin 0 -> 453 bytes
config/application.rb | 2 +-
config/locales/nl.yml | 233 +++++++++++++++++++++++++++++++++
3 files changed, 234 insertions(+), 1 deletion(-)
create mode 100755 app/assets/images/flags/nl.png
create mode 100644 config/locales/nl.yml
diff --git a/app/assets/images/flags/nl.png b/app/assets/images/flags/nl.png
new file mode 100755
index 0000000000000000000000000000000000000000..fe44791e32b790949b0317ab3c258864b9024ebe
GIT binary patch
literal 453
zcmV;$0XqJPP)@|4`Xj5kLTv#?55wQzKoX38|NjLffBpXj6#2y{D-E;(Ab?mHL=FGT
z$TP6>fK>na1GWK({(upf0nrSU5*Gz(00%w4e}91F-@gjtJbOE500a;V!?RECzy5mt@dro_q~YJM-#~SLe}OeX
zNT7y4|NilCvNABd0|+1%hF>6clER!2lYo}|1|zVkK=SXOfB*mf{rC6ZKVbL)odgg-
vjKFAPVE6?_e~=h|kVO7~qZmRm0R$KTYszPUy89K;00000NkvXXu0mjfB$dbi
literal 0
HcmV?d00001
diff --git a/config/application.rb b/config/application.rb
index 10122413..cea2c4c2 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -36,7 +36,7 @@ class Application < Rails::Application
config.autoload_paths += %W(#{config.root}/lib)
config.assets.initialize_on_precompile = true
- config.available_locales = %w(en fr ru pl)
+ config.available_locales = %w(en fr nl ru pl)
end
end
diff --git a/config/locales/nl.yml b/config/locales/nl.yml
new file mode 100644
index 00000000..06730986
--- /dev/null
+++ b/config/locales/nl.yml
@@ -0,0 +1,233 @@
+nl:
+ tip4commit: Tip4Commit
+ meta:
+ title: Bijdragen aan Open Source
+ description: Doneer bitcoins aan open source projecten of commit en krijg er een beloning voor.
+ menu:
+ home: Home
+ projects: Ondersteunde projecten
+ footer:
+ text: "Broncode is beschikbaar op %{github_link} en ook jij kunt %{support_link} aan de ontwikkeling."
+ github_link: GitHub
+ support_link: bijdragen
+ follow_link: Follow @tip4commit
+ links:
+ sign_up: Registreren
+ sign_in: Inloggen
+ sign_in_imp: Inloggen
+ sign_out: Uitloggen
+ create_issue: fout melden
+ errors:
+ project_not_found: Project niet gevonden.
+ opt_in_notice: "Door klachten van project eigenaren is het niet meer mogenlijk om automatisch projecten toe te voegen. Bestaande projecten zonder stortingen zijn verwijderd. Als je jouw project(en) wildt aanmelden dan gebruik de %{create_issue_link} optie van github."
+ access_denied: Geen toegang
+ can_assign_more_tips: "Het is niet mogelijk om meer als 100% van het beschickbaar saldo over te maken."
+ wrong_bitcoin_address: Er is een fout opgetreden tijdens het bijwerken van het bitcoin adres
+ user_not_found: Gebruiker niet gevonden
+ access_denied: Je bezit niet over de rechten deze actie uit te voeren!
+ notices:
+ project_updated: De instellingen van het project zijn bijgewerkt
+ tips_decided: De beloningen zijn ingesteld
+ user_updated: Je gegens zijn opgeslagen!
+ user_unsubscribed: "Je bent afgemeld! Sorry voor het lastig vallen. Je kunt nog steeds je bitcoins adres bij ons opslaan om automatisch de beloningen te ontvangen"
+ tip_amounts:
+ undecided: "Onbeslist"
+ free: "Gratis: 0%"
+ tiny: "Mini: 0.1%"
+ small: "Klein: 0.5%"
+ normal: "Normaal: 1%"
+ big: "Groot: 2%"
+ huge: "Enorm: 5%"
+ js:
+ errors:
+ value:
+ invalid: De waarde is ongeldig
+ email:
+ invalid: Ongeldig e-mail adres
+ blank: E-mail is verplicht en kan niet leeg blijven
+ password:
+ blank: Wachtwoord is verplicht en kan niet leeg blijven
+ invalid: De wachtwoorden komen niet overeen
+ password_confirmation:
+ blank: Wachtwoord is verplicht en kan niet leeg blijven
+ invalid: De wachtwoorden komen niet overeen
+ home:
+ index:
+ see_projects: Bekijk projecten
+ how_does_it_work:
+ title: Hoe werkt het?
+ text: Mensen sponsoren bitcoins aan projecten. Als een commit van een persoon is geaccepteerd (merge in repository), maken we automaitsch een belong over aan deze persoon.
+ button: Wat zijn Bitcoins
+ donate:
+ title: Doneren
+ text: Zoek een project dat je wilt spponsoren en maak bitcoins over. Je donatie wordt toegevoegd aan het saldo van het project en wordt als beloning voor nieuwe commits uitbetaald.
+ button: Zoek een project
+ contribute:
+ title: Bijdragen
+ text: Ga en repareer iets! Als je commit wordt egaccepteerd door de eigenaar van het project (merg in master), krijg je een beloning!
+ sign_in_text: "Conroleer je e-mail voor een e-mail met %{sign_in_link}."
+ sign_up_text: "Als je nog niet bent geregistreedt kun je je %{sign_up_link} met een geldig e-mail adres of via"
+ button: Gesteunde projecten
+ projects:
+ index:
+ find_project:
+ placeholder: Vul een GitHub project URLof een zoekwoord in om hem te vinden...
+ button: Vind project
+ repository: Repository
+ description: Omschrijving
+ watchers: Watchers
+ balance: Saldo
+ forked_from: forked van
+ support: Steun project
+ show:
+ title: "Bijdrage aan %{project}"
+ fetch_pending: (Wachten initial fetch)
+ edit_project: project instellingen aanpassen
+ decide_tip_amounts: Beloningen instellen
+ disabled_notifications: "Project eigenaren hebben besloten om nieuwe ondersteuners niet in te lichten over beloningen. Ze vinden deze manier van beloningen waarschijnlijk niet goed."
+ project_sponsors: Project sponsoren
+ fee: "%{percentage} van gesponsordt geld wordt gebruikt voor de ondersteuning van nieuwe commits."
+ balance: Saldo
+ deposits: stortingen
+ custom_tip_size: (elke nieuwe commit ontvangt een percentage van het beschickbare saldo)
+ default_tip_size: "(elke nieuwe commit ontvangt %{percentage} van het beschickbare saldo)"
+ min_tip_size: "De mininmum grote van een beloning is %{min_tip}, echte kan deze kleiner zijn als het saldo van het project daar onder licht."
+ unconfirmed_amount: "(%{amount} onbevesticht)"
+ tipping_policies: Beloningspolicy
+ updated_by_user: "(Laatste update door %{name} op %{date})"
+ updated_by_unknown: "(Laatste update op %{date})"
+ tips_paid: Beloningen betaald
+ unclaimed_amount: "(%{amount} is nog niet geclaimed, en wordt terug gestord naar het project als deze na 1 maand nogaltijd niet geclaimed is.)"
+ last_tips: Laatste beloningen
+ see_all: Alles zien
+ received: "ontvangen %{amount}"
+ will_receive: Gaan een beloning ontvangen
+ for_commit: voor commit
+ when_decided: als de hoogte is vastgesteld
+ next_tip: Volgende beloning
+ contribute_and_earn: Bijdragen en beloond worden
+ contribute_and_earn_description: "Doneer bitcoins aan dit project of %{make_commits_link} en krijg beloningen. Als je commit wordt geaccepteerd %{branch} door een projecteigenaar en er is een positief saldo van bitcoins, krijg je een beloning!"
+ contribute_and_earn_branch: "in de branch %{branch}"
+ make_commits_link: maak commits
+ tell_us_bitcoin_address: "Gewoon je bitcoin adres %{tell_us_link}."
+ tell_us_link: aan ons vertellen
+ sign_in: "Gewoon je e-maol controleren of %{sign_in_link}."
+ promote_project: Promote %{project}
+ embedding: Laden
+ image_url: "URL van afbeelding:"
+ shield_title: beloning voor de volgende commit
+ edit:
+ project_settings: "%{project} project instellingen"
+ branch: Branch
+ default_branch: Standaard branch
+ tipping_policies: Beloningspolicies
+ hold_tips: "Stuur de beloningen niet direct. Geef eigenaren de mogenlijkheid om de hoogte in te stellen voor ze worden verstuurd."
+ save: Project instellingen opslaan
+ disable_notifications: Niets melden aan nieuwe bijdragers
+ decide_tip_amounts:
+ commit: Commit
+ author: Auteur
+ message: Bericht
+ tip: Beloning (afhangkelijk van het project saldo)
+ submit: Stuur de geselecteerde hoeveelheid beloningen
+ blacklisted:
+ title: Sorry, dit project ondersteund geen beloningen!
+ message: De auteur van het project heeft ervoor gekozen om geen beloningen toe te staan.
+ tips:
+ index:
+ tips: Beloningen
+ project_tips: '%{project} beloningen'
+ user_tips: "%{user} beloningen"
+ created_at: Aangemaakt op
+ commiter: Commiter
+ project: Project
+ commit: Commit
+ amount: Bedrag
+ refunded: Teruggestord aan project saldo
+ undecided: De hoogte van de beloning is nog niet vastgesteld
+ no_bitcoin_address: Gebruiker heeft geen bitcoin adres opgegeven
+ below_threshold: "Gebruikers saldo is onder de terugstorddrempel"
+ waiting: Wachten om terug gestord te worden
+ error: (er is een fout opgetreden bij het overmaken)
+ deposits:
+ index:
+ project_deposits: '%{project} stortingen'
+ deposits: Stortingen
+ created_at: Toegevoegd op
+ project: Project
+ amount: Bedrag
+ transaction: Transactie
+ confirmed: Bevestigd
+ confirmed_yes: 'Ja'
+ confirmed_no: 'Nee'
+ users:
+ index:
+ title: Top bijdagers
+ name: Naam
+ commits_count: Commits beloond
+ withdrawn: Teruggetrokken
+ show:
+ balance: Saldo
+ threshold: "Je ontvangt he geld zodra je zaldo over het minimum is van: %{threshold}"
+ see_all: bekijk alles
+ received: "%{time} ontvangen %{amount} voor commit %{commit} in %{project}"
+ bitcoin_address_placeholder: Jouw bitcoin adres
+ notify: Stuur me een bericht over nieuwe beloningen (niet meer als 1 keer per maand)
+ submit_user: Gegevens opslaan
+ change_password: Wijzig wachtwoord
+ submit_password: Wijzig mijn wachtwoord
+ withdrawals:
+ index:
+ title: Laatste terugroepingen
+ created_at: Aangemaakt op
+ transaction: Transactiie
+ result: Resultaat
+ error: Foutief
+ success: Success
+ devise:
+ sessions:
+ new:
+ title: Registreren
+ remember_me: Mij onthouden
+ submit: Inloggen
+ registrations:
+ new:
+ title: Registreren
+ submit: Registreren
+ passwords:
+ new:
+ title: Wachtwoord vergeten?
+ submit: Stuur me de instructies om mijn wachtwoord te resetten
+ edit:
+ title: Wachtwoord aanpassen
+ submit: Mijn wachtwoord aanpassen
+ confirmations:
+ new:
+ title: Stuur bevestigingsinstructies opnieuw
+ submit: Stuur bevestigingsinstructies opnieuw
+ links:
+ sign_in: Inloggen
+ sign_up: Registreren
+ recover: Wachtwoord vergeten?
+ confirm: Geen bevestigingsintructies ontvangen?
+ sign_in_with: "Inloggen met %{provider}"
+ errors:
+ primary_email: Je e-mail adres moet gevalideerd worden.
+ onmiauth_info: We kunnen je gegevens niet ophalen.
+ activerecord:
+ attributes:
+ user:
+ email: E-mail
+ bitcoin_address: Bitcoin adres
+ password: Wachtwoord
+ password_confirmation: Wachtwoord bevestigen
+ display_name: Weergavenaam
+ omniauth_providers:
+ github: GitHub
+ bitbucket: BitBucket
+ general:
+ or: of
+ disclaimer:
+ line1: "We zijn niet gerelateerd aan de meeste van de projecten, haar eigenaren zijn zich misschien niet bewust van of actief tegen het gebruik van tip4commit. Door moegenlijke etische en wettelijke problemen moeten we misschien enkele van de projecten uit de lijst wissen (op wens van de prohect eigenaar)."
+ line2: "Ook sturen we geen melding meer aan de ontwikkelaars. Dus we kunnen niet garanteren dat de donaties ze bereiken."
+ line3: "Door het doneren van geld gaat u ermee akkoord dat ze naar Free Software Foundation of elders naar Tip4Commit's keuze."
From bcd5bed4d612674cbb78ff03a6d31edd3b81311f Mon Sep 17 00:00:00 2001
From: Dennis van de Hoef
Date: Mon, 2 Feb 2015 22:25:31 +0100
Subject: [PATCH 158/415] add generated javascipt
---
app/assets/javascripts/i18n/translations.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/assets/javascripts/i18n/translations.js b/app/assets/javascripts/i18n/translations.js
index 029f45b8..31c58a41 100644
--- a/app/assets/javascripts/i18n/translations.js
+++ b/app/assets/javascripts/i18n/translations.js
@@ -1,2 +1,2 @@
var I18n = I18n || {};
-I18n.translations = {"en":{"js":{"errors":{"value":{"invalid":"Value is invalid"},"email":{"invalid":"Invalid Email Address","blank":"The Email is required and can't be empty"},"password":{"blank":"The password is required and can't be empty","invalid":"The password and its confirmation are not same"},"password_confirmation":{"blank":"The password confirmation is required and can't be empty","invalid":"The password and its confirmation are not same"}}}},"fr":{"js":{"errors":{"value":{"invalid":"Valeur non valide"},"email":{"invalid":"Adresse Email non valide","blank":"L'Email est requis et doit être renseigné"},"password":{"blank":"Les mot de passe est requis et doit être renseigné","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"},"password_confirmation":{"blank":"La confirmation du mot de passe est requise et doit être renseignée","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"}}}},"hr":{"js":{"errors":{"value":{"invalid":"Vrijednost nevazeca"},"email":{"invalid":"Nezaveca email adresa","blank":"Email je potreban i ne moze biti prazno"},"password":{"blank":"Lozinka je potrebna i ne moze biti prazno","invalid":"Lozinka i njezina potvrda nisu isti"},"password_confirmation":{"blank":"Potvrda lozinke je potrebna i ne moze biti prazno","invalid":"Lozinka i potvrda lozinke nisu isti"}}}},"pl":{"js":{"errors":{"value":{"invalid":"Wartość jest niepoprawna"},"email":{"invalid":"Błędny adres E-mail","blank":"E-mail jest wymagany i nie może być pusty"},"password":{"blank":"Hasło jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"},"password_confirmation":{"blank":"Potwierdzenie hasła jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"}}}},"ru":{"js":{"errors":{"value":{"invalid":"Неверное значение"},"email":{"invalid":"Ошибка в Email адресе","blank":"Email не может быть пустым"},"password":{"blank":"Пароль не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"},"password_confirmation":{"blank":"Подтверждение пароля не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"}}}}};
\ No newline at end of file
+I18n.translations = {"en":{"js":{"errors":{"value":{"invalid":"Value is invalid"},"email":{"invalid":"Invalid Email Address","blank":"The Email is required and can't be empty"},"password":{"blank":"The password is required and can't be empty","invalid":"The password and its confirmation are not same"},"password_confirmation":{"blank":"The password confirmation is required and can't be empty","invalid":"The password and its confirmation are not same"}}}},"hr":{"js":{"errors":{"value":{"invalid":"Vrijednost nevazeca"},"email":{"invalid":"Nezaveca email adresa","blank":"Email je potreban i ne moze biti prazno"},"password":{"blank":"Lozinka je potrebna i ne moze biti prazno","invalid":"Lozinka i njezina potvrda nisu isti"},"password_confirmation":{"blank":"Potvrda lozinke je potrebna i ne moze biti prazno","invalid":"Lozinka i potvrda lozinke nisu isti"}}}},"fr":{"js":{"errors":{"value":{"invalid":"Valeur non valide"},"email":{"invalid":"Adresse Email non valide","blank":"L'Email est requis et doit être renseigné"},"password":{"blank":"Les mot de passe est requis et doit être renseigné","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"},"password_confirmation":{"blank":"La confirmation du mot de passe est requise et doit être renseignée","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"}}}},"nl":{"js":{"errors":{"value":{"invalid":"De waarde is ongeldig"},"email":{"invalid":"Ongeldig e-mail adres","blank":"E-mail is verplicht en kan niet leeg blijven"},"password":{"blank":"Wachtwoord is verplicht en kan niet leeg blijven","invalid":"De wachtwoorden komen niet overeen"},"password_confirmation":{"blank":"Wachtwoord is verplicht en kan niet leeg blijven","invalid":"De wachtwoorden komen niet overeen"}}}},"ru":{"js":{"errors":{"value":{"invalid":"Неверное значение"},"email":{"invalid":"Ошибка в Email адресе","blank":"Email не может быть пустым"},"password":{"blank":"Пароль не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"},"password_confirmation":{"blank":"Подтверждение пароля не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"}}}},"pl":{"js":{"errors":{"value":{"invalid":"Wartość jest niepoprawna"},"email":{"invalid":"Błędny adres E-mail","blank":"E-mail jest wymagany i nie może być pusty"},"password":{"blank":"Hasło jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"},"password_confirmation":{"blank":"Potwierdzenie hasła jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"}}}}};
\ No newline at end of file
From d85427cb626568868196348eac22b909c59750e0 Mon Sep 17 00:00:00 2001
From: Stein Inge Morisbak
Date: Mon, 9 Feb 2015 21:29:59 +0100
Subject: [PATCH 159/415] Update blacklist.yml
---
config/blacklist.yml | 1 +
1 file changed, 1 insertion(+)
diff --git a/config/blacklist.yml b/config/blacklist.yml
index 19f7c9d6..42b994c3 100644
--- a/config/blacklist.yml
+++ b/config/blacklist.yml
@@ -35,3 +35,4 @@
- https://github.com/MediaCrush/*
- https://github.com/KnightOS/*
- https://github.com/KerbalStuff/*
+- https://github.com/digipost
From 8eb1ef52fa807d0cd5f5beb5229de21d1fa11588 Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Tue, 10 Feb 2015 09:30:25 +0530
Subject: [PATCH 160/415] Update blacklist.yml
---
config/blacklist.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/config/blacklist.yml b/config/blacklist.yml
index 42b994c3..78b26d62 100644
--- a/config/blacklist.yml
+++ b/config/blacklist.yml
@@ -35,4 +35,4 @@
- https://github.com/MediaCrush/*
- https://github.com/KnightOS/*
- https://github.com/KerbalStuff/*
-- https://github.com/digipost
+- https://github.com/digipost/*
From eb1734c00c7676f33e8db494832cb72989c52867 Mon Sep 17 00:00:00 2001
From: Dennis van de Hoef
Date: Mon, 9 Feb 2015 22:07:55 +0100
Subject: [PATCH 161/415] add the gravatar gem
---
Gemfile | 2 ++
Gemfile.lock | 2 ++
2 files changed, 4 insertions(+)
diff --git a/Gemfile b/Gemfile
index b1976865..c29623a2 100644
--- a/Gemfile
+++ b/Gemfile
@@ -37,6 +37,8 @@ gem "i18n-js"
gem 'kaminari-i18n'
gem 'devise-i18n'
+gem 'easy_gravatar'
+
group :development do
gem 'capistrano', '~> 3.0.1'
gem 'capistrano-rvm', '~> 0.1.0', github: 'capistrano/rvm'
diff --git a/Gemfile.lock b/Gemfile.lock
index d9298f3b..cda584a2 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -138,6 +138,7 @@ GEM
dusen (0.4.10)
activerecord
edge_rider (>= 0.2.5)
+ easy_gravatar (1.0.0)
edge_rider (0.3.0)
activerecord
erubis (2.7.0)
@@ -340,6 +341,7 @@ DEPENDENCIES
devise (~> 3.2.2)
devise-i18n
dusen
+ easy_gravatar
factory_girl_rails (~> 4.3.0)
haml-rails (~> 0.5.3)
http_accept_language
From aed307aef219127803175fdfff716fe9ca038d76 Mon Sep 17 00:00:00 2001
From: Dennis van de Hoef
Date: Wed, 11 Feb 2015 21:40:13 +0100
Subject: [PATCH 162/415] show gravatar display name and bitcoin adress
---
app/assets/stylesheets/users.css.scss | 10 ++++++++++
app/models/user.rb | 12 ++++++++++++
app/views/users/show.html.haml | 8 +++++++-
config/locales/en.yml | 1 +
config/locales/nl.yml | 1 +
5 files changed, 31 insertions(+), 1 deletion(-)
diff --git a/app/assets/stylesheets/users.css.scss b/app/assets/stylesheets/users.css.scss
index 31a2eacb..02dd9047 100644
--- a/app/assets/stylesheets/users.css.scss
+++ b/app/assets/stylesheets/users.css.scss
@@ -1,3 +1,13 @@
// Place all the styles related to the Users controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
+
+
+.from-gravatar{
+ display: block;
+ margin-bottom: 15px;
+ cursor: pointer;
+ font-style: italic;
+ margin-top: -12px;
+ padding-left: 14px;
+}
diff --git a/app/models/user.rb b/app/models/user.rb
index d16465b5..5b1cd575 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -24,6 +24,14 @@ def balance
tips.decided.unpaid.sum(:amount)
end
+ def gravatar_bitcoin
+ gravatar.get_value :currency, :bitcoin
+ end
+
+ def gravatar_display_name
+ gravatar.get_value :displayName
+ end
+
def display_name
attributes['display_name'].presence || name.presence || nickname.presence || email
end
@@ -63,6 +71,10 @@ def ready_for_withdrawal?
private
+ def gravatar
+ @gravatar ||= Gravatar::new(email)
+ end
+
def set_login_token!
loop do
self.login_token = SecureRandom.urlsafe_base64
diff --git a/app/views/users/show.html.haml b/app/views/users/show.html.haml
index 20fcb7aa..fd15340e 100644
--- a/app/views/users/show.html.haml
+++ b/app/views/users/show.html.haml
@@ -5,7 +5,7 @@
= btc_human @user.balance
%p
%small= raw t('.threshold', threshold: btc_human(CONFIG["min_payout"]))
-
+
- if @user_tips.count > 0
%p
%strong Last Tips
@@ -21,7 +21,13 @@
%p= @user.email
= twitter_bootstrap_form_for @user do |f|
= f.text_field :bitcoin_address, placeholder: t('.bitcoin_address_placeholder')
+ - if @user.gravatar_bitcoin.present?
+ %span.from-gravatar{data:{for: 'user[bitcoin_address]', value: @user.gravatar_bitcoin }}
+ = "#{t('.use_from_gravatar')}: #{@user.gravatar_bitcoin}"
= f.text_field :display_name
+ - if @user.gravatar_display_name.present?
+ %span.from-gravatar{data:{for: 'user[display_name]', value: @user.gravatar_display_name }}
+ = "#{t('.use_from_gravatar')}: #{@user.gravatar_display_name}"
- if f.object.bitcoin_address.blank?
= f.check_box :unsubscribed, t('.notify'), { checked: !f.object.unsubscribed? }, '0', '1'
%br
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 03ffa159..a3c68bd5 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -176,6 +176,7 @@ en:
submit_user: Update user info
change_password: Change your password
submit_password: Change my password
+ use_from_gravatar: Use from your gravatar profile
withdrawals:
index:
title: Last Withdrawals
diff --git a/config/locales/nl.yml b/config/locales/nl.yml
index 06730986..73036b8b 100644
--- a/config/locales/nl.yml
+++ b/config/locales/nl.yml
@@ -176,6 +176,7 @@ nl:
submit_user: Gegevens opslaan
change_password: Wijzig wachtwoord
submit_password: Wijzig mijn wachtwoord
+ use_from_gravatar: Gebruik van je gravatar profiel
withdrawals:
index:
title: Laatste terugroepingen
From 60f6a93142591c55cb4f47e9e031bfebb905c9a8 Mon Sep 17 00:00:00 2001
From: Dennis van de Hoef
Date: Wed, 11 Feb 2015 21:40:53 +0100
Subject: [PATCH 163/415] Use gravatar data on-click
---
app/assets/javascripts/users.js.coffee | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/app/assets/javascripts/users.js.coffee b/app/assets/javascripts/users.js.coffee
index 69410427..056e5d7a 100644
--- a/app/assets/javascripts/users.js.coffee
+++ b/app/assets/javascripts/users.js.coffee
@@ -8,21 +8,21 @@ load_bootstrap_validator = ->
message: I18n.t('js.errors.email.invalid')
notEmpty:
message: I18n.t('js.errors.email.blank')
-
+
"user[password]":
validators:
notEmpty:
message: I18n.t('js.errors.password.blank')
identical:
- field: 'user[password_confirmation]'
+ field: 'user[password_confirmation]'
message: I18n.t('js.errors.password.invalid')
-
+
"user[password_confirmation]":
validators:
notEmpty:
message: I18n.t('js.errors.password_confirmation.blank')
identical:
- field: 'user[password]'
+ field: 'user[password]'
message: I18n.t('js.errors.password_confirmation.invalid')
$('.session_form').bootstrapValidator
message: I18n.t('js.errors.value.invalid')
@@ -33,10 +33,14 @@ load_bootstrap_validator = ->
message: I18n.t('js.errors.email.invalid')
notEmpty:
message: I18n.t('js.errors.email.blank')
-
+
"user[password]":
validators:
notEmpty:
message: I18n.t('js.errors.password_confirmation.blank')
-$(document).on "ready page:load", load_bootstrap_validator
\ No newline at end of file
+$(document).on "ready page:load", load_bootstrap_validator
+
+$ ->
+ $('.from-gravatar').click (e) ->
+ $('input[name="'+$(this).data('for')+'"]').val($(this).data('value'))
From 3f5462672cd2fe52f4e8b1e47d7590f2530c9109 Mon Sep 17 00:00:00 2001
From: win32re
Date: Sun, 15 Feb 2015 20:12:29 +0100
Subject: [PATCH 164/415] Update README.md
---
README.md | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/README.md b/README.md
index 49017eb5..e0401e91 100644
--- a/README.md
+++ b/README.md
@@ -6,18 +6,17 @@ Tip4commit
Donate bitcoins to open source projects or receive tips for code contributions.
-| | |
-| -------------- | ------------------------------------------------- |
-| Official site: | https://tip4commit.com/ |
-| Discussions: | https://bitcointalk.org/index.php?topic=315802 |
-| FAQs: | https://github.com/tip4commit/tip4commit/wiki/FAQ |
-| Issues: | https://github.com/tip4commit/tip4commit/issues |
-
+Name | Link
+----|----|
+Official site | https://tip4commit.com/
+Discussions | https://bitcointalk.org/index.php?topic=31580
+FAQs | https://github.com/tip4commit/tip4commit/wiki/FAQ
+Issues | https://github.com/tip4commit/tip4commit/issues
Developers
==========
-If you would like to contribute to the development of tip4commit, you can find the contribution guidelines and installation instructions on the [developer README](https://github.com/tip4commit/tip4commit/wiki/Developer-README)
+If you would like to contribute to the development of tip4commit, you can find the contribution guidelines and installation instructions in the [developer README](https://github.com/tip4commit/tip4commit/wiki/Developer-README)
License
From 03f369c51158540d1fe2eb5d7b25ad8ea96d3c56 Mon Sep 17 00:00:00 2001
From: Dennis van de Hoef
Date: Mon, 16 Feb 2015 21:33:27 +0100
Subject: [PATCH 165/415] fix specs
---
Gemfile.lock | 2 +-
app/models/user.rb | 4 +++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/Gemfile.lock b/Gemfile.lock
index cda584a2..2e9158ef 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -138,7 +138,7 @@ GEM
dusen (0.4.10)
activerecord
edge_rider (>= 0.2.5)
- easy_gravatar (1.0.0)
+ easy_gravatar (1.0.1)
edge_rider (0.3.0)
activerecord
erubis (2.7.0)
diff --git a/app/models/user.rb b/app/models/user.rb
index 5b1cd575..52ac680f 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -25,10 +25,12 @@ def balance
end
def gravatar_bitcoin
+ return '' unless gravatar
gravatar.get_value :currency, :bitcoin
end
def gravatar_display_name
+ return '' unless gravatar
gravatar.get_value :displayName
end
@@ -72,7 +74,7 @@ def ready_for_withdrawal?
private
def gravatar
- @gravatar ||= Gravatar::new(email)
+ @gravatar ||= Gravatar::new(nil)
end
def set_login_token!
From b6dc2fe13c8d65a603f4b315626b38041873b8ba Mon Sep 17 00:00:00 2001
From: win32re
Date: Fri, 27 Feb 2015 12:04:11 +0100
Subject: [PATCH 166/415] Add Croatian translation to application.rb
---
config/application.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/config/application.rb b/config/application.rb
index cea2c4c2..d2e107e5 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -36,7 +36,7 @@ class Application < Rails::Application
config.autoload_paths += %W(#{config.root}/lib)
config.assets.initialize_on_precompile = true
- config.available_locales = %w(en fr nl ru pl)
+ config.available_locales = %w(en fr nl ru pl hr)
end
end
From c9997f2bb0a000bd40cf24b5f3d9417167752023 Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Wed, 11 Mar 2015 11:30:10 +0530
Subject: [PATCH 167/415] added croatian flag
---
app/assets/images/.keep | 0
app/assets/images/flags/hr.png | Bin 0 -> 524 bytes
2 files changed, 0 insertions(+), 0 deletions(-)
delete mode 100644 app/assets/images/.keep
create mode 100755 app/assets/images/flags/hr.png
diff --git a/app/assets/images/.keep b/app/assets/images/.keep
deleted file mode 100644
index e69de29b..00000000
diff --git a/app/assets/images/flags/hr.png b/app/assets/images/flags/hr.png
new file mode 100755
index 0000000000000000000000000000000000000000..696b515460ddb670acb7e9de4438aaf21fc5fb77
GIT binary patch
literal 524
zcmV+n0`vWeP)@|4`Xj5kLU3fF!G{fyDoR{}_Q36Vv~H|Ns5{^Z)NZrr*Dqe*gae=g)r_`DNuw
zfB*t(VEF(4$y0{Ee}M=nS{mB(NB;kxJOBSE{F_{n`2Y8>|G$0##TjK~fi?gH5EIz!
z|8Uj6|NiY-l-<0|OxA@1MWlzkmOI;leLR
z$De1;{4g{7^y$;LZ{NOt{rct07a;lk`E!5(f@%OM1_PkhC8`eE9egqWbga
z&p;hdpFRZ$Adm)#>fe8W4*Ct02B|hR1*-n0rS<;(dx&bFRY1n$$BzL5h>;=uaC^Mc
z(+@v?|NZ~x@4w%F|9yUZW7+yTpo@LH>e(bUfFghX{rmIxzpNnpimU?w0mQ=a>kp9s
z8>AGffmuv7DrFgv!3yU7{`2q8f1ngFoPlxn4
Date: Wed, 11 Mar 2015 12:01:16 +0530
Subject: [PATCH 168/415] fixed gravatar integration
---
app/assets/javascripts/i18n/translations.js | 2 +-
app/models/user.rb | 16 +++++++++++-----
2 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/app/assets/javascripts/i18n/translations.js b/app/assets/javascripts/i18n/translations.js
index 31c58a41..c7a35c14 100644
--- a/app/assets/javascripts/i18n/translations.js
+++ b/app/assets/javascripts/i18n/translations.js
@@ -1,2 +1,2 @@
var I18n = I18n || {};
-I18n.translations = {"en":{"js":{"errors":{"value":{"invalid":"Value is invalid"},"email":{"invalid":"Invalid Email Address","blank":"The Email is required and can't be empty"},"password":{"blank":"The password is required and can't be empty","invalid":"The password and its confirmation are not same"},"password_confirmation":{"blank":"The password confirmation is required and can't be empty","invalid":"The password and its confirmation are not same"}}}},"hr":{"js":{"errors":{"value":{"invalid":"Vrijednost nevazeca"},"email":{"invalid":"Nezaveca email adresa","blank":"Email je potreban i ne moze biti prazno"},"password":{"blank":"Lozinka je potrebna i ne moze biti prazno","invalid":"Lozinka i njezina potvrda nisu isti"},"password_confirmation":{"blank":"Potvrda lozinke je potrebna i ne moze biti prazno","invalid":"Lozinka i potvrda lozinke nisu isti"}}}},"fr":{"js":{"errors":{"value":{"invalid":"Valeur non valide"},"email":{"invalid":"Adresse Email non valide","blank":"L'Email est requis et doit être renseigné"},"password":{"blank":"Les mot de passe est requis et doit être renseigné","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"},"password_confirmation":{"blank":"La confirmation du mot de passe est requise et doit être renseignée","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"}}}},"nl":{"js":{"errors":{"value":{"invalid":"De waarde is ongeldig"},"email":{"invalid":"Ongeldig e-mail adres","blank":"E-mail is verplicht en kan niet leeg blijven"},"password":{"blank":"Wachtwoord is verplicht en kan niet leeg blijven","invalid":"De wachtwoorden komen niet overeen"},"password_confirmation":{"blank":"Wachtwoord is verplicht en kan niet leeg blijven","invalid":"De wachtwoorden komen niet overeen"}}}},"ru":{"js":{"errors":{"value":{"invalid":"Неверное значение"},"email":{"invalid":"Ошибка в Email адресе","blank":"Email не может быть пустым"},"password":{"blank":"Пароль не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"},"password_confirmation":{"blank":"Подтверждение пароля не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"}}}},"pl":{"js":{"errors":{"value":{"invalid":"Wartość jest niepoprawna"},"email":{"invalid":"Błędny adres E-mail","blank":"E-mail jest wymagany i nie może być pusty"},"password":{"blank":"Hasło jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"},"password_confirmation":{"blank":"Potwierdzenie hasła jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"}}}}};
\ No newline at end of file
+I18n.translations = {"en":{"js":{"errors":{"value":{"invalid":"Value is invalid"},"email":{"invalid":"Invalid Email Address","blank":"The Email is required and can't be empty"},"password":{"blank":"The password is required and can't be empty","invalid":"The password and its confirmation are not same"},"password_confirmation":{"blank":"The password confirmation is required and can't be empty","invalid":"The password and its confirmation are not same"}}}},"fr":{"js":{"errors":{"value":{"invalid":"Valeur non valide"},"email":{"invalid":"Adresse Email non valide","blank":"L'Email est requis et doit être renseigné"},"password":{"blank":"Les mot de passe est requis et doit être renseigné","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"},"password_confirmation":{"blank":"La confirmation du mot de passe est requise et doit être renseignée","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"}}}},"hr":{"js":{"errors":{"value":{"invalid":"Vrijednost nevazeca"},"email":{"invalid":"Nezaveca email adresa","blank":"Email je potreban i ne moze biti prazno"},"password":{"blank":"Lozinka je potrebna i ne moze biti prazno","invalid":"Lozinka i njezina potvrda nisu isti"},"password_confirmation":{"blank":"Potvrda lozinke je potrebna i ne moze biti prazno","invalid":"Lozinka i potvrda lozinke nisu isti"}}}},"nl":{"js":{"errors":{"value":{"invalid":"De waarde is ongeldig"},"email":{"invalid":"Ongeldig e-mail adres","blank":"E-mail is verplicht en kan niet leeg blijven"},"password":{"blank":"Wachtwoord is verplicht en kan niet leeg blijven","invalid":"De wachtwoorden komen niet overeen"},"password_confirmation":{"blank":"Wachtwoord is verplicht en kan niet leeg blijven","invalid":"De wachtwoorden komen niet overeen"}}}},"pl":{"js":{"errors":{"value":{"invalid":"Wartość jest niepoprawna"},"email":{"invalid":"Błędny adres E-mail","blank":"E-mail jest wymagany i nie może być pusty"},"password":{"blank":"Hasło jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"},"password_confirmation":{"blank":"Potwierdzenie hasła jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"}}}},"ru":{"js":{"errors":{"value":{"invalid":"Неверное значение"},"email":{"invalid":"Ошибка в Email адресе","blank":"Email не может быть пустым"},"password":{"blank":"Пароль не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"},"password_confirmation":{"blank":"Подтверждение пароля не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"}}}}};
\ No newline at end of file
diff --git a/app/models/user.rb b/app/models/user.rb
index 52ac680f..b3c3ced7 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -25,13 +25,19 @@ def balance
end
def gravatar_bitcoin
- return '' unless gravatar
- gravatar.get_value :currency, :bitcoin
+ begin
+ gravatar.get_value :currency, :bitcoin
+ rescue URI::InvalidURIError => e
+ nil
+ end
end
def gravatar_display_name
- return '' unless gravatar
- gravatar.get_value :displayName
+ begin
+ gravatar.get_value :displayName
+ rescue URI::InvalidURIError => e
+ nil
+ end
end
def display_name
@@ -74,7 +80,7 @@ def ready_for_withdrawal?
private
def gravatar
- @gravatar ||= Gravatar::new(nil)
+ @gravatar ||= Gravatar::new(email)
end
def set_login_token!
From 49610d41140a79479452bd92108f27150901ad93 Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Fri, 19 Jun 2015 14:45:11 +0500
Subject: [PATCH 169/415] fixed gravatar integration #240
---
app/models/user.rb | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/models/user.rb b/app/models/user.rb
index b3c3ced7..45a56054 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -27,7 +27,7 @@ def balance
def gravatar_bitcoin
begin
gravatar.get_value :currency, :bitcoin
- rescue URI::InvalidURIError => e
+ rescue URI::InvalidURIError, NoMethodError => e
nil
end
end
@@ -35,7 +35,7 @@ def gravatar_bitcoin
def gravatar_display_name
begin
gravatar.get_value :displayName
- rescue URI::InvalidURIError => e
+ rescue URI::InvalidURIError, NoMethodError => e
nil
end
end
From 0a27364c92ac94e6ab0171f3d4ba54586dfeda2e Mon Sep 17 00:00:00 2001
From: sssemil
Date: Fri, 19 Jun 2015 23:15:21 +0500
Subject: [PATCH 170/415] =?UTF-8?q?Show=20balance=20and=20next=20tip=20in?=
=?UTF-8?q?=20BTC,=20mBTC,=20=CE=BCBTC=20and=20Satoshi?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/users_controller.rb | 2 +-
app/helpers/application_helper.rb | 28 +++++++++++++++++++++----
app/models/user.rb | 4 ++++
app/views/layouts/application.html.haml | 4 ++--
app/views/users/show.html.haml | 10 ++++++---
db/migrate/20150620054216_add_denom.rb | 5 +++++
6 files changed, 43 insertions(+), 10 deletions(-)
create mode 100755 db/migrate/20150620054216_add_denom.rb
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index 2dfbc84d..57d67b1a 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -38,7 +38,7 @@ def login
private
def users_params
- params.require(:user).permit(:bitcoin_address, :password, :password_confirmation, :unsubscribed, :display_name)
+ params.require(:user).permit(:bitcoin_address, :password, :password_confirmation, :unsubscribed, :display_name, :denom)
end
def load_user ; super params ; end ;
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index a9f68c07..d59ec988 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -1,13 +1,33 @@
module ApplicationHelper
- def btc_human amount, options = {}
+ def btc_human amount, denom, options = {}
nobr = options.has_key?(:nobr) ? options[:nobr] : true
- btc = "%.8f Ƀ" % to_btc(amount)
+ if denom === 0
+ btc = to_btc(amount)
+ elsif denom === 1
+ btc = to_mbtc(amount)
+ elsif denom === 2
+ btc = to_ubtc(amount)
+ elsif denom === 3
+ btc = to_satoshi(amount)
+ end
btc = "#{btc}" if nobr
btc.html_safe
end
- def to_btc satoshies
- (1.0*satoshies.to_i/1e8)
+ def to_btc satoshies
+ "%.8f Ƀ" % (1.0*satoshies.to_i/1e8)
+ end
+
+ def to_mbtc satoshies
+ "%.5f mɃ" % (1.0*satoshies.to_i/1e5)
+ end
+
+ def to_ubtc satoshies
+ "%.2f μɃ" % (1.0*satoshies.to_i/1e2)
+ end
+
+ def to_satoshi satoshies
+ "%.0f Satoshi" % satoshies
end
def render_flash_messages
diff --git a/app/models/user.rb b/app/models/user.rb
index b3c3ced7..440b89bd 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -24,6 +24,10 @@ def balance
tips.decided.unpaid.sum(:amount)
end
+ def denom
+ attributes['denom'].presence || denom.presence
+ end
+
def gravatar_bitcoin
begin
gravatar.get_value :currency, :bitcoin
diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml
index 89a999b0..80fcd22c 100644
--- a/app/views/layouts/application.html.haml
+++ b/app/views/layouts/application.html.haml
@@ -38,9 +38,9 @@
= current_user.display_name
\/
- if current_user.nickname.present?
- = link_to btc_human(current_user.balance), user_pretty_path(current_user.nickname)
+ = link_to btc_human(current_user.balance, current_user.denom), user_pretty_path(current_user.nickname)
- else
- = link_to btc_human(current_user.balance), current_user
+ = link_to btc_human(current_user.balance, current_user.denom), current_user
\/
= link_to t('links.sign_out'), destroy_user_session_path, method: :delete
- else
diff --git a/app/views/users/show.html.haml b/app/views/users/show.html.haml
index fd15340e..41d48e0b 100644
--- a/app/views/users/show.html.haml
+++ b/app/views/users/show.html.haml
@@ -2,9 +2,13 @@
%p
%strong= t('.balance')
%p
- = btc_human @user.balance
+ = btc_human @user.balance, @user.denom
+ = form_for(@user) do |f|
+ = f.select :denom,
+ options_for_select([["BTC", "0"], ["mBTC", "1"], ["μBTC", "2"], ["Satoshi", "3"]], selected: @user.denom)
+ = f.submit "save"
%p
- %small= raw t('.threshold', threshold: btc_human(CONFIG["min_payout"]))
+ %small= raw t('.threshold', threshold: btc_human(CONFIG["min_payout"], @user.denom))
- if @user_tips.count > 0
%p
@@ -14,7 +18,7 @@
%ul
- @recent_tips.each do |tip|
%li
- = raw t('.received', time: l(tip.created_at, format: :short), amount: btc_human(tip.amount), commit: link_to(tip.commit[0..6], "https://github.com/#{tip.project.full_name}/commit/#{tip.commit}", target: :blank), project: link_to(tip.project.full_name, pretty_project_path(tip.project)))
+ = raw t('.received', time: l(tip.created_at, format: :short), amount: btc_human(tip.amount, @user.denom), commit: link_to(tip.commit[0..6], "https://github.com/#{tip.project.full_name}/commit/#{tip.commit}", target: :blank), project: link_to(tip.project.full_name, pretty_project_path(tip.project)))
%p
%strong= User.human_attribute_name(:email)
diff --git a/db/migrate/20150620054216_add_denom.rb b/db/migrate/20150620054216_add_denom.rb
new file mode 100755
index 00000000..91cde8be
--- /dev/null
+++ b/db/migrate/20150620054216_add_denom.rb
@@ -0,0 +1,5 @@
+class AddDenom < ActiveRecord::Migration
+ def change
+ add_column :users, :denom, :integer, default: 0
+ end
+end
From 56edc04b98577b3ffdd250191237fa32d013156a Mon Sep 17 00:00:00 2001
From: Emil Suleymanov
Date: Sun, 21 Jun 2015 18:51:09 +0500
Subject: [PATCH 171/415] Fix building
---
.travis.yml | 1 +
1 file changed, 1 insertion(+)
diff --git a/.travis.yml b/.travis.yml
index 7f28cef1..2041e869 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -10,5 +10,6 @@ before_script:
- cp config/database.yml.sample config/database.yml
script:
+ - bundle exec rake db:migrate
- bundle exec rake spec
- bundle exec rake cucumber
From 6ec4d717ca509af721e3cea369535d6f55d96ebf Mon Sep 17 00:00:00 2001
From: Sebastian
Date: Thu, 25 Jun 2015 15:39:47 +0200
Subject: [PATCH 172/415] Update hr.yml
---
config/locales/hr.yml | 32 ++++++++++++++++----------------
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/config/locales/hr.yml b/config/locales/hr.yml
index ebfdb6c7..ba647343 100644
--- a/config/locales/hr.yml
+++ b/config/locales/hr.yml
@@ -4,12 +4,12 @@ hr:
title: Doprinosite otvorenom izvoru
description: Donirajte bitcoine u otvoreni izvor projekata ili napravite cinove i dobite napojnice.
menu:
- home: Pocetna stranica
+ home: Početna stranica
projects: Podrzavani Projekti
footer:
- text: "Izvorni kod dostupan na %{github_link} i mozete takoder %{support_link} razvoj."
+ text: "Izvorni kod je dostupan na %{github_link} a možete i %{support_link} razvoj."
github_link: GitHub
- support_link: podrzi
+ support_link: podržati
follow_link: Prati @tip4commit
links:
sign_up: Sign up
@@ -20,9 +20,9 @@ hr:
project_not_found: Projekt nije nadjen.
access_denied: Pristup odbijen
can_assign_more_tips: "Ne mozete dodijeliti vise od 100% dostupnih sredstva."
- wrong_bitcoin_address: Greska u updejtanju bitcoin adrese
- user_not_found: Korisnik nije naden
- access_denied: Niste ovlasteni da napravite ovu akciju!
+ wrong_bitcoin_address: Greška u bitcoin adresi
+ user_not_found: Korisnik nije nađen
+ access_denied: Niste ovlašteni da ovo napravite!
notices:
project_updated: Postavke projekta su primijenjena
tips_decided: Broj napojnica je bio definiran
@@ -54,18 +54,18 @@ hr:
see_projects: Vidjeti projekte
how_does_it_work:
title: Kako ovo radi?
- text: Ljudi doniraju bitcoine projektima. Kada se neciji cin potvrdi u repozitorij projekta, mi automatski posaljemo napojnicu autoru.
- button: Nauciti o Bitcoin
+ text: Ljudi doniraju bitcoine projektima. Kada se nečiji commit potvrdi u repozitoriju projekta, mi automatski pošaljemo napojnicu autoru.
+ button: Nauči više o Bitcoinu
donate:
- title: Donirati
- text: Pronadite projekt u koji zelite posvojiti svoje bitcoine. Vase donacije ce biti akumulirane sa fundovima ostalih donatora kao napojnice za nove cinove.
- button: Pronaci ili dodati pojekt
+ title: Donirajte
+ text: Pronađite projekt u koji želite uložiti vaše Bitcoine. Vaše donacije ce biti akumulirane sa donacijama ostalih donatora kao napojnice za nove commitove.
+ button: Pronađi ili dodaj projekt
contribute:
- title: Doprinositi
- text: Idite i popravite nesto! Ako je vas cin odobren od odrzavatelja projekta, dobiti cete napojnicu!
- sign_in_text: "Samo provjerite vas email ili %{sign_in_link}."
- sign_up_text: "Ako jos niste dobili pozivnicu, moze te se %{sign_up_link} sa valjanom email adresom ili"
- button: Podrzavani projekti
+ title: Doprinesi
+ text: Idite i popravite nešto! Ako održavatelj projekta odobri vaš commit, dobiti ćete napojnicu!
+ sign_in_text: "Samo provjerite vaš email ili %{sign_in_link}."
+ sign_up_text: "Ako još niste dobili pozivnicu, moze te se %{sign_up_link} sa valjanom email adresom ili"
+ button: Projekti koje podržavamo
projects:
index:
find_project:
From 0cb5acd5a05914bcea270b596c0a161eea48c286 Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Wed, 1 Jul 2015 14:23:57 +0500
Subject: [PATCH 173/415] fixed tests
---
app/helpers/application_helper.rb | 2 +-
db/schema.rb | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index d59ec988..e0ed3580 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -1,5 +1,5 @@
module ApplicationHelper
- def btc_human amount, denom, options = {}
+ def btc_human amount, denom = 0, options = {}
nobr = options.has_key?(:nobr) ? options[:nobr] : true
if denom === 0
btc = to_btc(amount)
diff --git a/db/schema.rb b/db/schema.rb
index 9e45e735..03ad325d 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 20141112064004) do
+ActiveRecord::Schema.define(version: 20150620054216) do
create_table "collaborators", force: true do |t|
t.integer "project_id"
@@ -124,6 +124,7 @@
t.string "confirmation_token"
t.string "unconfirmed_email"
t.string "display_name"
+ t.integer "denom", default: 0
end
add_index "users", ["email"], name: "index_users_on_email", unique: true
From 5cde4904b6ae6937c421e3dafde5b15f2b673694 Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Wed, 1 Jul 2015 16:06:29 +0500
Subject: [PATCH 174/415] removed coingiving because no one is using it and we
are going to close this project
---
app/views/projects/show.html.haml | 10 ++++------
app/views/user_mailer/new_tip.html.haml | 2 +-
config/locales/en.yml | 1 -
config/locales/fr.yml | 1 -
config/locales/hr.yml | 1 -
config/locales/nl.yml | 1 -
config/locales/pl.yml | 1 -
config/locales/ru.yml | 1 -
8 files changed, 5 insertions(+), 13 deletions(-)
diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml
index 9a853120..952722da 100644
--- a/app/views/projects/show.html.haml
+++ b/app/views/projects/show.html.haml
@@ -21,13 +21,11 @@
.col-md-4
.panel.panel-default
.panel-heading
- %h4.panel-title= t('.project_sponsors')
+ %h4.panel-title= t('projects.index.support')
.panel-body
- %iframe{ src: "//coingiving.com/project_sponsors?locale=#{I18n.locale}&url=#{project_url(@project, :protocol => 'https')}", scrolling: "no", style: 'width:100%; height:500px; border:0px; padding:0;overflow:hidden'}
- .hidden
- %span(data-coingiving="title")= "[tip4commit] " + @project.full_name
- %span(data-coingiving="description")= @project.description
- %span(data-coingiving="bitcoin-address")= @project.bitcoin_address
+ %p
+ %pre= @project.bitcoin_address
+ .qrcode.centered{data: {qrcode: "bitcoin:#{@project.bitcoin_address}"}}
%p
= t('.fee', percentage: number_to_percentage(100-CONFIG["our_fee"]*100, precision: 0))
diff --git a/app/views/user_mailer/new_tip.html.haml b/app/views/user_mailer/new_tip.html.haml
index cb7f9d30..b86b4a8a 100644
--- a/app/views/user_mailer/new_tip.html.haml
+++ b/app/views/user_mailer/new_tip.html.haml
@@ -4,7 +4,7 @@
%p Your current balance is #{btc_human @user.balance}. If you don't enter a bitcoin address your tips will be returned to the project in 30 days.
-%p If you don't need bitcoins you can redirect your funds to any charity by using its address which you can find at #{link_to 'coingiving.com', 'https://coingiving.com/'}.
+%p If you don't need bitcoins you can redirect your funds to #{link_to 'Free Software Foundation', 'https://www.fsf.org/about/ways-to-donate'}.
%p= link_to 'Sign In', login_users_url(token: @user.login_token)
diff --git a/config/locales/en.yml b/config/locales/en.yml
index a3c68bd5..1b073b13 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -85,7 +85,6 @@ en:
edit_project: Change project settings
decide_tip_amounts: Decide tip amounts
disabled_notifications: "Project maintainers have decided not to notify new contributors about tips and they probably don't like this way of funding."
- project_sponsors: Project sponsors
fee: "%{percentage} of deposited funds will be used to tip for new commits."
balance: Balance
deposits: deposits
diff --git a/config/locales/fr.yml b/config/locales/fr.yml
index fbda1b23..75b80695 100644
--- a/config/locales/fr.yml
+++ b/config/locales/fr.yml
@@ -83,7 +83,6 @@ fr:
edit_project: Changer les paramètres du projet
decide_tip_amounts: Choisir un montant de pourboire
disabled_notifications: "Les responsables du projet ont décidé de ne pas prévenir les nouveaux contributeurs au sujet des pourboires, et n'apprécient probablement pas ce type de rémunération."
- project_sponsors: Sponsors du projet
fee: "%{percentage} des fonds déposés seront utilisés pour récompenser les nouvelles contributions."
balance: Fonds
deposits: dépôts
diff --git a/config/locales/hr.yml b/config/locales/hr.yml
index ba647343..331d5f43 100644
--- a/config/locales/hr.yml
+++ b/config/locales/hr.yml
@@ -83,7 +83,6 @@ hr:
edit_project: Promijeni postavke projekta
decide_tip_amounts: Odredi kolicinu napojnica
disabled_notifications: "Odrzavatelji projekata su odlucili da nece obavjestiti nove doprinositelje o napojnicama i najvjerovatnije ne vole ovaj nacin isplate."
- project_sponsors: Sponzori projekta
fee: "%{percentage} od polozenih isplata ce se koristiti kao napojnice za nove cinove."
balance: Ravnoteza
deposits: polozenja
diff --git a/config/locales/nl.yml b/config/locales/nl.yml
index 73036b8b..8d154459 100644
--- a/config/locales/nl.yml
+++ b/config/locales/nl.yml
@@ -85,7 +85,6 @@ nl:
edit_project: project instellingen aanpassen
decide_tip_amounts: Beloningen instellen
disabled_notifications: "Project eigenaren hebben besloten om nieuwe ondersteuners niet in te lichten over beloningen. Ze vinden deze manier van beloningen waarschijnlijk niet goed."
- project_sponsors: Project sponsoren
fee: "%{percentage} van gesponsordt geld wordt gebruikt voor de ondersteuning van nieuwe commits."
balance: Saldo
deposits: stortingen
diff --git a/config/locales/pl.yml b/config/locales/pl.yml
index 9b1e612f..633ced1a 100644
--- a/config/locales/pl.yml
+++ b/config/locales/pl.yml
@@ -83,7 +83,6 @@ pl:
edit_project: Zmień ustawienia projektu
decide_tip_amounts: Ustal rozmiary napiwków
disabled_notifications: "Nadzorcy projektów zdecydowali nie powiadamiać nowych współpracowników o napiwkach i prawdopodobnie nie lubią tego typu finansowania."
- project_sponsors: Sponsorzy projektu
fee: "%{percentage} z salda zostanie użyte jako następny napiwek."
balance: saldo
deposits: wpłaty
diff --git a/config/locales/ru.yml b/config/locales/ru.yml
index 9eecd888..8821b7e3 100644
--- a/config/locales/ru.yml
+++ b/config/locales/ru.yml
@@ -87,7 +87,6 @@ ru:
edit_project: Изменить настройки проекта
decide_tip_amounts: Установить сумму чаевых
disabled_notifications: "Контрибьюторы проекта решили не уведомлять новых участников о чаевых и, вероятно, им не нравится такой способ финансирования."
- project_sponsors: Спонсоры проекта
fee: "%{percentage} средств будет выплачено в качестве чаевых за новый коммит."
balance: Баланс
deposits: депозиты
From 3390768454626cbfc31835e348e97fd7974ff72a Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Fri, 3 Jul 2015 16:23:52 +0500
Subject: [PATCH 175/415] fixed shield
---
app/helpers/projects_helper.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb
index 5911ecd9..c7cec444 100644
--- a/app/helpers/projects_helper.rb
+++ b/app/helpers/projects_helper.rb
@@ -1,7 +1,7 @@
module ProjectsHelper
def shield_btc_amount amount
- btc_amount = to_btc amount
+ btc_amount = amount / 1e8
"%.#{9 - btc_amount.to_i.to_s.length}f Ƀ" % btc_amount
end
From a8bc47716ae4740186b07a7b714125c06ef00185 Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Fri, 3 Jul 2015 16:31:36 +0500
Subject: [PATCH 176/415] use current_user.denom everywhere
---
app/helpers/application_helper.rb | 3 ++-
app/views/layouts/application.html.haml | 4 ++--
app/views/users/show.html.haml | 6 +++---
3 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index e0ed3580..04ea5f4d 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -1,6 +1,7 @@
module ApplicationHelper
- def btc_human amount, denom = 0, options = {}
+ def btc_human amount, denom = nil, options = {}
nobr = options.has_key?(:nobr) ? options[:nobr] : true
+ denom = denom || current_user.try(:denom) || 0
if denom === 0
btc = to_btc(amount)
elsif denom === 1
diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml
index 80fcd22c..89a999b0 100644
--- a/app/views/layouts/application.html.haml
+++ b/app/views/layouts/application.html.haml
@@ -38,9 +38,9 @@
= current_user.display_name
\/
- if current_user.nickname.present?
- = link_to btc_human(current_user.balance, current_user.denom), user_pretty_path(current_user.nickname)
+ = link_to btc_human(current_user.balance), user_pretty_path(current_user.nickname)
- else
- = link_to btc_human(current_user.balance, current_user.denom), current_user
+ = link_to btc_human(current_user.balance), current_user
\/
= link_to t('links.sign_out'), destroy_user_session_path, method: :delete
- else
diff --git a/app/views/users/show.html.haml b/app/views/users/show.html.haml
index 41d48e0b..f5608c03 100644
--- a/app/views/users/show.html.haml
+++ b/app/views/users/show.html.haml
@@ -2,13 +2,13 @@
%p
%strong= t('.balance')
%p
- = btc_human @user.balance, @user.denom
+ = btc_human @user.balance
= form_for(@user) do |f|
= f.select :denom,
options_for_select([["BTC", "0"], ["mBTC", "1"], ["μBTC", "2"], ["Satoshi", "3"]], selected: @user.denom)
= f.submit "save"
%p
- %small= raw t('.threshold', threshold: btc_human(CONFIG["min_payout"], @user.denom))
+ %small= raw t('.threshold', threshold: btc_human(CONFIG["min_payout"]))
- if @user_tips.count > 0
%p
@@ -18,7 +18,7 @@
%ul
- @recent_tips.each do |tip|
%li
- = raw t('.received', time: l(tip.created_at, format: :short), amount: btc_human(tip.amount, @user.denom), commit: link_to(tip.commit[0..6], "https://github.com/#{tip.project.full_name}/commit/#{tip.commit}", target: :blank), project: link_to(tip.project.full_name, pretty_project_path(tip.project)))
+ = raw t('.received', time: l(tip.created_at, format: :short), amount: btc_human(tip.amount), commit: link_to(tip.commit[0..6], "https://github.com/#{tip.project.full_name}/commit/#{tip.commit}", target: :blank), project: link_to(tip.project.full_name, pretty_project_path(tip.project)))
%p
%strong= User.human_attribute_name(:email)
From 3dbba5c43f24129f3560248be14dd578badb2c6c Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Fri, 3 Jul 2015 16:36:45 +0500
Subject: [PATCH 177/415] fixed nil amount bug
---
app/helpers/application_helper.rb | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 04ea5f4d..480b0b23 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -1,7 +1,8 @@
module ApplicationHelper
def btc_human amount, denom = nil, options = {}
+ amount ||= 0
nobr = options.has_key?(:nobr) ? options[:nobr] : true
- denom = denom || current_user.try(:denom) || 0
+ denom ||= current_user.try(:denom) || 0
if denom === 0
btc = to_btc(amount)
elsif denom === 1
From 620839df7110fc845ac68026a2f96773a71040e9 Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Fri, 3 Jul 2015 16:47:43 +0500
Subject: [PATCH 178/415] fixed tests. moved denom to options
---
app/helpers/application_helper.rb | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 480b0b23..e850cc3a 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -1,8 +1,8 @@
module ApplicationHelper
- def btc_human amount, denom = nil, options = {}
+ def btc_human amount, options = {}
amount ||= 0
nobr = options.has_key?(:nobr) ? options[:nobr] : true
- denom ||= current_user.try(:denom) || 0
+ denom = options.has_key?(:denom) ? options[:denom] : (try(:current_user) ? current_user.denom : 0)
if denom === 0
btc = to_btc(amount)
elsif denom === 1
From 1d9c7cdcd1b497253c54b26ca1feca20d0ce7972 Mon Sep 17 00:00:00 2001
From: Sebastian
Date: Sun, 12 Jul 2015 13:00:52 +0200
Subject: [PATCH 179/415] Update hr.yml
---
config/locales/hr.yml | 66 +++++++++++++++++++++----------------------
1 file changed, 33 insertions(+), 33 deletions(-)
diff --git a/config/locales/hr.yml b/config/locales/hr.yml
index 331d5f43..f04af922 100644
--- a/config/locales/hr.yml
+++ b/config/locales/hr.yml
@@ -1,13 +1,13 @@
hr:
tip4commit: Tip4Commit
meta:
- title: Doprinosite otvorenom izvoru
- description: Donirajte bitcoine u otvoreni izvor projekata ili napravite cinove i dobite napojnice.
+ title: Doprinesite open source-u
+ description: Donirajte bitcoine open source projektima ili napravite promjene i zaradite napojnice.
menu:
home: Početna stranica
- projects: Podrzavani Projekti
+ projects: Podržavani projekti
footer:
- text: "Izvorni kod je dostupan na %{github_link} a možete i %{support_link} razvoj."
+ text: "Izvorni kod je dostupan na %{github_link}u a možete i %{support_link} razvoj."
github_link: GitHub
support_link: podržati
follow_link: Prati @tip4commit
@@ -39,72 +39,72 @@ hr:
js:
errors:
value:
- invalid: Vrijednost nevazeca
+ invalid: Neispravna vrijednost
email:
- invalid: Nezaveca email adresa
- blank: Email je potreban i ne moze biti prazno
+ invalid: Neispravna email adresa
+ blank: Email je obavezan
password:
- blank: Lozinka je potrebna i ne moze biti prazno
- invalid: Lozinka i njezina potvrda nisu isti
+ blank: Lozinka je obavezma
+ invalid: Lozinka i potvrda nisu isti
password_confirmation:
- blank: Potvrda lozinke je potrebna i ne moze biti prazno
- invalid: Lozinka i potvrda lozinke nisu isti
+ blank: Potvrda lozinke je obavezna
+ invalid: Lozinka i potvrda nisu isti
home:
index:
- see_projects: Vidjeti projekte
+ see_projects: Vidi projekte
how_does_it_work:
title: Kako ovo radi?
- text: Ljudi doniraju bitcoine projektima. Kada se nečiji commit potvrdi u repozitoriju projekta, mi automatski pošaljemo napojnicu autoru.
+ text: Ljudi doniraju bitcoine projektima. Kada je nečija promjena potvrđena, mi automatski pošaljemo napojnicu autoru promjene.
button: Nauči više o Bitcoinu
donate:
title: Donirajte
- text: Pronađite projekt u koji želite uložiti vaše Bitcoine. Vaše donacije ce biti akumulirane sa donacijama ostalih donatora kao napojnice za nove commitove.
+ text: Pronađite projekt u koji želite uložiti vaše Bitcoine. Vaše donacije će biti akumulirane sa donacijama ostalih donatora kao napojnice za nove commitove.
button: Pronađi ili dodaj projekt
contribute:
title: Doprinesi
- text: Idite i popravite nešto! Ako održavatelj projekta odobri vaš commit, dobiti ćete napojnicu!
+ text: Idite i popravite nešto! Ako održavatelj projekta odobri vašu promjenu, dobiti ćete napojnicu!
sign_in_text: "Samo provjerite vaš email ili %{sign_in_link}."
sign_up_text: "Ako još niste dobili pozivnicu, moze te se %{sign_up_link} sa valjanom email adresom ili"
button: Projekti koje podržavamo
projects:
index:
find_project:
- placeholder: Upisite GitHub URL projekta kako biste dodati projekt ili bilo koju kljucnu rijec da biste je nasli...
- button: Nadji ili dodaj projekt
+ placeholder: Upišite GitHub URL projekta kako biste dodati projekt ili bilo koju ključnu rijeć da biste je našli...
+ button: Nađi ili dodaj projekt
repository: Repozitorij
description: Opis
watchers: Gledatelji
balance: Ravnoteza
forked_from: Odvojeno od
- support: Podrzavaj
+ support: Podrži
show:
- title: "Doprinosi %{project}"
+ title: "Doprinesi %{project}"
fetch_pending: (Pending initial fetch)
edit_project: Promijeni postavke projekta
- decide_tip_amounts: Odredi kolicinu napojnica
+ decide_tip_amounts: Odredi količinu napojnica
disabled_notifications: "Odrzavatelji projekata su odlucili da nece obavjestiti nove doprinositelje o napojnicama i najvjerovatnije ne vole ovaj nacin isplate."
fee: "%{percentage} od polozenih isplata ce se koristiti kao napojnice za nove cinove."
balance: Ravnoteza
- deposits: polozenja
- custom_tip_size: (Svaki novi cin dobiva postotak dostune ravnoteze)
- default_tip_size: "(Svaki novi cin dobiva %{percentage} dostupne ravnoteze)"
+ deposits: depoziti
+ custom_tip_size: (svaka nova promjena dobiva određen postotak dostupnih bitcoina)
+ default_tip_size: "(svaka nova promjena će dobiti %{percentage} dostupnih bitcoina)"
unconfirmed_amount: "(%{amount} nepotvrdeno)"
tipping_policies: Pravila o napojnicama
- updated_by_user: "(Zadnje updejtao %{name} na %{date})"
- updated_by_unknown: "(Zadnje updejtano %{date})"
- tips_paid: Napojnice placene
+ updated_by_user: "(Zadnje promjenio %{name} %{date})"
+ updated_by_unknown: "(Zadnje promjenjeno %{date})"
+ tips_paid: Ukupno količina isplaćenih napojnica
unclaimed_amount: "(%{amount} od ovog neostvarenog, i biti ce natrag isplaceno u projekt nakon jednog mjeseca.)"
last_tips: Zadnje napojnice
see_all: Vidjeti sve
- received: "dobiveno %{amount}"
- will_receive: ce dobiti napojnicu
- for_commit: za cin
- when_decided: kada je kolicina odlucena
- next_tip: Sljedeca napojnica
+ received: "je dobio %{amount}"
+ will_receive: će dobiti napojnicu
+ for_commit: za commit
+ when_decided: kada je kolicina odlučena
+ next_tip: Sljedeća napojnica
contribute_and_earn: Doprinesi i zaradi
- contribute_and_earn_description: "Doniraj Bitcone u ovaj projekt ili %{make_commits_link} i dobij napojnicu. Ako je commit prihvacen %{branch} od strane voditelja projekta i ima Bitcoina na racunu, dobit ce te napojnicu."
+ contribute_and_earn_description: "Doniraj Bitcone ovom projektu ili %{make_commits_link} i dobij napojnicu. Ako je voditelj projekta prihvatio promjenu u %{branch} i Bitcoini su dostpuni, dobiti će te napojnicu."
contribute_and_earn_branch: "u %{branch} branch"
- make_commits_link: make commits
+ make_commits_link: napravi commit
tell_us_bitcoin_address: "Samo %{tell_us_link} vasu bitcoin adresu."
tell_us_link: recite nam
sign_in: "Samo provjerite vas email ili %{sign_in_link}."
From 0714dc2b3e10b3c64b6b6a6795daaf93f2a23720 Mon Sep 17 00:00:00 2001
From: Arsen Gasparyan
Date: Thu, 23 Jul 2015 22:45:51 +0500
Subject: [PATCH 180/415] simpler warning
---
config/locales/en.yml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 1b073b13..8cb3f63e 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -228,6 +228,6 @@ en:
general:
or: or
disclaimer:
- line1: "We are not affiliated with most of the projects, their owners may be unaware of or actively against using tip4commit. Due to potential ethical and legal issues we may remove any project from the list by request of project maintainers."
- line2: "Also we are not notifying developers about their tips anymore. Thus we can't guarantee that donated funds will really reach them."
+ line1: "Tip4Commit is not affiliated with most of the projects."
+ line2: "There is no guarantee that the donated funds will reach the developers."
line3: "By donating funds you agree that they can be sent to Free Software Foundation or elsewhere at Tip4Commit's discretion."
From c15bbc2be5a8d553174f2c7aa5f284f06241493a Mon Sep 17 00:00:00 2001
From: Arsen Gasparyan
Date: Thu, 23 Jul 2015 23:14:55 +0500
Subject: [PATCH 181/415] show the full disclamer only on the project's page
---
app/assets/javascripts/i18n/translations.js | 2 +-
app/views/layouts/application.html.haml | 2 --
app/views/projects/show.html.haml | 3 +++
config/locales/en.yml | 4 ++--
4 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/app/assets/javascripts/i18n/translations.js b/app/assets/javascripts/i18n/translations.js
index c7a35c14..3bdc6e22 100644
--- a/app/assets/javascripts/i18n/translations.js
+++ b/app/assets/javascripts/i18n/translations.js
@@ -1,2 +1,2 @@
var I18n = I18n || {};
-I18n.translations = {"en":{"js":{"errors":{"value":{"invalid":"Value is invalid"},"email":{"invalid":"Invalid Email Address","blank":"The Email is required and can't be empty"},"password":{"blank":"The password is required and can't be empty","invalid":"The password and its confirmation are not same"},"password_confirmation":{"blank":"The password confirmation is required and can't be empty","invalid":"The password and its confirmation are not same"}}}},"fr":{"js":{"errors":{"value":{"invalid":"Valeur non valide"},"email":{"invalid":"Adresse Email non valide","blank":"L'Email est requis et doit être renseigné"},"password":{"blank":"Les mot de passe est requis et doit être renseigné","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"},"password_confirmation":{"blank":"La confirmation du mot de passe est requise et doit être renseignée","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"}}}},"hr":{"js":{"errors":{"value":{"invalid":"Vrijednost nevazeca"},"email":{"invalid":"Nezaveca email adresa","blank":"Email je potreban i ne moze biti prazno"},"password":{"blank":"Lozinka je potrebna i ne moze biti prazno","invalid":"Lozinka i njezina potvrda nisu isti"},"password_confirmation":{"blank":"Potvrda lozinke je potrebna i ne moze biti prazno","invalid":"Lozinka i potvrda lozinke nisu isti"}}}},"nl":{"js":{"errors":{"value":{"invalid":"De waarde is ongeldig"},"email":{"invalid":"Ongeldig e-mail adres","blank":"E-mail is verplicht en kan niet leeg blijven"},"password":{"blank":"Wachtwoord is verplicht en kan niet leeg blijven","invalid":"De wachtwoorden komen niet overeen"},"password_confirmation":{"blank":"Wachtwoord is verplicht en kan niet leeg blijven","invalid":"De wachtwoorden komen niet overeen"}}}},"pl":{"js":{"errors":{"value":{"invalid":"Wartość jest niepoprawna"},"email":{"invalid":"Błędny adres E-mail","blank":"E-mail jest wymagany i nie może być pusty"},"password":{"blank":"Hasło jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"},"password_confirmation":{"blank":"Potwierdzenie hasła jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"}}}},"ru":{"js":{"errors":{"value":{"invalid":"Неверное значение"},"email":{"invalid":"Ошибка в Email адресе","blank":"Email не может быть пустым"},"password":{"blank":"Пароль не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"},"password_confirmation":{"blank":"Подтверждение пароля не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"}}}}};
\ No newline at end of file
+I18n.translations = {"en":{"js":{"errors":{"value":{"invalid":"Value is invalid"},"email":{"invalid":"Invalid Email Address","blank":"The Email is required and can't be empty"},"password":{"blank":"The password is required and can't be empty","invalid":"The password and its confirmation are not same"},"password_confirmation":{"blank":"The password confirmation is required and can't be empty","invalid":"The password and its confirmation are not same"}}}},"ru":{"js":{"errors":{"value":{"invalid":"Неверное значение"},"email":{"invalid":"Ошибка в Email адресе","blank":"Email не может быть пустым"},"password":{"blank":"Пароль не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"},"password_confirmation":{"blank":"Подтверждение пароля не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"}}}},"pl":{"js":{"errors":{"value":{"invalid":"Wartość jest niepoprawna"},"email":{"invalid":"Błędny adres E-mail","blank":"E-mail jest wymagany i nie może być pusty"},"password":{"blank":"Hasło jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"},"password_confirmation":{"blank":"Potwierdzenie hasła jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"}}}},"nl":{"js":{"errors":{"value":{"invalid":"De waarde is ongeldig"},"email":{"invalid":"Ongeldig e-mail adres","blank":"E-mail is verplicht en kan niet leeg blijven"},"password":{"blank":"Wachtwoord is verplicht en kan niet leeg blijven","invalid":"De wachtwoorden komen niet overeen"},"password_confirmation":{"blank":"Wachtwoord is verplicht en kan niet leeg blijven","invalid":"De wachtwoorden komen niet overeen"}}}},"fr":{"js":{"errors":{"value":{"invalid":"Valeur non valide"},"email":{"invalid":"Adresse Email non valide","blank":"L'Email est requis et doit être renseigné"},"password":{"blank":"Les mot de passe est requis et doit être renseigné","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"},"password_confirmation":{"blank":"La confirmation du mot de passe est requise et doit être renseignée","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"}}}},"hr":{"js":{"errors":{"value":{"invalid":"Vrijednost nevazeca"},"email":{"invalid":"Nezaveca email adresa","blank":"Email je potreban i ne moze biti prazno"},"password":{"blank":"Lozinka je potrebna i ne moze biti prazno","invalid":"Lozinka i njezina potvrda nisu isti"},"password_confirmation":{"blank":"Potvrda lozinke je potrebna i ne moze biti prazno","invalid":"Lozinka i potvrda lozinke nisu isti"}}}}};
\ No newline at end of file
diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml
index 89a999b0..50788b9b 100644
--- a/app/views/layouts/application.html.haml
+++ b/app/views/layouts/application.html.haml
@@ -64,8 +64,6 @@
.footer
.alert.alert-warning
%p= t('general.disclaimer.line1')
- %p= t('general.disclaimer.line2')
- %p= t('general.disclaimer.line3')
%p.pull-right
- ::Rails.application.config.available_locales.each do |locale|
diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml
index 952722da..178e02a3 100644
--- a/app/views/projects/show.html.haml
+++ b/app/views/projects/show.html.haml
@@ -28,6 +28,9 @@
.qrcode.centered{data: {qrcode: "bitcoin:#{@project.bitcoin_address}"}}
%p
= t('.fee', percentage: number_to_percentage(100-CONFIG["our_fee"]*100, precision: 0))
+ .alert.alert-warning
+ %p= t('general.disclaimer.line2')
+ %p= t('general.disclaimer.line3')
.col-md-8
- unless @project.description.blank?
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 8cb3f63e..197f1925 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -229,5 +229,5 @@ en:
or: or
disclaimer:
line1: "Tip4Commit is not affiliated with most of the projects."
- line2: "There is no guarantee that the donated funds will reach the developers."
- line3: "By donating funds you agree that they can be sent to Free Software Foundation or elsewhere at Tip4Commit's discretion."
+ line2: "There is no guarantee that tips will be claimed by developers."
+ line3: "By donating the funds you agree that they can be sent to the Free Software Foundation or elsewhere at Tip4Commit's discretion."
From 150c8ba98a0d415837f185821f0049fa2bf20a68 Mon Sep 17 00:00:00 2001
From: SopaXorzTaker
Date: Tue, 28 Jul 2015 17:09:29 +0300
Subject: [PATCH 182/415] Update ru.yml
Improve Russian translation
---
config/locales/ru.yml | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/config/locales/ru.yml b/config/locales/ru.yml
index 8821b7e3..79f216bc 100644
--- a/config/locales/ru.yml
+++ b/config/locales/ru.yml
@@ -12,7 +12,7 @@ ru:
support_link: поддержать
follow_link: Следите за @tip4commit
links:
- sign_up: Sign up
+ sign_up: Регистрация
sign_in: Войти
sign_in_imp: войдите
sign_out: Выйти
@@ -22,7 +22,7 @@ ru:
project_not_found: Проект не найден.
access_denied: Доступ запрещен
can_assign_more_tips: "Нельзя использовать более чем 100% свободных средств."
- wrong_bitcoin_address: Ошибка обновления биткойн адреса
+ wrong_bitcoin_address: Ошибка обновления биткоин-адреса
user_not_found: Пользователь не найден
access_denied: Вы не авторизованы для выполнения данного действия!
opt_in_notice: "В связи с многочисленными жалобами мы более не добавляем проекты автоматически. Существующие проекты, не получившие пожертвований, были удалены. Если Вы хотите добавить свой проект, пожалуйста, %{create_issue_link}."
@@ -45,8 +45,8 @@ ru:
value:
invalid: Неверное значение
email:
- invalid: Ошибка в Email адресе
- blank: Email не может быть пустым
+ invalid: Ошибка в адресе электронной почты
+ blank: Адрес электронной почты не может быть пустым
password:
blank: Пароль не может быть пустым
invalid: Пароль и его подтверждение не совпадают
@@ -73,7 +73,7 @@ ru:
projects:
index:
find_project:
- placeholder: Введите GitHub адрес проекта или ключевое слово для поиска...
+ placeholder: Введите адрес GitHub-проекта или ключевое слово для поиска...
button: Найти проект
repository: Репозиторий
description: Описание
@@ -83,7 +83,7 @@ ru:
support: "Поддержать проект"
show:
title: "Помогайте %{project}"
- fetch_pending: (Pending initial fetch)
+ fetch_pending: (Ожидание получения)
edit_project: Изменить настройки проекта
decide_tip_amounts: Установить сумму чаевых
disabled_notifications: "Контрибьюторы проекта решили не уведомлять новых участников о чаевых и, вероятно, им не нравится такой способ финансирования."
From 5488a30acdd1af2a6191efcc5634db854e752fea Mon Sep 17 00:00:00 2001
From: SopaXorzTaker
Date: Tue, 28 Jul 2015 17:41:45 +0300
Subject: [PATCH 183/415] Update ru.yml
---
config/locales/ru.yml | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/config/locales/ru.yml b/config/locales/ru.yml
index 79f216bc..d099e7c4 100644
--- a/config/locales/ru.yml
+++ b/config/locales/ru.yml
@@ -2,7 +2,7 @@ ru:
tip4commit: Tip4Commit
meta:
title: Помощь проектам с открытым исходным кодом
- description: Жертвуйте биткойны проектам с открытым исходным кодом или создавайте коммиты и получайте чаевые за них.
+ description: Жертвуйте биткоины проектам с открытым исходным кодом или создавайте коммиты и получайте чаевые за них.
menu:
home: Главная
projects: Проекты
@@ -12,7 +12,7 @@ ru:
support_link: поддержать
follow_link: Следите за @tip4commit
links:
- sign_up: Регистрация
+ sign_up: Зарегистрироваться
sign_in: Войти
sign_in_imp: войдите
sign_out: Выйти
@@ -31,7 +31,7 @@ ru:
project_updated: Настройки проекта обновлены
tips_decided: Сумма чаевых определена
user_updated: Ваш профиль обновлен!
- user_unsubscribed: "Вы отписались! Приносим извинения за предоставленные неудобства. Однако, вы все равно можете оставить нам свой Биткойн адрес, чтобы получать вознаграждения"
+ user_unsubscribed: "Вы отписались! Приносим извинения за предоставленные неудобства. Однако, вы все равно можете оставить нам свой Биткоин-адрес, чтобы получать вознаграждения"
tip_amounts:
undecided: "Не определено"
free: "Нет: 0%"
@@ -58,11 +58,11 @@ ru:
see_projects: Проекты
how_does_it_work:
title: Как это работает?
- text: Люди жертвуют биткойны на проекты. Если владелец проекта принимает коммит в репозиторий, мы автоматически начисляем чаевые автору этого коммита.
- button: Узнать о Биткойн
+ text: Люди жертвуют биткоины на проекты. Если владелец проекта принимает коммит в репозиторий, мы автоматически начисляем чаевые автору этого коммита.
+ button: Узнать о Биткоин
donate:
title: Жертвуйте
- text: Найдите проект который вам по душе и перечислите биткойны на него. Ваши пожертвования вместе с пожертвованиями других людей будут автоматически выплачиваться авторам новых коммитов в виде чаевых.
+ text: Найдите проект который вам по душе и перечислите биткоины на него. Ваши пожертвования вместе с пожертвованиями других людей будут автоматически выплачиваться авторам новых коммитов в виде чаевых.
button: Найти или добавить проект
contribute:
title: Участвуйте
@@ -107,10 +107,10 @@ ru:
when_decided: когда сумма будет определена
next_tip: Следующие чаевые
contribute_and_earn: Помогайте и зарабатывайте
- contribute_and_earn_description: "Жертвуйте биткойны этому проекту или %{make_commits_link} и получайте чаевые за них. Если ваш коммит будет принят %{branch} владельцами проекта, а баланс этого проекта положительный, то вы получите чаевые!"
+ contribute_and_earn_description: "Жертвуйте биткоины этому проекту или %{make_commits_link} и получайте чаевые за них. Если ваш коммит будет принят %{branch} владельцами проекта, а баланс этого проекта положительный, то вы получите чаевые!"
contribute_and_earn_branch: "в ветку %{branch}"
make_commits_link: создавайте коммиты
- tell_us_bitcoin_address: "Просто %{tell_us_link} ваш биткойн адрес."
+ tell_us_bitcoin_address: "Просто %{tell_us_link} ваш биткоин-адрес."
tell_us_link: укажите
sign_in: "Просто проверьте ваш email или %{sign_in_link}."
promote_project: "Расскажите о %{project}"
@@ -172,7 +172,7 @@ ru:
threshold: "Вы получите свои деньги, когда ваш баланс достигнет %{threshold}"
see_all: смотреть все
received: "%{time} получено %{amount} за коммит %{commit} в %{project}"
- bitcoin_address_placeholder: Ваш биткойн адрес
+ bitcoin_address_placeholder: Ваш биткоин-адрес
notify: Сообщать мне о новых чаевых (не чаще чем одно сообщение в месяц)
submit_user: Обновить информацию пользователя
change_password: Смена пароля
@@ -220,7 +220,7 @@ ru:
attributes:
user:
email: E-mail
- bitcoin_address: Биткойн адрес
+ bitcoin_address: Биткоин-адрес
password: Пароль
password_confirmation: Подтверждение пароля
display_name: Имя
From 29ab8c618a536bb44f158dad31c122d932851548 Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Sat, 5 Sep 2015 12:23:48 +0500
Subject: [PATCH 184/415] allows to create tips specifying url instead of
commit id #250
---
app/views/projects/show.html.haml | 7 +++++--
app/views/tips/index.html.haml | 6 +++++-
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml
index 178e02a3..0b3f6efe 100644
--- a/app/views/projects/show.html.haml
+++ b/app/views/projects/show.html.haml
@@ -86,8 +86,11 @@
= raw t('.received', amount: btc_human(tip.amount))
- else
= t('.will_receive')
- = t('.for_commit')
- = link_to tip.commit[0..6], "https://github.com/#{@project.full_name}/commit/#{tip.commit}", target: :blank
+ - if tip.commit.start_with? 'http'
+ = link_to 'details', tip.commit, target: :blank
+ - else
+ = t('.for_commit')
+ = link_to tip.commit[0..6], "https://github.com/#{@project.full_name}/commit/#{tip.commit}", target: :blank
- if tip.undecided?
= t('.when_decided')
diff --git a/app/views/tips/index.html.haml b/app/views/tips/index.html.haml
index e5e4bb42..4e1ff7a3 100644
--- a/app/views/tips/index.html.haml
+++ b/app/views/tips/index.html.haml
@@ -29,7 +29,11 @@
= link_to tip.user.display_name, "https://github.com/#{tip.user.nickname}", target: '_blank'
- unless @project
%td= link_to tip.project.full_name, pretty_project_path(tip.project)
- %td= link_to tip.commit[0..6], "https://github.com/#{tip.project.full_name}/commit/#{tip.commit}", target: :blank
+ %td
+ - if tip.commit.start_with? 'http'
+ = link_to 'details', tip.commit, target: :blank
+ - else
+ = link_to tip.commit[0..6], "https://github.com/#{tip.project.full_name}/commit/#{tip.commit}", target: :blank
%td= btc_human tip.amount
%td
- if tip.sendmany.nil?
From 31fd6f0016b720847e0b5b36f4737673035f6871 Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Sat, 5 Sep 2015 13:29:29 +0500
Subject: [PATCH 185/415] fixed user page
---
app/views/users/show.html.haml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/views/users/show.html.haml b/app/views/users/show.html.haml
index f5608c03..83ae4fcc 100644
--- a/app/views/users/show.html.haml
+++ b/app/views/users/show.html.haml
@@ -18,7 +18,7 @@
%ul
- @recent_tips.each do |tip|
%li
- = raw t('.received', time: l(tip.created_at, format: :short), amount: btc_human(tip.amount), commit: link_to(tip.commit[0..6], "https://github.com/#{tip.project.full_name}/commit/#{tip.commit}", target: :blank), project: link_to(tip.project.full_name, pretty_project_path(tip.project)))
+ = raw t('.received', time: l(tip.created_at, format: :short), amount: btc_human(tip.amount), commit: (tip.commit.start_with?('http') ? link_to('details', tip.commit, target: :blank) : link_to(tip.commit[0..6], "https://github.com/#{tip.project.full_name}/commit/#{tip.commit}", target: :blank)), project: link_to(tip.project.full_name, pretty_project_path(tip.project)))
%p
%strong= User.human_attribute_name(:email)
From 4f199026d2fd08ec13c13e0ce520f46cc15a3834 Mon Sep 17 00:00:00 2001
From: sssemil
Date: Mon, 7 Sep 2015 13:23:29 +0500
Subject: [PATCH 186/415] Add USD
---
app/helpers/application_helper.rb | 25 +++++++++++++++++++++----
app/views/users/show.html.haml | 2 +-
2 files changed, 22 insertions(+), 5 deletions(-)
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index e850cc3a..3a391c61 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -11,27 +11,44 @@ def btc_human amount, options = {}
btc = to_ubtc(amount)
elsif denom === 3
btc = to_satoshi(amount)
+ elsif denom === 4
+ btc = to_usd(amount)
end
btc = "#{btc}" if nobr
btc.html_safe
end
- def to_btc satoshies
+ def to_btc satoshies
"%.8f Ƀ" % (1.0*satoshies.to_i/1e8)
end
- def to_mbtc satoshies
+ def to_mbtc satoshies
"%.5f mɃ" % (1.0*satoshies.to_i/1e5)
end
- def to_ubtc satoshies
+ def to_ubtc satoshies
"%.2f μɃ" % (1.0*satoshies.to_i/1e2)
end
- def to_satoshi satoshies
+ def to_satoshi satoshies
"%.0f Satoshi" % satoshies
end
+ def to_usd satoshies
+ "%.2f $" % usd(satoshies)
+ end
+
+ def usd satoshies
+ satoshies*0.00000001*usd_cource
+ end
+
+ def usd_cource
+ uri = URI('https://api.bitcoinaverage.com/ticker/USD/')
+ response = Net::HTTP.get_response(uri)
+ hash = JSON.parse(response.body)
+ hash["24h_avg"]
+ end
+
def render_flash_messages
html = []
flash.each do |_type, _message|
diff --git a/app/views/users/show.html.haml b/app/views/users/show.html.haml
index 83ae4fcc..8620fcf4 100644
--- a/app/views/users/show.html.haml
+++ b/app/views/users/show.html.haml
@@ -5,7 +5,7 @@
= btc_human @user.balance
= form_for(@user) do |f|
= f.select :denom,
- options_for_select([["BTC", "0"], ["mBTC", "1"], ["μBTC", "2"], ["Satoshi", "3"]], selected: @user.denom)
+ options_for_select([["BTC", "0"], ["mBTC", "1"], ["μBTC", "2"], ["Satoshi", "3"], ["USD", "4"]], selected: @user.denom)
= f.submit "save"
%p
%small= raw t('.threshold', threshold: btc_human(CONFIG["min_payout"]))
From ae0368a628b752d0ace6390938ef980a87468870 Mon Sep 17 00:00:00 2001
From: sssemil
Date: Sat, 12 Sep 2015 20:34:52 +0500
Subject: [PATCH 187/415] Change cources and add EUR
---
app/helpers/application_helper.rb | 24 ++++++++++++++++--------
app/views/users/show.html.haml | 2 +-
2 files changed, 17 insertions(+), 9 deletions(-)
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 3a391c61..6b264a5f 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -13,6 +13,8 @@ def btc_human amount, options = {}
btc = to_satoshi(amount)
elsif denom === 4
btc = to_usd(amount)
+ elsif denom === 5
+ btc = to_eur(amount)
end
btc = "#{btc}" if nobr
btc.html_safe
@@ -35,20 +37,26 @@ def to_satoshi satoshies
end
def to_usd satoshies
- "%.2f $" % usd(satoshies)
+ "%.2f $" % cource("USD", satoshies)
end
- def usd satoshies
- satoshies*0.00000001*usd_cource
+ def to_eur satoshies
+ "%.2f €" % cource("EUR", satoshies)
end
- def usd_cource
- uri = URI('https://api.bitcoinaverage.com/ticker/USD/')
- response = Net::HTTP.get_response(uri)
- hash = JSON.parse(response.body)
- hash["24h_avg"]
+ def cource(currency, satoshies)
+ satoshies*0.00000001*get_cource(currency)
end
+ def get_cource(currency)
+ Rails.cache.fetch("###" + currency, :expires_in => 24.hours) do
+ uri = URI('https://api.bitcoinaverage.com/ticker/' + currency + '/')
+ response = Net::HTTP.get_response(uri)
+ hash = JSON.parse(response.body)
+ hash["24h_avg"]
+ end
+ end
+
def render_flash_messages
html = []
flash.each do |_type, _message|
diff --git a/app/views/users/show.html.haml b/app/views/users/show.html.haml
index 8620fcf4..ad433bf2 100644
--- a/app/views/users/show.html.haml
+++ b/app/views/users/show.html.haml
@@ -5,7 +5,7 @@
= btc_human @user.balance
= form_for(@user) do |f|
= f.select :denom,
- options_for_select([["BTC", "0"], ["mBTC", "1"], ["μBTC", "2"], ["Satoshi", "3"], ["USD", "4"]], selected: @user.denom)
+ options_for_select([["BTC", "0"], ["mBTC", "1"], ["μBTC", "2"], ["Satoshi", "3"], ["USD", "4"], ["EUR", "5"]], selected: @user.denom)
= f.submit "save"
%p
%small= raw t('.threshold', threshold: btc_human(CONFIG["min_payout"]))
From d2bc07d8b3f66606dcbb5fec4ebcf5627eabad33 Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Sun, 13 Sep 2015 16:10:21 +0500
Subject: [PATCH 188/415] fixed usd format
---
app/helpers/application_helper.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 6b264a5f..7b63d3c8 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -37,7 +37,7 @@ def to_satoshi satoshies
end
def to_usd satoshies
- "%.2f $" % cource("USD", satoshies)
+ "$%.2f" % cource("USD", satoshies)
end
def to_eur satoshies
From df3e00bbcd879716755fca85049ab5e202da0eb9 Mon Sep 17 00:00:00 2001
From: entity0
Date: Tue, 13 Oct 2015 23:23:55 +0200
Subject: [PATCH 189/415] Update hr.yml
---
config/locales/hr.yml | 56 +++++++++++++++++++++----------------------
1 file changed, 28 insertions(+), 28 deletions(-)
diff --git a/config/locales/hr.yml b/config/locales/hr.yml
index f04af922..45642b59 100644
--- a/config/locales/hr.yml
+++ b/config/locales/hr.yml
@@ -1,8 +1,8 @@
hr:
tip4commit: Tip4Commit
meta:
- title: Doprinesite open source-u
- description: Donirajte bitcoine open source projektima ili napravite promjene i zaradite napojnice.
+ title: Doprinesite otvorenom kodu
+ description: Donirajte bitcoine projektima otvorenog koda ili napravite promjene i zaradite napojnice.
menu:
home: Početna stranica
projects: Podržavani projekti
@@ -69,12 +69,12 @@ hr:
projects:
index:
find_project:
- placeholder: Upišite GitHub URL projekta kako biste dodati projekt ili bilo koju ključnu rijeć da biste je našli...
+ placeholder: Upišite GitHub URL projekta kako biste dodali projekt ili bilo koju ključnu rijeć da biste ga našli...
button: Nađi ili dodaj projekt
repository: Repozitorij
description: Opis
watchers: Gledatelji
- balance: Ravnoteza
+ balance: Ravnoteža
forked_from: Odvojeno od
support: Podrži
show:
@@ -82,9 +82,9 @@ hr:
fetch_pending: (Pending initial fetch)
edit_project: Promijeni postavke projekta
decide_tip_amounts: Odredi količinu napojnica
- disabled_notifications: "Odrzavatelji projekata su odlucili da nece obavjestiti nove doprinositelje o napojnicama i najvjerovatnije ne vole ovaj nacin isplate."
- fee: "%{percentage} od polozenih isplata ce se koristiti kao napojnice za nove cinove."
- balance: Ravnoteza
+ disabled_notifications: "Održavatelji projekata su odlučili da neće obavjestiti nove doprinositelje o napojnicama i najvjerojatnije ne vole ovaj način isplate."
+ fee: "%{percentage} od položenih isplata će se koristiti kao napojnice za nove promjene."
+ balance: Ravnoteža
deposits: depoziti
custom_tip_size: (svaka nova promjena dobiva određen postotak dostupnih bitcoina)
default_tip_size: "(svaka nova promjena će dobiti %{percentage} dostupnih bitcoina)"
@@ -98,34 +98,34 @@ hr:
see_all: Vidjeti sve
received: "je dobio %{amount}"
will_receive: će dobiti napojnicu
- for_commit: za commit
- when_decided: kada je kolicina odlučena
+ for_commit: za promjenu
+ when_decided: kada je količina odlučena
next_tip: Sljedeća napojnica
contribute_and_earn: Doprinesi i zaradi
contribute_and_earn_description: "Doniraj Bitcone ovom projektu ili %{make_commits_link} i dobij napojnicu. Ako je voditelj projekta prihvatio promjenu u %{branch} i Bitcoini su dostpuni, dobiti će te napojnicu."
contribute_and_earn_branch: "u %{branch} branch"
- make_commits_link: napravi commit
- tell_us_bitcoin_address: "Samo %{tell_us_link} vasu bitcoin adresu."
- tell_us_link: recite nam
- sign_in: "Samo provjerite vas email ili %{sign_in_link}."
+ make_commits_link: napravi promjenu
+ tell_us_bitcoin_address: "Samo %{tell_us_link} Vašu Bitcoin adresu."
+ tell_us_link: nam recite
+ sign_in: "Samo provjerite Vaš email ili %{sign_in_link}."
promote_project: Promoviraj %{project}
embedding: Embedding
image_url: "URL slike:"
- shield_title: tip for next commit
+ shield_title: napojnica za sljedeću promjenu
edit:
project_settings: "%{project} project settings"
branch: Branch
default_branch: Default branch
tipping_policies: Tipping policies
hold_tips: "Do not send the tips immediatly. Give collaborators the ability to modify the tips before they're sent"
- save: Save the project settings
+ save: Spremi postavke projekta
disable_notifications: Don't notify new contributors
decide_tip_amounts:
- commit: Commit
+ commit: Promjena
author: Autor
message: Poruka
tip: Napojnica (relativna iznosu na racunu)
- submit: Posaljite odabrane iznose napojnica
+ submit: Pošaljite odabrane iznose napojnica
tips:
index:
tips: Napojnice
@@ -148,9 +148,9 @@ hr:
deposits: Uplate
created_at: "Stvoreno na"
project: Projekt
- amount: Kolicina
+ amount: Količina
transaction: Transakcija
- confirmed: Potvrdjeno
+ confirmed: Potvrđeno
confirmed_yes: 'Da'
confirmed_no: 'Ne'
users:
@@ -160,23 +160,23 @@ hr:
commits_count: Commits tipped
withdrawn: Withdrawn
show:
- balance: Ravnoteza
- threshold: "Dobiti ce te vase novce kada vasa ravnoteza prijede prag od %{threshold}"
+ balance: Ravnoteža
+ threshold: "Dobiti ćete Vaše novce kada Vaša ravnoteža prijeđe prag od %{threshold}"
see_all: vidjeti sve
received: "%{time} primljeno %{amount} za cin %{commit} u %{project}"
bitcoin_address_placeholder: Vasa bitcoin adresa
notify: Obavjesti me o novim savjetima (ne vise od jednog emaila po mjesecu)
- submit_user: Azurirati informaciju korisnika
- change_password: Promijeniti vasu lozinku
- submit_password: Promijeniti moju lozinku
+ submit_user: Ažuriraj
+ change_password: Promijeni lozinku
+ submit_password: Promijeni lozinku
withdrawals:
index:
- title: Zadnje povlacenje
+ title: Zadnje povlačenje
created_at: Stvoreno
transaction: Transakcije
result: Rezultat
- error: Greska
- success: Uspjesno
+ error: Greška
+ success: Uspješno
devise:
sessions:
new:
@@ -189,7 +189,7 @@ hr:
submit: Registracija
passwords:
new:
- title: Zaboravili ste vasu lozinku?
+ title: Zaboravili ste vašu lozinku?
submit: Poslati mi uputstva za resetiranje lozinke
edit:
title: Promijenite vasu lozinku
From c10e4049ecec5f76860298d4760a614c4da72152 Mon Sep 17 00:00:00 2001
From: sssemil
Date: Tue, 3 Nov 2015 20:56:33 +0400
Subject: [PATCH 190/415] More currencies
---
app/helpers/application_helper.rb | 104 +++++++++++++++++++++++++++++-
app/views/users/show.html.haml | 2 +-
2 files changed, 104 insertions(+), 2 deletions(-)
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 7b63d3c8..04cc461c 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -15,6 +15,40 @@ def btc_human amount, options = {}
btc = to_usd(amount)
elsif denom === 5
btc = to_eur(amount)
+ elsif denom === 6
+ btc = to_aud(amount)
+ elsif denom === 7
+ btc = to_brl(amount)
+ elsif denom === 8
+ btc = to_cad(amount)
+ elsif denom === 9
+ btc = to_cny(amount)
+ elsif denom === 10
+ btc = to_gbp(amount)
+ elsif denom === 11
+ btc = to_idr(amount)
+ elsif denom === 12
+ btc = to_ils(amount)
+ elsif denom === 13
+ btc = to_jpy(amount)
+ elsif denom === 14
+ btc = to_mxn(amount)
+ elsif denom === 15
+ btc = to_nok(amount)
+ elsif denom === 16
+ btc = to_nzd(amount)
+ elsif denom === 17
+ btc = to_pln(amount)
+ elsif denom === 18
+ btc = to_ron(amount)
+ elsif denom === 19
+ btc = to_rub(amount)
+ elsif denom === 20
+ btc = to_sek(amount)
+ elsif denom === 21
+ btc = to_sgd(amount)
+ elsif denom === 22
+ btc = to_zar(amount)
end
btc = "#{btc}" if nobr
btc.html_safe
@@ -40,8 +74,76 @@ def to_usd satoshies
"$%.2f" % cource("USD", satoshies)
end
+ def to_aud satoshies
+ "$%.2f" % cource("AUD", satoshies)
+ end
+
def to_eur satoshies
- "%.2f €" % cource("EUR", satoshies)
+ "€%.2f" % cource("EUR", satoshies)
+ end
+
+ def to_brl satoshies
+ "R$%.2f" % cource("BRL", satoshies)
+ end
+
+ def to_cad satoshies
+ "$%.2f" % cource("CAD", satoshies)
+ end
+
+ def to_cny satoshies
+ "¥%.2f" % cource("CNY", satoshies)
+ end
+
+ def to_gbp satoshies
+ "£%.2f" % cource("GBP", satoshies)
+ end
+
+ def to_idr satoshies
+ "Rp%.2f" % cource("IDR", satoshies)
+ end
+
+ def to_ils satoshies
+ "₪%.2f" % cource("ILS", satoshies)
+ end
+
+ def to_jpy satoshies
+ "¥%.2f" % cource("JPY", satoshies)
+ end
+
+ def to_mxn satoshies
+ "$%.2f" % cource("MXN", satoshies)
+ end
+
+ def to_nok satoshies
+ "kr%.2f" % cource("NOK", satoshies)
+ end
+
+ def to_nzd satoshies
+ "$%.2f" % cource("NZD", satoshies)
+ end
+
+ def to_pln satoshies
+ "zł%.2f" % cource("PLN", satoshies)
+ end
+
+ def to_ron satoshies
+ "lei%.2f" % cource("RON", satoshies)
+ end
+
+ def to_rub satoshies
+ "₽%.2f" % cource("RUB", satoshies)
+ end
+
+ def to_sek satoshies
+ "kr%.2f" % cource("SEK", satoshies)
+ end
+
+ def to_sgd satoshies
+ "$%.2f" % cource("SGD", satoshies)
+ end
+
+ def to_zar satoshies
+ "R%.2f" % cource("ZAR", satoshies)
end
def cource(currency, satoshies)
diff --git a/app/views/users/show.html.haml b/app/views/users/show.html.haml
index ad433bf2..1792e2a4 100644
--- a/app/views/users/show.html.haml
+++ b/app/views/users/show.html.haml
@@ -5,7 +5,7 @@
= btc_human @user.balance
= form_for(@user) do |f|
= f.select :denom,
- options_for_select([["BTC", "0"], ["mBTC", "1"], ["μBTC", "2"], ["Satoshi", "3"], ["USD", "4"], ["EUR", "5"]], selected: @user.denom)
+ options_for_select([["BTC", "0"], ["mBTC", "1"], ["μBTC", "2"], ["Satoshi", "3"], ["USD", "4"], ["EUR", "5"], ["AUD", "6"], ["BRL", "7"], ["CAD", "8"], ["CNY", "9"], ["GBP", "10"], ["IDR", "11"], ["ILS", "12"], ["JPY", "13"], ["MXN", "14"], ["NOK", "15"], ["NZD", "16"], ["PLN", "17"], ["RON", "18"], ["RUB", "19"], ["SEK", "20"], ["SGD", "21"], ["ZAR", "22"]], selected: @user.denom)
= f.submit "save"
%p
%small= raw t('.threshold', threshold: btc_human(CONFIG["min_payout"]))
From 50ab5103a5a17502417085c738fc2d368f62a523 Mon Sep 17 00:00:00 2001
From: Sanjiv Jha
Date: Wed, 4 Nov 2015 16:09:35 +0530
Subject: [PATCH 191/415] Updated the Gemfile to rails 4.2.4 and updated devise
as per instruction Replace public_assets in config
---
Gemfile | 10 +-
Gemfile.lock | 193 ++++++++++++++++++++----------------
config/environments/test.rb | 2 +-
3 files changed, 116 insertions(+), 89 deletions(-)
diff --git a/Gemfile b/Gemfile
index c29623a2..38067956 100644
--- a/Gemfile
+++ b/Gemfile
@@ -2,7 +2,7 @@ source 'https://rubygems.org'
ruby '2.0.0'
-gem 'rails', '4.0.2'
+gem 'rails', '4.2.4'
gem 'mysql2', group: :production
gem 'sass-rails', '~> 4.0.0'
gem 'haml-rails', '~> 0.5.3'
@@ -16,7 +16,7 @@ gem 'turbolinks', '~> 2.2.0'
gem 'jquery-turbolinks'
gem 'jbuilder', '~> 1.5.3'
gem 'airbrake', '~> 3.1.15'
-gem 'devise', '~> 3.2.2'
+gem 'devise', '~> 3.5.2'
gem 'omniauth', '~> 1.1.4'
gem 'omniauth-github', github: 'alexandrz/omniauth-github', branch: 'provide_emails'
gem 'octokit', '~> 2.7.0'
@@ -39,18 +39,19 @@ gem 'devise-i18n'
gem 'easy_gravatar'
+gem 'byebug', '~> 3.5.1'
+
group :development do
gem 'capistrano', '~> 3.0.1'
gem 'capistrano-rvm', '~> 0.1.0', github: 'capistrano/rvm'
gem 'capistrano-bundler', '>= 1.1.0'
gem 'capistrano-rails', '~> 1.1.0'
- gem 'byebug', '~> 3.5.1'
end
group :development, :test do
gem 'sqlite3', '~> 1.3.8'
gem 'factory_girl_rails', '~> 4.3.0'
- gem 'rspec-rails', '~> 3.0.0.beta'
+ gem 'rspec-rails', '~> 3.3.0'
end
group :test do
@@ -58,4 +59,5 @@ group :test do
gem 'shoulda-matchers', '~> 2.5.0'
gem 'cucumber-rails', require: false
gem 'database_cleaner'
+ gem 'minitest'
end
diff --git a/Gemfile.lock b/Gemfile.lock
index 2e9158ef..3443771d 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -51,38 +51,48 @@ GIT
GEM
remote: https://rubygems.org/
specs:
- actionmailer (4.0.2)
- actionpack (= 4.0.2)
- mail (~> 2.5.4)
- actionpack (4.0.2)
- activesupport (= 4.0.2)
- builder (~> 3.1.0)
- erubis (~> 2.7.0)
- rack (~> 1.5.2)
+ actionmailer (4.2.4)
+ actionpack (= 4.2.4)
+ actionview (= 4.2.4)
+ activejob (= 4.2.4)
+ mail (~> 2.5, >= 2.5.4)
+ rails-dom-testing (~> 1.0, >= 1.0.5)
+ actionpack (4.2.4)
+ actionview (= 4.2.4)
+ activesupport (= 4.2.4)
+ rack (~> 1.6)
rack-test (~> 0.6.2)
- activemodel (4.0.2)
- activesupport (= 4.0.2)
- builder (~> 3.1.0)
- activerecord (4.0.2)
- activemodel (= 4.0.2)
- activerecord-deprecated_finders (~> 1.0.2)
- activesupport (= 4.0.2)
- arel (~> 4.0.0)
- activerecord-deprecated_finders (1.0.3)
- activesupport (4.0.2)
- i18n (~> 0.6, >= 0.6.4)
- minitest (~> 4.2)
- multi_json (~> 1.3)
- thread_safe (~> 0.1)
- tzinfo (~> 0.3.37)
+ rails-dom-testing (~> 1.0, >= 1.0.5)
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
+ actionview (4.2.4)
+ activesupport (= 4.2.4)
+ builder (~> 3.1)
+ erubis (~> 2.7.0)
+ rails-dom-testing (~> 1.0, >= 1.0.5)
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
+ activejob (4.2.4)
+ activesupport (= 4.2.4)
+ globalid (>= 0.3.0)
+ activemodel (4.2.4)
+ activesupport (= 4.2.4)
+ builder (~> 3.1)
+ activerecord (4.2.4)
+ activemodel (= 4.2.4)
+ activesupport (= 4.2.4)
+ arel (~> 6.0)
+ activesupport (4.2.4)
+ i18n (~> 0.7)
+ json (~> 1.7, >= 1.7.7)
+ minitest (~> 5.1)
+ thread_safe (~> 0.3, >= 0.3.4)
+ tzinfo (~> 1.1)
addressable (2.3.5)
airbrake (3.1.15)
builder
multi_json
- arel (4.0.1)
- atomic (1.1.14)
- bcrypt-ruby (3.1.2)
- builder (3.1.4)
+ arel (6.0.3)
+ bcrypt (3.1.10)
+ builder (3.2.2)
byebug (3.5.1)
columnize (~> 0.8)
debugger-linecache (~> 1.2)
@@ -127,10 +137,11 @@ GEM
database_cleaner (1.2.0)
debugger-linecache (1.2.0)
demoji (0.0.5)
- devise (3.2.2)
- bcrypt-ruby (~> 3.0)
+ devise (3.5.2)
+ bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 3.2.6, < 5)
+ responders
thread_safe (~> 0.1)
warden (~> 1.2.3)
devise-i18n (0.11.0)
@@ -152,6 +163,8 @@ GEM
multipart-post (~> 1.2.0)
gherkin (2.12.2)
multi_json (~> 1.3)
+ globalid (0.3.6)
+ activesupport (>= 4.1.0)
haml (4.0.5)
tilt
haml-rails (0.5.3)
@@ -163,7 +176,7 @@ GEM
hike (1.2.3)
http_accept_language (2.0.2)
httpauth (0.2.1)
- i18n (0.6.9)
+ i18n (0.7.0)
i18n-js (2.1.2)
i18n
jbuilder (1.5.3)
@@ -175,7 +188,7 @@ GEM
jquery-turbolinks (2.0.1)
railties (>= 3.1.0)
turbolinks
- json (1.8.1)
+ json (1.8.3)
jwt (0.1.11)
multi_json (>= 1.5)
kaminari (0.15.0)
@@ -190,21 +203,22 @@ GEM
actionpack (>= 3.1)
less (~> 2.4.0)
libv8 (3.16.14.3)
- mail (2.5.4)
- mime-types (~> 1.16)
- treetop (~> 1.4.8)
- mime-types (1.25.1)
- mini_portile (0.5.3)
- minitest (4.7.5)
- multi_json (1.8.4)
+ loofah (2.0.3)
+ nokogiri (>= 1.5.9)
+ mail (2.6.3)
+ mime-types (>= 1.16, < 3)
+ mime-types (2.6.2)
+ mini_portile (0.6.2)
+ minitest (5.8.2)
+ multi_json (1.11.2)
multi_test (0.1.1)
multipart-post (1.2.0)
mysql2 (0.3.14)
net-scp (1.1.2)
net-ssh (>= 2.6.5)
net-ssh (2.7.0)
- nokogiri (1.6.1)
- mini_portile (~> 0.5.0)
+ nokogiri (1.6.6.2)
+ mini_portile (~> 0.6.0)
oauth2 (0.8.1)
faraday (~> 0.8)
httpauth (~> 0.1)
@@ -220,51 +234,61 @@ GEM
oauth2 (~> 0.8.0)
omniauth (~> 1.0)
orm_adapter (0.5.0)
- polyglot (0.3.3)
- rack (1.5.2)
- rack-test (0.6.2)
+ rack (1.6.4)
+ rack-test (0.6.3)
rack (>= 1.0)
- rails (4.0.2)
- actionmailer (= 4.0.2)
- actionpack (= 4.0.2)
- activerecord (= 4.0.2)
- activesupport (= 4.0.2)
+ rails (4.2.4)
+ actionmailer (= 4.2.4)
+ actionpack (= 4.2.4)
+ actionview (= 4.2.4)
+ activejob (= 4.2.4)
+ activemodel (= 4.2.4)
+ activerecord (= 4.2.4)
+ activesupport (= 4.2.4)
bundler (>= 1.3.0, < 2.0)
- railties (= 4.0.2)
- sprockets-rails (~> 2.0.0)
+ railties (= 4.2.4)
+ sprockets-rails
+ rails-deprecated_sanitizer (1.0.3)
+ activesupport (>= 4.2.0.alpha)
+ rails-dom-testing (1.0.7)
+ activesupport (>= 4.2.0.beta, < 5.0)
+ nokogiri (~> 1.6.0)
+ rails-deprecated_sanitizer (>= 1.0.1)
+ rails-html-sanitizer (1.0.2)
+ loofah (~> 2.0)
rails-i18n (4.0.3)
i18n (~> 0.6)
railties (~> 4.0)
- railties (4.0.2)
- actionpack (= 4.0.2)
- activesupport (= 4.0.2)
+ railties (4.2.4)
+ actionpack (= 4.2.4)
+ activesupport (= 4.2.4)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
- rake (10.1.1)
+ rake (10.4.2)
rdoc (4.1.1)
json (~> 1.4)
ref (1.0.5)
render_csv (2.0.0)
rails (>= 3.0)
- rspec-collection_matchers (0.0.2)
- rspec-expectations (>= 2.99.0.beta1)
- rspec-core (3.0.0.beta1)
- rspec-support (= 3.0.0.beta1)
- rspec-expectations (3.0.0.beta1)
- diff-lcs (>= 1.1.3, < 2.0)
- rspec-support (= 3.0.0.beta1)
- rspec-mocks (3.0.0.beta1)
- rspec-support (= 3.0.0.beta1)
- rspec-rails (3.0.0.beta1)
- actionpack (>= 3.0)
- activemodel (>= 3.0)
- activesupport (>= 3.0)
- railties (>= 3.0)
- rspec-collection_matchers
- rspec-core (= 3.0.0.beta1)
- rspec-expectations (= 3.0.0.beta1)
- rspec-mocks (= 3.0.0.beta1)
- rspec-support (3.0.0.beta1)
+ responders (2.1.0)
+ railties (>= 4.2.0, < 5)
+ rspec-core (3.3.2)
+ rspec-support (~> 3.3.0)
+ rspec-expectations (3.3.1)
+ diff-lcs (>= 1.2.0, < 2.0)
+ rspec-support (~> 3.3.0)
+ rspec-mocks (3.3.2)
+ diff-lcs (>= 1.2.0, < 2.0)
+ rspec-support (~> 3.3.0)
+ rspec-rails (3.3.3)
+ actionpack (>= 3.0, < 4.3)
+ activesupport (>= 3.0, < 4.3)
+ railties (>= 3.0, < 4.3)
+ rspec-core (~> 3.3.0)
+ rspec-expectations (~> 3.3.0)
+ rspec-mocks (~> 3.3.0)
+ rspec-support (~> 3.3.0)
+ rspec-support (3.3.0)
sass (3.2.13)
sass-rails (4.0.1)
railties (>= 4.0.0, < 5.0)
@@ -283,7 +307,7 @@ GEM
simplecov-html (~> 0.7.1)
simplecov-html (0.7.1)
slop (3.6.0)
- sprockets (2.10.1)
+ sprockets (2.12.4)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
@@ -302,17 +326,14 @@ GEM
therubyracer (0.12.0)
libv8 (~> 3.16.14.0)
ref
- thor (0.18.1)
- thread_safe (0.1.3)
- atomic
+ thor (0.19.1)
+ thread_safe (0.3.5)
tilt (1.4.1)
tins (0.13.1)
- treetop (1.4.15)
- polyglot
- polyglot (>= 0.3.1)
turbolinks (2.2.0)
coffee-rails
- tzinfo (0.3.38)
+ tzinfo (1.2.2)
+ thread_safe (~> 0.1)
uglifier (2.4.0)
execjs (>= 0.3.0)
json (>= 1.8.0)
@@ -338,7 +359,7 @@ DEPENDENCIES
cucumber-rails
database_cleaner
demoji
- devise (~> 3.2.2)
+ devise (~> 3.5.2)
devise-i18n
dusen
easy_gravatar
@@ -352,14 +373,15 @@ DEPENDENCIES
kaminari (~> 0.15.0)
kaminari-i18n
less-rails (~> 2.4.2)
+ minitest
mysql2
octokit (~> 2.7.0)
omniauth (~> 1.1.4)
omniauth-github!
- rails (= 4.0.2)
+ rails (= 4.2.4)
rails-i18n
render_csv
- rspec-rails (~> 3.0.0.beta)
+ rspec-rails (~> 3.3.0)
sass-rails (~> 4.0.0)
sawyer (~> 0.5.2)
sdoc
@@ -371,3 +393,6 @@ DEPENDENCIES
twitter-bootstrap-rails!
twitter_bootstrap_form_for!
uglifier (>= 1.3.0)
+
+BUNDLED WITH
+ 1.10.6
diff --git a/config/environments/test.rb b/config/environments/test.rb
index 359f1c92..70a0d8f5 100644
--- a/config/environments/test.rb
+++ b/config/environments/test.rb
@@ -13,7 +13,7 @@
config.eager_load = false
# Configure static asset server for tests with Cache-Control for performance.
- config.serve_static_assets = true
+ config.serve_static_files = true
config.static_cache_control = "public, max-age=3600"
# Show full error reports and disable caching.
From e9ce3fa7291af2db669584d4e319f64609b70e04 Mon Sep 17 00:00:00 2001
From: Sanjiv Jha
Date: Wed, 4 Nov 2015 16:28:20 +0530
Subject: [PATCH 192/415] Fixed the rspec & depreciated warning
---
Gemfile | 3 ++-
Gemfile.lock | 15 ++++++++++-----
spec/controllers/deposits_controller_spec.rb | 2 +-
spec/controllers/home_controller_spec.rb | 2 +-
spec/controllers/projects_controller_spec.rb | 2 +-
spec/controllers/tips_controller_spec.rb | 2 +-
spec/controllers/users_controller_spec.rb | 2 +-
spec/controllers/withdrawals_controller_spec.rb | 2 +-
spec/spec_helper.rb | 1 -
9 files changed, 18 insertions(+), 13 deletions(-)
diff --git a/Gemfile b/Gemfile
index 38067956..32ce2916 100644
--- a/Gemfile
+++ b/Gemfile
@@ -12,7 +12,7 @@ gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'therubyracer', '~> 0.12.0', platforms: :ruby
gem 'jquery-rails', '~> 3.0.4'
-gem 'turbolinks', '~> 2.2.0'
+gem 'turbolinks', '~> 2.5.0'
gem 'jquery-turbolinks'
gem 'jbuilder', '~> 1.5.3'
gem 'airbrake', '~> 3.1.15'
@@ -59,5 +59,6 @@ group :test do
gem 'shoulda-matchers', '~> 2.5.0'
gem 'cucumber-rails', require: false
gem 'database_cleaner'
+ gem 'rspec-activemodel-mocks'
gem 'minitest'
end
diff --git a/Gemfile.lock b/Gemfile.lock
index 3443771d..d513659e 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -117,10 +117,10 @@ GEM
coffee-rails (4.0.1)
coffee-script (>= 2.2.0)
railties (>= 4.0.0, < 5.0)
- coffee-script (2.2.0)
+ coffee-script (2.4.1)
coffee-script-source
execjs
- coffee-script-source (1.6.3)
+ coffee-script-source (1.9.1.1)
columnize (0.9.0)
commonjs (0.2.7)
cucumber (1.3.14)
@@ -153,7 +153,7 @@ GEM
edge_rider (0.3.0)
activerecord
erubis (2.7.0)
- execjs (2.0.2)
+ execjs (2.6.0)
factory_girl (4.3.0)
activesupport (>= 3.0.0)
factory_girl_rails (4.3.0)
@@ -272,6 +272,10 @@ GEM
rails (>= 3.0)
responders (2.1.0)
railties (>= 4.2.0, < 5)
+ rspec-activemodel-mocks (1.0.2)
+ activemodel (>= 3.0)
+ activesupport (>= 3.0)
+ rspec-mocks (>= 2.99, < 4.0)
rspec-core (3.3.2)
rspec-support (~> 3.3.0)
rspec-expectations (3.3.1)
@@ -330,7 +334,7 @@ GEM
thread_safe (0.3.5)
tilt (1.4.1)
tins (0.13.1)
- turbolinks (2.2.0)
+ turbolinks (2.5.3)
coffee-rails
tzinfo (1.2.2)
thread_safe (~> 0.1)
@@ -381,6 +385,7 @@ DEPENDENCIES
rails (= 4.2.4)
rails-i18n
render_csv
+ rspec-activemodel-mocks
rspec-rails (~> 3.3.0)
sass-rails (~> 4.0.0)
sawyer (~> 0.5.2)
@@ -389,7 +394,7 @@ DEPENDENCIES
simplecov
sqlite3 (~> 1.3.8)
therubyracer (~> 0.12.0)
- turbolinks (~> 2.2.0)
+ turbolinks (~> 2.5.0)
twitter-bootstrap-rails!
twitter_bootstrap_form_for!
uglifier (>= 1.3.0)
diff --git a/spec/controllers/deposits_controller_spec.rb b/spec/controllers/deposits_controller_spec.rb
index d24745b4..a2e43e76 100644
--- a/spec/controllers/deposits_controller_spec.rb
+++ b/spec/controllers/deposits_controller_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
-describe DepositsController do
+describe DepositsController, type: :controller do
describe "GET 'index'" do
it "returns http success" do
get 'index'
diff --git a/spec/controllers/home_controller_spec.rb b/spec/controllers/home_controller_spec.rb
index 7735def2..dd2d3352 100644
--- a/spec/controllers/home_controller_spec.rb
+++ b/spec/controllers/home_controller_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
-describe HomeController do
+describe HomeController, type: :controller do
describe 'GET #index' do
let(:subject) { get :index }
diff --git a/spec/controllers/projects_controller_spec.rb b/spec/controllers/projects_controller_spec.rb
index b0064169..e1cd7df7 100644
--- a/spec/controllers/projects_controller_spec.rb
+++ b/spec/controllers/projects_controller_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
-describe ProjectsController do
+describe ProjectsController, type: :controller do
describe 'GET #index' do
let(:subject) { get :index }
before do
diff --git a/spec/controllers/tips_controller_spec.rb b/spec/controllers/tips_controller_spec.rb
index 1159b37e..17346cc1 100644
--- a/spec/controllers/tips_controller_spec.rb
+++ b/spec/controllers/tips_controller_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
-describe TipsController do
+describe TipsController, type: :controller do
describe "GET 'index'" do
it "returns http success" do
get 'index'
diff --git a/spec/controllers/users_controller_spec.rb b/spec/controllers/users_controller_spec.rb
index 8810c5ec..c386eed3 100644
--- a/spec/controllers/users_controller_spec.rb
+++ b/spec/controllers/users_controller_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
-describe UsersController do
+describe UsersController, type: :controller do
describe 'GET #index' do
let(:subject) { get :index }
diff --git a/spec/controllers/withdrawals_controller_spec.rb b/spec/controllers/withdrawals_controller_spec.rb
index 53af5ea4..f3a369ff 100644
--- a/spec/controllers/withdrawals_controller_spec.rb
+++ b/spec/controllers/withdrawals_controller_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
-describe WithdrawalsController do
+describe WithdrawalsController, type: :controller do
describe "GET 'index'" do
it "returns http success" do
get 'index'
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index cee30cb5..87fd2c24 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -31,7 +31,6 @@
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
config.fixture_path = "#{::Rails.root}/spec/fixtures"
-
# If you're not using ActiveRecord, or you'd prefer not to run each of your
# examples within a transaction, remove the following line or assign false
# instead of true.
From 3dfbf897d0dfcfa9af578cc5f97c07c081c3c264 Mon Sep 17 00:00:00 2001
From: Sanjiv Jha
Date: Wed, 4 Nov 2015 17:00:27 +0530
Subject: [PATCH 193/415] removed the depreciated warning from rspec & updated
the rspec to use new method
---
spec/controllers/deposits_controller_spec.rb | 2 +-
spec/controllers/home_controller_spec.rb | 8 +++---
spec/controllers/projects_controller_spec.rb | 28 +++++++++----------
spec/controllers/tips_controller_spec.rb | 2 +-
spec/controllers/users_controller_spec.rb | 16 +++++------
.../withdrawals_controller_spec.rb | 2 +-
spec/spec_helper.rb | 1 -
spec/support/controller_macros.rb | 2 +-
8 files changed, 30 insertions(+), 31 deletions(-)
diff --git a/spec/controllers/deposits_controller_spec.rb b/spec/controllers/deposits_controller_spec.rb
index a2e43e76..750b6980 100644
--- a/spec/controllers/deposits_controller_spec.rb
+++ b/spec/controllers/deposits_controller_spec.rb
@@ -10,7 +10,7 @@
describe "routing" do
it "routes GET / to Deposits#index" do
- { :get => "/deposits" }.should route_to(
+ expect({ :get => "/deposits" }).to route_to(
:controller => "deposits" ,
:action => "index" )
end
diff --git a/spec/controllers/home_controller_spec.rb b/spec/controllers/home_controller_spec.rb
index dd2d3352..992e139b 100644
--- a/spec/controllers/home_controller_spec.rb
+++ b/spec/controllers/home_controller_spec.rb
@@ -15,26 +15,26 @@
describe "routing" do
it "routes GET / to Home#index" do
- { :get => "/" }.should route_to(
+ expect({ :get => "/" }).to route_to(
:controller => "home" ,
:action => "index" )
end
it "routes GET /home to Home#index" do
- { :get => "/" }.should route_to(
+ expect({ :get => "/" }).to route_to(
:controller => "home" ,
:action => "index" )
end
it "routes GET /users/999999/no-such-path to Home#index" do
- { :get => "/users/999999/no-such-path" }.should route_to(
+ expect({ :get => "/users/999999/no-such-path" }).to route_to(
:controller => "home" ,
:action => "index" ,
:path => "users/999999/no-such-path")
end
it "routes GET /any/non-existent/path to Home#index" do
- { :get => "/any/non-existent/path" }.should route_to(
+ expect({ :get => "/any/non-existent/path" }).to route_to(
:controller => "home" ,
:action => "index" ,
:path => "any/non-existent/path")
diff --git a/spec/controllers/projects_controller_spec.rb b/spec/controllers/projects_controller_spec.rb
index e1cd7df7..236829e9 100644
--- a/spec/controllers/projects_controller_spec.rb
+++ b/spec/controllers/projects_controller_spec.rb
@@ -151,13 +151,13 @@
describe "routing" do
it "routes GET /projects to Project#index" do
- { :get => "/projects" }.should route_to(
+ expect({ :get => "/projects" }).to route_to(
:controller => "projects" ,
:action => "index" )
end
it "routes GET /projects/search?query= to Project#search" do
- { :get => "/projects/search?query=seldon&order=balance" }.should route_to(
+ expect({ :get => "/projects/search?query=seldon&order=balance" }).to route_to(
:controller => "projects" ,
:action => "search" ,
:query => "seldon" ,
@@ -165,49 +165,49 @@
end
it "routes GET /projects/1 to Project#show" do
- { :get => "/projects/1" }.should route_to(
+ expect({ :get => "/projects/1" }).to route_to(
:controller => "projects" ,
:action => "show" ,
:id => "1" )
end
it "routes GET /projects/1/edit to Project#edit" do
- { :get => "/projects/1/edit" }.should route_to(
+ expect({ :get => "/projects/1/edit" }).to route_to(
:controller => "projects" ,
:action => "edit" ,
:id => "1" )
end
it "routes PUT /projects/1 to Project#update" do
- { :put => "/projects/1" }.should route_to(
+ expect({ :put => "/projects/1" }).to route_to(
:controller => "projects" ,
:action => "update" ,
:id => "1" )
end
it "routes GET /projects/1/decide_tip_amounts to Project#decide_tip_amounts" do
- { :get => "/projects/1/decide_tip_amounts" }.should route_to(
+ expect({ :get => "/projects/1/decide_tip_amounts" }).to route_to(
:controller => "projects" ,
:action => "decide_tip_amounts" ,
:id => "1" )
end
it "routes PATCH /projects/1/decide_tip_amounts to Project#decide_tip_amounts" do
- { :patch => "/projects/1/decide_tip_amounts" }.should route_to(
+ expect({ :patch => "/projects/1/decide_tip_amounts" }).to route_to(
:controller => "projects" ,
:action => "decide_tip_amounts" ,
:id => "1" )
end
it "routes GET /projects/1/tips to Tips#index" do
- { :get => "/projects/1/tips" }.should route_to(
+ expect({ :get => "/projects/1/tips" }).to route_to(
:controller => "tips" ,
:action => "index" ,
:project_id => "1" )
end
it "routes GET /projects/1/deposits to Deposits#index" do
- { :get => "/projects/1/deposits" }.should route_to(
+ expect({ :get => "/projects/1/deposits" }).to route_to(
:controller => "deposits" ,
:action => "index" ,
:project_id => "1" )
@@ -216,7 +216,7 @@
describe "Project pretty url routing" do
it "routes GET /:provider/:repo to Project#show" do
- { :get => "/github/test/test" }.should route_to(
+ expect({ :get => "/github/test/test" }).to route_to(
:controller => "projects" ,
:action => "show" ,
:service => "github" ,
@@ -224,7 +224,7 @@
end
it "routes GET /:provider/:repo/edit to Project#edit" do
- { :get => "/github/test/test/edit" }.should route_to(
+ expect({ :get => "/github/test/test/edit" }).to route_to(
:controller => "projects" ,
:action => "edit" ,
:service => "github" ,
@@ -232,7 +232,7 @@
end
it "routes GET /:provider/:repo/decide_tip_amounts to Project#decide_tip_amounts" do
- { :get => "/github/test/test/decide_tip_amounts" }.should route_to(
+ expect({ :get => "/github/test/test/decide_tip_amounts" }).to route_to(
:controller => "projects" ,
:action => "decide_tip_amounts" ,
:service => "github" ,
@@ -240,7 +240,7 @@
end
it "routes GET /:provider/:repo/tips to Project#tips" do
- { :get => "/github/test/test/tips" }.should route_to(
+ expect({ :get => "/github/test/test/tips" }).to route_to(
:controller => "tips" ,
:action => "index" ,
:service => "github" ,
@@ -248,7 +248,7 @@
end
it "routes GET /:provider/:repo/deposits to Project#deposits" do
- { :get => "/github/test/test/deposits" }.should route_to(
+ expect({ :get => "/github/test/test/deposits" }).to route_to(
:controller => "deposits" ,
:action => "index" ,
:service => "github" ,
diff --git a/spec/controllers/tips_controller_spec.rb b/spec/controllers/tips_controller_spec.rb
index 17346cc1..2453dbe3 100644
--- a/spec/controllers/tips_controller_spec.rb
+++ b/spec/controllers/tips_controller_spec.rb
@@ -10,7 +10,7 @@
describe "routing" do
it "routes GET / to Tips#index" do
- { :get => "/tips" }.should route_to(
+ expect({ :get => "/tips" }).to route_to(
:controller => "tips" ,
:action => "index" )
end
diff --git a/spec/controllers/users_controller_spec.rb b/spec/controllers/users_controller_spec.rb
index c386eed3..3d45dd35 100644
--- a/spec/controllers/users_controller_spec.rb
+++ b/spec/controllers/users_controller_spec.rb
@@ -97,26 +97,26 @@
describe "routing" do
it "routes GET /users to User#index" do
- { :get => "/users" }.should route_to(
+ expect({ :get => "/users" }).to route_to(
:controller => "users" ,
:action => "index" )
end
it "routes GET /users/nick-name321 to User#show" do
- { :get => "/users/nick-name321" }.should route_to(
+ expect({ :get => "/users/nick-name321" }).to route_to(
:controller => "users" ,
:action => "show" ,
:nickname => "nick-name321" )
end
it "routes GET /users/login to User#login" do
- { :get => "/users/login" }.should route_to(
+ expect({ :get => "/users/login" }).to route_to(
:controller => "users" ,
:action => "login" )
end
it "routes GET /users/1/tips to Tips#index" do
- { :get => "/users/1/tips" }.should route_to(
+ expect({ :get => "/users/1/tips" }).to route_to(
:controller => "tips" ,
:action => "index" ,
:user_id => "1" )
@@ -134,19 +134,19 @@
accepted = should_accept.select {|ea| ea =~ /\D+/}
rejected = should_reject.select {|ea| (ea =~ /\D+/).nil? }
- (accepted.size.should eq should_accept.size) &&
- (rejected.size.should eq should_reject.size)
+ (expect(accepted.size).to eq(should_accept.size)) &&
+ (expect(rejected.size).to eq(should_reject.size))
end
it "routes GET /users/:nickname to User#show" do
- { :get => "/users/#{user.nickname}" }.should route_to(
+ expect({ :get => "/users/#{user.nickname}" }).to route_to(
:controller => "users" ,
:action => "show" ,
:nickname => "kd" )
end
it "routes GET /users/:nickname/tips to Tips#index" do
- { :get => "/users/#{user.nickname}/tips" }.should route_to(
+ expect({ :get => "/users/#{user.nickname}/tips" }).to route_to(
:controller => "tips" ,
:action => "index" ,
:nickname => "kd" )
diff --git a/spec/controllers/withdrawals_controller_spec.rb b/spec/controllers/withdrawals_controller_spec.rb
index f3a369ff..226ec708 100644
--- a/spec/controllers/withdrawals_controller_spec.rb
+++ b/spec/controllers/withdrawals_controller_spec.rb
@@ -10,7 +10,7 @@
describe "routing" do
it "routes GET / to Withdrawals#index" do
- { :get => "/withdrawals" }.should route_to(
+ expect({ :get => "/withdrawals" }).to route_to(
:controller => "withdrawals" ,
:action => "index" )
end
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 87fd2c24..faf72d2e 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -5,7 +5,6 @@
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
-require 'rspec/autorun'
#
# Requires supporting ruby files with custom matchers and macros, etc, in
# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
diff --git a/spec/support/controller_macros.rb b/spec/support/controller_macros.rb
index f8a72269..d1cf5212 100644
--- a/spec/support/controller_macros.rb
+++ b/spec/support/controller_macros.rb
@@ -3,7 +3,7 @@ def login_user
before do
@request.env['devise.mapping'] = Devise.mappings[:user]
@current_user = create(:user)
- @current_user.confirm!
+ @current_user.confirm
sign_in @current_user
end
end
From 2f37c1173e4e5eb3f398067b944400f6ff5fa41f Mon Sep 17 00:00:00 2001
From: Sanjiv Jha
Date: Wed, 4 Nov 2015 17:53:18 +0530
Subject: [PATCH 194/415] Removed all instance of should matcher & added expect
instead of should
---
spec/controllers/projects_controller_spec.rb | 16 ++++++++--------
spec/models/user_spec.rb | 8 ++++----
spec/spec_helper.rb | 3 +++
3 files changed, 15 insertions(+), 12 deletions(-)
diff --git a/spec/controllers/projects_controller_spec.rb b/spec/controllers/projects_controller_spec.rb
index 236829e9..24b24018 100644
--- a/spec/controllers/projects_controller_spec.rb
+++ b/spec/controllers/projects_controller_spec.rb
@@ -53,7 +53,7 @@
describe 'POST #search' do
it 'returns 200 status code' do
post :search
- response.should be_success
+ expect(response).to be_success
end
end
@@ -75,7 +75,7 @@
when :get ; get action , :id => a_project.id
when :patch ; patch action , :id => a_project.id
end
- response.should be_redirect
+ expect(response).to be_redirect
end
it 'via project name returns 200 status code' do
@@ -83,7 +83,7 @@
when :get ; get action , :service => 'github' , :repo => a_project.full_name
when :patch ; patch action , :service => 'github' , :repo => a_project.full_name
end
- response.should be_success
+ expect(response).to be_success
end
end
@@ -93,7 +93,7 @@
when :get ; get action , :id => 999999
when :patch ; patch action , :id => 999999
end
- response.should be_redirect
+ expect(response).to be_redirect
end
it 'via project name returns 200 status code' do
@@ -101,7 +101,7 @@
when :get ; get action , :service => 'github' , :repo => 'no-such/project' ;
when :patch ; patch action , :service => 'github' , :repo => 'no-such/project' ;
end
- response.should be_redirect
+ expect(response).to be_redirect
end
end
end
@@ -125,7 +125,7 @@
# include_context 'accessing_project' , :get , :edit
get :edit , :service => 'github' , :repo => 'test/test'
- response.should be_redirect
+ expect(response).to be_redirect
end
end
@@ -135,7 +135,7 @@
it 'returns 302 status code' do
get :decide_tip_amounts , :service => 'github' , :repo => 'test/test'
- response.should be_redirect
+ expect(response).to be_redirect
end
end
@@ -145,7 +145,7 @@
it 'returns 302 status code' do
patch :decide_tip_amounts , :service => 'github' , :repo => 'test/test'
- response.should be_redirect
+ expect(response).to be_redirect
end
end
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index 2a683d72..0e62b551 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -29,23 +29,23 @@
context 'when address is blank' do
it 'should be valid' do
user.bitcoin_address = ''
- user.should be_valid
+ expect(user).to be_valid
end
end
context 'when address is valid' do
it 'should be valid' do
user.bitcoin_address = '1M4bS4gPyA6Kb8w7aXsgth9oUZWcRk73tQ'
- user.should be_valid
+ expect(user).to be_valid
end
end
context 'when address is not valid' do
it 'should not be valid' do
user.bitcoin_address = '1M4bS4gPyA6Kb8w7aXsgth9oUZXXXXXXXX'
- user.should_not be_valid
+ expect(user).not_to be_valid
end
end
end
-end
\ No newline at end of file
+end
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index faf72d2e..600f6dde 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -1,4 +1,7 @@
+
+require "minitest/autorun"
require 'simplecov'
+
SimpleCov.start 'rails'
# This file is copied to spec/ when you run 'rails generate rspec:install'
From 13d7d4faede1d4cf2a84cd3ad73d418b80cca945 Mon Sep 17 00:00:00 2001
From: Sanjiv Jha
Date: Thu, 5 Nov 2015 16:02:38 +0530
Subject: [PATCH 195/415] updated the Cucumber version to match the rails
version
---
Gemfile.lock | 19 ++++++++++---------
features/support/env.rb | 2 +-
spec/spec_helper.rb | 1 -
3 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/Gemfile.lock b/Gemfile.lock
index d513659e..abef8c4f 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -108,7 +108,7 @@ GEM
capistrano-rails (1.1.0)
capistrano (>= 3.0.0)
capistrano-bundler (>= 1.0.0)
- capybara (2.2.1)
+ capybara (2.5.0)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
@@ -123,17 +123,18 @@ GEM
coffee-script-source (1.9.1.1)
columnize (0.9.0)
commonjs (0.2.7)
- cucumber (1.3.14)
+ cucumber (1.3.20)
builder (>= 2.1.2)
diff-lcs (>= 1.1.3)
gherkin (~> 2.12)
multi_json (>= 1.7.5, < 2.0)
- multi_test (>= 0.1.1)
- cucumber-rails (1.4.0)
- capybara (>= 1.1.2)
- cucumber (>= 1.2.0)
- nokogiri (>= 1.5.0)
- rails (>= 3.0.0)
+ multi_test (>= 0.1.2)
+ cucumber-rails (1.4.2)
+ capybara (>= 1.1.2, < 3)
+ cucumber (>= 1.3.8, < 2)
+ mime-types (>= 1.16, < 3)
+ nokogiri (~> 1.5)
+ rails (>= 3, < 5)
database_cleaner (1.2.0)
debugger-linecache (1.2.0)
demoji (0.0.5)
@@ -211,7 +212,7 @@ GEM
mini_portile (0.6.2)
minitest (5.8.2)
multi_json (1.11.2)
- multi_test (0.1.1)
+ multi_test (0.1.2)
multipart-post (1.2.0)
mysql2 (0.3.14)
net-scp (1.1.2)
diff --git a/features/support/env.rb b/features/support/env.rb
index 64ddf610..5a4dbb04 100644
--- a/features/support/env.rb
+++ b/features/support/env.rb
@@ -3,7 +3,7 @@
# newer version of cucumber-rails. Consider adding your own code to a new file
# instead of editing this one. Cucumber will automatically load all features/**/*.rb
# files.
-
+require 'minitest/autorun'
require 'cucumber/rails'
# Capybara defaults to CSS3 selectors rather than XPath.
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 600f6dde..d9fb3d51 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -1,4 +1,3 @@
-
require "minitest/autorun"
require 'simplecov'
From 9d7b1c0fbeb796a51a4a479099282772901ccede Mon Sep 17 00:00:00 2001
From: Sanjiv Jha
Date: Thu, 5 Nov 2015 18:53:06 +0530
Subject: [PATCH 196/415] Fixed the RSpec::Expectations::ExpectationNotMetError
---
features/step_definitions/common.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/features/step_definitions/common.rb b/features/step_definitions/common.rb
index b798f914..9f72ab4c 100644
--- a/features/step_definitions/common.rb
+++ b/features/step_definitions/common.rb
@@ -113,7 +113,7 @@ def parse_path_from_page_string page_string
Then(/^I should be on the "(.*?)" page$/) do |page_string|
expected = parse_path_from_page_string page_string rescue expected = page_string
- actual = page.current_path
+ actual = URI.decode(page.current_path)
expected.chop! if (expected.end_with? '/') && (expected.size > 1)
actual .chop! if (actual .end_with? '/') && (actual .size > 1)
From 3e8d3b9871cb7cebfc90754d261faa4d9ba4dc63 Mon Sep 17 00:00:00 2001
From: Sanjiv Jha
Date: Thu, 19 Nov 2015 16:01:38 +0530
Subject: [PATCH 197/415] Schema updated
---
app/assets/javascripts/i18n/translations.js | 2 +-
db/schema.rb | 70 ++++++++++-----------
2 files changed, 36 insertions(+), 36 deletions(-)
diff --git a/app/assets/javascripts/i18n/translations.js b/app/assets/javascripts/i18n/translations.js
index 3bdc6e22..6b16f141 100644
--- a/app/assets/javascripts/i18n/translations.js
+++ b/app/assets/javascripts/i18n/translations.js
@@ -1,2 +1,2 @@
var I18n = I18n || {};
-I18n.translations = {"en":{"js":{"errors":{"value":{"invalid":"Value is invalid"},"email":{"invalid":"Invalid Email Address","blank":"The Email is required and can't be empty"},"password":{"blank":"The password is required and can't be empty","invalid":"The password and its confirmation are not same"},"password_confirmation":{"blank":"The password confirmation is required and can't be empty","invalid":"The password and its confirmation are not same"}}}},"ru":{"js":{"errors":{"value":{"invalid":"Неверное значение"},"email":{"invalid":"Ошибка в Email адресе","blank":"Email не может быть пустым"},"password":{"blank":"Пароль не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"},"password_confirmation":{"blank":"Подтверждение пароля не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"}}}},"pl":{"js":{"errors":{"value":{"invalid":"Wartość jest niepoprawna"},"email":{"invalid":"Błędny adres E-mail","blank":"E-mail jest wymagany i nie może być pusty"},"password":{"blank":"Hasło jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"},"password_confirmation":{"blank":"Potwierdzenie hasła jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"}}}},"nl":{"js":{"errors":{"value":{"invalid":"De waarde is ongeldig"},"email":{"invalid":"Ongeldig e-mail adres","blank":"E-mail is verplicht en kan niet leeg blijven"},"password":{"blank":"Wachtwoord is verplicht en kan niet leeg blijven","invalid":"De wachtwoorden komen niet overeen"},"password_confirmation":{"blank":"Wachtwoord is verplicht en kan niet leeg blijven","invalid":"De wachtwoorden komen niet overeen"}}}},"fr":{"js":{"errors":{"value":{"invalid":"Valeur non valide"},"email":{"invalid":"Adresse Email non valide","blank":"L'Email est requis et doit être renseigné"},"password":{"blank":"Les mot de passe est requis et doit être renseigné","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"},"password_confirmation":{"blank":"La confirmation du mot de passe est requise et doit être renseignée","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"}}}},"hr":{"js":{"errors":{"value":{"invalid":"Vrijednost nevazeca"},"email":{"invalid":"Nezaveca email adresa","blank":"Email je potreban i ne moze biti prazno"},"password":{"blank":"Lozinka je potrebna i ne moze biti prazno","invalid":"Lozinka i njezina potvrda nisu isti"},"password_confirmation":{"blank":"Potvrda lozinke je potrebna i ne moze biti prazno","invalid":"Lozinka i potvrda lozinke nisu isti"}}}}};
\ No newline at end of file
+I18n.translations = {"en":{"js":{"errors":{"value":{"invalid":"Value is invalid"},"email":{"invalid":"Invalid Email Address","blank":"The Email is required and can't be empty"},"password":{"blank":"The password is required and can't be empty","invalid":"The password and its confirmation are not same"},"password_confirmation":{"blank":"The password confirmation is required and can't be empty","invalid":"The password and its confirmation are not same"}}}},"pl":{"js":{"errors":{"value":{"invalid":"Wartość jest niepoprawna"},"email":{"invalid":"Błędny adres E-mail","blank":"E-mail jest wymagany i nie może być pusty"},"password":{"blank":"Hasło jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"},"password_confirmation":{"blank":"Potwierdzenie hasła jest wymagane i nie może być puste","invalid":"Hasło i jego potwierdzenie nie są takie same"}}}},"nl":{"js":{"errors":{"value":{"invalid":"De waarde is ongeldig"},"email":{"invalid":"Ongeldig e-mail adres","blank":"E-mail is verplicht en kan niet leeg blijven"},"password":{"blank":"Wachtwoord is verplicht en kan niet leeg blijven","invalid":"De wachtwoorden komen niet overeen"},"password_confirmation":{"blank":"Wachtwoord is verplicht en kan niet leeg blijven","invalid":"De wachtwoorden komen niet overeen"}}}},"fr":{"js":{"errors":{"value":{"invalid":"Valeur non valide"},"email":{"invalid":"Adresse Email non valide","blank":"L'Email est requis et doit être renseigné"},"password":{"blank":"Les mot de passe est requis et doit être renseigné","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"},"password_confirmation":{"blank":"La confirmation du mot de passe est requise et doit être renseignée","invalid":"Le mot de passe et sa confirmation ne sont pas identiques"}}}},"ru":{"js":{"errors":{"value":{"invalid":"Неверное значение"},"email":{"invalid":"Ошибка в адресе электронной почты","blank":"Адрес электронной почты не может быть пустым"},"password":{"blank":"Пароль не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"},"password_confirmation":{"blank":"Подтверждение пароля не может быть пустым","invalid":"Пароль и его подтверждение не совпадают"}}}},"hr":{"js":{"errors":{"value":{"invalid":"Neispravna vrijednost"},"email":{"invalid":"Neispravna email adresa","blank":"Email je obavezan"},"password":{"blank":"Lozinka je obavezma","invalid":"Lozinka i potvrda nisu isti"},"password_confirmation":{"blank":"Potvrda lozinke je obavezna","invalid":"Lozinka i potvrda nisu isti"}}}}};
\ No newline at end of file
diff --git a/db/schema.rb b/db/schema.rb
index 03ad325d..52c6d93a 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -13,7 +13,7 @@
ActiveRecord::Schema.define(version: 20150620054216) do
- create_table "collaborators", force: true do |t|
+ create_table "collaborators", force: :cascade do |t|
t.integer "project_id"
t.string "login"
t.datetime "created_at"
@@ -22,9 +22,9 @@
add_index "collaborators", ["project_id"], name: "index_collaborators_on_project_id"
- create_table "deposits", force: true do |t|
+ create_table "deposits", force: :cascade do |t|
t.integer "project_id"
- t.string "txid"
+ t.string "txid", limit: 255
t.integer "confirmations"
t.datetime "created_at"
t.datetime "updated_at"
@@ -34,22 +34,22 @@
add_index "deposits", ["project_id"], name: "index_deposits_on_project_id"
- create_table "projects", force: true do |t|
- t.string "url"
- t.string "bitcoin_address"
+ create_table "projects", force: :cascade do |t|
+ t.string "url", limit: 255
+ t.string "bitcoin_address", limit: 255
t.datetime "created_at"
t.datetime "updated_at"
- t.string "name"
- t.string "full_name"
- t.string "source_full_name"
+ t.string "name", limit: 255
+ t.string "full_name", limit: 255
+ t.string "source_full_name", limit: 255
t.text "description"
t.integer "watchers_count"
- t.string "language"
- t.string "last_commit"
+ t.string "language", limit: 255
+ t.string "last_commit", limit: 255
t.integer "available_amount_cache"
- t.string "github_id"
- t.string "host", default: "github"
- t.boolean "hold_tips", default: false
+ t.string "github_id", limit: 255
+ t.string "host", default: "github"
+ t.boolean "hold_tips", default: false
t.datetime "info_updated_at"
t.string "branch"
t.boolean "disable_notifications"
@@ -60,16 +60,16 @@
add_index "projects", ["full_name"], name: "index_projects_on_full_name", unique: true
add_index "projects", ["github_id"], name: "index_projects_on_github_id", unique: true
- create_table "sendmanies", force: true do |t|
- t.string "txid"
+ create_table "sendmanies", force: :cascade do |t|
+ t.string "txid", limit: 255
t.text "data"
- t.string "result"
+ t.string "result", limit: 255
t.boolean "is_error"
t.datetime "created_at"
t.datetime "updated_at"
end
- create_table "tipping_policies_texts", force: true do |t|
+ create_table "tipping_policies_texts", force: :cascade do |t|
t.integer "project_id"
t.integer "user_id"
t.text "text"
@@ -80,13 +80,13 @@
add_index "tipping_policies_texts", ["project_id"], name: "index_tipping_policies_texts_on_project_id"
add_index "tipping_policies_texts", ["user_id"], name: "index_tipping_policies_texts_on_user_id"
- create_table "tips", force: true do |t|
+ create_table "tips", force: :cascade do |t|
t.integer "user_id"
t.integer "amount", limit: 8
t.integer "sendmany_id"
t.datetime "created_at"
t.datetime "updated_at"
- t.string "commit"
+ t.string "commit", limit: 255
t.integer "project_id"
t.datetime "refunded_at"
t.text "commit_message"
@@ -97,34 +97,34 @@
add_index "tips", ["sendmany_id"], name: "index_tips_on_sendmany_id"
add_index "tips", ["user_id"], name: "index_tips_on_user_id"
- create_table "users", force: true do |t|
- t.string "email", default: "", null: false
- t.string "encrypted_password", default: "", null: false
- t.string "reset_password_token"
+ create_table "users", force: :cascade do |t|
+ t.string "email", limit: 255, default: "", null: false
+ t.string "encrypted_password", limit: 255, default: "", null: false
+ t.string "reset_password_token", limit: 255
t.datetime "reset_password_sent_at"
t.datetime "remember_created_at"
- t.integer "sign_in_count", default: 0, null: false
+ t.integer "sign_in_count", default: 0, null: false
t.datetime "current_sign_in_at"
t.datetime "last_sign_in_at"
- t.string "current_sign_in_ip"
- t.string "last_sign_in_ip"
+ t.string "current_sign_in_ip", limit: 255
+ t.string "last_sign_in_ip", limit: 255
t.datetime "created_at"
t.datetime "updated_at"
- t.string "nickname"
- t.string "name"
- t.string "image"
- t.string "bitcoin_address"
- t.string "login_token"
+ t.string "nickname", limit: 255
+ t.string "name", limit: 255
+ t.string "image", limit: 255
+ t.string "bitcoin_address", limit: 255
+ t.string "login_token", limit: 255
t.boolean "unsubscribed"
t.datetime "notified_at"
- t.integer "commits_count", default: 0
- t.integer "withdrawn_amount", limit: 8, default: 0
+ t.integer "commits_count", default: 0
+ t.integer "withdrawn_amount", limit: 8, default: 0
t.datetime "confirmed_at"
t.datetime "confirmation_sent_at"
t.string "confirmation_token"
t.string "unconfirmed_email"
t.string "display_name"
- t.integer "denom", default: 0
+ t.integer "denom", default: 0
end
add_index "users", ["email"], name: "index_users_on_email", unique: true
From 4a065b33cf82adf760f188933d40b4c013e80889 Mon Sep 17 00:00:00 2001
From: APerson
Date: Sun, 22 Nov 2015 13:33:53 -0500
Subject: [PATCH 198/415] Use a panel for project descriptions
When project descriptions were inside a well, the upper portion of a project page was a sea of grayscale boxes. Putting project descriptions inside Bootstrap panels instead of wells lightens up the layout and makes the description more noticeable.
---
app/views/projects/show.html.haml | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml
index 0b3f6efe..0ab43a02 100644
--- a/app/views/projects/show.html.haml
+++ b/app/views/projects/show.html.haml
@@ -34,7 +34,8 @@
.col-md-8
- unless @project.description.blank?
- .well.well-sm= @project.description
+ .panel.panel-default
+ .panel-body= @project.description
%h4
= t('.balance')
- if @project.deposits.count > 0
From 43649b219ffdb4b58e6f26388fef7b57713ee3b2 Mon Sep 17 00:00:00 2001
From: Sanjiv Jha
Date: Thu, 19 Nov 2015 17:03:34 +0530
Subject: [PATCH 199/415] Change the Account to email address in feature
cucumber spec
---
features/sign_up_sign_in.feature | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/features/sign_up_sign_in.feature b/features/sign_up_sign_in.feature
index 2a7d1e4e..5363b3c3 100644
--- a/features/sign_up_sign_in.feature
+++ b/features/sign_up_sign_in.feature
@@ -139,11 +139,11 @@ Feature: Visitors should be able to sign_up and sign_in
And I fill "Password" with: "new-guys-password"
And I click "Sign in"
Then I should be on the "sign_in" page
- And I should see "You have to confirm your account before continuing"
+ And I should see "You have to confirm your email address before continuing"
When I confirm the email address: "new-guy@example.com"
Then I should be on the "sign_in" page
- And I should see "Your account was successfully confirmed"
+ And I should see "Your email address has been successfully confirmed"
When I fill "E-mail" with: "new-guy@example.com"
And I fill "Password" with: "new-guys-password"
And I click "Sign in"
From 07bfc6c9aeec95af2a2e6475b38e0f2336e1972b Mon Sep 17 00:00:00 2001
From: Sanjiv Jha
Date: Tue, 15 Dec 2015 00:50:18 +0530
Subject: [PATCH 200/415] Removed minitest Gem from Gemfile
---
Gemfile | 1 -
Gemfile.lock | 1 -
spec/spec_helper.rb | 2 +-
3 files changed, 1 insertion(+), 3 deletions(-)
diff --git a/Gemfile b/Gemfile
index 32ce2916..aa997b3c 100644
--- a/Gemfile
+++ b/Gemfile
@@ -60,5 +60,4 @@ group :test do
gem 'cucumber-rails', require: false
gem 'database_cleaner'
gem 'rspec-activemodel-mocks'
- gem 'minitest'
end
diff --git a/Gemfile.lock b/Gemfile.lock
index abef8c4f..a851162d 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -378,7 +378,6 @@ DEPENDENCIES
kaminari (~> 0.15.0)
kaminari-i18n
less-rails (~> 2.4.2)
- minitest
mysql2
octokit (~> 2.7.0)
omniauth (~> 1.1.4)
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index d9fb3d51..d1ad52da 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -1,4 +1,4 @@
-require "minitest/autorun"
+require "minitest/spec"
require 'simplecov'
SimpleCov.start 'rails'
From b279f036c901bf8f1a47c8e5b6edc62125d6b9d5 Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Wed, 16 Dec 2015 22:10:14 +0500
Subject: [PATCH 201/415] added settings and callback for hd wallet
---
Gemfile | 3 +++
Gemfile.lock | 9 +++++++++
app/controllers/home_controller.rb | 8 ++++++++
config/config.yml.sample | 6 ++++++
config/routes.rb | 1 +
5 files changed, 27 insertions(+)
diff --git a/Gemfile b/Gemfile
index c29623a2..50746679 100644
--- a/Gemfile
+++ b/Gemfile
@@ -37,6 +37,9 @@ gem "i18n-js"
gem 'kaminari-i18n'
gem 'devise-i18n'
+gem 'money-tree'
+gem 'rest-client'
+
gem 'easy_gravatar'
group :development do
diff --git a/Gemfile.lock b/Gemfile.lock
index 2e9158ef..ed55411f 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -150,6 +150,7 @@ GEM
railties (>= 3.0.0)
faraday (0.8.9)
multipart-post (~> 1.2.0)
+ ffi (1.9.10)
gherkin (2.12.2)
multi_json (~> 1.3)
haml (4.0.5)
@@ -196,6 +197,8 @@ GEM
mime-types (1.25.1)
mini_portile (0.5.3)
minitest (4.7.5)
+ money-tree (0.9.0)
+ ffi
multi_json (1.8.4)
multi_test (0.1.1)
multipart-post (1.2.0)
@@ -203,6 +206,7 @@ GEM
net-scp (1.1.2)
net-ssh (>= 2.6.5)
net-ssh (2.7.0)
+ netrc (0.7.7)
nokogiri (1.6.1)
mini_portile (~> 0.5.0)
oauth2 (0.8.1)
@@ -246,6 +250,9 @@ GEM
ref (1.0.5)
render_csv (2.0.0)
rails (>= 3.0)
+ rest-client (1.7.2)
+ mime-types (>= 1.16, < 3.0)
+ netrc (~> 0.7)
rspec-collection_matchers (0.0.2)
rspec-expectations (>= 2.99.0.beta1)
rspec-core (3.0.0.beta1)
@@ -352,6 +359,7 @@ DEPENDENCIES
kaminari (~> 0.15.0)
kaminari-i18n
less-rails (~> 2.4.2)
+ money-tree
mysql2
octokit (~> 2.7.0)
omniauth (~> 1.1.4)
@@ -359,6 +367,7 @@ DEPENDENCIES
rails (= 4.0.2)
rails-i18n
render_csv
+ rest-client
rspec-rails (~> 3.0.0.beta)
sass-rails (~> 4.0.0)
sawyer (~> 0.5.2)
diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb
index 2ef282df..c8f4ada7 100644
--- a/app/controllers/home_controller.rb
+++ b/app/controllers/home_controller.rb
@@ -55,4 +55,12 @@ def blockchain_info_callback
end
end
+ def blockchain_info_callback_v2
+ if params[:confirmations].to_i < 30
+ render json: params
+ else
+ render :text => "*ok*"
+ end
+ end
+
end
diff --git a/config/config.yml.sample b/config/config.yml.sample
index 3713bf2f..94696bbc 100644
--- a/config/config.yml.sample
+++ b/config/config.yml.sample
@@ -10,6 +10,12 @@ blockchain_info:
guid: "111111111111"
password: "111111111111"
callback_secret: "111111111111"
+ # api_key for https://alpha.blockchain.info/
+ api_key: "111111111111"
+
+wallet:
+ xpub: xpub11111111111111
+
devise:
secret: "111111111111"
diff --git a/config/routes.rb b/config/routes.rb
index 647da251..7f598e39 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -6,6 +6,7 @@
:controllers => { :omniauth_callbacks => 'users/omniauth_callbacks' }
get '/blockchain_info_callback' => 'home#blockchain_info_callback' , :as => 'blockchain_info_callback'
+ get '/blockchain_info_callback_v2' => 'home#blockchain_info_callback_v2' , :as => 'blockchain_info_callback_v2'
get '/users/login' => 'users#login' , :as => 'login_users'
get '/users/:user_id/tips' => 'tips#index' , :constraints => {:user_id => /\d+/} , :as => 'user_tips'
From f083e601147b5b4d9ac64d66bf7990858b412660 Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Wed, 16 Dec 2015 22:58:02 +0500
Subject: [PATCH 202/415] updated mri, therubyracer and sqlite versions
---
.travis.yml | 2 +-
Gemfile | 6 +++---
Gemfile.lock | 14 +++++++-------
3 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 2041e869..6b5f83b2 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,7 +1,7 @@
language: ruby
rvm:
- - 2.0.0
+ - 2.2.4
bundler_args: --without development --jobs=9 --retry=2 --quiet
diff --git a/Gemfile b/Gemfile
index aa997b3c..3082599d 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,6 +1,6 @@
source 'https://rubygems.org'
-ruby '2.0.0'
+ruby '2.2.4'
gem 'rails', '4.2.4'
gem 'mysql2', group: :production
@@ -10,7 +10,7 @@ gem 'less-rails', '~> 2.4.2'
gem 'kaminari', '~> 0.15.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
-gem 'therubyracer', '~> 0.12.0', platforms: :ruby
+gem 'therubyracer', '~> 0.12.2', platforms: :ruby
gem 'jquery-rails', '~> 3.0.4'
gem 'turbolinks', '~> 2.5.0'
gem 'jquery-turbolinks'
@@ -49,7 +49,7 @@ group :development do
end
group :development, :test do
- gem 'sqlite3', '~> 1.3.8'
+ gem 'sqlite3', '~> 1.3.11'
gem 'factory_girl_rails', '~> 4.3.0'
gem 'rspec-rails', '~> 3.3.0'
end
diff --git a/Gemfile.lock b/Gemfile.lock
index a851162d..e80a1e00 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -203,7 +203,7 @@ GEM
less-rails (2.4.2)
actionpack (>= 3.1)
less (~> 2.4.0)
- libv8 (3.16.14.3)
+ libv8 (3.16.14.13)
loofah (2.0.3)
nokogiri (>= 1.5.9)
mail (2.6.3)
@@ -268,7 +268,7 @@ GEM
rake (10.4.2)
rdoc (4.1.1)
json (~> 1.4)
- ref (1.0.5)
+ ref (2.0.0)
render_csv (2.0.0)
rails (>= 3.0)
responders (2.1.0)
@@ -321,14 +321,14 @@ GEM
actionpack (>= 3.0)
activesupport (>= 3.0)
sprockets (~> 2.8)
- sqlite3 (1.3.8)
+ sqlite3 (1.3.11)
sshkit (1.3.0)
net-scp (>= 1.1.2)
net-ssh
term-ansicolor
term-ansicolor (1.2.2)
tins (~> 0.8)
- therubyracer (0.12.0)
+ therubyracer (0.12.2)
libv8 (~> 3.16.14.0)
ref
thor (0.19.1)
@@ -392,12 +392,12 @@ DEPENDENCIES
sdoc
shoulda-matchers (~> 2.5.0)
simplecov
- sqlite3 (~> 1.3.8)
- therubyracer (~> 0.12.0)
+ sqlite3 (~> 1.3.11)
+ therubyracer (~> 0.12.2)
turbolinks (~> 2.5.0)
twitter-bootstrap-rails!
twitter_bootstrap_form_for!
uglifier (>= 1.3.0)
BUNDLED WITH
- 1.10.6
+ 1.11.2
From 54ed1683e3b84d293539250e4d4e062be63b12da Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Sat, 19 Dec 2015 12:41:00 +0500
Subject: [PATCH 203/415] updated deploy configureation
---
config/deploy.rb | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/config/deploy.rb b/config/deploy.rb
index cd5541a0..1f1bfbc5 100644
--- a/config/deploy.rb
+++ b/config/deploy.rb
@@ -7,7 +7,7 @@
set :scm, :git
set :rvm_type, :user
-set :rvm_ruby_version, '2.0.0-p247'
+set :rvm_ruby_version, '2.2.4'
set :rvm_custom_path, '~/.rvm'
set :format, :pretty
@@ -40,4 +40,4 @@
after :finishing, 'deploy:cleanup'
-end
\ No newline at end of file
+end
From dc5a4dcd17f1ce2b9894daec7acbf828992900b6 Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov
Date: Sat, 19 Dec 2015 14:07:14 +0500
Subject: [PATCH 204/415] added support for blockchain receiving api v2
---
app/controllers/home_controller.rb | 43 +++++++++++++++++--
app/models/project.rb | 7 +++
config/config.yml.sample | 3 ++
config/routes.rb | 2 +-
...081507_add_bitcoin_address2_to_projects.rb | 12 ++++++
db/schema.rb | 17 ++++----
lib/wallet.rb | 25 +++++++++++
7 files changed, 96 insertions(+), 13 deletions(-)
create mode 100644 db/migrate/20151219081507_add_bitcoin_address2_to_projects.rb
create mode 100644 lib/wallet.rb
diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb
index c8f4ada7..9601118e 100644
--- a/app/controllers/home_controller.rb
+++ b/app/controllers/home_controller.rb
@@ -16,7 +16,7 @@ def blockchain_info_callback
test = params[:test]
if (params[:value].to_i < 0) || Sendmany.find_by(txid: params[:transaction_hash])
- render :text => "*ok*";
+ render :text => "*ok*"
return
end
@@ -56,11 +56,46 @@ def blockchain_info_callback
end
def blockchain_info_callback_v2
- if params[:confirmations].to_i < 30
- render json: params
- else
+ if (params[:secret]!=CONFIG["blockchain_info"]["callback_secret2"])
+ render json: {error: 'Forbidden'}, status: 403
+ return
+ end
+
+ if params[:value].to_i < 0
render :text => "*ok*"
+ return
+ end
+
+ if project = Project.find_by(bitcoin_address2: params[:address])
+ deposit = project.deposits.find_by(txid: params[:transaction_hash])
+ else
+ deposit = nil
+ end
+
+ if deposit
+ deposit.update_attribute(:confirmations, confirmations = params[:confirmations])
+ project.update_cache
+ if confirmations.to_i > 10
+ render :text => "*ok*"
+ else
+ render :text => "Deposit #{deposit.id} updated!"
+ end
+ return
+ end
+
+ if project
+ deposit = Deposit.create({
+ project_id: project.id,
+ txid: params[:transaction_hash],
+ confirmations: params[:confirmations],
+ amount: params[:value].to_i
+ })
+ project.update_cache
+ render :text => "Deposit #{deposit[:txid]} has been created!"
+ else
+ render :text => "Project with deposit address #{params[:address]} is not found!"
end
+
end
end
diff --git a/app/models/project.rb b/app/models/project.rb
index 7a9e567d..b07de0c7 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -263,4 +263,11 @@ def unarchive_address!
return nil
end
end
+
+ # Receiving API v2
+ def generate_address2
+ new_address = Wallet.generate_address_and_register_callback
+ Rails.logger.info "Generated: #{new_address.inspect}"
+ self.update bitcoin_address2: new_address['address']
+ end
end
diff --git a/config/config.yml.sample b/config/config.yml.sample
index 94696bbc..28fc9076 100644
--- a/config/config.yml.sample
+++ b/config/config.yml.sample
@@ -1,3 +1,5 @@
+app_host: 'tip4commit.com'
+
github:
key: "111111111111"
secret: "111111111111"
@@ -12,6 +14,7 @@ blockchain_info:
callback_secret: "111111111111"
# api_key for https://alpha.blockchain.info/
api_key: "111111111111"
+ callback_secret2: "111111111111"
wallet:
xpub: xpub11111111111111
diff --git a/config/routes.rb b/config/routes.rb
index 7f598e39..659819b3 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -6,7 +6,7 @@
:controllers => { :omniauth_callbacks => 'users/omniauth_callbacks' }
get '/blockchain_info_callback' => 'home#blockchain_info_callback' , :as => 'blockchain_info_callback'
- get '/blockchain_info_callback_v2' => 'home#blockchain_info_callback_v2' , :as => 'blockchain_info_callback_v2'
+ get '/blockchain_info_callback_v2/:secret' => 'home#blockchain_info_callback_v2', :as => 'blockchain_info_callback_v2'
get '/users/login' => 'users#login' , :as => 'login_users'
get '/users/:user_id/tips' => 'tips#index' , :constraints => {:user_id => /\d+/} , :as => 'user_tips'
diff --git a/db/migrate/20151219081507_add_bitcoin_address2_to_projects.rb b/db/migrate/20151219081507_add_bitcoin_address2_to_projects.rb
new file mode 100644
index 00000000..8ade9884
--- /dev/null
+++ b/db/migrate/20151219081507_add_bitcoin_address2_to_projects.rb
@@ -0,0 +1,12 @@
+class AddBitcoinAddress2ToProjects < ActiveRecord::Migration
+ def change
+ add_column :projects, :bitcoin_address2, :string, index: true
+ reversible do |dir|
+ dir.up do
+ Project.find_each do |project|
+ project.generate_address2
+ end
+ end
+ end
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 52c6d93a..6d9ea3a3 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,11 +11,11 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 20150620054216) do
+ActiveRecord::Schema.define(version: 20151219081507) do
create_table "collaborators", force: :cascade do |t|
t.integer "project_id"
- t.string "login"
+ t.string "login", limit: 255
t.datetime "created_at"
t.datetime "updated_at"
end
@@ -48,13 +48,14 @@
t.string "last_commit", limit: 255
t.integer "available_amount_cache"
t.string "github_id", limit: 255
- t.string "host", default: "github"
+ t.string "host", limit: 255, default: "github"
t.boolean "hold_tips", default: false
t.datetime "info_updated_at"
- t.string "branch"
+ t.string "branch", limit: 255
t.boolean "disable_notifications"
- t.string "avatar_url"
+ t.string "avatar_url", limit: 255
t.datetime "deleted_at"
+ t.string "bitcoin_address2"
end
add_index "projects", ["full_name"], name: "index_projects_on_full_name", unique: true
@@ -121,9 +122,9 @@
t.integer "withdrawn_amount", limit: 8, default: 0
t.datetime "confirmed_at"
t.datetime "confirmation_sent_at"
- t.string "confirmation_token"
- t.string "unconfirmed_email"
- t.string "display_name"
+ t.string "confirmation_token", limit: 255
+ t.string "unconfirmed_email", limit: 255
+ t.string "display_name", limit: 255
t.integer "denom", default: 0
end
diff --git a/lib/wallet.rb b/lib/wallet.rb
new file mode 100644
index 00000000..a7e4bbab
--- /dev/null
+++ b/lib/wallet.rb
@@ -0,0 +1,25 @@
+class Wallet
+
+ # @return Hash - {"address"=>"1VhXRDrsBnmqgLzkAizb2RTDWNLqQDaiz", "index"=>0, "callback"=>"https://b27d33dc.ngrok.io/blockchain_info_callback_v2"}
+ class << self
+ def generate_address_and_register_callback
+ callback_url = 'https://'+CONFIG['app_host']+'/blockchain_info_callback_v2/'+CONFIG['blockchain_info']['callback_secret2']
+ params = {
+ xpub: CONFIG['wallet']['xpub'],
+ callback: callback_url,
+ key: CONFIG['blockchain_info']['api_key']
+ }
+ response = RestClient.get "https://api.blockchain.info/v2/receive", params: params
+ return JSON.parse(response)
+ rescue RestClient::BadRequest => e
+ return e
+ end
+ end
+
+ # Callback response example
+ #
+ # GET /blockchain_info_callback_v2?address=1VhXRDrsBnmqgLzkAizb2RTDWNLqQDaiz&transaction_hash=6b3653774e7d71b8b802dc39cc885027eae8e4f1488fcdc39c72bcdcd2abbc67&value=100000&confirmations=0
+ # User-Agent: Blockchain.info Receive Payments Callback Client
+
+
+end
From 3ef01d2c722b59fb64b20368ce77c2f63be3ce04 Mon Sep 17 00:00:00 2001
From: Aleksandr Zykov