Skip to content
Snippets Groups Projects
Commit 17ec3e29 authored by Inga Kirschnick's avatar Inga Kirschnick
Browse files

Merge branch 'public-corpus' of gitlab.ub.uni-bielefeld.de:sfb1288inf/nopaque into public-corpus

parents d0b369ef 122cce98
No related branches found
No related tags found
No related merge requests found
......@@ -775,14 +775,16 @@ class User(HashidMixin, UserMixin, db.Model):
#endregion Profile Privacy settings
def follow_corpus(self, corpus, role=None):
if role is None:
r = CorpusFollowerRole.query.filter_by(default=True).first()
if self.is_following_corpus(corpus):
return
r = CorpusFollowerRole.query.filter_by(default=True).first() if role is None else role
cfa = CorpusFollowerAssociation(corpus=corpus, role=r, follower=self)
db.session.add(cfa)
def unfollow_corpus(self, corpus):
if self.is_following_corpus(corpus):
self.followed_corpora.remove(corpus)
if not self.is_following_corpus(corpus):
return
self.followed_corpora.remove(corpus)
def is_following_corpus(self, corpus):
return corpus in self.followed_corpora
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment