From 2354b10eb5e9c7382726bc5e6e041ea30a903c90 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Mon, 16 Jul 2018 01:11:53 +0200 Subject: Add admin dashboard (#8029) --- app/lib/potential_friendship_tracker.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'app/lib') diff --git a/app/lib/potential_friendship_tracker.rb b/app/lib/potential_friendship_tracker.rb index 017a9748d..dfca54f7b 100644 --- a/app/lib/potential_friendship_tracker.rb +++ b/app/lib/potential_friendship_tracker.rb @@ -20,6 +20,8 @@ class PotentialFriendshipTracker redis.zincrby(key, weight, target_account_id) redis.zremrangebyrank(key, 0, -MAX_ITEMS) redis.expire(key, EXPIRE_AFTER) + + ActivityTracker.increment('activity:interactions') end def remove(account_id, target_account_id) -- cgit From 8f64b17d98612f853a83ee766edc2bb41c82fd75 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Mon, 16 Jul 2018 15:17:43 +0200 Subject: Whitelist dat/ipfs/gopher links in sanitizer (#8034) Fix #7994 --- app/lib/sanitize_config.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/lib') diff --git a/app/lib/sanitize_config.rb b/app/lib/sanitize_config.rb index c2b466924..1bba4a5a6 100644 --- a/app/lib/sanitize_config.rb +++ b/app/lib/sanitize_config.rb @@ -2,7 +2,7 @@ class Sanitize module Config - HTTP_PROTOCOLS ||= ['http', 'https', :relative].freeze + HTTP_PROTOCOLS ||= ['http', 'https', 'dat', 'dweb', 'ipfs', 'ipns', 'ssb', 'gopher', :relative].freeze CLASS_WHITELIST_TRANSFORMER = lambda do |env| node = env[:node] -- cgit From a23ac107e4f9cc46a95d8e2dca6a5056dbcce39d Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Mon, 16 Jul 2018 18:35:43 +0200 Subject: Fix activity:interactions counter to count all interactions (#8037) --- app/lib/potential_friendship_tracker.rb | 2 -- app/services/favourite_service.rb | 1 + app/services/post_status_service.rb | 4 +++- app/services/reblog_service.rb | 1 + 4 files changed, 5 insertions(+), 3 deletions(-) (limited to 'app/lib') diff --git a/app/lib/potential_friendship_tracker.rb b/app/lib/potential_friendship_tracker.rb index dfca54f7b..017a9748d 100644 --- a/app/lib/potential_friendship_tracker.rb +++ b/app/lib/potential_friendship_tracker.rb @@ -20,8 +20,6 @@ class PotentialFriendshipTracker redis.zincrby(key, weight, target_account_id) redis.zremrangebyrank(key, 0, -MAX_ITEMS) redis.expire(key, EXPIRE_AFTER) - - ActivityTracker.increment('activity:interactions') end def remove(account_id, target_account_id) diff --git a/app/services/favourite_service.rb b/app/services/favourite_service.rb index 6e1ac3ba9..b565bcc32 100644 --- a/app/services/favourite_service.rb +++ b/app/services/favourite_service.rb @@ -37,6 +37,7 @@ class FavouriteService < BaseService end def bump_potential_friendship(account, status) + ActivityTracker.increment('activity:interactions') return if account.following?(status.account_id) PotentialFriendshipTracker.record(account.id, status.account_id, :favourite) end diff --git a/app/services/post_status_service.rb b/app/services/post_status_service.rb index 4c3485853..300eae547 100644 --- a/app/services/post_status_service.rb +++ b/app/services/post_status_service.rb @@ -83,7 +83,9 @@ class PostStatusService < BaseService end def bump_potential_friendship(account, status) - return if !status.reply? || account.following?(status.in_reply_to_account_id) + return if !status.reply? || account.id == status.in_reply_to_account_id + ActivityTracker.increment('activity:interactions') + return if account.following?(status.in_reply_to_account_id) PotentialFriendshipTracker.record(account.id, status.in_reply_to_account_id, :reply) end end diff --git a/app/services/reblog_service.rb b/app/services/reblog_service.rb index 0ee8bac2f..33ddef8b8 100644 --- a/app/services/reblog_service.rb +++ b/app/services/reblog_service.rb @@ -44,6 +44,7 @@ class ReblogService < BaseService end def bump_potential_friendship(account, reblog) + ActivityTracker.increment('activity:interactions') return if account.following?(reblog.reblog.account_id) PotentialFriendshipTracker.record(account.id, reblog.reblog.account_id, :reblog) end -- cgit