Skip to content

Commit

Permalink
AricleInfo: hide IP edit count from API output since it's always 0
Browse files Browse the repository at this point in the history
  • Loading branch information
MusikAnimal committed Jun 22, 2021
1 parent 97a2e27 commit f903bdf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/AppBundle/Model/ArticleInfoApi.php
Expand Up @@ -281,7 +281,7 @@ public function getArticleInfoApiData(Project $project, Page $page): array
'editors' => (int) $info['num_editors'],
'minor_edits' => (int) $info['minor_edits'],
'author' => $info['author'],
'author_editcount' => (int) $info['author_editcount'],
'author_editcount' => null === $info['author_editcount'] ? null : (int) $info['author_editcount'],
'created_at' => $creationDateTime,
'created_rev_id' => $info['created_rev_id'],
'modified_at' => $modifiedDateTime->format('Y-m-d H:i'),
Expand Down
3 changes: 2 additions & 1 deletion templates/articleInfo/api.html.twig
Expand Up @@ -19,7 +19,8 @@
{% if data.error is not defined and data.author is not empty -%}
{{ msg('comma-character') }}
{{ msg('created-by')|lower }}: {{ wiki.userLink(data.author, project) }}
(<a target="_blank" href="{{ url('EditCounterResult', { 'project': project.domain, 'username': data.author }) }}">{{ data.author_editcount|num_format }}</a>)
{# IPs have an edit count of null for performance reasons, so we simply don't show anything #}{% if data.author_editcount != null %}
(<a target="_blank" title="{{ msg('approximate') }}" href="{{ url('EditCounterResult', { 'project': project.domain, 'username': data.author }) }}">{{ data.author_editcount|num_format }}</a>){% endif %}
{% endif %}
&middot;
<a target="_blank" href="{{ url('ArticleInfoResult', { 'project': project.domain, 'page': page.title }) }}">{{ msg('see-full-page-stats') }}</a>
Expand Down

0 comments on commit f903bdf

Please sign in to comment.