Fix foreign user data transmission for admins

This commit is contained in:
Patrick Jentsch 2020-05-20 10:32:39 +02:00
parent 8d201a29ae
commit d4e81b11e0
5 changed files with 16 additions and 15 deletions

View File

@ -47,7 +47,7 @@ def user_data_stream_init():
def foreign_user_data_stream_init(user_id):
socketio.start_background_task(user_data_stream,
current_app._get_current_object(),
user_id, request.sid, True)
user_id, request.sid, foreign=True)
def user_data_stream(app, user_id, session_id, foreign=False):

View File

@ -7,20 +7,21 @@ var nopaque = {};
// nopaque ressources
nopaque.socket = undefined;
nopaque.corpora = undefined;
nopaque.corporaSubscribers = [];
nopaque.jobs = undefined;
nopaque.jobsSubscribers = [];
nopaque.foreignCorpora = undefined;
nopaque.foreignCorporaSubscribers = [];
nopaque.foreignJobs = undefined;
nopaque.foreignJobsSubscribers = [];
// User data
nopaque.user = {};
nopaque.user.isAuthenticated = undefined;
nopaque.user.settings = {}
nopaque.user.settings = {};
nopaque.user.settings.darkMode = undefined;
nopaque.corporaSubscribers = [];
nopaque.jobsSubscribers = [];
// Foreign user (user inspected with admin credentials) data
nopaque.foreignUser = {};
nopaque.foreignUser.isAuthenticated = undefined;
nopaque.foreignUser.settings = {};
nopaque.foreignUser.settings.darkMode = undefined;
nopaque.foreignCorporaSubscribers = [];
nopaque.foreignJobsSubscribers = [];
nopaque.flashedMessages = undefined;

View File

@ -104,7 +104,7 @@
var corpusList = new RessourceList("corpora", nopaque.foreignCorporaSubscribers, "corpus");
var jobList = new RessourceList("jobs", nopaque.foreignJobsSubscribers, "job");
document.addEventListener("DOMContentLoaded", () => {
nopaque.socket.emit("foreign_user_ressources_init", {{ user.id }});
nopaque.socket.emit("foreign_user_data_stream_init", {{ user.id }});
});
</script>
{% endblock %}

View File

@ -213,7 +213,7 @@
{% else %}
var informationUpdater = new InformationUpdater({{ corpus.id }}, true);
document.addEventListener("DOMContentLoaded", () => {
nopaque.socket.emit("subscribe_foreign_user_ressources", {{ corpus.user_id }});
nopaque.socket.emit("foreign_user_data_stream_init", {{ corpus.user_id }});
});
{% endif %}
</script>

View File

@ -254,7 +254,7 @@
{% else %}
var informationUpdater = new InformationUpdater({{ job.id }}, true);
document.addEventListener("DOMContentLoaded", () => {
nopaque.socket.emit("foreign_user_ressources_init", {{ job.user_id }});
nopaque.socket.emit("foreign_user_data_stream_init", {{ job.user_id }});
});
{% endif %}
</script>