small fix

This commit is contained in:
Patrick Jentsch 2023-02-24 09:44:09 +01:00
parent 0609e2cd72
commit cb31afe723

View File

@ -775,13 +775,16 @@ class User(HashidMixin, UserMixin, db.Model):
#endregion Profile Privacy settings
def follow_corpus(self, corpus, role=None):
if self.is_following_corpus(corpus):
return
if role is None:
r = CorpusFollowerRole.query.filter_by(default=True).first()
cfa = CorpusFollowerAssociation(corpus=corpus, role=r, follower=self)
db.session.add(cfa)
def unfollow_corpus(self, corpus):
if self.is_following_corpus(corpus):
if not self.is_following_corpus(corpus):
return
self.followed_corpora.remove(corpus)
def is_following_corpus(self, corpus):