From 20e22722b00cebeb08605721b2214d73a5c34f51 Mon Sep 17 00:00:00 2001 From: Deimos Date: Sun, 26 May 2019 16:21:06 -0600 Subject: [PATCH] Prepend group + page slug to wiki edit messages Since every commit only affects a single file, this will make it much easier to see what they're affecting (and stop users from needing to include it manually). --- tildes/tildes/models/group/group_wiki_page.py | 6 +++++- tildes/tildes/templates/group_wiki_edit_page.jinja2 | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/tildes/tildes/models/group/group_wiki_page.py b/tildes/tildes/models/group/group_wiki_page.py index 2eddce3..d369083 100644 --- a/tildes/tildes/models/group/group_wiki_page.py +++ b/tildes/tildes/models/group/group_wiki_page.py @@ -68,7 +68,7 @@ class GroupWikiPage(DatabaseModel): # create the directory for the group if it doesn't already exist self.file_path.parent.mkdir(mode=0o755, exist_ok=True) - self.edit(markdown, user, f'~{group.path}: Create page "{page_name}"') + self.edit(markdown, user, "Create page") def __acl__(self) -> Sequence[Tuple[str, Any, str]]: """Pyramid security ACL.""" @@ -140,6 +140,10 @@ class GroupWikiPage(DatabaseModel): repo.index.add(str(self.file_path.relative_to(self.BASE_PATH))) repo.index.write() + # Prepend the group name and page slug to the edit message - if you change the + # format of this, make sure to also change the page-editing template to match + edit_message = f"~{self.group.path}/{self.slug}: {edit_message}" + repo.create_commit( repo.head.name, author, diff --git a/tildes/tildes/templates/group_wiki_edit_page.jinja2 b/tildes/tildes/templates/group_wiki_edit_page.jinja2 index d81e687..daeef2a 100644 --- a/tildes/tildes/templates/group_wiki_edit_page.jinja2 +++ b/tildes/tildes/templates/group_wiki_edit_page.jinja2 @@ -30,7 +30,10 @@
- +
+ ~{{ page.group.path }}/{{ page.slug }}: + +