Skip to content

Commit

Permalink
✨ Fix issue with duplicate entries for board members.
Browse files Browse the repository at this point in the history
  • Loading branch information
kmoberg committed Jan 15, 2024
1 parent 8497eb1 commit 0d1e154
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,28 +283,28 @@ def updateLastMessage(uid, messageType, time):
userGroupsTS = userInfo.parsed[0]['client_servergroups'].split(',')
userGroupsTracked = list(set(groupsTracked) & set(userGroupsTS))
userGroupsWebsite = userInfoWebsite['data']['tags']
if userInfoWebsite['data']['isStaff']:
if '11' in userGroupsWebsite:
userGroupsWebsite.remove('11')
if userInfoWebsite['data']['isStaff'] and '11' in userGroupsWebsite:
userGroupsWebsite.remove('11')

# If user is a board member
if userInfoWebsite['data']['isBoardMember']:
# Don't assign the "NY Controller" tag.
logger.info(f"Found a board member!")
logger.info(f"userInfoWebsite['data'] is currently: {userInfoWebsite['data']}")

# Remove the 'NY Controller' tag
if '11' in userGroupsWebsite:
logger.info(f"User has id 11 in list. Removing it.")
logger.info(f"User has id 11 (NY Controller) in list. Removing it.")
try:
userGroupsWebsite.remove('11')
except error as e:
logger.info(f"Failed to remove tag 11. Error: {e}")
logger.info("Removed id 11 successfully!")

# Add the 'Board Member' tag
if '17401' not in userGroupsWebsite:
if '17401' in userGroupsWebsite:
userGroupsWebsite.append('17401')
logger.info(f"Sucessfully added id 17401 to user {userInfoWebsite['data']['cid']}")
logger.info(f"Sucessfully added id 17401 (Board Member) to user {userInfoWebsite['data']['cid']}")

# Ignore server groups for 'KM'
# Check if user is KM and if he has the 'I1' tag if so, remove it and add C3.
Expand Down

0 comments on commit 0d1e154

Please sign in to comment.