Share link expiration update and small fixes

This commit is contained in:
Inga Kirschnick 2023-02-13 10:16:44 +01:00
parent 1767ceee01
commit 8595e2a203
3 changed files with 9 additions and 4 deletions

View File

@ -76,6 +76,7 @@ def corpus(corpus_id):
return redirect(url_for('.corpus', corpus_id=corpus.id)) return redirect(url_for('.corpus', corpus_id=corpus.id))
now = datetime.utcnow() now = datetime.utcnow()
payload = { payload = {
'exp': now + timedelta(weeks=1),
'iat': now, 'iat': now,
'iss': current_app.config['SERVER_NAME'], 'iss': current_app.config['SERVER_NAME'],
'sub': corpus.hashid 'sub': corpus.hashid

View File

@ -33,7 +33,7 @@ def dashboard():
] ]
corpora = [ corpora = [
c.to_json_serializeable() for c c.to_json_serializeable() for c
in Corpus.query.filter(Corpus.is_public == True).all() in Corpus.query.filter(Corpus.is_public == True, Corpus.user != current_user).all()
] ]
return render_template('main/dashboard.html.j2', title='Dashboard', users=users, corpora=corpora) return render_template('main/dashboard.html.j2', title='Dashboard', users=users, corpora=corpora)

View File

@ -18,7 +18,7 @@
{% endif %} {% endif %}
</a> </a>
{% if corpus.status.name in ['BUILT', 'STARTING_ANALYSIS_SESSION', 'RUNNING_ANALYSIS_SESSION', 'CANCELING_ANALYSIS_SESSION'] and current_user.is_following_corpus(corpus) %} {% if corpus.status.name in ['BUILT', 'STARTING_ANALYSIS_SESSION', 'RUNNING_ANALYSIS_SESSION', 'CANCELING_ANALYSIS_SESSION'] and current_user.is_following_corpus(corpus) %}
<a class="btn waves-effect waves-light" href="{{ url_for('corpora.analyse_corpus', corpus_id=corpus.id) }}">Analyse</a> <a class="btn waves-effect waves-light" href="{{ url_for('corpora.analyse_corpus', corpus_id=corpus.id) }}">Analyze</a>
{% endif %} {% endif %}
</div> </div>
</div> </div>
@ -44,12 +44,14 @@
</div> </div>
</div> </div>
</div> </div>
{% if current_user.is_following_corpus(corpus) %}
<div class="card"> <div class="card">
<div class="card-content"> <div class="card-content">
<span class="card-title" id="files">Corpus files</span> <span class="card-title" id="files">Corpus files</span>
<div class="corpus-file-list no-autoinit" data-user-id="{{ corpus.user.hashid }}" data-corpus-id="{{ corpus.hashid }}"></div> <div class="corpus-file-list no-autoinit" data-user-id="{{ corpus.user.hashid }}" data-corpus-id="{{ corpus.hashid }}"></div>
</div> </div>
</div> </div>
{% endif %}
</div> </div>
</div> </div>
</div> </div>
@ -59,8 +61,10 @@
{% block scripts %} {% block scripts %}
{{ super() }} {{ super() }}
<script> <script>
let corpusFileList = new PublicCorpusFileList(document.querySelector('.corpus-file-list')); {% if current_user.is_following_corpus(corpus) %}
corpusFileList.add({{ corpus_files|tojson }}); let corpusFileList = new PublicCorpusFileList(document.querySelector('.corpus-file-list'));
corpusFileList.add({{ corpus_files|tojson }});
{% endif %}
let corpusFollowingRequest = document.querySelector('#follow-corpus-request'); let corpusFollowingRequest = document.querySelector('#follow-corpus-request');