Browse Source

Merge branch 'tag-conv-rm-group-name' into 'develop'

remove group name from hierarchical tags

See merge request tildes/tildes!139
merge-requests/139/merge
Oscar 23 hours ago
parent
commit
3ef2fd051c
  1. 9
      tildes/tildes/views/topic.py

9
tildes/tildes/views/topic.py

@ -124,6 +124,15 @@ def post_group_topics(
# remove any tag that's the same as the group's name
new_topic.tags = [tag for tag in new_topic.tags if tag != str(group.path)]
# remove the group's name from any hierarchical tag
for idx, tag in enumerate(new_topic.tags):
split_tag = tag.split(".")
if split_tag[0] == str(group.path):
tag = ".".join(split_tag[1::])
new_topic.tags[idx] = tag
# remove duplicates
new_topic.tags = list(set(new_topic.tags))
request.apply_rate_limit("topic_post")
request.db_session.add(new_topic)

Loading…
Cancel
Save