mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-04-27 03:00:12 -04:00
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:
@@ -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({})
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user