diff options
Diffstat (limited to 'wqflask')
-rw-r--r-- | wqflask/wqflask/metadata_edits.py | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/wqflask/wqflask/metadata_edits.py b/wqflask/wqflask/metadata_edits.py index dcadcc99..a13cadf8 100644 --- a/wqflask/wqflask/metadata_edits.py +++ b/wqflask/wqflask/metadata_edits.py @@ -26,6 +26,7 @@ from wqflask.decorators import login_required from gn3.authentication import AdminRole from gn3.authentication import get_highest_user_access_role +from gn3.authentication import get_user_info_by_key from gn3.csvcmp import create_dirs_if_not_exists from gn3.csvcmp import csv_diff from gn3.csvcmp import extract_invalid_csv_headers @@ -51,14 +52,6 @@ from gn3.db.sample_data import get_case_attributes metadata_edit = Blueprint("metadata_edit", __name__) -def _get_author(author: str) -> str: - redis_conn = redis.from_url( - current_app.config["REDIS_URL"], decode_responses=True - ) - return json.loads(redis_conn.hget("users", author)).get( - "full_name", author) - - def _get_diffs( diff_dir: str, user_id: str, redis_conn: redis.Redis, gn_proxy_url: str ): @@ -718,7 +711,13 @@ def show_case_attribute_columns(): if diff_data: for id_, author, diff in diff_data: diff = json.loads(diff) - author = _get_author(author) + author = get_user_info_by_key( + key="user_id", + value=author, + conn=redis.from_url( + current_app.config["REDIS_URL"], decode_responses=True + ) + ).get("full_name") if (m_ := diff.get("Modification")): m_["author"] = author m_["id"] = id_ |