Mod log: show edit reason for wiki pages

This also includes a minor refactor of how we display the "details text"
for ModActions in the moderation log.
This commit is contained in:
Chad Birch
2015-07-13 12:05:24 -06:00
parent 3e6fc896fa
commit bcd51343ab
3 changed files with 12 additions and 9 deletions

View File

@@ -409,7 +409,8 @@ class WikiApiController(WikiController):
if page.special or c.is_wiki_mod:
description = modactions.get(page.name, 'Page %s edited' % page.name)
ModAction.create(c.site, c.user, 'wikirevise', details=description)
ModAction.create(c.site, c.user, "wikirevise",
details=description, description=reason)
except ConflictException as e:
self.handle_error(409, 'EDIT_CONFLICT', newcontent=e.new, newrevision=page.revision, diffcontent=e.htmldiff)
return json.dumps({})

View File

@@ -253,12 +253,15 @@ class ModAction(tdb_cassandra.UuidThing):
return q
def get_extra_text(self):
text = ''
if hasattr(self, 'details') and not self.details == None:
@property
def details_text(self):
text = ""
if getattr(self, "details", None):
text += self._details_text.get(self.details, self.details)
if hasattr(self, 'description') and not self.description == None:
text += ' %s' % self.description
if getattr(self, "description", None):
if text:
text += ": "
text += self.description
return text
@classmethod
@@ -307,7 +310,6 @@ class ModAction(tdb_cassandra.UuidThing):
item.moderator = moderators[item.mod_id36]
item.subreddit = srs[item.sr_id36]
item.text = cls._text.get(item.action, '')
item.details = item.get_extra_text()
item.target = None
item.target_author = None

View File

@@ -73,8 +73,8 @@
${thing.wrapped_user_target} 
%endif
%if hasattr(thing, 'details') and thing.details:
<em>(${thing.details})</em>
%if thing.details_text:
<em>(${thing.details_text})</em>
%endif
</td>
</tr>