Welcome to mirror list, hosted at ThFree Co, Russian Federation.

team.rb « mattermost « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 714748aea3c6c3a08c0ce60c649b0c83e7e1b87f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
module Mattermost
  class Team < Session
    def self.team_admin
      return [] unless initial_load['team_members']

      team_ids = initial_load['team_members'].map do |team|
        team['team_id'] if team['roles'].split.include?('team_admin')
      end.compact

      initial_load['teams'].select do |team|
        team_ids.include?(team['id'])
      end
    end

    private

    def initial_load
      @initial_load ||= get('/users/initial_load').parsed_response
    end
  end
end