diff --git a/app/corpora/routes.py b/app/corpora/routes.py index f212847912ea9db6731a1e42963cfc3d5262f9d8..4c1ebd293b799d31b3b3b01cd4f7be7d723c2db0 100644 --- a/app/corpora/routes.py +++ b/app/corpora/routes.py @@ -81,13 +81,10 @@ def corpus(corpus_id): db.session.commit() flash('Your changes have been saved') return redirect(url_for('.corpus', corpus_id=corpus.id)) - # if corpus.following_users == [None]: - # following_users = [] - # else: - # following_users = [ - # u.to_json_serializeable() for u - # in corpus.following_users - # ] + # following_users = [ + # u.to_json_serializeable() for u + # in corpus.following_users + # ] return render_template( 'corpora/corpus.html.j2', corpus_settings_form=corpus_settings_form, diff --git a/app/models.py b/app/models.py index 24f59d608ea321dc164a01d2e49975ef58e9fe91..4c7a1362fa8d39ee445ed7a4583f90998bbe0bcf 100644 --- a/app/models.py +++ b/app/models.py @@ -650,6 +650,10 @@ class User(HashidMixin, UserMixin, db.Model): x.hashid: x.to_json_serializeable(relationships=True) for x in self.spacy_nlp_pipeline_models } + json_serializeable['followed_corpora'] = { + x.hashid: x.to_json_serializeable(relationships=True) + for x in self.followed_corpora + } if filter_by_privacy_settings: if not self.has_profile_privacy_setting(ProfilePrivacySettings.SHOW_EMAIL): diff --git a/app/static/js/ResourceLists/CorpusFileList.js b/app/static/js/ResourceLists/CorpusFileList.js index fd4ff4801f2e001876b08ee61f69dc5aece94310..ca27fe27e10505a8ffffc84bd0d828172879c2a7 100644 --- a/app/static/js/ResourceLists/CorpusFileList.js +++ b/app/static/js/ResourceLists/CorpusFileList.js @@ -17,7 +17,7 @@ class CorpusFileList extends ResourceList { }); }); app.getUser(this.userId).then((user) => { - this.add(Object.values(user.corpora[this.corpusId].files)); + this.add(Object.values(user.corpora[this.corpusId].files || user.followed_corpora[this.corpusId].files)); this.isInitialized = true; }); }