- {{/if}}
diff --git a/app/controllers/aspects_controller.rb b/app/controllers/aspects_controller.rb
index 4e0344cc3..b970f7596 100644
--- a/app/controllers/aspects_controller.rb
+++ b/app/controllers/aspects_controller.rb
@@ -84,18 +84,6 @@ class AspectsController < ApplicationController
head :no_content
end
- def toggle_contact_visibility
- @aspect = current_user.aspects.where(:id => params[:aspect_id]).first
-
- if @aspect.contacts_visible?
- @aspect.contacts_visible = false
- else
- @aspect.contacts_visible = true
- end
- @aspect.save
- head :no_content
- end
-
private
def connect_person_to_aspect(aspecting_person_id)
@@ -109,6 +97,6 @@ class AspectsController < ApplicationController
end
def aspect_params
- params.require(:aspect).permit(:name, :contacts_visible, :chat_enabled, :order_id)
+ params.require(:aspect).permit(:name, :chat_enabled, :order_id)
end
end
diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb
index feaddad14..8d24202e8 100644
--- a/app/controllers/home_controller.rb
+++ b/app/controllers/home_controller.rb
@@ -21,7 +21,7 @@ class HomeController < ApplicationController
partial_dir.join("_show.html.erb").exist? ||
partial_dir.join("_show.haml").exist?
render :show
- elsif User.count > 1 && Role.where(name: "admin").any?
+ elsif Role.admins.any?
render :default
else
redirect_to podmin_path
diff --git a/app/controllers/people_controller.rb b/app/controllers/people_controller.rb
index c47ff2ae2..9d33cf338 100644
--- a/app/controllers/people_controller.rb
+++ b/app/controllers/people_controller.rb
@@ -77,7 +77,6 @@ class PeopleController < ApplicationController
end
gon.preloads[:person] = @presenter.as_json
gon.preloads[:photos_count] = Photo.visible(current_user, @person).count(:all)
- gon.preloads[:contacts_count] = Contact.contact_contacts_for(current_user, @person).count(:all)
respond_with @presenter, layout: "with_header"
end
@@ -123,30 +122,6 @@ class PeopleController < ApplicationController
end
end
- def contacts
- respond_to do |format|
- format.json { head :not_acceptable }
-
- format.any do
- @person = Person.find_by_guid(params[:person_id])
-
- if @person
- @contact = current_user.contact_for(@person)
- @contacts_of_contact = Contact.contact_contacts_for(current_user, @person)
- gon.preloads[:person] = PersonPresenter.new(@person, current_user).as_json
- gon.preloads[:photos_count] = Photo.visible(current_user, @person).count(:all)
- gon.preloads[:contacts_count] = @contacts_of_contact.count(:all)
- @contacts_of_contact = @contacts_of_contact.paginate(page: params[:page], per_page: (params[:limit] || 15))
- @hashes = hashes_for_people @contacts_of_contact, @aspects
- respond_with @person, layout: "with_header"
- else
- flash[:error] = I18n.t "people.show.does_not_exist"
- redirect_to people_path
- end
- end
- end
- end
-
private
def find_person
diff --git a/app/controllers/photos_controller.rb b/app/controllers/photos_controller.rb
index 5674d888c..4bcbb90d2 100644
--- a/app/controllers/photos_controller.rb
+++ b/app/controllers/photos_controller.rb
@@ -31,7 +31,6 @@ class PhotosController < ApplicationController
format.all do
gon.preloads[:person] = @presenter.as_json
gon.preloads[:photos_count] = Photo.visible(current_user, @person).count(:all)
- gon.preloads[:contacts_count] = Contact.contact_contacts_for(current_user, @person).count(:all)
render "people/show", layout: "with_header"
end
format.mobile { render "people/show" }
diff --git a/app/controllers/streams_controller.rb b/app/controllers/streams_controller.rb
index 89190168c..0d0947616 100644
--- a/app/controllers/streams_controller.rb
+++ b/app/controllers/streams_controller.rb
@@ -5,7 +5,7 @@
# the COPYRIGHT file.
class StreamsController < ApplicationController
- before_action :authenticate_user!
+ before_action :authenticate_user!, except: :public
before_action :save_selected_aspects, :only => :aspects
layout proc { request.format == :mobile ? "application" : "with_header" }
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index f262b288a..213d034b6 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -46,6 +46,10 @@ module ApplicationHelper
current_user.services.size == AppConfig.configured_services.size
end
+ def service_unconnected?(service)
+ AppConfig.show_service?(service, current_user) && current_user.services.none? {|x| x.provider == service }
+ end
+
def popover_with_close_html(without_close_html)
without_close_html + link_to('×'.html_safe, "#", :class => 'close')
end
diff --git a/app/models/contact.rb b/app/models/contact.rb
index 2f3dd4e73..0fa2e4d89 100644
--- a/app/models/contact.rb
+++ b/app/models/contact.rb
@@ -47,17 +47,6 @@ class Contact < ApplicationRecord
).destroy_all
end
- def contacts
- people = Person.arel_table
- incoming_aspects = Aspect.where(
- :user_id => self.person.owner_id,
- :contacts_visible => true).joins(:contacts).where(
- :contacts => {:person_id => self.user.person_id}).select('aspects.id')
- incoming_aspect_ids = incoming_aspects.map{|a| a.id}
- similar_contacts = Person.joins(:contacts => :aspect_memberships).where(
- :aspect_memberships => {:aspect_id => incoming_aspect_ids}).where(people[:id].not_eq(self.user.person.id)).select('DISTINCT people.*')
- end
-
def mutual?
sharing && receiving
end
@@ -72,17 +61,6 @@ class Contact < ApplicationRecord
end
end
- def self.contact_contacts_for(user, person)
- return none unless user
-
- if person == user.person
- user.contact_people
- else
- contact = user.contact_for(person)
- contact.try(:contacts) || none
- end
- end
-
# Follows back if user setting is set so
def receive(_recipient_user_ids)
user.share_with(person, user.auto_follow_back_aspect) if user.auto_follow_back && !receiving
diff --git a/app/serializers/export/aspect_serializer.rb b/app/serializers/export/aspect_serializer.rb
index ceeef754c..938939ad9 100644
--- a/app/serializers/export/aspect_serializer.rb
+++ b/app/serializers/export/aspect_serializer.rb
@@ -2,8 +2,6 @@
module Export
class AspectSerializer < ActiveModel::Serializer
- attributes :name,
- :contacts_visible,
- :chat_enabled
+ attributes :name, :chat_enabled
end
end
diff --git a/app/views/aspects/_aspect_stream.haml b/app/views/aspects/_aspect_stream.haml
index 902528710..036640de3 100644
--- a/app/views/aspects/_aspect_stream.haml
+++ b/app/views/aspects/_aspect_stream.haml
@@ -2,12 +2,13 @@
-# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file.
-.container-fluid.main-stream-publisher
- .pull-left.hidden-xs
- = owner_image_link
- = render "publisher/publisher", publisher_aspects_for(stream)
+- if user_signed_in?
+ .container-fluid.main-stream-publisher
+ .pull-left.hidden-xs
+ = owner_image_link
+ = render "publisher/publisher", publisher_aspects_for(stream)
-- if current_user.getting_started?
+- if current_user&.getting_started?
.stream#main-stream{:title => popover_with_close_html("3. #{t('.stay_updated')}"),
"data-content" => t(".stay_updated_explanation")}
- else
@@ -17,5 +18,5 @@
.loader.hidden
.spinner
-- if current_user.contacts.size < 2
+- if current_user && current_user.contacts.size < 2
= render 'aspects/no_contacts_message'
diff --git a/app/views/contacts/_header.html.haml b/app/views/contacts/_header.html.haml
index d8d323fb1..4348e0dea 100644
--- a/app/views/contacts/_header.html.haml
+++ b/app/views/contacts/_header.html.haml
@@ -4,12 +4,6 @@
- if @aspect.contacts.size > 0 && @aspect.contacts.size < 20
= start_a_conversation_link(@aspect, @aspect.contacts.size)
- = link_to aspect_toggle_contact_visibility_path(@aspect), id: "contacts_visibility_toggle", class: "contacts_button", method: :put, remote: true do
- -if @aspect.contacts_visible?
- %i.entypo-lock-open.contacts-header-icon{title: t("aspects.edit.aspect_list_is_visible")}
- -else
- %i.entypo-lock.contacts-header-icon{title: t("aspects.edit.aspect_list_is_not_visible")}
-
-if AppConfig.chat.enabled?
= link_to aspect_toggle_chat_privilege_path(@aspect), id: "chat_privilege_toggle", class: "contacts_button", method: :put, remote: true do
-if @aspect.chat_enabled?
diff --git a/app/views/home/podmin.haml b/app/views/home/podmin.haml
index 35812647f..7b502870c 100644
--- a/app/views/home/podmin.haml
+++ b/app/views/home/podmin.haml
@@ -31,7 +31,7 @@
%span.entypo-key
= t(".make_yourself_an_admin")
!= t(".make_yourself_an_admin_info",
- wiki: link_to("diaspora* wiki", "https://wiki.diasporafoundation.org/FAQ_for_pod_maintainers#What_are_roles_and_how_do_I_use_them.3F_.2F_Make_yourself_an_admin"),
+ wiki: link_to("diaspora* wiki", "https://wiki.diasporafoundation.org/Permalink:FAQ_-_Add_admin"),
admin_dashboard: link_to(t("javascripts.header.admin"), admin_dashboard_path))
.row
diff --git a/app/views/people/contacts.haml b/app/views/people/contacts.haml
deleted file mode 100644
index 698f5951b..000000000
--- a/app/views/people/contacts.haml
+++ /dev/null
@@ -1,32 +0,0 @@
-- content_for :page_title do
- = @person.name
-
-.container-fluid#profile_container
- .row
- .col-md-3
- .sidebar.profile-sidebar#profile
- -# here be JS
-
- .col-md-9
- .profile_header
- -# more JS
-
- .stream-container
- #people-stream.stream
- - @hashes.each do |hash|
- = render partial: 'people/person', locals: hash
- = will_paginate @contacts_of_contact, renderer: WillPaginate::ActionView::BootstrapLinkRenderer
-
--if user_signed_in? && @person
- #new_status_message_pane
- = render 'shared/modal',
- path: new_status_message_path(:person_id => @person.id),
- title: t('status_messages.new.mentioning', person: @person.name),
- id: 'mentionModal'
-
- -if @contact
- .conversations-form-container#new_conversation_pane
- = render 'shared/modal',
- path: new_conversation_path(:contact_id => @contact.id, name: @contact.person.name, modal: true),
- title: t('conversations.index.new_conversation'),
- id: 'conversationModal'
diff --git a/app/views/streams/main_stream.html.haml b/app/views/streams/main_stream.html.haml
index dd297185b..abc6f1f36 100644
--- a/app/views/streams/main_stream.html.haml
+++ b/app/views/streams/main_stream.html.haml
@@ -7,7 +7,7 @@
= javascript_include_tag :jsxc, id: 'jsxc',
data: { endpoint: get_bosh_endpoint }
-- if current_user.getting_started?
+- if current_user&.getting_started?
#welcome-to-diaspora
.container-fluid
.row
@@ -22,159 +22,161 @@
.container-fluid
.row
- .col-md-3
- .sidebar.left-navbar
- %ul#stream_selection
- %li{data: {stream: "stream"}}
- = link_to t("streams.multi.title"), stream_path, rel: "backbone", class: "hoverable"
- %li.nested-list.my-activity{data: {stream: "activity"}}
- = link_to t("streams.activity.title"), activity_stream_path, rel: "backbone", class: "hoverable"
- %ul
- %li{data: {stream: "liked"}}
- = link_to t("streams.liked.title"), liked_stream_path, rel: "backbone", class: "hoverable selectable"
- %li{data: {stream: "commented"}}
- = link_to t("streams.commented.title"), commented_stream_path,
- rel: "backbone", class: "hoverable selectable"
- %li{data: {stream: "mentions"}}
- = link_to t("streams.mentions.title"), mentioned_stream_path, rel: "backbone", class: "hoverable"
- %li.nested-list.all-aspects
- = render "aspects/aspect_listings", stream: @stream
- %li.nested-list
- = render "tags/followed_tags_listings"
- %li{data: {stream: "public"}}
- = link_to t("streams.public.title"), public_stream_path, rel: "backbone", class: "hoverable"
+ - if user_signed_in?
+ .col-md-3
+ .sidebar.left-navbar
+ %ul#stream-selection
+ %li{data: {stream: "stream"}}
+ = link_to t("streams.multi.title"), stream_path, rel: "backbone", class: "hoverable"
+ %li.nested-list.my-activity{data: {stream: "activity"}}
+ = link_to t("streams.activity.title"), activity_stream_path, rel: "backbone", class: "hoverable"
+ %ul
+ %li{data: {stream: "liked"}}
+ = link_to t("streams.liked.title"), liked_stream_path, rel: "backbone", class: "hoverable selectable"
+ %li{data: {stream: "commented"}}
+ = link_to t("streams.commented.title"), commented_stream_path,
+ rel: "backbone", class: "hoverable selectable"
+ %li{data: {stream: "mentions"}}
+ = link_to t("streams.mentions.title"), mentioned_stream_path, rel: "backbone", class: "hoverable"
+ %li.nested-list.all-aspects
+ = render "aspects/aspect_listings", stream: @stream
+ %li.nested-list
+ = render "tags/followed_tags_listings"
+ %li{data: {stream: "public"}}
+ = link_to t("streams.public.title"), public_stream_path, rel: "backbone", class: "hoverable"
+
+ .sidebar.info-bar.hidden-xs
+ - if AppConfig.settings.invitations.open?
+ .section.collapsed
+ .title
+ %h5.title-header
+ .entypo-triangle-right
+ .entypo-triangle-down
+ = t("shared.invitations.invite_your_friends")
+ .content
+ = render "shared/invitations"
- .sidebar.info-bar.hidden-xs
- - if AppConfig.settings.invitations.open?
.section.collapsed
.title
%h5.title-header
.entypo-triangle-right
.entypo-triangle-down
- = t("shared.invitations.invite_your_friends")
+ = t("aspects.index.new_here.title")
.content
- = render "shared/invitations"
+ != t("aspects.index.new_here.follow",
+ link: link_to("#" + t("shared.publisher.new_user_prefill.newhere"),
+ tag_path(name: t("shared.publisher.new_user_prefill.newhere"))))
+ %br
+ = link_to(t("aspects.index.new_here.learn_more"),
+ "http://wiki.diasporafoundation.org/Welcoming_Committee")
- .section.collapsed
- .title
- %h5.title-header
- .entypo-triangle-right
- .entypo-triangle-down
- = t("aspects.index.new_here.title")
- .content
- != t("aspects.index.new_here.follow",
- link: link_to("#" + t("shared.publisher.new_user_prefill.newhere"),
- tag_path(name: t("shared.publisher.new_user_prefill.newhere"))))
- %br
- = link_to(t("aspects.index.new_here.learn_more"),
- "http://wiki.diasporafoundation.org/Welcoming_Committee")
-
- .section.collapsed
- .title
- %h5.title-header
- .entypo-triangle-right
- .entypo-triangle-down
- = t("aspects.index.help.need_help")
- .content
- %p
- = t("aspects.index.help.here_to_help")
- %p
- = t("aspects.index.help.do_you")
- %ul
- %li
- != t("aspects.index.help.have_a_question",
- link: link_to("#" + t("aspects.index.help.tag_question"),
- tag_path(name: t("aspects.index.help.tag_question"))))
- %li
- != t("aspects.index.help.find_a_bug",
- link: link_to(t("aspects.index.help.tag_bug"),
- "https://wiki.diasporafoundation.org/How_to_report_a_bug"))
- %li
- != t("aspects.index.help.feature_suggestion",
- link: link_to(t("aspects.index.help.tag_feature"),
- "https://discourse.diasporafoundation.org/c/features-and-ideas"))
- %p
- != t("aspects.index.help.tutorials_and_wiki",
- faq: link_to(t("_help"), help_path),
- tutorial: link_to(t("aspects.index.help.tutorial_link_text"),
- "https://diasporafoundation.org/tutorials", target: "_blank"),
- wiki: link_to("Wiki", "http://wiki.diasporafoundation.org",
- target: "_blank"),
- target: "_blank")
-
- %p
- != t("aspects.index.help.support_forum",
- support_forum: link_to(t("aspects.index.help.support_forum_link"),
- "https://discourse.diasporafoundation.org/c/support", target: "_blank"))
-
- - unless AppConfig.configured_services.blank? || all_services_connected?
.section.collapsed
.title
%h5.title-header
.entypo-triangle-right
.entypo-triangle-down
- = t("aspects.index.services.heading")
+ = t("aspects.index.help.need_help")
.content
- %div
- = t("aspects.index.services.content")
+ %p
+ = t("aspects.index.help.here_to_help")
+ %p
+ = t("aspects.index.help.do_you")
+ %ul
+ %li
+ != t("aspects.index.help.have_a_question",
+ link: link_to("#" + t("aspects.index.help.tag_question"),
+ tag_path(name: t("aspects.index.help.tag_question"))))
+ %li
+ != t("aspects.index.help.find_a_bug",
+ link: link_to(t("aspects.index.help.tag_bug"),
+ "https://wiki.diasporafoundation.org/How_to_report_a_bug"))
+ %li
+ != t("aspects.index.help.feature_suggestion",
+ link: link_to(t("aspects.index.help.tag_feature"),
+ "https://discourse.diasporafoundation.org/c/features-and-ideas"))
+ %p
+ != t("aspects.index.help.tutorials_and_wiki",
+ faq: link_to(t("_help"), help_path),
+ tutorial: link_to(t("aspects.index.help.tutorial_link_text"),
+ "https://diasporafoundation.org/tutorials", target: "_blank"),
+ wiki: link_to("Wiki", "http://wiki.diasporafoundation.org",
+ target: "_blank"),
+ target: "_blank")
- .right-service-icons
- - AppConfig.configured_services.each do |service|
- - if AppConfig.show_service?(service, current_user)
- - unless current_user.services.any? {|x| x.provider == service }
+ %p
+ != t("aspects.index.help.support_forum",
+ support_forum: link_to(t("aspects.index.help.support_forum_link"),
+ "https://discourse.diasporafoundation.org/c/support", target: "_blank"))
+
+ - unless AppConfig.configured_services.blank? || all_services_connected?
+ .section.collapsed
+ .title
+ %h5.title-header
+ .entypo-triangle-right
+ .entypo-triangle-down
+ = t("aspects.index.services.heading")
+ .content
+ %div
+ = t("aspects.index.services.content")
+
+ .right-service-icons
+ - AppConfig.configured_services.each do |service|
+ - if service_unconnected?(service)
= link_to(content_tag(:div, nil,
class: "social-media-logos-#{service.to_s.downcase}-24x24",
title: service.to_s.titleize), "/auth/#{service}")
- .section.collapsed
- .title
- %h5.title-header
- .entypo-triangle-right
- .entypo-triangle-down
- = t("bookmarklet.heading")
- .content
- != t("bookmarklet.explanation", link: link_to(t("bookmarklet.post_something"), bookmarklet_code))
-
- - if donations_enabled?
.section.collapsed
.title
%h5.title-header
.entypo-triangle-right
.entypo-triangle-down
- = t("aspects.index.donate")
+ = t("bookmarklet.heading")
+ .content
+ != t("bookmarklet.explanation", link: link_to(t("bookmarklet.post_something"), bookmarklet_code))
+
+ - if donations_enabled?
+ .section.collapsed
+ .title
+ %h5.title-header
+ .entypo-triangle-right
+ .entypo-triangle-down
+ = t("aspects.index.donate")
+ .content
+ %p
+ = t("aspects.index.keep_pod_running", pod: AppConfig.pod_uri.host)
+ = render "shared/donatepod"
+
+ - if AppConfig.admins.podmin_email.present?
+ .section.collapsed
+ .title
+ %h5.title-header
+ .entypo-triangle-right
+ .entypo-triangle-down
+ = t("aspects.index.help.any_problem")
+ .content
+ %p
+ = t("aspects.index.help.contact_podmin")
+ %p
+ = link_to t("aspects.index.help.mail_podmin"), "mailto:#{AppConfig.admins.podmin_email}"
+
+ .excellence-box
.content
%p
- = t("aspects.index.keep_pod_running", pod: AppConfig.pod_uri.host)
- = render "shared/donatepod"
+ = link_to t("layouts.application.be_excellent"), "https://diasporafoundation.org/community_guidelines"
- - if AppConfig.admins.podmin_email.present?
- .section.collapsed
- .title
- %h5.title-header
- .entypo-triangle-right
- .entypo-triangle-down
- = t("aspects.index.help.any_problem")
+ .info-links
.content
- %p
- = t("aspects.index.help.contact_podmin")
- %p
- = link_to t("aspects.index.help.mail_podmin"), "mailto:#{AppConfig.admins.podmin_email}"
+ %ul
+ = render "shared/links"
- .excellence-box
- .content
- %p
- = link_to t("layouts.application.be_excellent"), "https://diasporafoundation.org/community_guidelines"
+ .powered-box
+ .content
+ .powered-by-diaspora.text-center
+ = link_to t("layouts.application.powered_by"), "https://diasporafoundation.org"
- .info-links
- .content
- %ul
- = render "shared/links"
-
- .powered-box
- .content
- .powered-by-diaspora.text-center
- = link_to t("layouts.application.powered_by"), "https://diasporafoundation.org"
-
- .col-md-9
+ .col-md-9{class: ("center-block public-stream" unless user_signed_in?)}
.stream-container#aspect-stream-container
+ - unless user_signed_in?
+ %h2= @stream.title
= render "aspects/aspect_stream", stream: @stream
diff --git a/app/views/streams/main_stream.mobile.haml b/app/views/streams/main_stream.mobile.haml
index 7b84c08e2..ce8eb270f 100644
--- a/app/views/streams/main_stream.mobile.haml
+++ b/app/views/streams/main_stream.mobile.haml
@@ -2,6 +2,9 @@
-# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file.
+- unless user_signed_in?
+ %h1= @stream.title
+
#main-stream.stream
= render 'shared/stream', posts: @stream.stream_posts
= render 'shared/stream_more_button'
diff --git a/config/locales/diaspora/en.yml b/config/locales/diaspora/en.yml
index d9e887a91..f28b8f551 100644
--- a/config/locales/diaspora/en.yml
+++ b/config/locales/diaspora/en.yml
@@ -369,8 +369,6 @@ en:
contacts_know_aspect_a: "No. They cannot see the name of the aspect under any circumstances."
person_multiple_aspects_q: "Can I add a person to multiple aspects?"
person_multiple_aspects_a: "Yes. Go to your contacts page and click on “My contacts”. For each contact you can use the menu on the right to add them to (or remove them from) as many aspects as you want. Or you can add them to a new aspect (or remove them from an aspect) by clicking the aspect selector button on their profile page. Or you can even just move the pointer over their name where you see it in the stream, and a “hovercard” will appear. You can change the aspects they are in right there."
- contacts_visible_q: "What does “make contacts in this aspect visible to each other” mean?"
- contacts_visible_a: "If you check this option then contacts from that aspect will be able to see who else is in it, in the “Contacts” tab on your profile page. (At the moment, only your contacts who are on the same pod as you will be able to see the “Contacts” tab on your profile.) It’s best to select this option only if the contacts in that aspect all know each other, for example if the aspect is for a club or society you belong to. They still won’t be able to see what the aspect is called."
remove_notification_q: "If I remove someone from an aspect, or all of my aspects, are they notified of this?"
remove_notification_a: "No. They are also not notified if you add them to more aspects, when you are already sharing with them."
change_aspect_of_post_q: "Once I have posted something, can I change the aspect(s) that can see it?"
diff --git a/config/locales/javascript/javascript.en.yml b/config/locales/javascript/javascript.en.yml
index e89cf6109..b935267b5 100644
--- a/config/locales/javascript/javascript.en.yml
+++ b/config/locales/javascript/javascript.en.yml
@@ -81,7 +81,6 @@ en:
other: "The connection test returned an error for <%= count %> pods."
aspects:
- make_aspect_list_visible: "Make contacts in this aspect visible to each other?"
name: "Name"
create:
add_a_new_aspect: "Add a new aspect"
@@ -124,8 +123,6 @@ en:
add_contact: "Add contact"
aspect_chat_is_enabled: "Contacts in this aspect are able to chat with you."
aspect_chat_is_not_enabled: "Contacts in this aspect are not able to chat with you."
- aspect_list_is_visible: "Contacts in this aspect are able to see each other."
- aspect_list_is_not_visible: "Contacts in this aspect are not able to see each other."
remove_contact: "Remove contact"
error_add: "Couldn’t add <%= name %> to the aspect :("
error_remove: "Couldn’t remove <%= name %> from the aspect :("
@@ -236,7 +233,6 @@ en:
gender: "Gender"
born: "Birthday"
photos: "Photos"
- contacts: "Contacts"
posts: "Posts"
conversation:
diff --git a/config/routes.rb b/config/routes.rb
index 28ca010f6..846921b8b 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -59,7 +59,6 @@ Rails.application.routes.draw do
get "aspects" => "streams#aspects", :as => "aspects_stream"
resources :aspects, except: %i(index new edit) do
- put :toggle_contact_visibility
put :toggle_chat_privilege
collection do
put "order" => :update_order
@@ -165,7 +164,6 @@ Rails.application.routes.draw do
resources :people, only: %i(show index) do
resources :status_messages, only: %i(new create)
resources :photos, except: %i(new update)
- get :contacts
get :stream
get :hovercard
diff --git a/db/migrate/20180406235521_remove_contacts_visible_from_aspects.rb b/db/migrate/20180406235521_remove_contacts_visible_from_aspects.rb
new file mode 100644
index 000000000..5b201ccdf
--- /dev/null
+++ b/db/migrate/20180406235521_remove_contacts_visible_from_aspects.rb
@@ -0,0 +1,8 @@
+# frozen_string_literal: true
+
+class RemoveContactsVisibleFromAspects < ActiveRecord::Migration[5.1]
+ def change
+ remove_index :aspects, column: %i[user_id contacts_visible], name: :index_aspects_on_user_id_and_contacts_visible
+ remove_column :aspects, :contacts_visible, :boolean, default: true, null: false
+ end
+end
diff --git a/features/desktop/contacts.feature b/features/desktop/contacts.feature
deleted file mode 100644
index 1beecbc86..000000000
--- a/features/desktop/contacts.feature
+++ /dev/null
@@ -1,42 +0,0 @@
-@javascript
-Feature: show contacts
-
- Background:
- Given following users exist:
- | username | email |
- | Bob Jones | bob@bob.bob |
- | Alice Smith | alice@alice.alice |
- | Robert Grimm | robert@grimm.grimm |
- And I sign in as "robert@grimm.grimm"
- And I am on "alice@alice.alice"'s page
- And I add the person to my "Unicorns" aspect
-
- Scenario: see own contacts on profile
- When I am on "robert@grimm.grimm"'s page
- And I press the first "#contacts_link"
- Then I should be on the contacts page
-
- Scenario: see contacts of a visible aspect list
- When I am on "bob@bob.bob"'s page
- And I add the person to my "Unicorns" aspect
- And I sign out
- And I sign in as "alice@alice.alice"
- And I am on "robert@grimm.grimm"'s page
- Then I should see "Contacts" within "#profile-horizontal-bar"
-
- When I press the first "#contacts_link"
- Then I should see "Bob Jones" within "#people-stream .media-body"
- When I add the person to my "Besties" aspect within "#people-stream"
- Then I should see a flash message containing "You have started sharing with Bob Jones!"
-
- Scenario: don't see contacts of an invisible aspect list
- When I am on "bob@bob.bob"'s page
- And I add the person to my "Unicorns" aspect
- And I am on the contacts page
- And I follow "Unicorns"
- And I press the first "a#contacts_visibility_toggle"
- And I sign out
-
- And I sign in as "alice@alice.alice"
- And I am on "robert@grimm.grimm"'s page
- Then I should not see "Contacts" within "#profile-horizontal-bar"
diff --git a/features/desktop/keyboard_navigation.feature b/features/desktop/keyboard_navigation.feature
index f153e6e8f..b1e9078f3 100644
--- a/features/desktop/keyboard_navigation.feature
+++ b/features/desktop/keyboard_navigation.feature
@@ -25,7 +25,7 @@ Feature: Keyboard navigation
Scenario: navigate downwards after changing the stream
When I go to the activity stream page
And I click on selector "[data-stream='stream'] a"
- Then I should see "Stream" within "#stream_selection .selected"
+ Then I should see "Stream" within "#stream-selection .selected"
When I press the "J" key somewhere
Then post 1 should be highlighted
diff --git a/features/desktop/public_stream.feature b/features/desktop/public_stream.feature
index 02449b93c..8e53e1070 100644
--- a/features/desktop/public_stream.feature
+++ b/features/desktop/public_stream.feature
@@ -12,3 +12,7 @@ Feature: The public stream
When I sign in as "alice@alice.alice"
And I am on the public stream page
Then I should see "Bob’s public post"
+
+ Scenario: seeing public posts as a logged out user
+ When I am on the public stream page
+ Then I should see "Bob’s public post"
diff --git a/lib/diaspora/mentionable.rb b/lib/diaspora/mentionable.rb
index 81ade53b7..59f2da8f0 100644
--- a/lib/diaspora/mentionable.rb
+++ b/lib/diaspora/mentionable.rb
@@ -72,7 +72,7 @@ module Diaspora::Mentionable
end
# Regex to find mentions with new syntax, only used for backporting to old syntax
- NEW_SYNTAX_REGEX = /@\{[^ ]+\}/
+ NEW_SYNTAX_REGEX = /@\{[^\} ]+\}/
# replaces new syntax with old syntax, to be compatible with old pods
# @deprecated remove when most of the posts can handle the new syntax
diff --git a/lib/schemas/archive-format.json b/lib/schemas/archive-format.json
index 314331506..cc4c99ffe 100644
--- a/lib/schemas/archive-format.json
+++ b/lib/schemas/archive-format.json
@@ -31,7 +31,6 @@
"type": "object",
"properties": {
"name": { "type": "string" },
- "contacts_visible": { "type": "boolean" },
"chat_enabled": { "type": "boolean" }
},
"required": [
diff --git a/spec/controllers/aspects_controller_spec.rb b/spec/controllers/aspects_controller_spec.rb
index d763f4a83..a243cfaf8 100644
--- a/spec/controllers/aspects_controller_spec.rb
+++ b/spec/controllers/aspects_controller_spec.rb
@@ -156,22 +156,4 @@ describe AspectsController, :type => :controller do
end
end
end
-
- describe "#toggle_contact_visibility" do
- it 'sets contacts visible' do
- @alices_aspect_1.contacts_visible = false
- @alices_aspect_1.save
-
- get :toggle_contact_visibility, xhr: true, params: {aspect_id: @alices_aspect_1.id}
- expect(@alices_aspect_1.reload.contacts_visible).to be true
- end
-
- it 'sets contacts hidden' do
- @alices_aspect_1.contacts_visible = true
- @alices_aspect_1.save
-
- get :toggle_contact_visibility, xhr: true, params: {aspect_id: @alices_aspect_1.id}
- expect(@alices_aspect_1.reload.contacts_visible).to be false
- end
- end
end
diff --git a/spec/controllers/home_controller_spec.rb b/spec/controllers/home_controller_spec.rb
index 82cc10711..6f8b8e031 100644
--- a/spec/controllers/home_controller_spec.rb
+++ b/spec/controllers/home_controller_spec.rb
@@ -6,31 +6,14 @@
describe HomeController, type: :controller do
describe "#show" do
- it "does not redirect for :html if there are at least 2 users and an admin" do
- allow(User).to receive(:count).and_return(2)
- allow(Role).to receive_message_chain(:where, :any?).and_return(true)
- allow(Role).to receive_message_chain(:where, :exists?).and_return(true)
+ it "does not redirect for :html if there is at least one admin" do
+ expect(Role).to receive_message_chain(:admins, :any?).and_return(true)
get :show
expect(response).not_to be_redirect
end
- it "redirects to the podmin page for :html if there are less than 2 users" do
- allow(User).to receive(:count).and_return(1)
- allow(Role).to receive_message_chain(:where, :any?).and_return(true)
- get :show
- expect(response).to redirect_to(podmin_path)
- end
-
it "redirects to the podmin page for :html if there is no admin" do
- allow(User).to receive(:count).and_return(2)
- allow(Role).to receive_message_chain(:where, :any?).and_return(false)
- get :show
- expect(response).to redirect_to(podmin_path)
- end
-
- it "redirects to the podmin page for :html if there are less than 2 users and no admin" do
- allow(User).to receive(:count).and_return(0)
- allow(Role).to receive_message_chain(:where, :any?).and_return(false)
+ expect(Role).to receive_message_chain(:admins, :any?).and_return(false)
get :show
expect(response).to redirect_to(podmin_path)
end
diff --git a/spec/controllers/people_controller_spec.rb b/spec/controllers/people_controller_spec.rb
index 740744525..e979a9c00 100644
--- a/spec/controllers/people_controller_spec.rb
+++ b/spec/controllers/people_controller_spec.rb
@@ -580,40 +580,6 @@ describe PeopleController, :type => :controller do
end
end
-
- describe '#contacts' do
- it 'assigns the contacts of a person' do
- contact = alice.contact_for(bob.person)
- contacts = contact.contacts
- get :contacts, params: {person_id: bob.person.to_param}
- expect(assigns(:contacts_of_contact).to_a).to eq(contacts.to_a)
- expect(response).to be_success
- end
-
- it 'shows an error when invalid person id' do
- get :contacts, params: {person_id: "foo"}
- expect(flash[:error]).to be_present
- expect(response).to redirect_to people_path
- end
-
- it "displays the correct number of photos" do
- 16.times do |i|
- eve.post(:photo, :user_file => uploaded_photo, :to => eve.aspects.first.id, :public => true)
- end
- get :contacts, params: {person_id: eve.person.to_param}
- expect(response.body).to include ',"photos_count":16'
-
- eve.post(:photo, :user_file => uploaded_photo, :to => eve.aspects.first.id, :public => false)
- get :contacts, params: {person_id: eve.person.to_param}
- expect(response.body).to include ',"photos_count":16' # eve is not sharing with alice
- end
-
- it "returns a 406 for json format" do
- get :contacts, params: {person_id: "foo"}, format: :json
- expect(response.code).to eq("406")
- end
- end
-
describe '#diaspora_id?' do
it 'returns true for pods on urls' do
expect(@controller.send(:diaspora_id?, "ilya_123@pod.geraspora.de")).to be true
diff --git a/spec/controllers/streams_controller_spec.rb b/spec/controllers/streams_controller_spec.rb
index 9eb5e56ee..d46c22887 100644
--- a/spec/controllers/streams_controller_spec.rb
+++ b/spec/controllers/streams_controller_spec.rb
@@ -7,54 +7,80 @@
describe StreamsController, :type => :controller do
include_context :gon
- before do
- sign_in alice
- end
-
- describe "#public" do
- it "succeeds" do
- get :public
- expect(response).to be_success
- end
- end
-
- describe '#multi' do
- it 'succeeds' do
- get :multi
- expect(response).to be_success
+ context "with a logged in user" do
+ before do
+ sign_in alice
end
- it 'succeeds on mobile' do
- get :multi, :format => :mobile
- expect(response).to be_success
+ describe "#public" do
+ it "succeeds" do
+ get :public
+ expect(response).to be_success
+ end
end
- context "getting started" do
- it "add the inviter to gon" do
- user = FactoryGirl.create(:user, getting_started: true, invited_by: alice)
- sign_in user
-
+ describe "#multi" do
+ it "succeeds" do
get :multi
+ expect(response).to be_success
+ end
- expect(gon["preloads"][:mentioned_person][:name]).to eq(alice.person.name)
- expect(gon["preloads"][:mentioned_person][:handle]).to eq(alice.person.diaspora_handle)
+ it "succeeds on mobile" do
+ get :multi, format: :mobile
+ expect(response).to be_success
+ end
+
+ context "getting started" do
+ it "add the inviter to gon" do
+ user = FactoryGirl.create(:user, getting_started: true, invited_by: alice)
+ sign_in user
+
+ get :multi
+
+ expect(gon["preloads"][:mentioned_person][:name]).to eq(alice.person.name)
+ expect(gon["preloads"][:mentioned_person][:handle]).to eq(alice.person.diaspora_handle)
+ end
+ end
+ end
+
+ streams = {
+ liked: Stream::Likes,
+ mentioned: Stream::Mention,
+ followed_tags: Stream::FollowedTag,
+ activity: Stream::Activity
+ }
+
+ streams.each do |stream_path, stream_class|
+ describe "a GET to #{stream_path}" do
+ it "assigns a stream of the proper class" do
+ get stream_path
+ expect(response).to be_success
+ expect(assigns[:stream]).to be_a stream_class
+ end
end
end
end
- streams = {
- :liked => Stream::Likes,
- :mentioned => Stream::Mention,
- :followed_tags => Stream::FollowedTag,
- :activity => Stream::Activity
- }
-
- streams.each do |stream_path, stream_class|
- describe "a GET to #{stream_path}" do
- it 'assigns a stream of the proper class' do
- get stream_path
+ context "with no user signed in" do
+ describe "#public" do
+ it "succeeds" do
+ get :public
expect(response).to be_success
- expect(assigns[:stream]).to be_a stream_class
+ end
+
+ it "succeeds on mobile" do
+ get :public, format: :mobile
+ expect(response).to be_success
+ end
+ end
+
+ describe "other streams" do
+ it "redirects to the login page" do
+ %i[activity followed_tags liked mentioned multi].each do |stream_path|
+ get stream_path
+ expect(response).to be_redirect
+ expect(response).to redirect_to new_user_session_path
+ end
end
end
end
diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb
index 569360e94..feb94673c 100644
--- a/spec/helpers/application_helper_spec.rb
+++ b/spec/helpers/application_helper_spec.rb
@@ -35,6 +35,30 @@ describe ApplicationHelper, :type => :helper do
end
end
+ describe "#service_unconnected?" do
+ attr_reader :current_user
+
+ before do
+ @current_user = alice
+ end
+
+ it "returns true if the service is unconnected" do
+ expect(AppConfig).to receive(:show_service?).with("service", alice).and_return(true)
+ expect(service_unconnected?("service")).to be true
+ end
+
+ it "returns false if the service is already connected" do
+ @current_user.services << FactoryGirl.build(:service, provider: "service")
+ expect(AppConfig).to receive(:show_service?).with("service", alice).and_return(true)
+ expect(service_unconnected?("service")).to be false
+ end
+
+ it "returns false if the the service shouldn't be shown" do
+ expect(AppConfig).to receive(:show_service?).with("service", alice).and_return(false)
+ expect(service_unconnected?("service")).to be false
+ end
+ end
+
describe "#jquery_include_tag" do
describe "with jquery cdn" do
before do
diff --git a/spec/integration/exporter_spec.rb b/spec/integration/exporter_spec.rb
index 908a92532..ac9bdbfd9 100644
--- a/spec/integration/exporter_spec.rb
+++ b/spec/integration/exporter_spec.rb
@@ -47,12 +47,10 @@ describe Diaspora::Exporter do
"contact_groups": [
{
"name": "generic",
- "contacts_visible": true,
"chat_enabled": false
},
{
"name": "Work",
- "contacts_visible": false,
"chat_enabled": false
}
]
diff --git a/spec/javascripts/app/pages/contacts_spec.js b/spec/javascripts/app/pages/contacts_spec.js
index 485b17dc1..c9d972ec6 100644
--- a/spec/javascripts/app/pages/contacts_spec.js
+++ b/spec/javascripts/app/pages/contacts_spec.js
@@ -34,35 +34,6 @@ describe("app.pages.Contacts", function(){
});
});
- context('toggle contacts visibility', function() {
- beforeEach(function() {
- this.visibilityToggle = $("#contacts_visibility_toggle");
- this.lockIcon = $("#contacts_visibility_toggle i");
- });
-
- it("updates the title for the tooltip", function() {
- expect(this.lockIcon.attr("data-original-title")).toBe(
- Diaspora.I18n.t("contacts.aspect_list_is_visible")
- );
-
- this.visibilityToggle.trigger("click");
-
- expect(this.lockIcon.attr("data-original-title")).toBe(
- Diaspora.I18n.t("contacts.aspect_list_is_not_visible")
- );
- });
-
- it("toggles the lock icon", function() {
- expect(this.lockIcon.hasClass("entypo-lock-open")).toBeTruthy();
- expect(this.lockIcon.hasClass("entypo-lock")).toBeFalsy();
-
- this.visibilityToggle.trigger("click");
-
- expect(this.lockIcon.hasClass("entypo-lock")).toBeTruthy();
- expect(this.lockIcon.hasClass("entypo-lock-open")).toBeFalsy();
- });
- });
-
context('show aspect name form', function() {
beforeEach(function() {
this.button = $('#change_aspect_name');
diff --git a/spec/javascripts/app/views/aspect_create_view_spec.js b/spec/javascripts/app/views/aspect_create_view_spec.js
index bd1a38c4b..bac0870ed 100644
--- a/spec/javascripts/app/views/aspect_create_view_spec.js
+++ b/spec/javascripts/app/views/aspect_create_view_spec.js
@@ -17,7 +17,6 @@ describe("app.views.AspectCreate", function() {
expect(this.view.$("#newAspectModal.modal").length).toBe(1);
expect(this.view.$("#newAspectModal form").length).toBe(1);
expect(this.view.$("#newAspectModal input#aspect_name").length).toBe(1);
- expect(this.view.$("#newAspectModal input#aspect_contacts_visible").length).toBe(1);
expect(this.view.$("#newAspectModal .btn-primary").length).toBe(1);
});
@@ -61,21 +60,6 @@ describe("app.views.AspectCreate", function() {
expect(obj.name).toBe(name);
});
- it("should send the correct contacts_visible to the server", function() {
- this.view.createAspect();
- var obj = JSON.parse(jasmine.Ajax.requests.mostRecent().params);
- /* jshint camelcase: false */
- expect(obj.contacts_visible).toBeFalsy();
- /* jshint camelcase: true */
-
- this.view.$("input#aspect_contacts_visible").prop("checked", true);
- this.view.createAspect();
- obj = JSON.parse(jasmine.Ajax.requests.mostRecent().params);
- /* jshint camelcase: false */
- expect(obj.contacts_visible).toBeTruthy();
- /* jshint camelcase: true */
- });
-
it("should send person_id = null to the server", function() {
this.view.createAspect();
var obj = JSON.parse(jasmine.Ajax.requests.mostRecent().params);
@@ -150,7 +134,6 @@ describe("app.views.AspectCreate", function() {
expect(this.view.$("#newAspectModal.modal").length).toBe(1);
expect(this.view.$("#newAspectModal form").length).toBe(1);
expect(this.view.$("#newAspectModal input#aspect_name").length).toBe(1);
- expect(this.view.$("#newAspectModal input#aspect_contacts_visible").length).toBe(1);
expect(this.view.$("#newAspectModal .btn-primary").length).toBe(1);
});
@@ -174,21 +157,6 @@ describe("app.views.AspectCreate", function() {
expect(obj.name).toBe(name);
});
- it("should send the correct contacts_visible to the server", function() {
- this.view.createAspect();
- var obj = JSON.parse(jasmine.Ajax.requests.mostRecent().params);
- /* jshint camelcase: false */
- expect(obj.contacts_visible).toBeFalsy();
- /* jshint camelcase: true */
-
- this.view.$("input#aspect_contacts_visible").prop("checked", true);
- this.view.createAspect();
- obj = JSON.parse(jasmine.Ajax.requests.mostRecent().params);
- /* jshint camelcase: false */
- expect(obj.contacts_visible).toBeTruthy();
- /* jshint camelcase: true */
- });
-
it("should send the correct person_id to the server", function() {
this.view.createAspect();
var obj = JSON.parse(jasmine.Ajax.requests.mostRecent().params);
diff --git a/spec/lib/diaspora/mentionable_spec.rb b/spec/lib/diaspora/mentionable_spec.rb
index aef3e12f4..25926d898 100644
--- a/spec/lib/diaspora/mentionable_spec.rb
+++ b/spec/lib/diaspora/mentionable_spec.rb
@@ -217,6 +217,13 @@ STR
expect(Diaspora::Mentionable.backport_mention_syntax(text)).to eq(expected_text)
end
+ it "replaces the new syntax with the old syntax for immediately consecutive mentions" do
+ text = "mention @{#{people[0].diaspora_handle}}@{#{people[1].diaspora_handle}} text"
+ expected_text = "mention @{#{people[0].name}; #{people[0].diaspora_handle}}" \
+ "@{#{people[1].name}; #{people[1].diaspora_handle}} text"
+ expect(Diaspora::Mentionable.backport_mention_syntax(text)).to eq(expected_text)
+ end
+
it "removes curly braces from name of the mentioned person when adding it" do
profile = FactoryGirl.build(:profile, first_name: "{Alice}", last_name: "(Smith) [123]")
person = FactoryGirl.create(:person, profile: profile)
diff --git a/spec/models/aspect_spec.rb b/spec/models/aspect_spec.rb
index c5426bf7c..b65816ab2 100644
--- a/spec/models/aspect_spec.rb
+++ b/spec/models/aspect_spec.rb
@@ -30,10 +30,6 @@ describe Aspect, :type => :model do
expect(aspect.contacts.size).to eq(1)
end
- it "has a contacts_visible? method" do
- expect(alice.aspects.first.contacts_visible?).to be true
- end
-
it "sets an order_id" do
aspect_2 = alice.aspects.create(name: "People")
expect(aspect_2.order_id).to eq(2)
diff --git a/spec/models/contact_spec.rb b/spec/models/contact_spec.rb
index dd5f5b27c..dc5be39b8 100644
--- a/spec/models/contact_spec.rb
+++ b/spec/models/contact_spec.rb
@@ -160,62 +160,6 @@ describe Contact, type: :model do
end
end
- describe "#contacts" do
- before do
- bob.aspects.create(name: "next")
-
- @original_aspect = bob.aspects.where(name: "generic").first
- @new_aspect = bob.aspects.where(name: "next").first
-
- @people1 = []
- @people2 = []
-
- 1.upto(5) do
- person = FactoryGirl.build(:person)
- bob.contacts.create(person: person, aspects: [@original_aspect])
- @people1 << person
- end
- 1.upto(5) do
- person = FactoryGirl.build(:person)
- bob.contacts.create(person: person, aspects: [@new_aspect])
- @people2 << person
- end
- # eve <-> bob <-> alice
- end
-
- context "on a contact for a local user" do
- before do
- alice.reload
- alice.aspects.reload
- @contact = alice.contact_for(bob.person)
- end
-
- it "returns the target local user's contacts that are in the same aspect" do
- expect(@contact.contacts.map(&:id)).to match_array([eve.person].concat(@people1).map(&:id))
- end
-
- it "returns nothing if contacts_visible is false in that aspect" do
- @original_aspect.contacts_visible = false
- @original_aspect.save
- expect(@contact.contacts).to eq([])
- end
-
- it "returns no duplicate contacts" do
- [alice, eve].each {|c| bob.add_contact_to_aspect(bob.contact_for(c.person), bob.aspects.last) }
- contact_ids = @contact.contacts.map(&:id)
- expect(contact_ids.uniq).to eq(contact_ids)
- end
- end
-
- context "on a contact for a remote user" do
- let(:contact) { bob.contact_for @people1.first }
-
- it "returns an empty array" do
- expect(contact.contacts).to eq([])
- end
- end
- end
-
describe "#receive" do
it "shares back if auto_following is enabled" do
alice.auto_follow_back = true
diff --git a/spec/serializers/export/aspect_serializer_spec.rb b/spec/serializers/export/aspect_serializer_spec.rb
index bd13b7b2b..eba297f19 100644
--- a/spec/serializers/export/aspect_serializer_spec.rb
+++ b/spec/serializers/export/aspect_serializer_spec.rb
@@ -6,9 +6,8 @@ describe Export::AspectSerializer do
it "has aspect attributes" do
expect(serializer.attributes).to eq(
- name: aspect.name,
- contacts_visible: aspect.contacts_visible,
- chat_enabled: aspect.chat_enabled
+ name: aspect.name,
+ chat_enabled: aspect.chat_enabled
)
end
end
diff --git a/spec/support/data_generator.rb b/spec/support/data_generator.rb
index a2849a6f9..16f7d877b 100644
--- a/spec/support/data_generator.rb
+++ b/spec/support/data_generator.rb
@@ -170,7 +170,7 @@ class DataGenerator
end
def work_aspect
- user.aspects.create(name: "Work", contacts_visible: false)
+ user.aspects.create(name: "Work")
end
def status_messages_flavours