Skip to content

Commit

Permalink
Add special class for moderators
Browse files Browse the repository at this point in the history
  • Loading branch information
PythonCoderAS committed Dec 29, 2019
1 parent 003ae55 commit 9e58fea
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions praw/models/reddit/flair.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def __eq__(self, other):
if isinstance(other, str):
return str(self) == other
return (
isinstance(other, SubmissionFlair)
isinstance(other, self.__class__)
and str(self) == str(other)
and self.flair_template_id == other.flair_template_id
)
Expand All @@ -48,11 +48,20 @@ def __init__(self, reddit, submission, _data):
super().__init__(reddit, _data=_data)

def change_text(self, text):
"""Allow the submission author or moderator to give a custom text."""
if not (
self.submission.subreddit.user_is.moderator
or self.flair_text_editable
):
pass
else:
self.flair_text = text
"""Allow the submission author to give a custom text to the flair.
Please verify that the flair is editable before editing the text of the
flair.
"""
self.flair_text = text


class SubmissionModerationFlair(SubmissionFlair):
"""A special flair that is returned to moderators.
It has the same typical values as :class:`.SubmissionFlair`.
"""

def change_css_class(self, css_class):
"""Change the css class of the flair (Mod only)."""
self.flair_css_class = css_class

0 comments on commit 9e58fea

Please sign in to comment.