diff --git a/tildes/tildes/templates/intercooler/topic_tags_edit.jinja2 b/tildes/tildes/templates/intercooler/topic_tags_edit.jinja2
index 18b96c5..ec98981 100644
--- a/tildes/tildes/templates/intercooler/topic_tags_edit.jinja2
+++ b/tildes/tildes/templates/intercooler/topic_tags_edit.jinja2
@@ -12,6 +12,7 @@
data-ic-target="#sidebar .topic-tags"
data-js-remove-on-success
>
+
{{ topic_tagging(value=topic.tags|join(', '), auto_focus=True, autocomplete_options=topic.group.common_topic_tags) }}
diff --git a/tildes/tildes/views/api/web/topic.py b/tildes/tildes/views/api/web/topic.py
index 259f815..4697345 100644
--- a/tildes/tildes/views/api/web/topic.py
+++ b/tildes/tildes/views/api/web/topic.py
@@ -161,11 +161,23 @@ def get_topic_tags(request: Request) -> dict:
renderer="topic_tags.jinja2",
permission="tag",
)
-@use_kwargs({"tags": String()})
-def put_tag_topic(request: Request, tags: str) -> dict:
+@use_kwargs({"tags": String(), "conflict_check": String()})
+def put_tag_topic(request: Request, tags: str, conflict_check: str) -> dict:
"""Apply tags to a topic with Intercooler."""
+ # pylint: disable=too-many-branches
topic = request.context
+ # check for edit conflict by verifying tags didn't change after they loaded the form
+ if conflict_check:
+ conflict_check_tags = conflict_check.split(",")
+ else:
+ conflict_check_tags = []
+
+ if conflict_check_tags != topic.tags:
+ raise ValidationError(
+ {"tags": ["Someone else edited simultaneously, please cancel and retry"]}
+ )
+
if tags:
# split the tag string on commas
new_tags = tags.split(",")