implement some stuff
parent
b21953379a
commit
7af2975a5b
|
@ -369,9 +369,95 @@ class LoggedOutUser():
|
|||
|
||||
return f"Unban in {text}"
|
||||
|
||||
# received awards, modaction num, followed users, followed subs, notif count, message notifs, post notifs, modaction notifs, reddit notifs, notficiations do, notifications color, do posts, do reddit
|
||||
# alts
|
||||
# alt ids
|
||||
# received awards, modaction num, followed users, followed subs,
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def notifications_count(self):
|
||||
return 0
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def normal_notifications_count(self):
|
||||
return self.notifications_count \
|
||||
- self.message_notifications_count \
|
||||
- self.post_notifications_count \
|
||||
- self.modaction_notifications_count \
|
||||
- self.reddit_notifications_count
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def message_notifications_count(self):
|
||||
return 0
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def post_notifications_count(self):
|
||||
return 0
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def modaction_notifications_count(self):
|
||||
return 0
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def reddit_notifications_count(self):
|
||||
return 0
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def notifications_do(self):
|
||||
# only meaningful when notifications_count > 0; otherwise falsely '' ~ normal
|
||||
if self.normal_notifications_count > 0:
|
||||
return ''
|
||||
elif self.message_notifications_count > 0:
|
||||
return 'messages'
|
||||
elif self.post_notifications_count > 0:
|
||||
return 'posts'
|
||||
elif self.modaction_notifications_count > 0:
|
||||
return 'modactions'
|
||||
elif self.reddit_notifications_count > 0:
|
||||
return 'reddit'
|
||||
return ''
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def notifications_color(self):
|
||||
colors = {
|
||||
'': '#dc3545',
|
||||
'messages': '#d8910d',
|
||||
'posts': '#0000ff',
|
||||
'modactions': '#1ad80d',
|
||||
'reddit': '#805ad5',
|
||||
}
|
||||
return colors[self.notifications_do] if self.notifications_do \
|
||||
else colors['']
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def do_posts(self):
|
||||
return self.post_notifications_count and \
|
||||
self.post_notifications_count == (
|
||||
self.notifications_count
|
||||
- self.modaction_notifications_count
|
||||
- self.reddit_notifications_count)
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def do_reddit(self):
|
||||
return self.notifications_count == self.reddit_notifications_count
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def alts(self):
|
||||
return []
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def alt_ids(self):
|
||||
return [x.id for x in self.alts if not x._alt_deleted]
|
||||
|
||||
# moderated subs
|
||||
@lazy
|
||||
def has_follower(self, user):
|
||||
|
@ -467,6 +553,51 @@ class LoggedOutUser():
|
|||
|
||||
# apps, userblocks, savedlinks, saved comments, subscribers, saved count, saved comment count, subscriped count
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def applications(self):
|
||||
return []
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def userblocks(self):
|
||||
return []
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def saved_idlist(self):
|
||||
return []
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def saved_comment_idlist(self):
|
||||
return []
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def subscribed_idlist(self):
|
||||
return []
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def saved_count(self):
|
||||
return 0
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def saved_comment_count(self):
|
||||
return 0
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def subscribed_count(self):
|
||||
return 0
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def winnings(self):
|
||||
return 0
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def filter_words(self):
|
||||
|
@ -1011,15 +1142,6 @@ class User(Base, LoggedOutUser):
|
|||
|
||||
return notifs.count() + self.post_notifications_count + self.modaction_notifications_count
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def normal_notifications_count(self):
|
||||
return self.notifications_count \
|
||||
- self.message_notifications_count \
|
||||
- self.post_notifications_count \
|
||||
- self.modaction_notifications_count \
|
||||
- self.reddit_notifications_count
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def message_notifications_count(self):
|
||||
|
@ -1085,49 +1207,6 @@ class User(Base, LoggedOutUser):
|
|||
Comment.body_html.like('%<p>New site mention%<a href="https://old.reddit.com/r/%'),
|
||||
Comment.parent_submission == None, Comment.author_id == AUTOJANNY_ID).count()
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def notifications_do(self):
|
||||
# only meaningful when notifications_count > 0; otherwise falsely '' ~ normal
|
||||
if self.normal_notifications_count > 0:
|
||||
return ''
|
||||
elif self.message_notifications_count > 0:
|
||||
return 'messages'
|
||||
elif self.post_notifications_count > 0:
|
||||
return 'posts'
|
||||
elif self.modaction_notifications_count > 0:
|
||||
return 'modactions'
|
||||
elif self.reddit_notifications_count > 0:
|
||||
return 'reddit'
|
||||
return ''
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def notifications_color(self):
|
||||
colors = {
|
||||
'': '#dc3545',
|
||||
'messages': '#d8910d',
|
||||
'posts': '#0000ff',
|
||||
'modactions': '#1ad80d',
|
||||
'reddit': '#805ad5',
|
||||
}
|
||||
return colors[self.notifications_do] if self.notifications_do \
|
||||
else colors['']
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def do_posts(self):
|
||||
return self.post_notifications_count and \
|
||||
self.post_notifications_count == (
|
||||
self.notifications_count
|
||||
- self.modaction_notifications_count
|
||||
- self.reddit_notifications_count)
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def do_reddit(self):
|
||||
return self.notifications_count == self.reddit_notifications_count
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def alts(self):
|
||||
|
@ -1161,11 +1240,6 @@ class User(Base, LoggedOutUser):
|
|||
|
||||
return output
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def alt_ids(self):
|
||||
return [x.id for x in self.alts if not x._alt_deleted]
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def moderated_subs(self):
|
||||
|
|
Loading…
Reference in New Issue