Skip to content

Commit 1f23a8f

Browse files
authored
Merge pull request attzonko#6 from attzonko/working_apiv4
Minor fixes for APIv4 usage with multiple teams
2 parents 61e697d + cb4b3d6 commit 1f23a8f

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

mattermost_bot/mattermost_v4.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import websocket._exceptions
99

1010
from mattermost_bot.mattermost import MattermostClient, MattermostAPI
11+
from pprint import pprint
1112

1213
logger = logging.getLogger(__name__)
1314

@@ -76,15 +77,13 @@ def get_profiles(self,channel_id=None, pagination_size=100):
7677
team_id = self.default_team_id
7778

7879
start = 0
79-
end = start + pagination_size
8080

8181
current_page = self.get('/users?page=0&per_page={}&in_team={}'.format(pagination_size, team_id))
8282
for user in current_page:
8383
profiles.update(self.create_user_dict(user))
8484

8585
while len(current_page) == pagination_size:
86-
start = end
87-
end += pagination_size
86+
start = start + 1
8887
current_page = self.get('/users?page={}&per_page={}&in_team={}'.format(start, pagination_size, team_id))
8988
for user in current_page:
9089
profiles.update(self.create_user_dict(user))

mattermost_bot/settings.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
BOT_TEAM = 'devops'
1818
SSL_VERIFY = True
1919

20-
IGNORE_NOTIFIES = ['@channel', '@all']
20+
IGNORE_NOTIFIES = ['@here', '@channel', '@all']
2121
WORKERS_NUM = 10
2222

2323
DEFAULT_REPLY_MODULE = None

0 commit comments

Comments
 (0)