mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-12-25 10:54:18 +00:00
Merge branch 'public-corpus' of gitlab.ub.uni-bielefeld.de:sfb1288inf/nopaque into public-corpus
This commit is contained in:
commit
17ec3e292a
@ -775,14 +775,16 @@ class User(HashidMixin, UserMixin, db.Model):
|
|||||||
#endregion Profile Privacy settings
|
#endregion Profile Privacy settings
|
||||||
|
|
||||||
def follow_corpus(self, corpus, role=None):
|
def follow_corpus(self, corpus, role=None):
|
||||||
if role is None:
|
if self.is_following_corpus(corpus):
|
||||||
r = CorpusFollowerRole.query.filter_by(default=True).first()
|
return
|
||||||
|
r = CorpusFollowerRole.query.filter_by(default=True).first() if role is None else role
|
||||||
cfa = CorpusFollowerAssociation(corpus=corpus, role=r, follower=self)
|
cfa = CorpusFollowerAssociation(corpus=corpus, role=r, follower=self)
|
||||||
db.session.add(cfa)
|
db.session.add(cfa)
|
||||||
|
|
||||||
def unfollow_corpus(self, corpus):
|
def unfollow_corpus(self, corpus):
|
||||||
if self.is_following_corpus(corpus):
|
if not self.is_following_corpus(corpus):
|
||||||
self.followed_corpora.remove(corpus)
|
return
|
||||||
|
self.followed_corpora.remove(corpus)
|
||||||
|
|
||||||
def is_following_corpus(self, corpus):
|
def is_following_corpus(self, corpus):
|
||||||
return corpus in self.followed_corpora
|
return corpus in self.followed_corpora
|
||||||
|
Loading…
Reference in New Issue
Block a user