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:
parent
a6230b8138
commit
4e8983036a
|
@ -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
|
||||
|
||||
|
|
|
@ -25,22 +25,9 @@ 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
|
||||
|
||||
end
|
||||
|
||||
def show
|
||||
params.require(:id)
|
||||
render_serialized(UserAction.stream_item(params[:id], guardian), UserActionSerializer)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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) }
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue