mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 19:03:45 +08:00
FEATURE: Remove ignore feature SiteSetting and enable ignore by default (#7349)
This commit is contained in:
parent
a723699519
commit
442fb2facb
|
@ -6,7 +6,6 @@
|
|||
</div>
|
||||
<div class="instructions">{{i18n 'user.muted_users_instructions'}}</div>
|
||||
|
||||
{{#if siteSettings.ignore_user_enabled}}
|
||||
<div class="controls tracking-controls">
|
||||
<label>{{d-icon "eye-slash" class="icon"}} {{i18n 'user.ignored_users'}}</label>
|
||||
{{user-selector excludeCurrentUser=true
|
||||
|
@ -15,7 +14,6 @@
|
|||
class="user-selector"}}
|
||||
</div>
|
||||
<div class="instructions">{{i18n 'user.ignored_users_instructions'}}</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
|
||||
{{plugin-outlet name="user-preferences-notifications" args=(hash model=model save=(action "save"))}}
|
||||
|
|
|
@ -993,7 +993,6 @@ class UsersController < ApplicationController
|
|||
end
|
||||
|
||||
def notification_level
|
||||
raise Discourse::NotFound unless SiteSetting.ignore_user_enabled
|
||||
user = fetch_user_from_params
|
||||
|
||||
if params[:notification_level] == "ignore"
|
||||
|
|
|
@ -3,8 +3,6 @@ module Jobs
|
|||
every 1.day
|
||||
|
||||
def execute(args)
|
||||
return unless SiteSetting.ignore_user_enabled
|
||||
|
||||
params = {
|
||||
threshold: SiteSetting.ignored_users_count_message_threshold,
|
||||
gap_days: SiteSetting.ignored_users_message_gap_days,
|
||||
|
|
|
@ -1837,8 +1837,6 @@ en:
|
|||
|
||||
log_personal_messages_views: "Log personal message views by Admin for other users/groups."
|
||||
|
||||
ignore_user_enabled: "[Beta] Allow ignoring users."
|
||||
|
||||
ignored_users_count_message_threshold: "Notify moderators if a particular user is ignored by this many other users."
|
||||
|
||||
ignored_users_message_gap_days: "How long to wait before notifying moderators again about a user who has been ignored by many others."
|
||||
|
|
|
@ -529,9 +529,6 @@ users:
|
|||
default: false
|
||||
client: true
|
||||
log_personal_messages_views: false
|
||||
ignore_user_enabled:
|
||||
default: false
|
||||
client: true
|
||||
ignored_users_count_message_threshold:
|
||||
default: 5
|
||||
client: true
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
class RemoveIgnoreUserEnabledSiteSetting < ActiveRecord::Migration[5.2]
|
||||
def up
|
||||
execute "DELETE FROM site_settings WHERE name = 'ignore_user_enabled'"
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
|
@ -407,7 +407,7 @@ class Guardian
|
|||
|
||||
def can_ignore_users?
|
||||
return false if anonymous?
|
||||
SiteSetting.ignore_user_enabled? && (@user.staff? || @user.trust_level >= TrustLevel.levels[:member])
|
||||
@user.staff? || @user.trust_level >= TrustLevel.levels[:member]
|
||||
end
|
||||
|
||||
def allow_themes?(theme_ids, include_preview: false)
|
||||
|
|
|
@ -602,8 +602,6 @@ class TopicView
|
|||
@contains_gaps = false
|
||||
@filtered_posts = unfiltered_posts
|
||||
|
||||
if SiteSetting.ignore_user_enabled
|
||||
|
||||
sql = <<~SQL
|
||||
SELECT ignored_user_id
|
||||
FROM ignored_users as ig
|
||||
|
@ -620,7 +618,6 @@ class TopicView
|
|||
@filtered_posts = @filtered_posts.where.not("user_id IN (?) AND id <> ?", ignored_user_ids, first_post_id)
|
||||
@contains_gaps = true
|
||||
end
|
||||
end
|
||||
|
||||
# Filters
|
||||
if @filter == 'summary'
|
||||
|
|
|
@ -2676,9 +2676,6 @@ describe Guardian do
|
|||
end
|
||||
|
||||
describe '#can_ignore_user?' do
|
||||
before do
|
||||
SiteSetting.ignore_user_enabled = true
|
||||
end
|
||||
|
||||
let(:guardian) { Guardian.new(trust_level_2) }
|
||||
|
||||
|
|
|
@ -39,21 +39,6 @@ describe TopicView do
|
|||
let!(:post2) { Fabricate(:post, topic: topic, user: evil_trout) }
|
||||
let!(:post3) { Fabricate(:post, topic: topic, user: user) }
|
||||
|
||||
describe "when SiteSetting.ignore_user_enabled is false" do
|
||||
it "does not filter out ignored user posts" do
|
||||
SiteSetting.ignore_user_enabled = false
|
||||
|
||||
tv = TopicView.new(topic.id, evil_trout)
|
||||
expect(tv.filtered_post_ids).to eq([post.id, post2.id, post3.id])
|
||||
end
|
||||
end
|
||||
|
||||
describe "when SiteSetting.ignore_user_enabled is true" do
|
||||
|
||||
before do
|
||||
SiteSetting.ignore_user_enabled = true
|
||||
end
|
||||
|
||||
it "filters out ignored user posts" do
|
||||
tv = TopicView.new(topic.id, evil_trout)
|
||||
expect(tv.filtered_post_ids).to eq([post.id, post2.id])
|
||||
|
@ -100,7 +85,6 @@ describe TopicView do
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "chunk_size" do
|
||||
it "returns `chunk_size` by default" do
|
||||
|
|
|
@ -4,7 +4,6 @@ require_dependency 'jobs/scheduled/ignored_users_summary'
|
|||
|
||||
describe Jobs::IgnoredUsersSummary do
|
||||
before do
|
||||
SiteSetting.ignore_user_enabled = true
|
||||
SiteSetting.ignored_users_count_message_threshold = 1
|
||||
SiteSetting.ignored_users_message_gap_days = 365
|
||||
end
|
||||
|
|
|
@ -2033,18 +2033,6 @@ describe UsersController do
|
|||
sign_in(user)
|
||||
end
|
||||
|
||||
context 'when ignore_user_enable is OFF' do
|
||||
it 'raises an error when not logged in' do
|
||||
put "/u/#{another_user.username}/notification_level.json", params: { notification_level: "" }
|
||||
expect(response.status).to eq(404)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when ignore_user_enable is ON' do
|
||||
before do
|
||||
SiteSetting.ignore_user_enabled = true
|
||||
end
|
||||
|
||||
let!(:ignored_user) { Fabricate(:ignored_user, user: user, ignored_user: another_user) }
|
||||
let!(:muted_user) { Fabricate(:muted_user, user: user, muted_user: another_user) }
|
||||
|
||||
|
@ -2087,7 +2075,6 @@ describe UsersController do
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "for user with period in username" do
|
||||
let(:user_with_period) { Fabricate(:user, username: "myname.test") }
|
||||
|
|
|
@ -35,10 +35,6 @@ describe UserUpdater do
|
|||
end
|
||||
|
||||
describe '#update_ignored_users' do
|
||||
before do
|
||||
SiteSetting.ignore_user_enabled = true
|
||||
end
|
||||
|
||||
it 'updates ignored users' do
|
||||
u1 = Fabricate(:user, trust_level: 2)
|
||||
u2 = Fabricate(:user, trust_level: 2)
|
||||
|
|
Loading…
Reference in New Issue
Block a user