diff options
author | Trygve Aaberge <trygveaa@gmail.com> | 2017-11-21 17:47:20 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-21 17:47:20 +0100 |
commit | 385fdb4efd25a2e173eba62cb787a03cefa0b69e (patch) | |
tree | a4043cbf7ced217826493d32cc78d158f89d54e5 | |
parent | ccb6f81dc4cd65a5e65d7231d4e76e1682f194cf (diff) | |
parent | 1efb45bc0a6010f2a9b0727e66d5992e12b2fa18 (diff) | |
download | wee-slack-385fdb4efd25a2e173eba62cb787a03cefa0b69e.tar.gz |
Merge pull request #478 from alyssais/hide_closed_group_dms
Hide closed group dms
-rw-r--r-- | wee_slack.py | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/wee_slack.py b/wee_slack.py index 47f0b80..216c911 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -1244,22 +1244,20 @@ class SlackChannel(object): # self.create_buffer() def check_should_open(self, force=False): - try: - if self.is_archived: - return - except: - pass + if hasattr(self, "is_archived") and self.is_archived: + return + if force: self.create_buffer() - else: - for reason in ["is_member", "is_open", "unread_count_display"]: - try: - if eval("self." + reason): - self.create_buffer() - if config.background_load_all_history: - self.get_history(slow_queue=True) - except: - pass + return + + # Only check is_member if is_open is not set, because in some cases + # (e.g. group DMs), is_member should be ignored in favor of is_open. + is_open = self.is_open if hasattr(self, "is_open") else self.is_member + if is_open or self.unread_count_display: + self.create_buffer() + if config.background_load_all_history: + self.get_history(slow_queue=True) def set_related_server(self, team): self.team = team |