diff options
author | Douwe Maan <douwe@gitlab.com> | 2017-07-28 12:58:20 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2017-07-28 12:58:20 +0300 |
commit | 850a22547ccb0969b3b013dcb891bff90b068d7f (patch) | |
tree | 93f28923f22fac22ed5ee2e94a7173fbcdd03259 /lib | |
parent | 3109623d6e03ca1ac677ddbd69e5b8b20f82b65f (diff) | |
parent | d7062dd042f7dd773900ecf6ea79e1ca26592eb5 (diff) |
Merge branch 'zj-delete-mm-team' into 'master'
Remove Mattermost team with GitLab group
Closes #30023
See merge request !11362
Diffstat (limited to 'lib')
-rw-r--r-- | lib/mattermost/client.rb | 10 | ||||
-rw-r--r-- | lib/mattermost/team.rb | 7 |
2 files changed, 17 insertions, 0 deletions
diff --git a/lib/mattermost/client.rb b/lib/mattermost/client.rb index 3d60618006c..d80cd7d2a4e 100644 --- a/lib/mattermost/client.rb +++ b/lib/mattermost/client.rb @@ -24,6 +24,10 @@ module Mattermost json_response session.post(path, options) end + def delete(session, path, options) + json_response session.delete(path, options) + end + def session_get(path, options = {}) with_session do |session| get(session, path, options) @@ -36,6 +40,12 @@ module Mattermost end end + def session_delete(path, options = {}) + with_session do |session| + delete(session, path, options) + end + end + def json_response(response) json_response = JSON.parse(response.body) diff --git a/lib/mattermost/team.rb b/lib/mattermost/team.rb index 2cdbbdece16..b2511f3af1d 100644 --- a/lib/mattermost/team.rb +++ b/lib/mattermost/team.rb @@ -14,5 +14,12 @@ module Mattermost type: type }.to_json) end + + # The deletion is done async, so the response is fast. + # On the mattermost side, this triggers an soft deletion first, after which + # the actuall data is removed + def destroy(team_id:) + session_delete("/api/v4/teams/#{team_id}?permanent=true") + end end end |