Author
|
zPlus <zplus@peers.community>
2022-07-29 12:08:45
|
Committer
|
zPlus <zplus@peers.community>
2022-07-29 12:08:45
|
Commit
|
d358548
(patch)
|
Tree
|
1c55eca
|
Parent(s)
|
|
Add support for tags in mailing lists threads.
commits diff:
bcc46e1..d358548
3 files changed,
41 insertions,
10 deletions
—
download
Diffstat
Diff options
+10/-7
M static/css/clif.css
+6/-0
M templates/mailing_list/emails_thread.html
40
|
40
|
|
</div>
|
41
|
41
|
|
|
42
|
42
|
|
<div class="info">
|
|
43
|
+ |
{% for tag in tags %}
|
|
44
|
+ |
<div class="tag">
|
|
45
|
+ |
<b>{{ tag }}:</b> {{ tags[tag]|join(', ') }}
|
|
46
|
+ |
</div>
|
|
47
|
+ |
{% endfor %}
|
|
48
|
+ |
|
43
|
49
|
|
<details open>
|
44
|
50
|
|
<summary>{{ participants|length }} participants</summary>
|
45
|
51
|
|
{% for address in participants %}
|
+25/-3
M web.py
81
|
81
|
|
repositories.sort()
|
82
|
82
|
|
return repositories
|
83
|
83
|
|
|
|
84
|
+ |
def parse_thread_tags(data):
|
|
85
|
+ |
"""
|
|
86
|
+ |
Parse "tags" file of a mailing list thread.
|
|
87
|
+ |
"""
|
|
88
|
+ |
|
|
89
|
+ |
tags = {}
|
|
90
|
+ |
|
|
91
|
+ |
for line in data.splitlines():
|
|
92
|
+ |
k, v = line.split('=', 1)
|
|
93
|
+ |
k = k.strip()
|
|
94
|
+ |
v = v.strip()
|
|
95
|
+ |
tags[k] = tags.get(k, []) + [ v ]
|
|
96
|
+ |
|
|
97
|
+ |
return tags
|
|
98
|
+ |
|
84
|
99
|
|
|
85
|
100
|
|
|
86
|
101
|
|
|
641
|
656
|
|
# displaying purposes only)
|
642
|
657
|
|
emails = []
|
643
|
658
|
|
participants = []
|
|
659
|
+ |
tags = {}
|
644
|
660
|
|
|
645
|
661
|
|
for obj in thread_tree:
|
646
|
|
- |
if obj.type != pygit2.GIT_OBJ_BLOB \
|
647
|
|
- |
or not obj.name.endswith('.email'):
|
|
662
|
+ |
if obj.type != pygit2.GIT_OBJ_BLOB:
|
|
663
|
+ |
continue
|
|
664
|
+ |
|
|
665
|
+ |
if obj.name == 'tags':
|
|
666
|
+ |
tags = parse_thread_tags(obj.data.decode('UTF-8'))
|
|
667
|
+ |
continue
|
|
668
|
+ |
|
|
669
|
+ |
if not obj.name.endswith('.email'):
|
648
|
670
|
|
continue
|
649
|
671
|
|
|
650
|
672
|
|
message = email.message_from_string(obj.data.decode('UTF-8'), policy=email.policy.default)
|
669
|
691
|
|
emails.sort(key = lambda email: email['received_at'])
|
670
|
692
|
|
|
671
|
693
|
|
return template('mailing_list/emails_thread.html', thread=thread_data, emails=emails,
|
672
|
|
- |
participants=participants, list_address=list_address,
|
|
694
|
+ |
participants=participants, list_address=list_address, tags=tags,
|
673
|
695
|
|
repository=repository)
|