diff --git a/Changelog.md b/Changelog.md index 5789b2f14..c34f849c5 100644 --- a/Changelog.md +++ b/Changelog.md @@ -27,6 +27,7 @@ * Fix visiblity on invitation modal when opening it from the stream [#7191](https://github.com/diaspora/diaspora/pull/7191) * Add avatar fallback on tags page [#7198](https://github.com/diaspora/diaspora/pull/7198) * Update notifications when changing the stream [#7199](https://github.com/diaspora/diaspora/pull/7199) +* Fix 500 on mobile commented and liked streams [#7219](https://github.com/diaspora/diaspora/pull/7219) ## Features * Show spinner when loading comments in the stream [#7170](https://github.com/diaspora/diaspora/pull/7170) diff --git a/app/controllers/conversations_controller.rb b/app/controllers/conversations_controller.rb index b667e31e4..c69b6d7d8 100644 --- a/app/controllers/conversations_controller.rb +++ b/app/controllers/conversations_controller.rb @@ -38,21 +38,22 @@ class ConversationsController < ApplicationController person_ids = current_user.contacts.mutual.where(column => params[recipients_param].split(",")).pluck(:person_id) end + unless person_ids.present? + render text: I18n.t("javascripts.conversation.create.no_recipient"), status: 422 + return + end + opts = params.require(:conversation).permit(:subject) opts[:participant_ids] = person_ids opts[:message] = { text: params[:conversation][:text] } @conversation = current_user.build_conversation(opts) - if person_ids.present? && @conversation.save + if @conversation.save Diaspora::Federation::Dispatcher.defer_dispatch(current_user, @conversation) flash[:notice] = I18n.t("conversations.create.sent") render json: {id: @conversation.id} else - message = I18n.t("conversations.create.fail") - if person_ids.blank? - message = I18n.t("javascripts.conversation.create.no_recipient") - end - render text: message, status: 422 + render text: I18n.t("conversations.create.fail"), status: 422 end end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 4a20f5909..6fed2b8b6 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -33,14 +33,6 @@ module ApplicationHelper "bookmarklet('#{bookmarklet_url}', #{width}, #{height});" end - def contacts_link - if current_user.contacts.size > 0 - contacts_path - else - community_spotlight_path - end - end - def all_services_connected? current_user.services.size == AppConfig.configured_services.size end diff --git a/app/helpers/stream_helper.rb b/app/helpers/stream_helper.rb index 73e23d25c..fc30a0457 100644 --- a/app/helpers/stream_helper.rb +++ b/app/helpers/stream_helper.rb @@ -30,6 +30,10 @@ module StreamHelper aspects_stream_path(max_time: time_for_scroll(@stream), a_ids: session[:a_ids]) elsif current_page?(:public_stream) public_stream_path(max_time: time_for_scroll(@stream)) + elsif current_page?(:commented_stream) + commented_stream_path(max_time: time_for_scroll(@stream)) + elsif current_page?(:liked_stream) + liked_stream_path(max_time: time_for_scroll(@stream)) elsif current_page?(:mentioned_stream) mentioned_stream_path(max_time: time_for_scroll(@stream)) elsif current_page?(:followed_tags_stream) diff --git a/features/desktop/help.feature b/features/desktop/help.feature new file mode 100644 index 000000000..cd44eec9d --- /dev/null +++ b/features/desktop/help.feature @@ -0,0 +1,8 @@ +@javascript +Feature: Getting help + + Scenario: Visit help page + When I am on the help page + Then I should see "diaspora* FAQ" + When I follow "Mentions" + Then I should see "What is a “mention”?" within ".faq_question_mentions .question" diff --git a/lib/stream/aspect.rb b/lib/stream/aspect.rb index bdfe6c084..0891ebde1 100644 --- a/lib/stream/aspect.rb +++ b/lib/stream/aspect.rb @@ -85,18 +85,6 @@ class Stream::Aspect < Stream::Base @all_aspects ||= aspect_ids.length == user.aspects.size end - # Provides a link to the user to the contacts page that corresponds with - # the stream's active aspects. - # - # @return [String] Link to contacts - def contacts_link - if for_all_aspects? || aspect_ids.size > 1 - Rails.application.routes.url_helpers.contacts_path - else - Rails.application.routes.url_helpers.contacts_path(:a_id => aspect.id) - end - end - # This is perfomance optimization, as everyone in your aspect stream you have # a contact. # diff --git a/lib/stream/base.rb b/lib/stream/base.rb index 0d705469f..72dad18d2 100644 --- a/lib/stream/base.rb +++ b/lib/stream/base.rb @@ -49,11 +49,6 @@ class Stream::Base includes(:profile) end - # @return [String] - def contacts_link - Rails.application.routes.url_helpers.contacts_path - end - # @return [Boolean] def for_all_aspects? true diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index 68ef70571..e03b15624 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -10,24 +10,6 @@ describe ApplicationHelper, :type => :helper do @person = FactoryGirl.create(:person) end - describe "#contacts_link" do - before do - def current_user - @current_user - end - end - - it 'links to community spotlight' do - @current_user = FactoryGirl.create(:user) - expect(contacts_link).to eq(community_spotlight_path) - end - - it 'links to contacts#index' do - @current_user = alice - expect(contacts_link).to eq(contacts_path) - end - end - describe "#all_services_connected?" do before do AppConfig.configured_services = [1, 2, 3] diff --git a/spec/helpers/stream_helper_spec.rb b/spec/helpers/stream_helper_spec.rb index 7705409b3..2afd7ff4f 100644 --- a/spec/helpers/stream_helper_spec.rb +++ b/spec/helpers/stream_helper_spec.rb @@ -41,6 +41,20 @@ describe StreamHelper, type: :helper do expect(helper.next_page_path).to include activity_stream_path end + it "works for commented page when current page is commented stream" do + allow(helper).to receive(:current_page?).and_return(false) + expect(helper).to receive(:current_page?).with(:commented_stream).and_return(true) + allow(helper).to receive(:controller).and_return(build_controller(StreamsController)) + expect(helper.next_page_path).to include commented_stream_path + end + + it "works for liked page when current page is liked stream" do + allow(helper).to receive(:current_page?).and_return(false) + expect(helper).to receive(:current_page?).with(:liked_stream).and_return(true) + allow(helper).to receive(:controller).and_return(build_controller(StreamsController)) + expect(helper.next_page_path).to include liked_stream_path + end + it "works for mentioned page when current page is mentioned stream" do allow(helper).to receive(:current_page?).and_return(false) expect(helper).to receive(:current_page?).with(:mentioned_stream).and_return(true) diff --git a/spec/lib/stream/base_spec.rb b/spec/lib/stream/base_spec.rb index 2f5c2435e..0ae2c734b 100644 --- a/spec/lib/stream/base_spec.rb +++ b/spec/lib/stream/base_spec.rb @@ -6,12 +6,6 @@ describe Stream::Base do @stream = Stream::Base.new(alice) end - describe '#contacts_link' do - it 'should default to your contacts page' do - expect(@stream.contacts_link).to match(/contacts/) - end - end - describe '#stream_posts' do it "should returns the posts.for_a_stream" do posts = double diff --git a/spec/shared_behaviors/stream.rb b/spec/shared_behaviors/stream.rb index fa1c0d2de..c322f261b 100644 --- a/spec/shared_behaviors/stream.rb +++ b/spec/shared_behaviors/stream.rb @@ -18,10 +18,6 @@ shared_examples_for 'it is a stream' do expect(@stream.send(:publisher_opts)).not_to be_nil end - it 'has a contacts link' do - expect(@stream.contacts_link).not_to be_nil - end - it 'should make the stream a time object' do @stream.max_time = 123 expect(@stream.max_time).to be_a(Time)