Merge branch 'develop' of git.znuny.com:zammad/zammad into develop
This commit is contained in:
commit
a4a513edea
118 changed files with 864 additions and 656 deletions
|
@ -416,7 +416,6 @@ browser:build:
|
|||
- core
|
||||
script:
|
||||
- export RAILS_ENV=production
|
||||
- rake db:drop;
|
||||
- rake db:create
|
||||
- rake db:migrate
|
||||
- rake assets:precompile
|
||||
|
|
2
Gemfile
2
Gemfile
|
@ -2,7 +2,7 @@ source 'https://rubygems.org'
|
|||
|
||||
ruby '2.4.1'
|
||||
|
||||
gem 'rails', '4.2.9'
|
||||
gem 'rails', '5.0.5'
|
||||
gem 'rails-observers'
|
||||
gem 'activerecord-session_store'
|
||||
|
||||
|
|
279
Gemfile.lock
279
Gemfile.lock
|
@ -17,35 +17,38 @@ GIT
|
|||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
actionmailer (4.2.9)
|
||||
actionpack (= 4.2.9)
|
||||
actionview (= 4.2.9)
|
||||
activejob (= 4.2.9)
|
||||
actioncable (5.0.5)
|
||||
actionpack (= 5.0.5)
|
||||
nio4r (>= 1.2, < 3.0)
|
||||
websocket-driver (~> 0.6.1)
|
||||
actionmailer (5.0.5)
|
||||
actionpack (= 5.0.5)
|
||||
actionview (= 5.0.5)
|
||||
activejob (= 5.0.5)
|
||||
mail (~> 2.5, >= 2.5.4)
|
||||
rails-dom-testing (~> 1.0, >= 1.0.5)
|
||||
actionpack (4.2.9)
|
||||
actionview (= 4.2.9)
|
||||
activesupport (= 4.2.9)
|
||||
rack (~> 1.6)
|
||||
rack-test (~> 0.6.2)
|
||||
rails-dom-testing (~> 1.0, >= 1.0.5)
|
||||
rails-dom-testing (~> 2.0)
|
||||
actionpack (5.0.5)
|
||||
actionview (= 5.0.5)
|
||||
activesupport (= 5.0.5)
|
||||
rack (~> 2.0)
|
||||
rack-test (~> 0.6.3)
|
||||
rails-dom-testing (~> 2.0)
|
||||
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
||||
actionview (4.2.9)
|
||||
activesupport (= 4.2.9)
|
||||
actionview (5.0.5)
|
||||
activesupport (= 5.0.5)
|
||||
builder (~> 3.1)
|
||||
erubis (~> 2.7.0)
|
||||
rails-dom-testing (~> 1.0, >= 1.0.5)
|
||||
rails-dom-testing (~> 2.0)
|
||||
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
||||
activejob (4.2.9)
|
||||
activesupport (= 4.2.9)
|
||||
globalid (>= 0.3.0)
|
||||
activemodel (4.2.9)
|
||||
activesupport (= 4.2.9)
|
||||
builder (~> 3.1)
|
||||
activerecord (4.2.9)
|
||||
activemodel (= 4.2.9)
|
||||
activesupport (= 4.2.9)
|
||||
arel (~> 6.0)
|
||||
activejob (5.0.5)
|
||||
activesupport (= 5.0.5)
|
||||
globalid (>= 0.3.6)
|
||||
activemodel (5.0.5)
|
||||
activesupport (= 5.0.5)
|
||||
activerecord (5.0.5)
|
||||
activemodel (= 5.0.5)
|
||||
activesupport (= 5.0.5)
|
||||
arel (~> 7.0)
|
||||
activerecord-nulldb-adapter (0.3.7)
|
||||
activerecord (>= 2.0.0)
|
||||
activerecord-session_store (1.1.0)
|
||||
|
@ -54,44 +57,45 @@ GEM
|
|||
multi_json (~> 1.11, >= 1.11.2)
|
||||
rack (>= 1.5.2, < 3)
|
||||
railties (>= 4.0, < 5.2)
|
||||
activesupport (4.2.9)
|
||||
activesupport (5.0.5)
|
||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||
i18n (~> 0.7)
|
||||
minitest (~> 5.1)
|
||||
thread_safe (~> 0.3, >= 0.3.4)
|
||||
tzinfo (~> 1.1)
|
||||
addressable (2.4.0)
|
||||
arel (6.0.4)
|
||||
addressable (2.5.2)
|
||||
public_suffix (>= 2.0.2, < 4.0)
|
||||
arel (7.1.4)
|
||||
argon2 (1.1.3)
|
||||
ffi (~> 1.9)
|
||||
ffi-compiler (~> 0.1)
|
||||
ast (2.3.0)
|
||||
autoprefixer-rails (7.1.2.4)
|
||||
autoprefixer-rails (7.1.3)
|
||||
execjs
|
||||
biz (1.7.0)
|
||||
clavius (~> 1.0)
|
||||
tzinfo
|
||||
browser (2.2.0)
|
||||
browser (2.5.1)
|
||||
buftok (0.2.0)
|
||||
builder (3.2.3)
|
||||
childprocess (0.5.9)
|
||||
childprocess (0.7.1)
|
||||
ffi (~> 1.0, >= 1.0.11)
|
||||
clavius (1.0.2)
|
||||
clavius (1.0.3)
|
||||
clearbit (0.2.7)
|
||||
nestful (~> 1.1.0)
|
||||
coderay (1.1.1)
|
||||
coffee-rails (4.2.1)
|
||||
coderay (1.1.2)
|
||||
coffee-rails (4.2.2)
|
||||
coffee-script (>= 2.2.0)
|
||||
railties (>= 4.0.0, < 5.2.x)
|
||||
railties (>= 4.0.0)
|
||||
coffee-script (2.4.1)
|
||||
coffee-script-source
|
||||
execjs
|
||||
coffee-script-source (1.12.2)
|
||||
coffeelint (1.14.0)
|
||||
coffeelint (1.16.0)
|
||||
coffee-script
|
||||
execjs
|
||||
json
|
||||
composite_primary_keys (8.1.6)
|
||||
activerecord (~> 4.2.0)
|
||||
composite_primary_keys (9.0.7)
|
||||
activerecord (~> 5.0.0)
|
||||
concurrent-ruby (1.0.5)
|
||||
coveralls (0.8.21)
|
||||
json (>= 1.8, < 3)
|
||||
|
@ -107,12 +111,12 @@ GEM
|
|||
delayed_job_active_record (4.1.2)
|
||||
activerecord (>= 3.0, < 5.2)
|
||||
delayed_job (>= 3.0, < 5)
|
||||
diff-lcs (1.2.5)
|
||||
diffy (3.1.0)
|
||||
diff-lcs (1.3)
|
||||
diffy (3.2.0)
|
||||
docile (1.1.5)
|
||||
domain_name (0.5.20170404)
|
||||
unf (>= 0.0.5, < 1.0.0)
|
||||
doorkeeper (4.2.0)
|
||||
doorkeeper (4.2.6)
|
||||
railties (>= 4.2)
|
||||
eco (1.0.0)
|
||||
coffee-script
|
||||
|
@ -122,18 +126,18 @@ GEM
|
|||
em-websocket (0.5.1)
|
||||
eventmachine (>= 0.12.9)
|
||||
http_parser.rb (~> 0.6.0)
|
||||
equalizer (0.0.10)
|
||||
equalizer (0.0.11)
|
||||
erubis (2.7.0)
|
||||
eventmachine (1.2.3)
|
||||
eventmachine (1.2.5)
|
||||
execjs (2.7.0)
|
||||
factory_girl (4.8.0)
|
||||
activesupport (>= 3.0.0)
|
||||
factory_girl_rails (4.8.0)
|
||||
factory_girl (~> 4.8.0)
|
||||
railties (>= 3.0.0)
|
||||
faraday (0.9.2)
|
||||
faraday (0.11.0)
|
||||
multipart-post (>= 1.2, < 3)
|
||||
faraday-http-cache (1.3.1)
|
||||
faraday-http-cache (2.0.0)
|
||||
faraday (~> 0.8)
|
||||
ffi (1.9.18)
|
||||
ffi-compiler (0.1.3)
|
||||
|
@ -142,17 +146,17 @@ GEM
|
|||
figaro (1.1.1)
|
||||
thor (~> 0.14)
|
||||
formatador (0.2.5)
|
||||
github_changelog_generator (1.14.1)
|
||||
github_changelog_generator (1.14.3)
|
||||
activesupport
|
||||
faraday-http-cache
|
||||
multi_json
|
||||
octokit (~> 4.0)
|
||||
octokit (~> 4.6)
|
||||
rainbow (>= 2.1)
|
||||
rake (>= 10.0)
|
||||
retriable (~> 2.1)
|
||||
globalid (0.4.0)
|
||||
activesupport (>= 4.2.0)
|
||||
guard (2.14.0)
|
||||
guard (2.14.1)
|
||||
formatador (>= 0.2.4)
|
||||
listen (>= 2.7, < 4.0)
|
||||
lumberjack (~> 1.0)
|
||||
|
@ -170,10 +174,10 @@ GEM
|
|||
guard-symlink (0.1.1)
|
||||
guard
|
||||
guard-compat (~> 1.1)
|
||||
hashdiff (0.3.5)
|
||||
hashdiff (0.3.6)
|
||||
hashie (3.5.6)
|
||||
htmlentities (4.3.4)
|
||||
http (1.0.4)
|
||||
http (2.2.2)
|
||||
addressable (~> 2.3)
|
||||
http-cookie (~> 1.0)
|
||||
http-form_data (~> 1.0.1)
|
||||
|
@ -190,13 +194,13 @@ GEM
|
|||
ice_cube (~> 0.13)
|
||||
ice_cube (0.16.2)
|
||||
inflection (1.0.0)
|
||||
json (1.8.6)
|
||||
json (2.1.0)
|
||||
jwt (1.5.6)
|
||||
kgio (2.11.0)
|
||||
koala (2.4.0)
|
||||
koala (3.0.0)
|
||||
addressable
|
||||
faraday
|
||||
multi_json (>= 1.3.0)
|
||||
json (>= 1.8)
|
||||
libv8 (3.16.14.19)
|
||||
listen (3.1.5)
|
||||
rb-fsevent (~> 0.9, >= 0.9.4)
|
||||
|
@ -208,41 +212,40 @@ GEM
|
|||
multi_json (~> 1.10)
|
||||
loofah (2.0.3)
|
||||
nokogiri (>= 1.5.9)
|
||||
lumberjack (1.0.10)
|
||||
lumberjack (1.0.12)
|
||||
mail (2.6.6)
|
||||
mime-types (>= 1.16, < 4)
|
||||
memoizable (0.4.2)
|
||||
thread_safe (~> 0.3, >= 0.3.1)
|
||||
method_source (0.8.2)
|
||||
mime-types (3.1)
|
||||
mime-types-data (~> 3.2015)
|
||||
mime-types-data (3.2016.0521)
|
||||
mime-types (2.99.3)
|
||||
mini_portile2 (2.2.0)
|
||||
minitest (5.10.3)
|
||||
multi_json (1.12.1)
|
||||
multi_xml (0.6.0)
|
||||
multipart-post (2.0.0)
|
||||
mysql2 (0.4.6)
|
||||
mysql2 (0.4.9)
|
||||
naught (1.1.0)
|
||||
nenv (0.3.0)
|
||||
nestful (1.1.1)
|
||||
net-ldap (0.15.0)
|
||||
net-ldap (0.16.0)
|
||||
netrc (0.11.0)
|
||||
nio4r (2.1.0)
|
||||
nokogiri (1.8.0)
|
||||
mini_portile2 (~> 2.2.0)
|
||||
nori (2.6.0)
|
||||
notiffany (0.1.1)
|
||||
nenv (~> 0.1)
|
||||
shellany (~> 0.0)
|
||||
oauth (0.5.1)
|
||||
oauth (0.5.3)
|
||||
oauth2 (1.4.0)
|
||||
faraday (>= 0.8, < 0.13)
|
||||
jwt (~> 1.0)
|
||||
multi_json (~> 1.3)
|
||||
multi_xml (~> 0.5)
|
||||
rack (>= 1.2, < 3)
|
||||
octokit (4.4.1)
|
||||
sawyer (~> 0.7.0, >= 0.5.3)
|
||||
octokit (4.7.0)
|
||||
sawyer (~> 0.8.0, >= 0.5.3)
|
||||
omniauth (1.6.1)
|
||||
hashie (>= 3.4.6, < 3.6.0)
|
||||
rack (>= 1.6.2, < 3)
|
||||
|
@ -254,12 +257,12 @@ GEM
|
|||
omniauth-gitlab (1.0.2)
|
||||
omniauth (~> 1.0)
|
||||
omniauth-oauth2 (~> 1.0)
|
||||
omniauth-google-oauth2 (0.5.0)
|
||||
omniauth-google-oauth2 (0.5.2)
|
||||
jwt (~> 1.5)
|
||||
multi_json (~> 1.3)
|
||||
omniauth (>= 1.1.1)
|
||||
omniauth-oauth2 (>= 1.3.1)
|
||||
omniauth-linkedin-oauth2 (0.1.5)
|
||||
omniauth-linkedin-oauth2 (0.2.5)
|
||||
omniauth (~> 1.0)
|
||||
omniauth-oauth2
|
||||
omniauth-microsoft-office365 (0.0.7)
|
||||
|
@ -271,14 +274,14 @@ GEM
|
|||
omniauth-oauth2 (1.4.0)
|
||||
oauth2 (~> 1.0)
|
||||
omniauth (~> 1.2)
|
||||
omniauth-twitter (1.2.1)
|
||||
json (~> 1.3)
|
||||
omniauth-twitter (1.4.0)
|
||||
omniauth-oauth (~> 1.1)
|
||||
parser (2.3.1.2)
|
||||
rack
|
||||
parser (2.4.0.0)
|
||||
ast (~> 2.2)
|
||||
pg (0.20.0)
|
||||
pluginator (1.5.0)
|
||||
power_assert (0.3.1)
|
||||
power_assert (1.1.0)
|
||||
powerpack (0.1.1)
|
||||
pre-commit (0.35.0)
|
||||
pluginator (~> 1.5)
|
||||
|
@ -286,68 +289,68 @@ GEM
|
|||
coderay (~> 1.1.0)
|
||||
method_source (~> 0.8.1)
|
||||
slop (~> 3.4)
|
||||
puma (3.9.1)
|
||||
rack (1.6.8)
|
||||
public_suffix (3.0.0)
|
||||
puma (3.10.0)
|
||||
rack (2.0.3)
|
||||
rack-livereload (0.3.16)
|
||||
rack
|
||||
rack-test (0.6.3)
|
||||
rack (>= 1.0)
|
||||
rails (4.2.9)
|
||||
actionmailer (= 4.2.9)
|
||||
actionpack (= 4.2.9)
|
||||
actionview (= 4.2.9)
|
||||
activejob (= 4.2.9)
|
||||
activemodel (= 4.2.9)
|
||||
activerecord (= 4.2.9)
|
||||
activesupport (= 4.2.9)
|
||||
bundler (>= 1.3.0, < 2.0)
|
||||
railties (= 4.2.9)
|
||||
sprockets-rails
|
||||
rails-deprecated_sanitizer (1.0.3)
|
||||
activesupport (>= 4.2.0.alpha)
|
||||
rails-dom-testing (1.0.8)
|
||||
activesupport (>= 4.2.0.beta, < 5.0)
|
||||
nokogiri (~> 1.6)
|
||||
rails-deprecated_sanitizer (>= 1.0.1)
|
||||
rails (5.0.5)
|
||||
actioncable (= 5.0.5)
|
||||
actionmailer (= 5.0.5)
|
||||
actionpack (= 5.0.5)
|
||||
actionview (= 5.0.5)
|
||||
activejob (= 5.0.5)
|
||||
activemodel (= 5.0.5)
|
||||
activerecord (= 5.0.5)
|
||||
activesupport (= 5.0.5)
|
||||
bundler (>= 1.3.0)
|
||||
railties (= 5.0.5)
|
||||
sprockets-rails (>= 2.0.0)
|
||||
rails-dom-testing (2.0.3)
|
||||
activesupport (>= 4.2.0)
|
||||
nokogiri (>= 1.6)
|
||||
rails-html-sanitizer (1.0.3)
|
||||
loofah (~> 2.0)
|
||||
rails-observers (0.1.5)
|
||||
activemodel (>= 4.0)
|
||||
railties (4.2.9)
|
||||
actionpack (= 4.2.9)
|
||||
activesupport (= 4.2.9)
|
||||
railties (5.0.5)
|
||||
actionpack (= 5.0.5)
|
||||
activesupport (= 5.0.5)
|
||||
method_source
|
||||
rake (>= 0.8.7)
|
||||
thor (>= 0.18.1, < 2.0)
|
||||
rainbow (2.2.2)
|
||||
rake
|
||||
raindrops (0.19.0)
|
||||
rake (12.0.0)
|
||||
rb-fsevent (0.9.7)
|
||||
rb-inotify (0.9.7)
|
||||
ffi (>= 0.5.0)
|
||||
rb-fsevent (0.10.2)
|
||||
rb-inotify (0.9.10)
|
||||
ffi (>= 0.5.0, < 2)
|
||||
ref (2.0.0)
|
||||
rest-client (2.0.0)
|
||||
rest-client (1.8.0)
|
||||
http-cookie (>= 1.0.2, < 2.0)
|
||||
mime-types (>= 1.16, < 4.0)
|
||||
netrc (~> 0.8)
|
||||
mime-types (>= 1.16, < 3.0)
|
||||
netrc (~> 0.7)
|
||||
retriable (2.1.0)
|
||||
rspec-core (3.5.4)
|
||||
rspec-support (~> 3.5.0)
|
||||
rspec-expectations (3.5.0)
|
||||
rspec-core (3.6.0)
|
||||
rspec-support (~> 3.6.0)
|
||||
rspec-expectations (3.6.0)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.5.0)
|
||||
rspec-mocks (3.5.0)
|
||||
rspec-support (~> 3.6.0)
|
||||
rspec-mocks (3.6.0)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.5.0)
|
||||
rspec-rails (3.5.2)
|
||||
rspec-support (~> 3.6.0)
|
||||
rspec-rails (3.6.1)
|
||||
actionpack (>= 3.0)
|
||||
activesupport (>= 3.0)
|
||||
railties (>= 3.0)
|
||||
rspec-core (~> 3.5.0)
|
||||
rspec-expectations (~> 3.5.0)
|
||||
rspec-mocks (~> 3.5.0)
|
||||
rspec-support (~> 3.5.0)
|
||||
rspec-support (3.5.0)
|
||||
rspec-core (~> 3.6.0)
|
||||
rspec-expectations (~> 3.6.0)
|
||||
rspec-mocks (~> 3.6.0)
|
||||
rspec-support (~> 3.6.0)
|
||||
rspec-support (3.6.0)
|
||||
rubocop (0.42.0)
|
||||
parser (>= 2.3.1.1, < 3.0)
|
||||
powerpack (~> 0.1)
|
||||
|
@ -355,23 +358,26 @@ GEM
|
|||
ruby-progressbar (~> 1.7)
|
||||
unicode-display_width (~> 1.0, >= 1.0.1)
|
||||
ruby-progressbar (1.8.1)
|
||||
ruby_dep (1.4.0)
|
||||
ruby_dep (1.5.0)
|
||||
rubyzip (1.2.1)
|
||||
safe_yaml (1.0.4)
|
||||
sass (3.4.22)
|
||||
sass (3.5.1)
|
||||
sass-listen (~> 4.0.0)
|
||||
sass-listen (4.0.0)
|
||||
rb-fsevent (~> 0.9, >= 0.9.4)
|
||||
rb-inotify (~> 0.9, >= 0.9.7)
|
||||
sass-rails (5.0.6)
|
||||
railties (>= 4.0.0, < 6)
|
||||
sass (~> 3.1)
|
||||
sprockets (>= 2.8, < 4.0)
|
||||
sprockets-rails (>= 2.0, < 4.0)
|
||||
tilt (>= 1.1, < 3)
|
||||
sawyer (0.7.0)
|
||||
addressable (>= 2.3.5, < 2.5)
|
||||
faraday (~> 0.8, < 0.10)
|
||||
sawyer (0.8.1)
|
||||
addressable (>= 2.3.5, < 2.6)
|
||||
faraday (~> 0.8, < 1.0)
|
||||
selenium-webdriver (2.53.4)
|
||||
childprocess (~> 0.5)
|
||||
rubyzip (~> 1.0)
|
||||
websocket (~> 1.0)
|
||||
shellany (0.0.1)
|
||||
simple-rss (1.3.1)
|
||||
simple_oauth (0.3.1)
|
||||
|
@ -379,10 +385,10 @@ GEM
|
|||
docile (~> 1.1.0)
|
||||
json (>= 1.8, < 3)
|
||||
simplecov-html (~> 0.10.0)
|
||||
simplecov-html (0.10.1)
|
||||
simplecov-html (0.10.2)
|
||||
simplecov-rcov (0.2.3)
|
||||
simplecov (>= 0.4.1)
|
||||
slack-notifier (1.5.1)
|
||||
slack-notifier (2.3.1)
|
||||
slop (3.6.0)
|
||||
spring (2.0.2)
|
||||
activesupport (>= 4.2)
|
||||
|
@ -391,47 +397,46 @@ GEM
|
|||
sprockets (3.7.1)
|
||||
concurrent-ruby (~> 1.0)
|
||||
rack (> 1, < 3)
|
||||
sprockets-rails (3.2.0)
|
||||
sprockets-rails (3.2.1)
|
||||
actionpack (>= 4.0)
|
||||
activesupport (>= 4.0)
|
||||
sprockets (>= 3.0.0)
|
||||
sqlite3 (1.3.11)
|
||||
sqlite3 (1.3.13)
|
||||
telegramAPI (1.2.2)
|
||||
rest-client (~> 2.0, >= 1.7.3)
|
||||
rest-client (~> 1.7, >= 1.7.3)
|
||||
term-ansicolor (1.6.0)
|
||||
tins (~> 1.0)
|
||||
test-unit (3.2.1)
|
||||
test-unit (3.2.5)
|
||||
power_assert
|
||||
therubyracer (0.12.3)
|
||||
libv8 (~> 3.16.14.15)
|
||||
ref
|
||||
thor (0.19.4)
|
||||
thread_safe (0.3.6)
|
||||
tilt (2.0.5)
|
||||
tilt (2.0.8)
|
||||
tins (1.15.0)
|
||||
twitter (5.17.0)
|
||||
addressable (~> 2.3)
|
||||
twitter (6.1.0)
|
||||
addressable (~> 2.5)
|
||||
buftok (~> 0.2.0)
|
||||
equalizer (= 0.0.10)
|
||||
faraday (~> 0.9.0)
|
||||
http (~> 1.0)
|
||||
equalizer (= 0.0.11)
|
||||
faraday (~> 0.11.0)
|
||||
http (~> 2.1)
|
||||
http_parser.rb (~> 0.6.0)
|
||||
json (~> 1.8)
|
||||
memoizable (~> 0.4.0)
|
||||
naught (~> 1.0)
|
||||
simple_oauth (~> 0.3.0)
|
||||
memoizable (~> 0.4.2)
|
||||
naught (~> 1.1)
|
||||
simple_oauth (~> 0.3.1)
|
||||
tzinfo (1.2.3)
|
||||
thread_safe (~> 0.1)
|
||||
uglifier (3.0.2)
|
||||
uglifier (3.2.0)
|
||||
execjs (>= 0.3.0, < 3)
|
||||
unf (0.1.4)
|
||||
unf_ext
|
||||
unf_ext (0.0.7.4)
|
||||
unicode-display_width (1.1.1)
|
||||
unicode-display_width (1.3.0)
|
||||
unicorn (5.3.0)
|
||||
kgio (~> 2.6)
|
||||
raindrops (~> 0.7)
|
||||
valid_email2 (2.0.0)
|
||||
valid_email2 (2.0.1)
|
||||
activemodel (>= 3.2)
|
||||
mail (~> 2.5)
|
||||
viewpoint (1.1.0)
|
||||
|
@ -443,7 +448,9 @@ GEM
|
|||
addressable (>= 2.3.6)
|
||||
crack (>= 0.3.2)
|
||||
hashdiff
|
||||
websocket (1.2.3)
|
||||
websocket-driver (0.6.5)
|
||||
websocket-extensions (>= 0.1.0)
|
||||
websocket-extensions (0.1.2)
|
||||
writeexcel (1.0.5)
|
||||
zendesk_api (1.14.4)
|
||||
faraday (~> 0.9)
|
||||
|
@ -507,7 +514,7 @@ DEPENDENCIES
|
|||
pre-commit
|
||||
puma
|
||||
rack-livereload
|
||||
rails (= 4.2.9)
|
||||
rails (= 5.0.5)
|
||||
rails-observers
|
||||
rb-fsevent
|
||||
rspec-rails
|
||||
|
@ -539,4 +546,4 @@ RUBY VERSION
|
|||
ruby 2.4.1p111
|
||||
|
||||
BUNDLED WITH
|
||||
1.15.3
|
||||
1.15.4
|
||||
|
|
|
@ -4,6 +4,7 @@ class Index extends App.ControllerSubContent
|
|||
events:
|
||||
'click .js-resetToken': 'resetToken'
|
||||
'click .js-select': 'selectAll'
|
||||
'click .js-restartFailedJobs': 'restartFailedJobs'
|
||||
|
||||
constructor: ->
|
||||
super
|
||||
|
@ -42,4 +43,14 @@ class Index extends App.ControllerSubContent
|
|||
@load()
|
||||
)
|
||||
|
||||
restartFailedJobs: (e) =>
|
||||
e.preventDefault()
|
||||
@ajax(
|
||||
id: 'restart_failed_jobs_request'
|
||||
type: 'POST'
|
||||
url: "#{@apiPath}/monitoring/restart_failed_jobs"
|
||||
success: (data) =>
|
||||
@load()
|
||||
)
|
||||
|
||||
App.Config.set('Monitoring', { prio: 3600, name: 'Monitoring', parent: '#system', target: '#system/monitoring', controller: Index, permission: ['admin.monitoring'] }, 'NavBarAdmin')
|
||||
|
|
|
@ -34,6 +34,9 @@
|
|||
<% end %>
|
||||
<% end %>
|
||||
</ul>
|
||||
<% if _.contains(@data.actions, 'restart_failed_jobs'): %>
|
||||
<button class="btn btn--primary js-restartFailedJobs"><%- @T('Restart failed jobs') %></button>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
</div>
|
|
@ -1,10 +1,6 @@
|
|||
module ApplicationController::Authenticates
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
skip_before_action :verify_authenticity_token
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def response_access_deny
|
||||
|
|
|
@ -58,7 +58,7 @@ class ApplicationsController < ApplicationController
|
|||
private
|
||||
|
||||
def clean_params
|
||||
params_data = params.permit! #.to_h
|
||||
params_data = params.permit!.to_h
|
||||
params_data.delete('application')
|
||||
params_data.delete('action')
|
||||
params_data.delete('controller')
|
||||
|
|
|
@ -13,10 +13,10 @@ module CreatesTicketArticles
|
|||
raise Exceptions::UnprocessableEntity, 'Need at least article: { body: "some text" }' if !params[:body]
|
||||
|
||||
# fill default values
|
||||
if params[:type_id].empty? && params[:type].empty?
|
||||
if params[:type_id].blank? && params[:type].blank?
|
||||
params[:type_id] = Ticket::Article::Type.lookup(name: 'note').id
|
||||
end
|
||||
if params[:sender_id].empty? && params[:sender].empty?
|
||||
if params[:sender_id].blank? && params[:sender].blank?
|
||||
sender = 'Customer'
|
||||
if current_user.permissions?('ticket.agent')
|
||||
sender = 'Agent'
|
||||
|
@ -73,7 +73,7 @@ module CreatesTicketArticles
|
|||
}
|
||||
|
||||
# add attachments as param
|
||||
if params[:attachments]
|
||||
if params[:attachments].present?
|
||||
params[:attachments].each_with_index { |attachment, index|
|
||||
|
||||
# validation
|
||||
|
@ -112,7 +112,7 @@ module CreatesTicketArticles
|
|||
)
|
||||
end
|
||||
|
||||
return article if !form_id
|
||||
return article if form_id.blank?
|
||||
|
||||
# remove attachments from upload cache
|
||||
Store.remove(
|
||||
|
|
|
@ -9,7 +9,7 @@ class Integration::SipgateController < ApplicationController
|
|||
# notify about inbound call / block inbound call
|
||||
def in
|
||||
if params['event'] == 'newCall'
|
||||
config_inbound = config[:inbound] || {}
|
||||
config_inbound = config_integration[:inbound] || {}
|
||||
block_caller_ids = config_inbound[:block_caller_ids] || []
|
||||
|
||||
# check if call need to be blocked
|
||||
|
@ -43,8 +43,8 @@ class Integration::SipgateController < ApplicationController
|
|||
|
||||
# set caller id of outbound call
|
||||
def out
|
||||
config_outbound = config[:outbound][:routing_table]
|
||||
default_caller_id = config[:outbound][:default_caller_id]
|
||||
config_outbound = config_integration[:outbound][:routing_table]
|
||||
default_caller_id = config_integration[:outbound][:default_caller_id]
|
||||
|
||||
xml = Builder::XmlMarkup.new(indent: 2)
|
||||
xml.instruct!
|
||||
|
@ -89,14 +89,14 @@ class Integration::SipgateController < ApplicationController
|
|||
xml_error('Feature is disable, please contact your admin to enable it!')
|
||||
return
|
||||
end
|
||||
if !config || !config[:inbound] || !config[:outbound]
|
||||
if !config_integration || !config_integration[:inbound] || !config_integration[:outbound]
|
||||
xml_error('Feature not configured, please contact your admin!')
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
def config
|
||||
@config ||= Setting.get('sipgate_config')
|
||||
def config_integration
|
||||
@config_integration ||= Setting.get('sipgate_config')
|
||||
end
|
||||
|
||||
def xml_error(error)
|
||||
|
|
|
@ -30,6 +30,7 @@ curl http://localhost/api/v1/monitoring/health_check?token=XXX
|
|||
token_or_permission_check
|
||||
|
||||
issues = []
|
||||
actions = Set.new
|
||||
|
||||
# channel check
|
||||
last_run_tolerance = Time.zone.now - 1.hour
|
||||
|
@ -81,6 +82,11 @@ curl http://localhost/api/v1/monitoring/health_check?token=XXX
|
|||
issues.push 'scheduler not running'
|
||||
end
|
||||
|
||||
Scheduler.failed_jobs.each do |job|
|
||||
issues.push "Failed to run scheduled job '#{job.name}'. Cause: #{job.error_message}"
|
||||
actions.add(:restart_failed_jobs)
|
||||
end
|
||||
|
||||
token = Setting.get('monitoring_token')
|
||||
|
||||
if issues.empty?
|
||||
|
@ -96,8 +102,9 @@ curl http://localhost/api/v1/monitoring/health_check?token=XXX
|
|||
result = {
|
||||
healthy: false,
|
||||
message: issues.join(';'),
|
||||
issues: issues,
|
||||
token: token,
|
||||
issues: issues,
|
||||
actions: actions,
|
||||
token: token,
|
||||
}
|
||||
render json: result
|
||||
end
|
||||
|
@ -173,6 +180,14 @@ curl http://localhost/api/v1/monitoring/status?token=XXX
|
|||
render json: result, status: :created
|
||||
end
|
||||
|
||||
def restart_failed_jobs
|
||||
access_check
|
||||
|
||||
Scheduler.restart_failed_jobs
|
||||
|
||||
render json: {}, status: :ok
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def token_or_permission_check
|
||||
|
|
|
@ -31,15 +31,16 @@ class ObjectManagerAttributesController < ApplicationController
|
|||
)
|
||||
raise Exceptions::UnprocessableEntity, 'already exists' if exists
|
||||
|
||||
local_params = params.permit!.to_h
|
||||
begin
|
||||
object_manager_attribute = ObjectManager::Attribute.add(
|
||||
object: params[:object],
|
||||
name: params[:name],
|
||||
display: params[:display],
|
||||
data_type: params[:data_type],
|
||||
data_option: params[:data_option],
|
||||
active: params[:active],
|
||||
screens: params[:screens],
|
||||
object: local_params[:object],
|
||||
name: local_params[:name],
|
||||
display: local_params[:display],
|
||||
data_type: local_params[:data_type],
|
||||
data_option: local_params[:data_option],
|
||||
active: local_params[:active],
|
||||
screens: local_params[:screens],
|
||||
position: 1550,
|
||||
editable: true,
|
||||
)
|
||||
|
@ -52,15 +53,17 @@ class ObjectManagerAttributesController < ApplicationController
|
|||
# PUT /object_manager_attributes/1
|
||||
def update
|
||||
check_params
|
||||
|
||||
local_params = params.permit!.to_h
|
||||
begin
|
||||
object_manager_attribute = ObjectManager::Attribute.add(
|
||||
object: params[:object],
|
||||
name: params[:name],
|
||||
display: params[:display],
|
||||
data_type: params[:data_type],
|
||||
data_option: params[:data_option],
|
||||
active: params[:active],
|
||||
screens: params[:screens],
|
||||
object: local_params[:object],
|
||||
name: local_params[:name],
|
||||
display: local_params[:display],
|
||||
data_type: local_params[:data_type],
|
||||
data_option: local_params[:data_option],
|
||||
active: local_params[:active],
|
||||
screens: local_params[:screens],
|
||||
position: 1550,
|
||||
editable: true,
|
||||
)
|
||||
|
|
|
@ -252,7 +252,7 @@ curl http://localhost/api/v1/organization/{id} -v -u #{login}:#{password} -H "Co
|
|||
# do pagination if needed
|
||||
if params[:page] && params[:per_page]
|
||||
offset = (params[:page].to_i - 1) * params[:per_page].to_i
|
||||
organization_all = organization_all.slice(offset, params[:per_page].to_i) || []
|
||||
organization_all = organization_all[offset, params[:per_page].to_i] || []
|
||||
end
|
||||
|
||||
if params[:expand]
|
||||
|
|
|
@ -24,7 +24,7 @@ class SessionsController < ApplicationController
|
|||
if params[:remember_me]
|
||||
expire_after = 1.year
|
||||
end
|
||||
env['rack.session.options'][:expire_after] = expire_after
|
||||
request.env['rack.session.options'][:expire_after] = expire_after
|
||||
|
||||
# set session user
|
||||
current_user_set(user)
|
||||
|
|
|
@ -93,7 +93,7 @@ class TicketsController < ApplicationController
|
|||
render json: { error: 'Invalid email of customer' }, status: :unprocessable_entity
|
||||
return
|
||||
end
|
||||
customer = User.find_by(email: email)
|
||||
customer = User.find_by(email: email.downcase)
|
||||
if !customer
|
||||
role_ids = Role.signup_role_ids
|
||||
customer = User.create(
|
||||
|
@ -122,7 +122,7 @@ class TicketsController < ApplicationController
|
|||
ticket.with_lock do
|
||||
|
||||
# create tags if given
|
||||
if params[:tags] && !params[:tags].empty?
|
||||
if params[:tags].present?
|
||||
tags = params[:tags].split(/,/)
|
||||
tags.each { |tag|
|
||||
ticket.tag_add(tag)
|
||||
|
@ -142,12 +142,13 @@ class TicketsController < ApplicationController
|
|||
# child: [ticket_id1, ticket_id2, ...]
|
||||
# },
|
||||
# }
|
||||
if params[:links]
|
||||
raise 'Invalid link structure' if params[:links].to_h.class != Hash
|
||||
params[:links].each { |target_object, link_types_with_object_ids|
|
||||
raise 'Invalid link structure (Object)' if link_types_with_object_ids.to_h.class != Hash
|
||||
if params[:links].present?
|
||||
link = params[:links].permit!.to_h
|
||||
raise Exceptions::UnprocessableEntity, 'Invalid link structure' if !link.is_a? Hash
|
||||
link.each { |target_object, link_types_with_object_ids|
|
||||
raise Exceptions::UnprocessableEntity, 'Invalid link structure (Object)' if !link_types_with_object_ids.is_a? Hash
|
||||
link_types_with_object_ids.each { |link_type, object_ids|
|
||||
raise 'Invalid link structure (Object->LinkType)' if object_ids.class != Array
|
||||
raise Exceptions::UnprocessableEntity, 'Invalid link structure (Object->LinkType)' if !object_ids.is_a? Array
|
||||
object_ids.each { |local_object_id|
|
||||
link = Link.add(
|
||||
link_type: link_type,
|
||||
|
@ -399,7 +400,7 @@ class TicketsController < ApplicationController
|
|||
# do pagination if needed
|
||||
if params[:page] && params[:per_page]
|
||||
offset = (params[:page].to_i - 1) * params[:per_page].to_i
|
||||
tickets = tickets.slice(offset, params[:per_page].to_i) || []
|
||||
tickets = tickets[offset, params[:per_page].to_i] || []
|
||||
end
|
||||
|
||||
if params[:expand]
|
||||
|
|
|
@ -378,7 +378,7 @@ class UsersController < ApplicationController
|
|||
# do pagination if needed
|
||||
if params[:page] && params[:per_page]
|
||||
offset = (params[:page].to_i - 1) * params[:per_page].to_i
|
||||
user_all = user_all.slice(offset, params[:per_page].to_i) || []
|
||||
user_all = user_all[offset, params[:per_page].to_i] || []
|
||||
end
|
||||
|
||||
if params[:expand]
|
||||
|
|
|
@ -293,6 +293,10 @@ returns
|
|||
|
||||
def association_name_to_id_convert(params)
|
||||
|
||||
if params.respond_to?(:permit!)
|
||||
params = params.permit!.to_h
|
||||
end
|
||||
|
||||
data = {}
|
||||
params.each { |key, value|
|
||||
data[key.to_sym] = value
|
||||
|
|
|
@ -23,8 +23,8 @@ returns
|
|||
|
||||
def param_cleanup(params, new_object = false)
|
||||
|
||||
if params.respond_to?('permit!')
|
||||
params.permit!
|
||||
if params.respond_to?(:permit!)
|
||||
params = params.permit!.to_h
|
||||
end
|
||||
|
||||
if params.nil?
|
||||
|
|
|
@ -257,7 +257,7 @@ module HasGroups
|
|||
end
|
||||
|
||||
def destroy_group_relations
|
||||
group_through.klass.destroy_all(group_through.foreign_key => id)
|
||||
group_through.klass.where(group_through.foreign_key => id).destroy_all
|
||||
end
|
||||
|
||||
# methods defined here are going to extend the class, not the instance of it
|
||||
|
|
|
@ -223,9 +223,9 @@ returns
|
|||
|
||||
lookup(extract_numbers(caller_id)).each { |record|
|
||||
if record.level == 'known'
|
||||
preferences_known[direction].push record
|
||||
preferences_known[direction].push record.attributes
|
||||
else
|
||||
preferences_maybe[direction].push record
|
||||
preferences_maybe[direction].push record.attributes
|
||||
end
|
||||
comment = ''
|
||||
if record.user_id
|
||||
|
|
|
@ -338,7 +338,7 @@ Cti::Log.process(
|
|||
log.comment = comment
|
||||
log.save
|
||||
else
|
||||
raise ArgumentError, "Unknown event #{event}"
|
||||
raise ArgumentError, "Unknown event #{event.inspect}"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -18,10 +18,10 @@ class Observer::Organization::RefObjectTouch < ActiveRecord::Observer
|
|||
def ref_object_touch(record)
|
||||
|
||||
# return if we run import mode
|
||||
return if Setting.get('import_mode')
|
||||
return true if Setting.get('import_mode')
|
||||
|
||||
# featrue used for different propose, do not touch references
|
||||
return if User.where(organization_id: record.id).count > 100
|
||||
return true if User.where(organization_id: record.id).count > 100
|
||||
|
||||
# touch organizations tickets
|
||||
Ticket.select('id').where(organization_id: record.id).pluck(:id).each { |ticket_id|
|
||||
|
@ -32,11 +32,12 @@ class Observer::Organization::RefObjectTouch < ActiveRecord::Observer
|
|||
}
|
||||
|
||||
# touch current members
|
||||
record.member_ids.uniq.each { |user_id|
|
||||
User.select('id').where(organization_id: record.id).pluck(:id).each { |user_id|
|
||||
user = User.find(user_id)
|
||||
user.with_lock do
|
||||
user.touch
|
||||
end
|
||||
}
|
||||
true
|
||||
end
|
||||
end
|
||||
|
|
|
@ -18,7 +18,7 @@ class Observer::User::RefObjectTouch < ActiveRecord::Observer
|
|||
def ref_object_touch(record)
|
||||
|
||||
# return if we run import mode
|
||||
return if Setting.get('import_mode')
|
||||
return true if Setting.get('import_mode')
|
||||
|
||||
# touch old organization if changed
|
||||
member_ids = []
|
||||
|
@ -47,9 +47,9 @@ class Observer::User::RefObjectTouch < ActiveRecord::Observer
|
|||
|
||||
# touch old/current customer
|
||||
member_ids.uniq.each { |user_id|
|
||||
if user_id != record.id
|
||||
User.find(user_id).touch
|
||||
end
|
||||
next if user_id == record.id
|
||||
User.find(user_id).touch
|
||||
}
|
||||
true
|
||||
end
|
||||
end
|
||||
|
|
|
@ -73,7 +73,7 @@ returns
|
|||
query.delete! '*'
|
||||
organizations = Organization.where(
|
||||
'name LIKE ? OR note LIKE ?', "%#{query}%", "%#{query}%"
|
||||
).order('name').limit(limit)
|
||||
).order('name').limit(limit).to_a
|
||||
|
||||
# if only a few organizations are found, search for names of users
|
||||
if organizations.length <= 3
|
||||
|
|
|
@ -42,7 +42,7 @@ class Overview < ApplicationModel
|
|||
|
||||
def link_name(name)
|
||||
local_link = name.downcase
|
||||
local_link = local_link.parameterize('_')
|
||||
local_link = local_link.parameterize(separator: '_')
|
||||
local_link.gsub!(/\s/, '_')
|
||||
local_link.gsub!(/_+/, '_')
|
||||
local_link = URI.escape(local_link)
|
||||
|
|
|
@ -114,7 +114,7 @@ returns
|
|||
permission_ids.push permission.id
|
||||
}
|
||||
next if permission_ids.empty?
|
||||
Role.joins(:roles_permissions).joins(:permissions).where('permissions_roles.permission_id IN (?) AND roles.active = ? AND permissions.active = ?', permission_ids, true, true).uniq().each { |role|
|
||||
Role.joins(:roles_permissions).joins(:permissions).where('permissions_roles.permission_id IN (?) AND roles.active = ? AND permissions.active = ?', permission_ids, true, true).distinct().each { |role|
|
||||
roles.push role
|
||||
}
|
||||
}
|
||||
|
|
|
@ -169,9 +169,13 @@ class Scheduler < ApplicationModel
|
|||
end
|
||||
|
||||
def self._start_job(job, try_count = 0, try_run_time = Time.zone.now)
|
||||
job.last_run = Time.zone.now
|
||||
job.pid = Thread.current.object_id
|
||||
job.save
|
||||
job.update(
|
||||
last_run: Time.zone.now,
|
||||
pid: Thread.current.object_id,
|
||||
status: 'ok',
|
||||
error_message: '',
|
||||
)
|
||||
|
||||
logger.info "execute #{job.method} (try_count #{try_count})..."
|
||||
eval job.method() # rubocop:disable Lint/Eval
|
||||
rescue => e
|
||||
|
@ -197,7 +201,15 @@ class Scheduler < ApplicationModel
|
|||
if try_run_max > try_count
|
||||
_start_job(job, try_count, try_run_time)
|
||||
else
|
||||
raise "STOP thread for #{job.method} after #{try_count} tries (#{e.inspect})"
|
||||
@@jobs_started[ job.id ] = false
|
||||
error = "Failed to run #{job.method} after #{try_count} tries #{e.inspect}"
|
||||
logger.error error
|
||||
|
||||
job.update(
|
||||
error_message: error,
|
||||
status: 'error',
|
||||
active: false,
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -255,4 +267,28 @@ class Scheduler < ApplicationModel
|
|||
|
||||
end
|
||||
|
||||
# This function returns a list of failed jobs
|
||||
#
|
||||
# @example
|
||||
# Scheduler.failed_jobs
|
||||
#
|
||||
# return [Array]
|
||||
def self.failed_jobs
|
||||
where(status: 'error', active: false)
|
||||
end
|
||||
|
||||
# This function restarts failed jobs to retry them
|
||||
#
|
||||
# @example
|
||||
# Scheduler.restart_failed_jobs
|
||||
#
|
||||
# return [true]
|
||||
def self.restart_failed_jobs
|
||||
failed_jobs.each do |job|
|
||||
job.update(active: true)
|
||||
end
|
||||
|
||||
true
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -13,16 +13,15 @@ class Taskbar < ApplicationModel
|
|||
attr_accessor :local_update
|
||||
|
||||
def state_changed?
|
||||
return false if !state
|
||||
return false if state.empty?
|
||||
return false if state.blank?
|
||||
state.each { |_key, value|
|
||||
if value.class == Hash || value.class == ActiveSupport::HashWithIndifferentAccess
|
||||
if value.is_a? Hash
|
||||
value.each { |_key1, value1|
|
||||
next if value1 && value1.empty?
|
||||
next if value1.blank?
|
||||
return true
|
||||
}
|
||||
else
|
||||
next if value && value.empty?
|
||||
next if value.blank?
|
||||
return true
|
||||
end
|
||||
}
|
||||
|
|
|
@ -505,7 +505,7 @@ returns
|
|||
permission_ids.push permission.id
|
||||
}
|
||||
next if permission_ids.empty?
|
||||
Role.joins(:roles_permissions).joins(:permissions).where('permissions_roles.permission_id IN (?) AND roles.active = ? AND permissions.active = ?', permission_ids, true, true).uniq().pluck(:id).each { |role_id|
|
||||
Role.joins(:roles_permissions).joins(:permissions).where('permissions_roles.permission_id IN (?) AND roles.active = ? AND permissions.active = ?', permission_ids, true, true).distinct().pluck(:id).each { |role_id|
|
||||
role_ids.push role_id
|
||||
}
|
||||
total_role_ids.push role_ids
|
||||
|
|
|
@ -12,11 +12,9 @@ module Zammad
|
|||
# Application configuration should go into files in config/initializers
|
||||
# -- all .rb files in that directory are automatically loaded.
|
||||
|
||||
# Do not swallow errors in after_commit/after_rollback callbacks.
|
||||
config.active_record.raise_in_transactional_callbacks = true
|
||||
|
||||
# Custom directories with classes and modules you want to be autoloadable.
|
||||
config.autoload_paths += %W(#{config.root}/lib)
|
||||
config.eager_load_paths += %W(#{config.root}/lib)
|
||||
|
||||
# Activate observers that should always be running.
|
||||
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
|
||||
|
|
|
@ -22,7 +22,7 @@ Rails.application.configure do
|
|||
|
||||
# Disable serving static files from the `/public` folder by default since
|
||||
# Apache or NGINX already handles this.
|
||||
config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
|
||||
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
|
||||
|
||||
# Compress JavaScripts and CSS.
|
||||
config.assets.js_compressor = :uglifier
|
||||
|
|
|
@ -13,8 +13,8 @@ Rails.application.configure do
|
|||
config.eager_load = false
|
||||
|
||||
# Configure static file server for tests with Cache-Control for performance.
|
||||
config.serve_static_files = true
|
||||
config.static_cache_control = 'public, max-age=3600'
|
||||
config.public_file_server.enabled = true
|
||||
config.public_file_server.headers = { 'Cache-Control' => 'public, max-age=3600' }
|
||||
|
||||
# Show full error reports and disable caching.
|
||||
config.consider_all_requests_local = true
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
Zammad::Application.routes.draw do
|
||||
api_path = Rails.configuration.api_path
|
||||
|
||||
match api_path + '/monitoring/health_check', to: 'monitoring#health_check', via: :get
|
||||
match api_path + '/monitoring/status', to: 'monitoring#status', via: :get
|
||||
match api_path + '/monitoring/token', to: 'monitoring#token', via: :post
|
||||
match api_path + '/monitoring/health_check', to: 'monitoring#health_check', via: :get
|
||||
match api_path + '/monitoring/status', to: 'monitoring#status', via: :get
|
||||
match api_path + '/monitoring/token', to: 'monitoring#token', via: :post
|
||||
match api_path + '/monitoring/restart_failed_jobs', to: 'monitoring#restart_failed_jobs', via: :post
|
||||
|
||||
end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class CreateBase < ActiveRecord::Migration
|
||||
class CreateBase < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
|
||||
# clear old caches to start from scratch
|
||||
|
@ -514,6 +514,8 @@ class CreateBase < ActiveRecord::Migration
|
|||
t.integer :prio, null: false
|
||||
t.string :pid, limit: 250, null: true
|
||||
t.string :note, limit: 250, null: true
|
||||
t.string :error_message, null: true
|
||||
t.string :status, null: true
|
||||
t.boolean :active, null: false, default: false
|
||||
t.integer :updated_by_id, null: false
|
||||
t.integer :created_by_id, null: false
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class CreateTicket < ActiveRecord::Migration
|
||||
class CreateTicket < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
create_table :ticket_state_types do |t|
|
||||
t.column :name, :string, limit: 250, null: false
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class CreateNetwork < ActiveRecord::Migration
|
||||
class CreateNetwork < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
create_table :networks do |t|
|
||||
t.column :name, :string, limit: 100, null: false
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class UpdateTimestamps < ActiveRecord::Migration
|
||||
class UpdateTimestamps < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
# get all models
|
||||
Models.all.each { |_model, value|
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class ObjectManagerUpdateUser < ActiveRecord::Migration
|
||||
class ObjectManagerUpdateUser < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
|
||||
# return if it's a new setup
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class PermissionActive < ActiveRecord::Migration
|
||||
class PermissionActive < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
# return if it's a new setup
|
||||
return if !Setting.find_by(name: 'system_init_done')
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class CreateDoorkeeperTables < ActiveRecord::Migration
|
||||
class CreateDoorkeeperTables < ActiveRecord::Migration[4.2]
|
||||
def change
|
||||
create_table :oauth_applications do |t|
|
||||
t.string :name, null: false
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class OrganizationDomainBasedAssignment < ActiveRecord::Migration
|
||||
class OrganizationDomainBasedAssignment < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
# return if it's a new setup
|
||||
return if !Setting.find_by(name: 'system_init_done')
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class JobUnableToCreateIssue432 < ActiveRecord::Migration
|
||||
class JobUnableToCreateIssue432 < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
# return if it's a new setup
|
||||
return if !Setting.find_by(name: 'system_init_done')
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class TicketNumberGeneratorIssue427 < ActiveRecord::Migration
|
||||
class TicketNumberGeneratorIssue427 < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
# return if it's a new setup
|
||||
return if !Setting.find_by(name: 'system_init_done')
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class StoreConfigNameUpdateIssue428 < ActiveRecord::Migration
|
||||
class StoreConfigNameUpdateIssue428 < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
# return if it's a new setup
|
||||
return if !Setting.find_by(name: 'system_init_done')
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class MonitoringIssue453 < ActiveRecord::Migration
|
||||
class MonitoringIssue453 < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
# return if it's a new setup
|
||||
return if !Setting.find_by(name: 'system_init_done')
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class AddTaskbarMeta < ActiveRecord::Migration
|
||||
class AddTaskbarMeta < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
# return if it's a new setup
|
||||
return if !Setting.find_by(name: 'system_init_done')
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class ObjectManagerAttributeCreateMiddle < ActiveRecord::Migration
|
||||
class ObjectManagerAttributeCreateMiddle < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
# return if it's a new setup
|
||||
return if !Setting.find_by(name: 'system_init_done')
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class SlackGroupConfigIssue587 < ActiveRecord::Migration
|
||||
class SlackGroupConfigIssue587 < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
|
||||
# return if it's a new setup
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class AddTicketTimeAccounting373 < ActiveRecord::Migration
|
||||
class AddTicketTimeAccounting373 < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
|
||||
# return if it's a new setup
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class FixedTypos622 < ActiveRecord::Migration
|
||||
class FixedTypos622 < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
|
||||
# return if it's a new setup
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class UnableToEnableTimeAccounting633 < ActiveRecord::Migration
|
||||
class UnableToEnableTimeAccounting633 < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
|
||||
# return if it's a new setup
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class LoginEmailLength650 < ActiveRecord::Migration
|
||||
class LoginEmailLength650 < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
|
||||
# return if it's a new setup
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class UiTicketZoomArticleNewInternal < ActiveRecord::Migration
|
||||
class UiTicketZoomArticleNewInternal < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
|
||||
# return if it's a new setup
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class FixedTranslation < ActiveRecord::Migration
|
||||
class FixedTranslation < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
|
||||
# return if it's a new setup
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class ApplicationSecretSetting < ActiveRecord::Migration
|
||||
class ApplicationSecretSetting < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
|
||||
# return if it's a new setup
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class FollowUpPossibleCheck643 < ActiveRecord::Migration
|
||||
class FollowUpPossibleCheck643 < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
|
||||
# return if it's a new setup
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class RemoveLastLoginFromHistory722 < ActiveRecord::Migration
|
||||
class RemoveLastLoginFromHistory722 < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
|
||||
# return if it's a new setup
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class DoNotImportOnwNotifications731 < ActiveRecord::Migration
|
||||
class DoNotImportOnwNotifications731 < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
|
||||
# return if it's a new setup
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class TicketStatePriorityDefaults < ActiveRecord::Migration
|
||||
class TicketStatePriorityDefaults < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
|
||||
# return if it's a new setup
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class ReloadOnlineBrowserAfterCorsCsrfChanges < ActiveRecord::Migration
|
||||
class ReloadOnlineBrowserAfterCorsCsrfChanges < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
|
||||
# return if it's a new setup
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class TelegramSupport < ActiveRecord::Migration
|
||||
class TelegramSupport < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
|
||||
# return if it's a new setup
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class FixedTranslation2 < ActiveRecord::Migration
|
||||
class FixedTranslation2 < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
|
||||
# return if it's a new setup
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class FixedAdminUserPermission920 < ActiveRecord::Migration
|
||||
class FixedAdminUserPermission920 < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
|
||||
# return if it's a new setup
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class ValidateAgentLimit < ActiveRecord::Migration
|
||||
class ValidateAgentLimit < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
# return if it's a new setup
|
||||
return if !Setting.find_by(name: 'system_init_done')
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class LdapSupport < ActiveRecord::Migration
|
||||
class LdapSupport < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
|
||||
# return if it's a new setup
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class OverviewRoleIds < ActiveRecord::Migration
|
||||
class OverviewRoleIds < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
|
||||
# return if it's a new setup
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class ChatIncreaseMessageSize < ActiveRecord::Migration
|
||||
class ChatIncreaseMessageSize < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
|
||||
# return if it's a new setup
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class PrettyDateOptionsAdded < ActiveRecord::Migration
|
||||
class PrettyDateOptionsAdded < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
|
||||
# return if it's a new setup
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class AddOriginById < ActiveRecord::Migration
|
||||
class AddOriginById < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
|
||||
# return if it's a new setup
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class AddReplyTo < ActiveRecord::Migration
|
||||
class AddReplyTo < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
|
||||
# return if it's a new setup
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class FollowUpMerged < ActiveRecord::Migration
|
||||
class FollowUpMerged < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
|
||||
# return if it's a new setup
|
||||
|
|
12
db/migrate/20170515000001_scheduler_status.rb
Normal file
12
db/migrate/20170515000001_scheduler_status.rb
Normal file
|
@ -0,0 +1,12 @@
|
|||
class SchedulerStatus < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
|
||||
# return if it's a new setup
|
||||
return if !Setting.find_by(name: 'system_init_done')
|
||||
|
||||
change_table :schedulers do |t|
|
||||
t.string :error_message, null: true
|
||||
t.string :status, null: true
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,4 +1,4 @@
|
|||
class TriggerRecipientUpdate < ActiveRecord::Migration
|
||||
class TriggerRecipientUpdate < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
|
||||
# return if it's a new setup
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class ReplyToSenderFeature < ActiveRecord::Migration
|
||||
class ReplyToSenderFeature < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
|
||||
# return if it's a new setup
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class SettingDeliveryPermanentFailed < ActiveRecord::Migration
|
||||
class SettingDeliveryPermanentFailed < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
|
||||
# return if it's a new setup
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class LdapMultiGroupMapping < ActiveRecord::Migration
|
||||
class LdapMultiGroupMapping < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
|
||||
# return if it's a new setup
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class ForeignKeys < ActiveRecord::Migration
|
||||
class ForeignKeys < ActiveRecord::Migration[4.2]
|
||||
disable_ddl_transaction!
|
||||
|
||||
def change
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class EnhancedPermissions < ActiveRecord::Migration
|
||||
class EnhancedPermissions < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
|
||||
# return if it's a new setup
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class TreeSelect < ActiveRecord::Migration
|
||||
class TreeSelect < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
|
||||
# return if it's a new setup
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class LocaleAddDirection < ActiveRecord::Migration
|
||||
class LocaleAddDirection < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
|
||||
# return if it's a new setup
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class FormGroupSelection < ActiveRecord::Migration
|
||||
class FormGroupSelection < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
|
||||
# return if it's a new setup
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class ExchangeIntegration < ActiveRecord::Migration
|
||||
class ExchangeIntegration < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
|
||||
# return if it's a new setup
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class OmniauthOffice365Setting < ActiveRecord::Migration
|
||||
class OmniauthOffice365Setting < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
|
||||
# return if it's a new setup
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class TicketZoomSetting2 < ActiveRecord::Migration
|
||||
class TicketZoomSetting2 < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
|
||||
# return if it's a new setup
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class ObjectManagerUserEmailOptional < ActiveRecord::Migration
|
||||
class ObjectManagerUserEmailOptional < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
|
||||
# return if it's a new setup
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class UserEmailMultipleUse < ActiveRecord::Migration
|
||||
class UserEmailMultipleUse < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
|
||||
# return if it's a new setup
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class CleanupCtiLog < ActiveRecord::Migration
|
||||
class CleanupCtiLog < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
|
||||
# return if it's a new setup
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class FixedTwitterTicketArticlePreferences3 < ActiveRecord::Migration
|
||||
class FixedTwitterTicketArticlePreferences3 < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
|
||||
# return if it's a new setup
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class SettingProxy < ActiveRecord::Migration
|
||||
class SettingProxy < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
|
||||
# return if it's a new setup
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class IdoitSupport < ActiveRecord::Migration
|
||||
class IdoitSupport < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
|
||||
# return if it's a new setup
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class CheckMkIntegration < ActiveRecord::Migration
|
||||
class CheckMkIntegration < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
|
||||
# return if it's a new setup
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class AgendBasedSenderIssue1351 < ActiveRecord::Migration
|
||||
class AgendBasedSenderIssue1351 < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
|
||||
# return if it's a new setup
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class OutOfOffice < ActiveRecord::Migration
|
||||
class OutOfOffice < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
|
||||
# return if it's a new setup
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class LastOwnerUpdate < ActiveRecord::Migration
|
||||
class LastOwnerUpdate < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
|
||||
# return if it's a new setup
|
||||
|
|
47
db/migrate/20170905140038_cti_log_preferences_migration.rb
Normal file
47
db/migrate/20170905140038_cti_log_preferences_migration.rb
Normal file
|
@ -0,0 +1,47 @@
|
|||
# Rails dropped the class
|
||||
# ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter::MysqlDateTime
|
||||
# via: https://github.com/rails/rails/commit/f1a0fa9e19b7e4ccaea191fc6cf0613880222ee7
|
||||
# which we use in stored Cti::Log instance preferences.
|
||||
# Since we don't need the instances but just an Hash we have to:
|
||||
# - create a dummy class
|
||||
# - loop over all instances
|
||||
# - deserialize them in the preferences
|
||||
# - replace them in the preferences with the Hash version
|
||||
|
||||
# create a dummy class
|
||||
module ActiveRecord
|
||||
module ConnectionAdapters
|
||||
class AbstractMysqlAdapter
|
||||
class MysqlDateTime < Type::DateTime
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
class CtiLogPreferencesMigration < ActiveRecord::Migration[5.0]
|
||||
|
||||
def change
|
||||
# correct all entries
|
||||
Cti::Log.all.each do |item|
|
||||
next if !item.preferences
|
||||
next if item.preferences.blank?
|
||||
|
||||
# check from and to keys which hold the instances
|
||||
%w(from to).each do |direction|
|
||||
next if item.preferences[direction].blank?
|
||||
|
||||
# loop over all instances and covert them
|
||||
# to an Hash via .attributes
|
||||
updated = item.preferences[direction].each_with_object([]) do |caller_id, new_direction|
|
||||
new_direction.push(caller_id.attributes)
|
||||
end
|
||||
|
||||
# overwrite the old key with the converted data
|
||||
item.preferences[direction] = updated
|
||||
end
|
||||
|
||||
# update entry
|
||||
item.save!
|
||||
end
|
||||
end
|
||||
end
|
|
@ -26,6 +26,7 @@ $(function() {
|
|||
tag: 'input',
|
||||
type: 'text',
|
||||
placeholder: 'Your Name',
|
||||
defaultValue: '',
|
||||
},
|
||||
{
|
||||
display: 'Email',
|
||||
|
@ -33,12 +34,14 @@ $(function() {
|
|||
tag: 'input',
|
||||
type: 'email',
|
||||
placeholder: 'Your Email',
|
||||
defaultValue: function () {return User.email;},
|
||||
},
|
||||
{
|
||||
display: 'Message',
|
||||
name: 'body',
|
||||
tag: 'textarea',
|
||||
placeholder: 'Your Message...',
|
||||
defaultValue: '',
|
||||
rows: 7,
|
||||
},
|
||||
{
|
||||
|
@ -74,6 +77,7 @@ $(function() {
|
|||
tag: 'input',
|
||||
type: 'text',
|
||||
placeholder: 'Your Name',
|
||||
defaultValue: '',
|
||||
},
|
||||
{
|
||||
display: 'Email',
|
||||
|
@ -81,12 +85,14 @@ $(function() {
|
|||
tag: 'input',
|
||||
type: 'email',
|
||||
placeholder: 'Your Email',
|
||||
defaultValue: '',
|
||||
},
|
||||
{
|
||||
display: 'Message',
|
||||
name: 'body',
|
||||
tag: 'textarea',
|
||||
placeholder: 'Your Message...',
|
||||
defaultValue: '',
|
||||
rows: 7,
|
||||
},
|
||||
],
|
||||
|
@ -360,13 +366,14 @@ $(function() {
|
|||
$form.append('<h2>' + this.options.messageTitle + '</h2>')
|
||||
}
|
||||
$.each(this.options.attributes, function(index, value) {
|
||||
var item = $('<div class="form-group"><label>' + _this.T(value.display) + '</label></div>')
|
||||
var item = $('<div class="form-group"><label>' + _this.T(value.display) + '</label></div>');
|
||||
var defaultValue = (typeof value.defaultValue === 'function') ? value.defaultValue() : value.defaultValue;
|
||||
for (var i=0; i < (value.repeat ? value.repeat : 1); i++) {
|
||||
if (value.tag == 'input') {
|
||||
item.append('<input class="form-control" name="' + value.name + '" type="' + value.type + '" placeholder="' + _this.T(value.placeholder) + '">')
|
||||
item.append('<input class="form-control" name="' + value.name + '" type="' + value.type + '" placeholder="' + _this.T(value.placeholder) + '" value="' + (defaultValue || '') + '">')
|
||||
}
|
||||
else if (value.tag == 'textarea') {
|
||||
item.append('<textarea class="form-control" name="' + value.name + '" placeholder="' + _this.T(value.placeholder) + '" rows="' + value.rows + '"></textarea>')
|
||||
item.append('<textarea class="form-control" name="' + value.name + '" placeholder="' + _this.T(value.placeholder) + '" rows="' + value.rows + '">' + (defaultValue || '') + '</textarea>')
|
||||
}
|
||||
}
|
||||
$form.append(item)
|
||||
|
|
25
spec/factories/scheduler.rb
Normal file
25
spec/factories/scheduler.rb
Normal file
|
@ -0,0 +1,25 @@
|
|||
FactoryGirl.define do
|
||||
sequence :test_scheduler_name do |n|
|
||||
"Testscheduler#{n}"
|
||||
end
|
||||
end
|
||||
|
||||
FactoryGirl.define do
|
||||
|
||||
factory :scheduler do
|
||||
name { generate(:test_scheduler_name) }
|
||||
last_run { Time.zone.now }
|
||||
pid 1337
|
||||
prio 1
|
||||
status 'ok'
|
||||
active true
|
||||
period { 10.minutes }
|
||||
running false
|
||||
note 'test'
|
||||
updated_by_id 1
|
||||
created_by_id 1
|
||||
created_at 1
|
||||
updated_at 1
|
||||
add_attribute(:method) { 'test' }
|
||||
end
|
||||
end
|
|
@ -26,6 +26,45 @@ RSpec.describe Scheduler do
|
|||
SpecSpace.send(:remove_const, :DelayedJobBackend)
|
||||
end
|
||||
|
||||
describe '.failed_jobs' do
|
||||
|
||||
it 'does list failed jobs' do
|
||||
job = create(:scheduler, status: 'error', active: false)
|
||||
failed_list = described_class.failed_jobs
|
||||
expect(failed_list).to be_present
|
||||
expect(failed_list).to include(job)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
describe '.restart_failed_jobs' do
|
||||
|
||||
it 'does restart failed jobs' do
|
||||
job = create(:scheduler, status: 'error', active: false)
|
||||
described_class.restart_failed_jobs
|
||||
job.reload
|
||||
expect(job.active).to be true
|
||||
end
|
||||
end
|
||||
|
||||
describe '._start_job' do
|
||||
|
||||
it 'sets error status/message for failed jobs' do
|
||||
job = create(:scheduler)
|
||||
described_class._start_job(job)
|
||||
expect(job.status).to eq 'error'
|
||||
expect(job.active).to be false
|
||||
expect(job.error_message).to be_present
|
||||
end
|
||||
|
||||
it 'executes job that is expected to succeed' do
|
||||
expect(Setting).to receive(:reload)
|
||||
job = create(:scheduler, method: 'Setting.reload')
|
||||
described_class._start_job(job)
|
||||
expect(job.status).to eq 'ok'
|
||||
end
|
||||
end
|
||||
|
||||
describe '.cleanup' do
|
||||
|
||||
it 'gets called by .threads' do
|
||||
|
|
|
@ -55,7 +55,7 @@ class ApiAuthControllerTest < ActionDispatch::IntegrationTest
|
|||
admin_credentials = ActionController::HttpAuthentication::Basic.encode_credentials('api-admin@example.com', 'adminpw')
|
||||
|
||||
Setting.set('api_password_access', false)
|
||||
get '/api/v1/sessions', {}, @headers.merge('Authorization' => admin_credentials)
|
||||
get '/api/v1/sessions', params: {}, headers: @headers.merge('Authorization' => admin_credentials)
|
||||
assert_response(401)
|
||||
assert_not(@response.header.key?('Access-Control-Allow-Origin'))
|
||||
result = JSON.parse(@response.body)
|
||||
|
@ -63,7 +63,7 @@ class ApiAuthControllerTest < ActionDispatch::IntegrationTest
|
|||
assert_equal('API password access disabled!', result['error'])
|
||||
|
||||
Setting.set('api_password_access', true)
|
||||
get '/api/v1/sessions', {}, @headers.merge('Authorization' => admin_credentials)
|
||||
get '/api/v1/sessions', params: {}, headers: @headers.merge('Authorization' => admin_credentials)
|
||||
assert_response(200)
|
||||
assert_equal('*', @response.header['Access-Control-Allow-Origin'])
|
||||
result = JSON.parse(@response.body)
|
||||
|
@ -76,7 +76,7 @@ class ApiAuthControllerTest < ActionDispatch::IntegrationTest
|
|||
agent_credentials = ActionController::HttpAuthentication::Basic.encode_credentials('api-agent@example.com', 'agentpw')
|
||||
|
||||
Setting.set('api_password_access', false)
|
||||
get '/api/v1/tickets', {}, @headers.merge('Authorization' => agent_credentials)
|
||||
get '/api/v1/tickets', params: {}, headers: @headers.merge('Authorization' => agent_credentials)
|
||||
assert_response(401)
|
||||
assert_not(@response.header.key?('Access-Control-Allow-Origin'))
|
||||
result = JSON.parse(@response.body)
|
||||
|
@ -84,7 +84,7 @@ class ApiAuthControllerTest < ActionDispatch::IntegrationTest
|
|||
assert_equal('API password access disabled!', result['error'])
|
||||
|
||||
Setting.set('api_password_access', true)
|
||||
get '/api/v1/tickets', {}, @headers.merge('Authorization' => agent_credentials)
|
||||
get '/api/v1/tickets', params: {}, headers: @headers.merge('Authorization' => agent_credentials)
|
||||
assert_response(200)
|
||||
assert_equal('*', @response.header['Access-Control-Allow-Origin'])
|
||||
result = JSON.parse(@response.body)
|
||||
|
@ -97,7 +97,7 @@ class ApiAuthControllerTest < ActionDispatch::IntegrationTest
|
|||
customer_credentials = ActionController::HttpAuthentication::Basic.encode_credentials('api-customer1@example.com', 'customer1pw')
|
||||
|
||||
Setting.set('api_password_access', false)
|
||||
get '/api/v1/tickets', {}, @headers.merge('Authorization' => customer_credentials)
|
||||
get '/api/v1/tickets', params: {}, headers: @headers.merge('Authorization' => customer_credentials)
|
||||
assert_response(401)
|
||||
assert_not(@response.header.key?('Access-Control-Allow-Origin'))
|
||||
result = JSON.parse(@response.body)
|
||||
|
@ -105,7 +105,7 @@ class ApiAuthControllerTest < ActionDispatch::IntegrationTest
|
|||
assert_equal('API password access disabled!', result['error'])
|
||||
|
||||
Setting.set('api_password_access', true)
|
||||
get '/api/v1/tickets', {}, @headers.merge('Authorization' => customer_credentials)
|
||||
get '/api/v1/tickets', params: {}, headers: @headers.merge('Authorization' => customer_credentials)
|
||||
assert_response(200)
|
||||
assert_equal('*', @response.header['Access-Control-Allow-Origin'])
|
||||
result = JSON.parse(@response.body)
|
||||
|
@ -126,7 +126,7 @@ class ApiAuthControllerTest < ActionDispatch::IntegrationTest
|
|||
admin_credentials = "Token token=#{admin_token.name}"
|
||||
|
||||
Setting.set('api_token_access', false)
|
||||
get '/api/v1/sessions', {}, @headers.merge('Authorization' => admin_credentials)
|
||||
get '/api/v1/sessions', params: {}, headers: @headers.merge('Authorization' => admin_credentials)
|
||||
assert_response(401)
|
||||
assert_not(@response.header.key?('Access-Control-Allow-Origin'))
|
||||
result = JSON.parse(@response.body)
|
||||
|
@ -134,7 +134,7 @@ class ApiAuthControllerTest < ActionDispatch::IntegrationTest
|
|||
assert_equal('API token access disabled!', result['error'])
|
||||
|
||||
Setting.set('api_token_access', true)
|
||||
get '/api/v1/sessions', {}, @headers.merge('Authorization' => admin_credentials)
|
||||
get '/api/v1/sessions', params: {}, headers: @headers.merge('Authorization' => admin_credentials)
|
||||
assert_response(200)
|
||||
assert_equal('*', @response.header['Access-Control-Allow-Origin'])
|
||||
|
||||
|
@ -145,7 +145,7 @@ class ApiAuthControllerTest < ActionDispatch::IntegrationTest
|
|||
admin_token.preferences[:permission] = ['admin.session_not_existing']
|
||||
admin_token.save!
|
||||
|
||||
get '/api/v1/sessions', {}, @headers.merge('Authorization' => admin_credentials)
|
||||
get '/api/v1/sessions', params: {}, headers: @headers.merge('Authorization' => admin_credentials)
|
||||
assert_response(401)
|
||||
result = JSON.parse(@response.body)
|
||||
assert_equal(Hash, result.class)
|
||||
|
@ -154,7 +154,7 @@ class ApiAuthControllerTest < ActionDispatch::IntegrationTest
|
|||
admin_token.preferences[:permission] = []
|
||||
admin_token.save!
|
||||
|
||||
get '/api/v1/sessions', {}, @headers.merge('Authorization' => admin_credentials)
|
||||
get '/api/v1/sessions', params: {}, headers: @headers.merge('Authorization' => admin_credentials)
|
||||
assert_response(401)
|
||||
result = JSON.parse(@response.body)
|
||||
assert_equal(Hash, result.class)
|
||||
|
@ -163,7 +163,7 @@ class ApiAuthControllerTest < ActionDispatch::IntegrationTest
|
|||
@admin.active = false
|
||||
@admin.save!
|
||||
|
||||
get '/api/v1/sessions', {}, @headers.merge('Authorization' => admin_credentials)
|
||||
get '/api/v1/sessions', params: {}, headers: @headers.merge('Authorization' => admin_credentials)
|
||||
assert_response(401)
|
||||
result = JSON.parse(@response.body)
|
||||
assert_equal(Hash, result.class)
|
||||
|
@ -172,7 +172,7 @@ class ApiAuthControllerTest < ActionDispatch::IntegrationTest
|
|||
admin_token.preferences[:permission] = ['admin.session']
|
||||
admin_token.save!
|
||||
|
||||
get '/api/v1/sessions', {}, @headers.merge('Authorization' => admin_credentials)
|
||||
get '/api/v1/sessions', params: {}, headers: @headers.merge('Authorization' => admin_credentials)
|
||||
assert_response(401)
|
||||
result = JSON.parse(@response.body)
|
||||
assert_equal(Hash, result.class)
|
||||
|
@ -181,13 +181,13 @@ class ApiAuthControllerTest < ActionDispatch::IntegrationTest
|
|||
@admin.active = true
|
||||
@admin.save!
|
||||
|
||||
get '/api/v1/sessions', {}, @headers.merge('Authorization' => admin_credentials)
|
||||
get '/api/v1/sessions', params: {}, headers: @headers.merge('Authorization' => admin_credentials)
|
||||
assert_response(200)
|
||||
result = JSON.parse(@response.body)
|
||||
assert_equal(Hash, result.class)
|
||||
assert(result)
|
||||
|
||||
get '/api/v1/roles', {}, @headers.merge('Authorization' => admin_credentials)
|
||||
get '/api/v1/roles', params: {}, headers: @headers.merge('Authorization' => admin_credentials)
|
||||
assert_response(401)
|
||||
result = JSON.parse(@response.body)
|
||||
assert_equal(Hash, result.class)
|
||||
|
@ -196,7 +196,7 @@ class ApiAuthControllerTest < ActionDispatch::IntegrationTest
|
|||
admin_token.preferences[:permission] = ['admin.session_not_existing', 'admin.role']
|
||||
admin_token.save!
|
||||
|
||||
get '/api/v1/roles', {}, @headers.merge('Authorization' => admin_credentials)
|
||||
get '/api/v1/roles', params: {}, headers: @headers.merge('Authorization' => admin_credentials)
|
||||
assert_response(200)
|
||||
result = JSON.parse(@response.body)
|
||||
assert_equal(Array, result.class)
|
||||
|
@ -205,14 +205,14 @@ class ApiAuthControllerTest < ActionDispatch::IntegrationTest
|
|||
admin_token.preferences[:permission] = ['ticket.agent']
|
||||
admin_token.save!
|
||||
|
||||
get '/api/v1/organizations', {}, @headers.merge('Authorization' => admin_credentials)
|
||||
get '/api/v1/organizations', params: {}, headers: @headers.merge('Authorization' => admin_credentials)
|
||||
assert_response(200)
|
||||
result = JSON.parse(@response.body)
|
||||
assert_equal(Array, result.class)
|
||||
assert(result)
|
||||
|
||||
name = "some org name #{rand(999_999_999)}"
|
||||
post '/api/v1/organizations', { name: name }.to_json, @headers.merge('Authorization' => admin_credentials)
|
||||
post '/api/v1/organizations', params: { name: name }.to_json, headers: @headers.merge('Authorization' => admin_credentials)
|
||||
assert_response(201)
|
||||
result = JSON.parse(@response.body)
|
||||
assert_equal(Hash, result.class)
|
||||
|
@ -220,7 +220,7 @@ class ApiAuthControllerTest < ActionDispatch::IntegrationTest
|
|||
assert(result)
|
||||
|
||||
name = "some org name #{rand(999_999_999)} - 2"
|
||||
put "/api/v1/organizations/#{result['id']}", { name: name }.to_json, @headers.merge('Authorization' => admin_credentials)
|
||||
put "/api/v1/organizations/#{result['id']}", params: { name: name }.to_json, headers: @headers.merge('Authorization' => admin_credentials)
|
||||
assert_response(200)
|
||||
result = JSON.parse(@response.body)
|
||||
assert_equal(Hash, result.class)
|
||||
|
@ -230,14 +230,14 @@ class ApiAuthControllerTest < ActionDispatch::IntegrationTest
|
|||
admin_token.preferences[:permission] = ['admin.organization']
|
||||
admin_token.save!
|
||||
|
||||
get '/api/v1/organizations', {}, @headers.merge('Authorization' => admin_credentials)
|
||||
get '/api/v1/organizations', params: {}, headers: @headers.merge('Authorization' => admin_credentials)
|
||||
assert_response(200)
|
||||
result = JSON.parse(@response.body)
|
||||
assert_equal(Array, result.class)
|
||||
assert(result)
|
||||
|
||||
name = "some org name #{rand(999_999_999)}"
|
||||
post '/api/v1/organizations', { name: name }.to_json, @headers.merge('Authorization' => admin_credentials)
|
||||
post '/api/v1/organizations', params: { name: name }.to_json, headers: @headers.merge('Authorization' => admin_credentials)
|
||||
assert_response(201)
|
||||
result = JSON.parse(@response.body)
|
||||
assert_equal(Hash, result.class)
|
||||
|
@ -245,7 +245,7 @@ class ApiAuthControllerTest < ActionDispatch::IntegrationTest
|
|||
assert(result)
|
||||
|
||||
name = "some org name #{rand(999_999_999)} - 2"
|
||||
put "/api/v1/organizations/#{result['id']}", { name: name }.to_json, @headers.merge('Authorization' => admin_credentials)
|
||||
put "/api/v1/organizations/#{result['id']}", params: { name: name }.to_json, headers: @headers.merge('Authorization' => admin_credentials)
|
||||
assert_response(200)
|
||||
result = JSON.parse(@response.body)
|
||||
assert_equal(Hash, result.class)
|
||||
|
@ -255,14 +255,14 @@ class ApiAuthControllerTest < ActionDispatch::IntegrationTest
|
|||
admin_token.preferences[:permission] = ['admin']
|
||||
admin_token.save!
|
||||
|
||||
get '/api/v1/organizations', {}, @headers.merge('Authorization' => admin_credentials)
|
||||
get '/api/v1/organizations', params: {}, headers: @headers.merge('Authorization' => admin_credentials)
|
||||
assert_response(200)
|
||||
result = JSON.parse(@response.body)
|
||||
assert_equal(Array, result.class)
|
||||
assert(result)
|
||||
|
||||
name = "some org name #{rand(999_999_999)}"
|
||||
post '/api/v1/organizations', { name: name }.to_json, @headers.merge('Authorization' => admin_credentials)
|
||||
post '/api/v1/organizations', params: { name: name }.to_json, headers: @headers.merge('Authorization' => admin_credentials)
|
||||
assert_response(201)
|
||||
result = JSON.parse(@response.body)
|
||||
assert_equal(Hash, result.class)
|
||||
|
@ -270,7 +270,7 @@ class ApiAuthControllerTest < ActionDispatch::IntegrationTest
|
|||
assert(result)
|
||||
|
||||
name = "some org name #{rand(999_999_999)} - 2"
|
||||
put "/api/v1/organizations/#{result['id']}", { name: name }.to_json, @headers.merge('Authorization' => admin_credentials)
|
||||
put "/api/v1/organizations/#{result['id']}", params: { name: name }.to_json, headers: @headers.merge('Authorization' => admin_credentials)
|
||||
assert_response(200)
|
||||
result = JSON.parse(@response.body)
|
||||
assert_equal(Hash, result.class)
|
||||
|
@ -289,7 +289,7 @@ class ApiAuthControllerTest < ActionDispatch::IntegrationTest
|
|||
agent_credentials = "Token token=#{agent_token.name}"
|
||||
|
||||
Setting.set('api_token_access', false)
|
||||
get '/api/v1/tickets', {}, @headers.merge('Authorization' => agent_credentials)
|
||||
get '/api/v1/tickets', params: {}, headers: @headers.merge('Authorization' => agent_credentials)
|
||||
assert_response(401)
|
||||
assert_not(@response.header.key?('Access-Control-Allow-Origin'))
|
||||
result = JSON.parse(@response.body)
|
||||
|
@ -297,21 +297,21 @@ class ApiAuthControllerTest < ActionDispatch::IntegrationTest
|
|||
assert_equal('API token access disabled!', result['error'])
|
||||
|
||||
Setting.set('api_token_access', true)
|
||||
get '/api/v1/tickets', {}, @headers.merge('Authorization' => agent_credentials)
|
||||
get '/api/v1/tickets', params: {}, headers: @headers.merge('Authorization' => agent_credentials)
|
||||
assert_response(200)
|
||||
assert_equal('*', @response.header['Access-Control-Allow-Origin'])
|
||||
result = JSON.parse(@response.body)
|
||||
assert_equal(Array, result.class)
|
||||
assert(result)
|
||||
|
||||
get '/api/v1/organizations', {}, @headers.merge('Authorization' => agent_credentials)
|
||||
get '/api/v1/organizations', params: {}, headers: @headers.merge('Authorization' => agent_credentials)
|
||||
assert_response(200)
|
||||
result = JSON.parse(@response.body)
|
||||
assert_equal(Array, result.class)
|
||||
assert(result)
|
||||
|
||||
name = "some org name #{rand(999_999_999)}"
|
||||
post '/api/v1/organizations', { name: name }.to_json, @headers.merge('Authorization' => agent_credentials)
|
||||
post '/api/v1/organizations', params: { name: name }.to_json, headers: @headers.merge('Authorization' => agent_credentials)
|
||||
assert_response(401)
|
||||
|
||||
end
|
||||
|
@ -326,7 +326,7 @@ class ApiAuthControllerTest < ActionDispatch::IntegrationTest
|
|||
customer_credentials = "Token token=#{customer_token.name}"
|
||||
|
||||
Setting.set('api_token_access', false)
|
||||
get '/api/v1/tickets', {}, @headers.merge('Authorization' => customer_credentials)
|
||||
get '/api/v1/tickets', params: {}, headers: @headers.merge('Authorization' => customer_credentials)
|
||||
assert_response(401)
|
||||
assert_not(@response.header.key?('Access-Control-Allow-Origin'))
|
||||
result = JSON.parse(@response.body)
|
||||
|
@ -334,21 +334,21 @@ class ApiAuthControllerTest < ActionDispatch::IntegrationTest
|
|||
assert_equal('API token access disabled!', result['error'])
|
||||
|
||||
Setting.set('api_token_access', true)
|
||||
get '/api/v1/tickets', {}, @headers.merge('Authorization' => customer_credentials)
|
||||
get '/api/v1/tickets', params: {}, headers: @headers.merge('Authorization' => customer_credentials)
|
||||
assert_equal('*', @response.header['Access-Control-Allow-Origin'])
|
||||
assert_response(200)
|
||||
result = JSON.parse(@response.body)
|
||||
assert_equal(Array, result.class)
|
||||
assert(result)
|
||||
|
||||
get '/api/v1/organizations', {}, @headers.merge('Authorization' => customer_credentials)
|
||||
get '/api/v1/organizations', params: {}, headers: @headers.merge('Authorization' => customer_credentials)
|
||||
assert_response(200)
|
||||
result = JSON.parse(@response.body)
|
||||
assert_equal(Array, result.class)
|
||||
assert(result)
|
||||
|
||||
name = "some org name #{rand(999_999_999)}"
|
||||
post '/api/v1/organizations', { name: name }.to_json, @headers.merge('Authorization' => customer_credentials)
|
||||
post '/api/v1/organizations', params: { name: name }.to_json, headers: @headers.merge('Authorization' => customer_credentials)
|
||||
assert_response(401)
|
||||
end
|
||||
|
||||
|
@ -365,7 +365,7 @@ class ApiAuthControllerTest < ActionDispatch::IntegrationTest
|
|||
@admin.save!
|
||||
|
||||
Setting.set('api_token_access', false)
|
||||
get '/api/v1/sessions', {}, @headers.merge('Authorization' => admin_credentials)
|
||||
get '/api/v1/sessions', params: {}, headers: @headers.merge('Authorization' => admin_credentials)
|
||||
assert_response(401)
|
||||
assert_not(@response.header.key?('Access-Control-Allow-Origin'))
|
||||
result = JSON.parse(@response.body)
|
||||
|
@ -373,7 +373,7 @@ class ApiAuthControllerTest < ActionDispatch::IntegrationTest
|
|||
assert_equal('API token access disabled!', result['error'])
|
||||
|
||||
Setting.set('api_token_access', true)
|
||||
get '/api/v1/sessions', {}, @headers.merge('Authorization' => admin_credentials)
|
||||
get '/api/v1/sessions', params: {}, headers: @headers.merge('Authorization' => admin_credentials)
|
||||
assert_response(401)
|
||||
assert_not(@response.header.key?('Access-Control-Allow-Origin'))
|
||||
result = JSON.parse(@response.body)
|
||||
|
@ -393,7 +393,7 @@ class ApiAuthControllerTest < ActionDispatch::IntegrationTest
|
|||
)
|
||||
admin_credentials = "Token token=#{admin_token.name}"
|
||||
|
||||
get '/api/v1/tickets', {}, @headers.merge('Authorization' => admin_credentials)
|
||||
get '/api/v1/tickets', params: {}, headers: @headers.merge('Authorization' => admin_credentials)
|
||||
assert_response(401)
|
||||
assert_not(@response.header.key?('Access-Control-Allow-Origin'))
|
||||
result = JSON.parse(@response.body)
|
||||
|
@ -416,7 +416,7 @@ class ApiAuthControllerTest < ActionDispatch::IntegrationTest
|
|||
)
|
||||
admin_credentials = "Token token=#{admin_token.name}"
|
||||
|
||||
get '/api/v1/tickets', {}, @headers.merge('Authorization' => admin_credentials)
|
||||
get '/api/v1/tickets', params: {}, headers: @headers.merge('Authorization' => admin_credentials)
|
||||
assert_response(200)
|
||||
assert_equal('*', @response.header['Access-Control-Allow-Origin'])
|
||||
result = JSON.parse(@response.body)
|
||||
|
@ -429,11 +429,11 @@ class ApiAuthControllerTest < ActionDispatch::IntegrationTest
|
|||
|
||||
test 'session auth - admin' do
|
||||
|
||||
post '/api/v1/signin', { username: 'api-admin@example.com', password: 'adminpw', fingerprint: '123456789' }
|
||||
post '/api/v1/signin', params: { username: 'api-admin@example.com', password: 'adminpw', fingerprint: '123456789' }
|
||||
assert_not(@response.header.key?('Access-Control-Allow-Origin'))
|
||||
assert_response(201)
|
||||
|
||||
get '/api/v1/sessions', {}
|
||||
get '/api/v1/sessions', params: {}
|
||||
assert_response(200)
|
||||
assert_not(@response.header.key?('Access-Control-Allow-Origin'))
|
||||
result = JSON.parse(@response.body)
|
||||
|
|
|
@ -8,49 +8,49 @@ class BasicControllerTest < ActionDispatch::IntegrationTest
|
|||
@headers = { 'ACCEPT' => 'application/json', 'CONTENT_TYPE' => 'application/json' }
|
||||
|
||||
# 404
|
||||
get '/not_existing_url', {}, @headers
|
||||
get '/not_existing_url', params: {}, headers: @headers
|
||||
assert_response(404)
|
||||
result = JSON.parse(@response.body)
|
||||
assert_equal(result.class, Hash)
|
||||
assert(result['error'], 'No route matches [GET] /not_existing_url')
|
||||
|
||||
# 401
|
||||
get '/api/v1/organizations', {}, @headers
|
||||
get '/api/v1/organizations', params: {}, headers: @headers
|
||||
assert_response(401)
|
||||
result = JSON.parse(@response.body)
|
||||
assert_equal(result.class, Hash)
|
||||
assert(result['error'], 'authentication failed')
|
||||
|
||||
# 422
|
||||
get '/tests/unprocessable_entity', {}, @headers
|
||||
get '/tests/unprocessable_entity', params: {}, headers: @headers
|
||||
assert_response(422)
|
||||
result = JSON.parse(@response.body)
|
||||
assert_equal(result.class, Hash)
|
||||
assert(result['error'], 'some error message')
|
||||
|
||||
# 401
|
||||
get '/tests/not_authorized', {}, @headers
|
||||
get '/tests/not_authorized', params: {}, headers: @headers
|
||||
assert_response(401)
|
||||
result = JSON.parse(@response.body)
|
||||
assert_equal(result.class, Hash)
|
||||
assert(result['error'], 'some error message')
|
||||
|
||||
# 401
|
||||
get '/tests/ar_not_found', {}, @headers
|
||||
get '/tests/ar_not_found', params: {}, headers: @headers
|
||||
assert_response(404)
|
||||
result = JSON.parse(@response.body)
|
||||
assert_equal(result.class, Hash)
|
||||
assert(result['error'], 'some error message')
|
||||
|
||||
# 500
|
||||
get '/tests/standard_error', {}, @headers
|
||||
get '/tests/standard_error', params: {}, headers: @headers
|
||||
assert_response(500)
|
||||
result = JSON.parse(@response.body)
|
||||
assert_equal(result.class, Hash)
|
||||
assert(result['error'], 'some error message')
|
||||
|
||||
# 422
|
||||
get '/tests/argument_error', {}, @headers
|
||||
get '/tests/argument_error', params: {}, headers: @headers
|
||||
assert_response(422)
|
||||
result = JSON.parse(@response.body)
|
||||
assert_equal(result.class, Hash)
|
||||
|
@ -61,7 +61,7 @@ class BasicControllerTest < ActionDispatch::IntegrationTest
|
|||
test 'html requests' do
|
||||
|
||||
# 404
|
||||
get '/not_existing_url', {}, @headers
|
||||
get '/not_existing_url', params: {}, headers: @headers
|
||||
assert_response(404)
|
||||
assert_match(/<html/, @response.body)
|
||||
assert_match(%r{<title>404: Not Found</title>}, @response.body)
|
||||
|
@ -69,7 +69,7 @@ class BasicControllerTest < ActionDispatch::IntegrationTest
|
|||
assert_match(%r{No route matches \[GET\] /not_existing_url}, @response.body)
|
||||
|
||||
# 401
|
||||
get '/api/v1/organizations', {}, @headers
|
||||
get '/api/v1/organizations', params: {}, headers: @headers
|
||||
assert_response(401)
|
||||
assert_match(/<html/, @response.body)
|
||||
assert_match(%r{<title>401: Unauthorized</title>}, @response.body)
|
||||
|
@ -77,7 +77,7 @@ class BasicControllerTest < ActionDispatch::IntegrationTest
|
|||
assert_match(/authentication failed/, @response.body)
|
||||
|
||||
# 422
|
||||
get '/tests/unprocessable_entity', {}, @headers
|
||||
get '/tests/unprocessable_entity', params: {}, headers: @headers
|
||||
assert_response(422)
|
||||
assert_match(/<html/, @response.body)
|
||||
assert_match(%r{<title>422: Unprocessable Entity</title>}, @response.body)
|
||||
|
@ -85,7 +85,7 @@ class BasicControllerTest < ActionDispatch::IntegrationTest
|
|||
assert_match(/some error message/, @response.body)
|
||||
|
||||
# 401
|
||||
get '/tests/not_authorized', {}, @headers
|
||||
get '/tests/not_authorized', params: {}, headers: @headers
|
||||
assert_response(401)
|
||||
assert_match(/<html/, @response.body)
|
||||
assert_match(%r{<title>401: Unauthorized</title>}, @response.body)
|
||||
|
@ -93,7 +93,7 @@ class BasicControllerTest < ActionDispatch::IntegrationTest
|
|||
assert_match(/some error message/, @response.body)
|
||||
|
||||
# 401
|
||||
get '/tests/ar_not_found', {}, @headers
|
||||
get '/tests/ar_not_found', params: {}, headers: @headers
|
||||
assert_response(404)
|
||||
assert_match(/<html/, @response.body)
|
||||
assert_match(%r{<title>404: Not Found</title>}, @response.body)
|
||||
|
@ -101,7 +101,7 @@ class BasicControllerTest < ActionDispatch::IntegrationTest
|
|||
assert_match(/some error message/, @response.body)
|
||||
|
||||
# 500
|
||||
get '/tests/standard_error', {}, @headers
|
||||
get '/tests/standard_error', params: {}, headers: @headers
|
||||
assert_response(500)
|
||||
assert_match(/<html/, @response.body)
|
||||
assert_match(%r{<title>500: Something went wrong</title>}, @response.body)
|
||||
|
@ -109,7 +109,7 @@ class BasicControllerTest < ActionDispatch::IntegrationTest
|
|||
assert_match(/some error message/, @response.body)
|
||||
|
||||
# 422
|
||||
get '/tests/argument_error', {}, @headers
|
||||
get '/tests/argument_error', params: {}, headers: @headers
|
||||
assert_response(422)
|
||||
assert_match(/<html/, @response.body)
|
||||
assert_match(%r{<title>422: Unprocessable Entity</title>}, @response.body)
|
||||
|
|
|
@ -41,7 +41,7 @@ class FormControllerTest < ActionDispatch::IntegrationTest
|
|||
end
|
||||
|
||||
test '01 - get config call' do
|
||||
post '/api/v1/form_config', {}.to_json, @headers
|
||||
post '/api/v1/form_config', params: {}.to_json, headers: @headers
|
||||
assert_response(401)
|
||||
result = JSON.parse(@response.body)
|
||||
assert_equal(result.class, Hash)
|
||||
|
@ -50,7 +50,7 @@ class FormControllerTest < ActionDispatch::IntegrationTest
|
|||
|
||||
test '02 - get config call' do
|
||||
Setting.set('form_ticket_create', true)
|
||||
post '/api/v1/form_config', {}.to_json, @headers
|
||||
post '/api/v1/form_config', params: {}.to_json, headers: @headers
|
||||
assert_response(401)
|
||||
result = JSON.parse(@response.body)
|
||||
assert_equal(result.class, Hash)
|
||||
|
@ -61,7 +61,7 @@ class FormControllerTest < ActionDispatch::IntegrationTest
|
|||
test '03 - get config call & do submit' do
|
||||
Setting.set('form_ticket_create', true)
|
||||
fingerprint = SecureRandom.hex(40)
|
||||
post '/api/v1/form_config', { fingerprint: fingerprint }.to_json, @headers
|
||||
post '/api/v1/form_config', params: { fingerprint: fingerprint }.to_json, headers: @headers
|
||||
|
||||
assert_response(200)
|
||||
result = JSON.parse(@response.body)
|
||||
|
@ -71,13 +71,13 @@ class FormControllerTest < ActionDispatch::IntegrationTest
|
|||
assert(result['token'])
|
||||
token = result['token']
|
||||
|
||||
post '/api/v1/form_submit', { fingerprint: fingerprint, token: 'invalid' }.to_json, @headers
|
||||
post '/api/v1/form_submit', params: { fingerprint: fingerprint, token: 'invalid' }.to_json, headers: @headers
|
||||
assert_response(401)
|
||||
result = JSON.parse(@response.body)
|
||||
assert_equal(result.class, Hash)
|
||||
assert_equal(result['error'], 'Not authorized')
|
||||
|
||||
post '/api/v1/form_submit', { fingerprint: fingerprint, token: token }.to_json, @headers
|
||||
post '/api/v1/form_submit', params: { fingerprint: fingerprint, token: token }.to_json, headers: @headers
|
||||
assert_response(200)
|
||||
result = JSON.parse(@response.body)
|
||||
assert_equal(result.class, Hash)
|
||||
|
@ -88,7 +88,7 @@ class FormControllerTest < ActionDispatch::IntegrationTest
|
|||
assert_equal(result['errors']['title'], 'required')
|
||||
assert_equal(result['errors']['body'], 'required')
|
||||
|
||||
post '/api/v1/form_submit', { fingerprint: fingerprint, token: token, email: 'some' }.to_json, @headers
|
||||
post '/api/v1/form_submit', params: { fingerprint: fingerprint, token: token, email: 'some' }.to_json, headers: @headers
|
||||
assert_response(200)
|
||||
result = JSON.parse(@response.body)
|
||||
assert_equal(result.class, Hash)
|
||||
|
@ -99,7 +99,7 @@ class FormControllerTest < ActionDispatch::IntegrationTest
|
|||
assert_equal(result['errors']['title'], 'required')
|
||||
assert_equal(result['errors']['body'], 'required')
|
||||
|
||||
post '/api/v1/form_submit', { fingerprint: fingerprint, token: token, name: 'Bob Smith', email: 'discard@znuny.com', title: 'test', body: 'hello' }.to_json, @headers
|
||||
post '/api/v1/form_submit', params: { fingerprint: fingerprint, token: token, name: 'Bob Smith', email: 'discard@znuny.com', title: 'test', body: 'hello' }.to_json, headers: @headers
|
||||
assert_response(200)
|
||||
result = JSON.parse(@response.body)
|
||||
assert_equal(result.class, Hash)
|
||||
|
@ -111,7 +111,7 @@ class FormControllerTest < ActionDispatch::IntegrationTest
|
|||
|
||||
travel 5.hours
|
||||
|
||||
post '/api/v1/form_submit', { fingerprint: fingerprint, token: token, name: 'Bob Smith', email: 'discard@znuny.com', title: 'test', body: 'hello' }.to_json, @headers
|
||||
post '/api/v1/form_submit', params: { fingerprint: fingerprint, token: token, name: 'Bob Smith', email: 'discard@znuny.com', title: 'test', body: 'hello' }.to_json, headers: @headers
|
||||
|
||||
assert_response(200)
|
||||
result = JSON.parse(@response.body)
|
||||
|
@ -124,7 +124,7 @@ class FormControllerTest < ActionDispatch::IntegrationTest
|
|||
|
||||
travel 20.hours
|
||||
|
||||
post '/api/v1/form_submit', { fingerprint: fingerprint, token: token, name: 'Bob Smith', email: 'discard@znuny.com', title: 'test', body: 'hello' }.to_json, @headers
|
||||
post '/api/v1/form_submit', params: { fingerprint: fingerprint, token: token, name: 'Bob Smith', email: 'discard@znuny.com', title: 'test', body: 'hello' }.to_json, headers: @headers
|
||||
assert_response(401)
|
||||
|
||||
end
|
||||
|
@ -132,7 +132,7 @@ class FormControllerTest < ActionDispatch::IntegrationTest
|
|||
test '04 - get config call & do submit' do
|
||||
Setting.set('form_ticket_create', true)
|
||||
fingerprint = SecureRandom.hex(40)
|
||||
post '/api/v1/form_config', { fingerprint: fingerprint }.to_json, @headers
|
||||
post '/api/v1/form_config', params: { fingerprint: fingerprint }.to_json, headers: @headers
|
||||
|
||||
assert_response(200)
|
||||
result = JSON.parse(@response.body)
|
||||
|
@ -142,13 +142,13 @@ class FormControllerTest < ActionDispatch::IntegrationTest
|
|||
assert(result['token'])
|
||||
token = result['token']
|
||||
|
||||
post '/api/v1/form_submit', { fingerprint: fingerprint, token: 'invalid' }.to_json, @headers
|
||||
post '/api/v1/form_submit', params: { fingerprint: fingerprint, token: 'invalid' }.to_json, headers: @headers
|
||||
assert_response(401)
|
||||
result = JSON.parse(@response.body)
|
||||
assert_equal(result.class, Hash)
|
||||
assert_equal(result['error'], 'Not authorized')
|
||||
|
||||
post '/api/v1/form_submit', { fingerprint: fingerprint, token: token }.to_json, @headers
|
||||
post '/api/v1/form_submit', params: { fingerprint: fingerprint, token: token }.to_json, headers: @headers
|
||||
assert_response(200)
|
||||
result = JSON.parse(@response.body)
|
||||
assert_equal(result.class, Hash)
|
||||
|
@ -159,7 +159,7 @@ class FormControllerTest < ActionDispatch::IntegrationTest
|
|||
assert_equal(result['errors']['title'], 'required')
|
||||
assert_equal(result['errors']['body'], 'required')
|
||||
|
||||
post '/api/v1/form_submit', { fingerprint: fingerprint, token: token, email: 'some' }.to_json, @headers
|
||||
post '/api/v1/form_submit', params: { fingerprint: fingerprint, token: token, email: 'some' }.to_json, headers: @headers
|
||||
assert_response(200)
|
||||
result = JSON.parse(@response.body)
|
||||
assert_equal(result.class, Hash)
|
||||
|
@ -170,7 +170,7 @@ class FormControllerTest < ActionDispatch::IntegrationTest
|
|||
assert_equal(result['errors']['title'], 'required')
|
||||
assert_equal(result['errors']['body'], 'required')
|
||||
|
||||
post '/api/v1/form_submit', { fingerprint: fingerprint, token: token, name: 'Bob Smith', email: 'somebody@example.com', title: 'test', body: 'hello' }.to_json, @headers
|
||||
post '/api/v1/form_submit', params: { fingerprint: fingerprint, token: token, name: 'Bob Smith', email: 'somebody@example.com', title: 'test', body: 'hello' }.to_json, headers: @headers
|
||||
assert_response(200)
|
||||
result = JSON.parse(@response.body)
|
||||
assert_equal(result.class, Hash)
|
||||
|
@ -185,7 +185,7 @@ class FormControllerTest < ActionDispatch::IntegrationTest
|
|||
|
||||
Setting.set('form_ticket_create', true)
|
||||
fingerprint = SecureRandom.hex(40)
|
||||
post '/api/v1/form_config', { fingerprint: fingerprint }.to_json, @headers
|
||||
post '/api/v1/form_config', params: { fingerprint: fingerprint }.to_json, headers: @headers
|
||||
|
||||
assert_response(200)
|
||||
result = JSON.parse(@response.body)
|
||||
|
@ -197,7 +197,7 @@ class FormControllerTest < ActionDispatch::IntegrationTest
|
|||
|
||||
(1..20).each { |count|
|
||||
travel 10.seconds
|
||||
post '/api/v1/form_submit', { fingerprint: fingerprint, token: token, name: 'Bob Smith', email: 'discard@znuny.com', title: "test#{count}", body: 'hello' }.to_json, @headers
|
||||
post '/api/v1/form_submit', params: { fingerprint: fingerprint, token: token, name: 'Bob Smith', email: 'discard@znuny.com', title: "test#{count}", body: 'hello' }.to_json, headers: @headers
|
||||
assert_response(200)
|
||||
result = JSON.parse(@response.body)
|
||||
assert_equal(result.class, Hash)
|
||||
|
@ -212,7 +212,7 @@ class FormControllerTest < ActionDispatch::IntegrationTest
|
|||
|
||||
sleep 10 # wait until elasticsearch is index
|
||||
|
||||
post '/api/v1/form_submit', { fingerprint: fingerprint, token: token, name: 'Bob Smith', email: 'discard@znuny.com', title: 'test-last', body: 'hello' }.to_json, @headers
|
||||
post '/api/v1/form_submit', params: { fingerprint: fingerprint, token: token, name: 'Bob Smith', email: 'discard@znuny.com', title: 'test-last', body: 'hello' }.to_json, headers: @headers
|
||||
assert_response(401)
|
||||
result = JSON.parse(@response.body)
|
||||
assert_equal(result.class, Hash)
|
||||
|
@ -222,7 +222,7 @@ class FormControllerTest < ActionDispatch::IntegrationTest
|
|||
|
||||
(1..20).each { |count|
|
||||
travel 10.seconds
|
||||
post '/api/v1/form_submit', { fingerprint: fingerprint, token: token, name: 'Bob Smith', email: 'discard@znuny.com', title: "test-2-#{count}", body: 'hello' }.to_json, @headers
|
||||
post '/api/v1/form_submit', params: { fingerprint: fingerprint, token: token, name: 'Bob Smith', email: 'discard@znuny.com', title: "test-2-#{count}", body: 'hello' }.to_json, headers: @headers
|
||||
assert_response(200)
|
||||
result = JSON.parse(@response.body)
|
||||
assert_equal(result.class, Hash)
|
||||
|
@ -237,7 +237,7 @@ class FormControllerTest < ActionDispatch::IntegrationTest
|
|||
|
||||
sleep 10 # wait until elasticsearch is index
|
||||
|
||||
post '/api/v1/form_submit', { fingerprint: fingerprint, token: token, name: 'Bob Smith', email: 'discard@znuny.com', title: 'test-2-last', body: 'hello' }.to_json, @headers
|
||||
post '/api/v1/form_submit', params: { fingerprint: fingerprint, token: token, name: 'Bob Smith', email: 'discard@znuny.com', title: 'test-2-last', body: 'hello' }.to_json, headers: @headers
|
||||
assert_response(401)
|
||||
result = JSON.parse(@response.body)
|
||||
assert_equal(result.class, Hash)
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue