DEV: do not return no_result_help from the server (#15220)

We don't need it anymore. Actually, I removed using of it on the client side a long time ago, when I was working on improving blank page syndrome on user activity pages (see https://github.com/discourse/discourse/pull/14311).

This PR also removes some old resource strings that we don't use anymore. We have new strings for blank pages.
This commit is contained in:
Andrei Prigorshnev 2021-12-08 18:46:54 +01:00 committed by GitHub
parent a6230b8138
commit 4e8983036a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 3 additions and 62 deletions

View File

@ -16,8 +16,7 @@ class DraftsController < ApplicationController
)
render json: {
drafts: stream ? serialize_data(stream, DraftSerializer) : [],
no_results_help: I18n.t("user_activity.no_drafts.self")
drafts: stream ? serialize_data(stream, DraftSerializer) : []
}
end

View File

@ -25,20 +25,7 @@ class UserActionsController < ApplicationController
}
stream = UserAction.stream(opts).to_a
if stream.empty? && (help_key = params['no_results_help_key'])
if user.id == guardian.user.try(:id)
help_key += ".self"
else
help_key += ".others"
end
render json: {
user_action: [],
no_results_help: I18n.t(help_key)
}
else
render_serialized(stream, UserActionSerializer, root: 'user_actions')
end
render_serialized(stream, UserActionSerializer, root: 'user_actions')
end
def show

View File

@ -1621,10 +1621,7 @@ class UsersController < ApplicationController
if bookmark_list.bookmarks.empty?
render json: {
bookmarks: [],
no_results_help: I18n.t(
params[:q].present? ? "user_activity.no_bookmarks.search" : "user_activity.no_bookmarks.self"
)
bookmarks: []
}
else
page = params[:page].to_i + 1

View File

@ -965,12 +965,6 @@ en:
pm_title: "Backup Drafts from ongoing topics"
pm_body: "Topic containing backup drafts"
user_activity:
no_bookmarks:
self: "You have no bookmarked posts; bookmarks allow you to quickly refer to specific posts."
search: "No bookmarks found with the provided search query."
others: "No bookmarks."
no_drafts:
self: "You have no drafts; begin composing a reply in any topic and it will be auto-saved as a new draft."
no_log_search_queries: "Search log queries are currently disabled (an administrator can enable them in site settings)."
email_settings:

View File

@ -49,36 +49,6 @@ describe UserActionsController do
.to eq(user.username)
end
it 'renders help text if provided for self' do
logged_in = sign_in(Fabricate(:user))
get "/user_actions.json", params: {
filter: UserAction::LIKE,
username: logged_in.username,
no_results_help_key: "user_activity.no_bookmarks"
}
expect(response.status).to eq(200)
parsed = response.parsed_body
expect(parsed["no_results_help"]).to eq(I18n.t("user_activity.no_bookmarks.self"))
end
it 'renders help text for others' do
user = Fabricate(:user)
get "/user_actions.json", params: {
filter: UserAction::LIKE,
username: user.username,
no_results_help_key: "user_activity.no_bookmarks"
}
expect(response.status).to eq(200)
parsed = response.parsed_body
expect(parsed["no_results_help"]).to eq(I18n.t("user_activity.no_bookmarks.others"))
end
context 'hidden profiles' do
fab!(:post) { Fabricate(:post) }

View File

@ -5074,9 +5074,6 @@ describe UsersController do
get "/u/#{user.username}/bookmarks.json"
expect(response.status).to eq(200)
expect(response.parsed_body['bookmarks']).to eq([])
expect(response.parsed_body['no_results_help']).to eq(
I18n.t('user_activity.no_bookmarks.self')
)
end
it "shows a helpful message if no bookmarks are found for the search" do
@ -5086,9 +5083,6 @@ describe UsersController do
}
expect(response.status).to eq(200)
expect(response.parsed_body['bookmarks']).to eq([])
expect(response.parsed_body['no_results_help']).to eq(
I18n.t('user_activity.no_bookmarks.search')
)
end
end