Skip to content

Commit

Permalink
Port info fix (#15)
Browse files Browse the repository at this point in the history
* Remove codeclimate coverage (#11)

* remove codeclimate coverage

* change badge

* udpate gemfile

* add js configuration

* add package lock

* erblint fix

* try to avoid a flaky test registering users

* restrict decidim version

* gemfile update

* bump version 0.21

* rollback version req

* fix 0.22 verification changes

* fix badge

* fix users report

* fix users check

* bump version

* fix gemfile

* update gemfile

* disable erblit check

* fix tests

* restore erblints

* disable erblit check
  • Loading branch information
microstudi authored Nov 19, 2020
1 parent 893da69 commit 899aba1
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 36 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ jobs:
- run: bundle exec rubocop -P
name: Lint Ruby files

- run: bundle exec erblint app/{cells,views}/**/*.erb
name: Lint ERB files
# - run: bundle exec erblint app/**/*.erb
# name: Lint ERB files

- run: npm run lint
name: Lint JS files
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ node_modules/
npm_debug.log
.ruby-version
tags
*.gem
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ require_relative "#{base_path}lib/decidim/direct_verifications/version"
gem "decidim", Decidim::DirectVerifications::DECIDIM_VERSION
gem "decidim-direct_verifications", path: "."

gem "bootsnap", "~> 1.3"
gem "puma", "~> 4.0"
gem "bootsnap", "~> 1.4"
gem "puma", "~> 4.3"
gem "uglifier", "~> 4.1"

group :development, :test do
Expand Down
32 changes: 16 additions & 16 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
decidim-direct_verifications (0.22)
decidim-direct_verifications (0.22.1)
decidim-admin (>= 0.22.0)
decidim-core (>= 0.22.0)

Expand Down Expand Up @@ -80,7 +80,7 @@ GEM
parser (>= 2.4)
smart_properties
bindex (0.8.1)
bootsnap (1.5.0)
bootsnap (1.5.1)
msgpack (~> 1.0)
browser (2.7.1)
builder (3.2.4)
Expand Down Expand Up @@ -364,7 +364,7 @@ GEM
smart_properties
erbse (0.1.4)
temple
erubi (1.9.0)
erubi (1.10.0)
etherpad-lite (0.3.0)
rest-client (>= 1.6)
execjs (2.7.0)
Expand Down Expand Up @@ -461,7 +461,7 @@ GEM
actionmailer (>= 3.2)
letter_opener (~> 1.0)
railties (>= 3.2)
listen (3.2.1)
listen (3.3.1)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
loofah (2.3.1)
Expand All @@ -480,16 +480,16 @@ GEM
method_source (1.0.0)
mime-types (3.3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2020.0512)
mime-types-data (3.2020.1104)
mimemagic (0.3.5)
mini_magick (4.10.1)
mini_magick (4.11.0)
mini_mime (1.0.2)
mini_portile2 (2.4.0)
minitest (5.14.2)
mixlib-cli (2.1.8)
mixlib-config (3.0.9)
tomlrb
mixlib-shellout (3.1.7)
mixlib-shellout (3.2.2)
chef-utils
msgpack (1.3.3)
multi_json (1.15.0)
Expand Down Expand Up @@ -533,11 +533,11 @@ GEM
paper_trail (10.3.1)
activerecord (>= 4.2)
request_store (~> 1.1)
parallel (1.19.2)
parallel (1.20.0)
parser (2.7.2.0)
ast (~> 2.4.1)
pg (1.1.4)
pg_search (2.3.4)
pg_search (2.3.5)
activerecord (>= 5.2)
activesupport (>= 5.2)
premailer (1.14.2)
Expand Down Expand Up @@ -605,7 +605,7 @@ GEM
virtus (~> 1.0.5)
wisper (>= 1.6.1)
redcarpet (3.5.0)
redis (4.2.2)
redis (4.2.4)
regexp_parser (1.8.2)
request_store (1.5.0)
rack (>= 1.4)
Expand Down Expand Up @@ -721,7 +721,7 @@ GEM
truncato (0.7.11)
htmlentities (~> 4.3.1)
nokogiri (>= 1.7.0, <= 2.0)
tzinfo (1.2.7)
tzinfo (1.2.8)
thread_safe (~> 0.1)
uber (0.1.0)
uglifier (4.2.0)
Expand All @@ -745,7 +745,7 @@ GEM
activemodel (>= 5.0)
bindex (>= 0.4.0)
railties (>= 5.0)
webmock (3.9.3)
webmock (3.10.0)
addressable (>= 2.3.6)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
Expand All @@ -761,16 +761,16 @@ PLATFORMS
ruby

DEPENDENCIES
bootsnap (~> 1.3)
bootsnap (~> 1.4)
byebug (~> 11.0)
codecov
decidim (= 0.22.0)
decidim-dev (= 0.22.0)
decidim (= 0.22)
decidim-dev (= 0.22)
decidim-direct_verifications!
faker (~> 1.9)
letter_opener_web (~> 1.3)
listen (~> 3.1)
puma (~> 4.0)
puma (~> 4.3)
spring (~> 2.0)
spring-watcher-listen (~> 2.0)
uglifier (~> 4.1)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Decidim::DirectVerifications

![[CI] Test](https://github.com/Platoniq/decidim-verifications-direct_verifications/workflows/%5BCI%5D%20Test/badge.svg)
![Test](https://github.com/Platoniq/decidim-verifications-direct_verifications/workflows/Test/badge.svg)
[![Maintainability](https://api.codeclimate.com/v1/badges/2195deb4de6c6354a6bc/maintainability)](https://codeclimate.com/github/Platoniq/decidim-verifications-direct_verifications/maintainability)
[![codecov](https://codecov.io/gh/Platoniq/decidim-verifications-direct_verifications/branch/master/graph/badge.svg?token=FR1zkV71S2)](https://codecov.io/gh/Platoniq/decidim-verifications-direct_verifications)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def index
def create
enforce_permission_to :create, :authorization

@userslist = params[:userlist]
@userslist = params[:userslist]
@processor = UserProcessor.new(current_organization, current_user, session)
@processor.emails = parser_class.new(@userslist).to_h
@processor.authorization_handler = current_authorization_handler
Expand Down Expand Up @@ -64,7 +64,7 @@ def revoke_users
end

def show_users_info
return if params[:authorize]
return if params[:authorize].in? %w(in out)

@stats.emails = @processor.emails.keys
flash.now[:info] = t(".info", handler: t("#{@processor.authorization_handler}.name", scope: "decidim.authorization_handlers"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
<div class="card-section">
<p><%= t("decidim.direct_verifications.verification.admin.new.info") %></p>
<%= form_tag direct_verifications_path, multipart: true, class: "form" do %>
<%= label_tag :userlist, t("admin.new.textarea", scope: "decidim.direct_verifications.verification") %>
<%= text_area_tag :userlist, @userslist, rows: 10 %>
<%= label_tag :userslist, t("admin.new.textarea", scope: "decidim.direct_verifications.verification") %>
<%= text_area_tag :userslist, @userslist, rows: 10 %>
<label>
<%= check_box_tag :register %>
<%= t("admin.new.register", scope: "decidim.direct_verifications.verification") %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

shared_examples_for "checking users" do |params|
context "when check without mails" do
before { params[:userlist] = "" }
before { params[:userslist] = "" }

it "renders the index with info message" do
perform_enqueued_jobs do
Expand All @@ -15,7 +15,7 @@
end

context "when check with mails" do
before { params[:userlist] = "[email protected]" }
before { params[:userslist] = "[email protected]" }

it "renders the index with info message" do
perform_enqueued_jobs do
Expand Down
4 changes: 2 additions & 2 deletions lib/decidim/direct_verifications/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
module Decidim
# This holds the decidim-direct_verifications version.
module DirectVerifications
VERSION = "0.22"
DECIDIM_VERSION = "0.22.0"
VERSION = "0.22.1"
DECIDIM_VERSION = "0.22"
MIN_DECIDIM_VERSION = ">= 0.22.0"
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ module Decidim::DirectVerifications::Verification::Admin

describe "POST create" do
context "when parameters are defaults" do
params = { userlist: "" }
params = { userslist: "" }
it_behaves_like "checking users", params
it "have no registered or authorized users" do
perform_enqueued_jobs do
Expand All @@ -45,7 +45,7 @@ module Decidim::DirectVerifications::Verification::Admin
end

context "when register users with check" do
params = { userlist: "[email protected]", register: true }
params = { userslist: "[email protected]", register: true }

it_behaves_like "checking users", params

Expand All @@ -68,7 +68,7 @@ module Decidim::DirectVerifications::Verification::Admin
end

context "when register users with authorize" do
params = { userlist: "[email protected]", register: true, authorize: "in" }
params = { userslist: "[email protected]", register: true, authorize: "in" }

it_behaves_like "registering users", params
it_behaves_like "authorizing users", params
Expand All @@ -83,7 +83,7 @@ module Decidim::DirectVerifications::Verification::Admin
context "when the name is not specified" do
it "infers the name from the email" do
post :create, params: {
userlist: "Name,Email,Type\r\n\"\",[email protected],consumer",
userslist: "Name,Email,Type\r\n\"\",[email protected],consumer",
register: true,
authorize: "in"
}
Expand All @@ -103,7 +103,7 @@ module Decidim::DirectVerifications::Verification::Admin

it "stores any extra columns as authorization metadata" do
post :create, params: {
userlist: "Name,Email,Type\r\nBrandy,[email protected],consumer,2\r\nWhisky,[email protected],producer,3",
userslist: "Name,Email,Type\r\nBrandy,[email protected],consumer,2\r\nWhisky,[email protected],producer,3",
register: true,
authorize: "in"
}
Expand All @@ -116,7 +116,7 @@ module Decidim::DirectVerifications::Verification::Admin
context "when the name is not specified" do
it "infers the name from the email" do
post :create, params: {
userlist: "Name,Email,Type\r\n\"\",[email protected],consumer",
userslist: "Name,Email,Type\r\n\"\",[email protected],consumer",
register: true,
authorize: "in"
}
Expand All @@ -129,7 +129,7 @@ module Decidim::DirectVerifications::Verification::Admin
end

context "when register users with revoke" do
params = { userlist: "[email protected]", authorize: "out" }
params = { userslist: "[email protected]", authorize: "out" }
it_behaves_like "revoking users", params
end
end
Expand Down

0 comments on commit 899aba1

Please sign in to comment.