Fixed new pronto warnings after develop branch sync

This commit is contained in:
Hank Grabowski 2018-12-30 17:04:35 -05:00
parent 89f918c486
commit ce01946eb0
10 changed files with 10 additions and 2 deletions

View file

@ -110,6 +110,7 @@ module Api
def find_post def find_post
post = post_service.find!(params[:post_id]) post = post_service.find!(params[:post_id])
return post if post.public? || private_read? return post if post.public? || private_read?
raise ActiveRecord::RecordNotFound raise ActiveRecord::RecordNotFound
end end
end end

View file

@ -81,6 +81,7 @@ module Api
def find_post def find_post
post = post_service.find!(params[:post_id]) post = post_service.find!(params[:post_id])
raise ActiveRecord::RecordNotFound unless post.public? || private_read? raise ActiveRecord::RecordNotFound unless post.public? || private_read?
post post
end end
end end

View file

@ -59,6 +59,7 @@ module Api
def add_location_params(mapped_parameters) def add_location_params(mapped_parameters)
return unless params.has_key?(:location) return unless params.has_key?(:location)
location = params.require(:location) location = params.require(:location)
mapped_parameters[:location_address] = location[:address] mapped_parameters[:location_address] = location[:address]
mapped_parameters[:location_coords] = "#{location[:lat]},#{location[:lng]}" mapped_parameters[:location_coords] = "#{location[:lat]},#{location[:lng]}"

View file

@ -29,6 +29,7 @@ module Api
person = if params.has_key?(:id) person = if params.has_key?(:id)
found_person = Person.find_by!(guid: params[:id]) found_person = Person.find_by!(guid: params[:id])
raise ActiveRecord::RecordNotFound unless found_person.searchable || access_token?("contacts:read") raise ActiveRecord::RecordNotFound unless found_person.searchable || access_token?("contacts:read")
found_person found_person
else else
current_user.person current_user.person

View file

@ -70,6 +70,7 @@ module User::Querying
def posts_from(person, with_order=true) def posts_from(person, with_order=true)
base_query = Post.from_person_visible_by_user(self, person) base_query = Post.from_person_visible_by_user(self, person)
return base_query.order("posts.created_at desc") if with_order return base_query.order("posts.created_at desc") if with_order
base_query base_query
end end

View file

@ -25,6 +25,7 @@ module User::SocialActions
def reshare!(target, opts={}) def reshare!(target, opts={})
raise I18n.t("reshares.create.error") if target.author.guid == guid raise I18n.t("reshares.create.error") if target.author.guid == guid
build_post(:reshare, :root_guid => target.guid).tap do |reshare| build_post(:reshare, :root_guid => target.guid).tap do |reshare|
reshare.save! reshare.save!
update_or_create_participation!(target) update_or_create_participation!(target)

View file

@ -17,7 +17,6 @@ class PostPresenter < BasePresenter
end end
def as_api_response def as_api_response
interactions = PostInteractionPresenter.new(@post, current_user)
{ {
guid: @post.guid, guid: @post.guid,
body: build_text, body: build_text,
@ -28,7 +27,7 @@ class PostPresenter < BasePresenter
nsfw: @post.nsfw, nsfw: @post.nsfw,
author: PersonPresenter.new(@post.author).as_api_json, author: PersonPresenter.new(@post.author).as_api_json,
provider_display_name: @post.provider_display_name, provider_display_name: @post.provider_display_name,
interaction_counters: interactions.as_counters, interaction_counters: PostInteractionPresenter.new(@post, current_user).as_counters,
location: @post.post_location, location: @post.post_location,
poll: PollPresenter.new(@post.poll, current_user).as_api_json, poll: PollPresenter.new(@post.poll, current_user).as_api_json,
mentioned_people: build_mentioned_people_json, mentioned_people: build_mentioned_people_json,

View file

@ -34,6 +34,7 @@ class ProfilePresenter < BasePresenter
def as_other_api_json(all_details) def as_other_api_json(all_details)
return base_api_json unless all_details return base_api_json unless all_details
base_api_json.merge(added_details_api_json) base_api_json.merge(added_details_api_json)
end end

View file

@ -46,6 +46,7 @@ class NotificationService
def update_status_by_guid(guid, is_read_status) def update_status_by_guid(guid, is_read_status)
notification = get_by_guid(guid) notification = get_by_guid(guid)
raise ActiveRecord::RecordNotFound unless notification raise ActiveRecord::RecordNotFound unless notification
notification.set_read_state(is_read_status) notification.set_read_state(is_read_status)
true true
end end

View file

@ -37,6 +37,7 @@ describe Api::Paging::IndexPaginator do
until page&.empty? until page&.empty?
page_count += 1 page_count += 1
break unless pager.next_page break unless pager.next_page
np = pager.next_page.split("=").last.to_i np = pager.next_page.split("=").last.to_i
pager = Api::Paging::IndexPaginator.new(@alice_search, np, @limit) pager = Api::Paging::IndexPaginator.new(@alice_search, np, @limit)
page = pager.page_data page = pager.page_data