Skip to content

Commit

Permalink
fix: detect hidden_by_limit
Browse files Browse the repository at this point in the history
closes 101
  • Loading branch information
sgratzl committed Jun 15, 2024
1 parent d8e6a82 commit bf7241d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions slack_cleaner2/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ def __init__(self, entry: JSONDict, slack: "SlackCleaner"):
:type slack: SlackCleaner
"""
self.id = entry["id"]
self.hidden_by_limit = "hidden_by_limit" in entry
self.hidden_by_limit = "hidden_by_limit" in entry or entry.get("mode", "") == "hidden_by_limit"
self.name = entry.get("name", "Unknown")
self.title = entry.get("title", "Unknown")
self.pinned_to = entry.get("pinned_to", False)
Expand All @@ -698,11 +698,13 @@ def __init__(self, entry: JSONDict, slack: "SlackCleaner"):
self._slack = slack

@cached_property
def user(self) -> SlackUser:
def user(self) -> Optional[SlackUser]:
"""
user created this file
"""
return self._slack.users.resolve_user(self.json["user"])
if "user" in self.json:
return self._slack.users.resolve_user(self.json["user"])
return None

@staticmethod
def list(
Expand Down

0 comments on commit bf7241d

Please sign in to comment.