From 4ed9e567656755fb5fefccedd30157c221809f35 Mon Sep 17 00:00:00 2001
From: Fredrik Jonsson <frjo@xdeb.org>
Date: Thu, 27 Jun 2024 21:56:15 +0200
Subject: [PATCH] Add back the source_type filter that was removed by mistake.
 (#4013)

Fixes #4012
---
 .../apply/activity/templatetags/activity_tags.py  | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/hypha/apply/activity/templatetags/activity_tags.py b/hypha/apply/activity/templatetags/activity_tags.py
index 896a92893..83c283cbd 100644
--- a/hypha/apply/activity/templatetags/activity_tags.py
+++ b/hypha/apply/activity/templatetags/activity_tags.py
@@ -118,3 +118,18 @@ def visibility_display(visibility: str, user) -> str:
         return f"{visibility} + {team_string}"
 
     return visibility
+
+
+@register.filter
+def source_type(value) -> str:
+    """Formats source type
+    For a given source type containing "submission", this will be converted
+    to "Submission" (ie. "application submission" -> "Submission").
+    Args:
+        value: the source type to be formatted
+    Returns:
+        A source type string with a capitalized first letter
+    """
+    if value and "submission" in value:
+        return "Submission"
+    return str(value).capitalize()
-- 
GitLab