Skip to content

Commit 25e0c3e

Browse files
committed
Log IP addresses with screened emails and urls
1 parent 612c0cc commit 25e0c3e

14 files changed

Lines changed: 24 additions & 12 deletions

app/assets/javascripts/admin/models/staff_action_log.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Discourse.StaffActionLog = Discourse.Model.extend({
1616
formattedDetails: function() {
1717
var formatted = "";
1818
formatted += this.format('email', 'email');
19-
formatted += this.format('admin.logs.staff_actions.ip_address', 'ip_address');
19+
formatted += this.format('admin.logs.ip_address', 'ip_address');
2020
if (!this.get('useCustomModalForDetails')) {
2121
formatted += this.format('admin.logs.staff_actions.new_value', 'new_value');
2222
formatted += this.format('admin.logs.staff_actions.previous_value', 'previous_value');

app/assets/javascripts/admin/templates/logs/screened_emails.js.handlebars

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
<div class="col heading match_count">{{i18n admin.logs.match_count}}</div>
1313
<div class="col heading last_match_at">{{i18n admin.logs.last_match_at}}</div>
1414
<div class="col heading created_at">{{i18n admin.logs.created_at}}</div>
15+
<div class="col heading ip_address">{{i18n admin.logs.ip_address}}</div>
1516
<div class="clearfix"></div>
1617
</div>
1718

app/assets/javascripts/admin/templates/logs/screened_emails_list_item.js.handlebars

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33
<div class="col match_count">{{match_count}}</div>
44
<div class="col last_match_at">{{unboundAgeWithTooltip last_match_at}}</div>
55
<div class="col created_at">{{unboundAgeWithTooltip created_at}}</div>
6+
<div class="col ip_address">{{ip_address}}</div>
67
<div class="clearfix"></div>

app/assets/javascripts/admin/templates/logs/screened_urls.js.handlebars

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
<div class="col heading match_count">{{i18n admin.logs.match_count}}</div>
1313
<div class="col heading last_match_at">{{i18n admin.logs.last_match_at}}</div>
1414
<div class="col heading created_at">{{i18n admin.logs.created_at}}</div>
15+
<div class="col heading ip_address">{{i18n admin.logs.ip_address}}</div>
1516
<div class="clearfix"></div>
1617
</div>
1718

app/assets/javascripts/admin/templates/logs/screened_urls_list_item.js.handlebars

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33
<div class="col match_count">{{match_count}}</div>
44
<div class="col last_match_at">{{unboundAgeWithTooltip last_match_at}}</div>
55
<div class="col created_at">{{unboundAgeWithTooltip created_at}}</div>
6+
<div class="col ip_address">{{ip_address}}</div>
67
<div class="clearfix"></div>

app/assets/stylesheets/admin/admin_base.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -703,9 +703,9 @@ table {
703703
.screened-emails, .screened-urls {
704704
width: 900px;
705705
.email, .url {
706-
width: 400px;
706+
width: 300px;
707707
}
708-
.action, .match_count, .last_match_at, .created_at {
708+
.action, .match_count, .last_match_at, .created_at, .ip_address {
709709
width: 110px;
710710
text-align: center;
711711
}

app/models/screened_email.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class ScreenedEmail < ActiveRecord::Base
1313
validates :email, presence: true, uniqueness: true
1414

1515
def self.block(email, opts={})
16-
find_by_email(email) || create(opts.slice(:action_type).merge({email: email}))
16+
find_by_email(email) || create(opts.slice(:action_type, :ip_address).merge({email: email}))
1717
end
1818

1919
def self.should_block?(email)

app/models/screened_url.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ def strip_http
2121
end
2222

2323
def self.watch(url, domain, opts={})
24-
find_by_url(url) || create(opts.slice(:action_type).merge(url: url, domain: domain))
24+
find_by_url(url) || create(opts.slice(:action_type, :ip_address).merge(url: url, domain: domain))
2525
end
2626
end

app/serializers/screened_email_serializer.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ class ScreenedEmailSerializer < ApplicationSerializer
33
:action,
44
:match_count,
55
:last_match_at,
6-
:created_at
6+
:created_at,
7+
:ip_address
78

89
def action
910
ScreenedEmail.actions.key(object.action_type).to_s

app/serializers/screened_url_serializer.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ class ScreenedUrlSerializer < ApplicationSerializer
44
:action,
55
:match_count,
66
:last_match_at,
7-
:created_at
7+
:created_at,
8+
:ip_address
89

910
def action
1011
ScreenedUrl.actions.key(object.action_type).to_s

0 commit comments

Comments
 (0)