-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcheck_templates.sh
More file actions
executable file
·81 lines (72 loc) · 2.43 KB
/
check_templates.sh
File metadata and controls
executable file
·81 lines (72 loc) · 2.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/bin/bash
# ThyWill Template Static Analysis Script
# Quick commands to find common template field issues
echo "🔍 ThyWill Template Field Analysis"
echo "=================================="
# Check for user.id references (should be user.display_name)
echo "1. Checking for incorrect user.id references..."
user_id_issues=$(rg "user.*\.id" --type html | grep -v "prayer\.id\|#.*id\|session\.id\|token\.id\|request\.id")
if [ -n "$user_id_issues" ]; then
echo "❌ Found user.id references (should use user.display_name):"
echo "$user_id_issues"
echo
else
echo "✅ No user.id issues found"
echo
fi
# Check for author_id in Prayer contexts
echo "2. Checking for author_id field usage..."
author_id_issues=$(rg "author_id" --type html)
if [ -n "$author_id_issues" ]; then
echo "⚠️ Found author_id references (Prayer model uses author_username):"
echo "$author_id_issues"
echo
else
echo "✅ No author_id issues found"
echo
fi
# Check for inconsistent field patterns
echo "3. Checking for field consistency patterns..."
echo "User field patterns:"
rg "user.*\.(id|display_name)" --type html | head -10
echo
echo "Prayer field patterns:"
rg "prayer.*\.(id|author_username|author_id)" --type html | head -10
echo
echo "PrayerMark field patterns:"
rg "mark.*\.(id|username|user_id)" --type html | head -10
echo
# Check for template comparison issues
echo "4. Checking for field comparison issues..."
comparison_issues=$(rg "== .*\.id" --type html | grep -v "prayer\.id\|session\.id\|token\.id")
if [ -n "$comparison_issues" ]; then
echo "⚠️ Found potential comparison issues:"
echo "$comparison_issues"
echo
else
echo "✅ No obvious comparison issues found"
echo
fi
# Check for href patterns
echo "5. Checking for user link patterns..."
user_links=$(rg 'href="/user/\{\{.*\}\}"' --type html)
if [ -n "$user_links" ]; then
echo "User links found:"
echo "$user_links"
echo
else
echo "✅ No user links found"
echo
fi
# Summary
echo "📊 Summary:"
echo "- Run './validate_templates.py' for detailed validation"
echo "- Check that user links use display_name, not id"
echo "- Verify Prayer model uses author_username, not author_id"
echo "- Ensure PrayerMark model uses username, not user_id"
echo
echo "💡 Common fixes:"
echo "- user.id → user.display_name"
echo "- me.id → me.display_name"
echo "- prayer.author_id → prayer.author_username"
echo "- mark.user_id → mark.username"