Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
22a05678
Commit
22a05678
authored
Dec 20, 2016
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix a few error messages
parent
70dcd45d
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
14 additions
and
18 deletions
+14
-18
app/helpers/mattermost_helper.rb
app/helpers/mattermost_helper.rb
+9
-0
copy.sh
copy.sh
+0
-11
lib/mattermost/client.rb
lib/mattermost/client.rb
+2
-2
lib/mattermost/session.rb
lib/mattermost/session.rb
+2
-2
spec/lib/mattermost/team_spec.rb
spec/lib/mattermost/team_spec.rb
+1
-3
No files found.
app/helpers/mattermost_helper.rb
0 → 100644
View file @
22a05678
module
MattermostHelper
def
mattermost_teams_options
(
teams
)
teams_options
=
teams
.
map
do
|
id
,
options
|
[
options
[
'display_name'
]
||
options
[
'name'
],
id
]
end
teams_options
.
compact
.
unshift
([
'Select team...'
,
'0'
])
end
end
copy.sh
deleted
100755 → 0
View file @
70dcd45d
#!/bin/bash
set
-xe
# rsync --delete -av config/{routes.rb,routes,initializers,application.rb} zj-gitlab:/opt/gitlab/embedded/service/gitlab-rails/config/
rsync
--delete
-av
lib/mattermost zj-gitlab:/opt/gitlab/embedded/service/gitlab-rails/lib
# rsync --delete -av vendor/{assets,gitignore,gitlab-ci-yml} zj-gitlab:/opt/gitlab/embedded/service/gitlab-rails/vendor/
# rsync --delete -av ../gitlab-shell/{bin,lib,spec,hooks} zj-gitlab:/opt/gitlab/embedded/service/gitlab-shell
#ssh gitlab-test 'cd /opt/gitlab/embedded/service/gitlab-rails && /opt/gitlab/embedded/bin/bundle install --deployment'
#ssh gitlab-test 'export NO_PRIVILEGE_DROP=true; export USE_DB=false; gitlab-rake assets:precompile'
ssh zj-gitlab gitlab-ctl restart
lib/mattermost/client.rb
View file @
22a05678
...
@@ -30,12 +30,12 @@ module Mattermost
...
@@ -30,12 +30,12 @@ module Mattermost
json_response
=
JSON
.
parse
(
response
.
body
)
json_response
=
JSON
.
parse
(
response
.
body
)
unless
response
.
success?
unless
response
.
success?
raise
ClientError
(
json_response
[
'message'
]
||
'Undefined error'
)
raise
Mattermost
::
ClientError
.
new
(
json_response
[
'message'
]
||
'Undefined error'
)
end
end
json_response
json_response
rescue
JSON
::
JSONError
rescue
JSON
::
JSONError
raise
ClientError
(
'Cannot parse response'
)
raise
Mattermost
::
ClientError
.
new
(
'Cannot parse response'
)
end
end
end
end
end
end
lib/mattermost/session.rb
View file @
22a05678
...
@@ -81,9 +81,9 @@ module Mattermost
...
@@ -81,9 +81,9 @@ module Mattermost
def
post
(
path
,
options
=
{})
def
post
(
path
,
options
=
{})
self
.
class
.
post
(
path
,
options
.
merge
(
headers:
@headers
))
self
.
class
.
post
(
path
,
options
.
merge
(
headers:
@headers
))
rescue
HTTParty
::
Error
=>
e
rescue
HTTParty
::
Error
=>
e
raise
ConnectionError
(
e
.
message
)
raise
Mattermost
::
ConnectionError
.
new
(
e
.
message
)
rescue
Errno
::
ECONNREFUSED
rescue
Errno
::
ECONNREFUSED
raise
ConnectionError
raise
Mattermost
::
ConnectionError
.
new
(
e
.
message
)
end
end
private
private
...
...
spec/lib/mattermost/team_spec.rb
View file @
22a05678
...
@@ -3,9 +3,6 @@ require 'spec_helper'
...
@@ -3,9 +3,6 @@ require 'spec_helper'
describe
Mattermost
::
Team
do
describe
Mattermost
::
Team
do
describe
'#all'
do
describe
'#all'
do
let
(
:user
)
{
build
(
:user
)
}
let
(
:user
)
{
build
(
:user
)
}
subject
{
described_class
.
new
(
user
)
}
let
(
:response
)
do
let
(
:response
)
do
[{
[{
"id"
=>
"xiyro8huptfhdndadpz8r3wnbo"
,
"id"
=>
"xiyro8huptfhdndadpz8r3wnbo"
,
...
@@ -22,6 +19,7 @@ describe Mattermost::Team do
...
@@ -22,6 +19,7 @@ describe Mattermost::Team do
"allow_open_invite"
=>
false
}]
"allow_open_invite"
=>
false
}]
end
end
subject
{
described_class
.
new
(
user
)
}
before
do
before
do
allow
(
subject
).
to
receive
(
:json_get
).
and_return
(
response
)
allow
(
subject
).
to
receive
(
:json_get
).
and_return
(
response
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment