social_stream 0.4.4 → 0.4.5
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/Gemfile +5 -1
- data/README.rdoc +2 -2
- data/app/controllers/api_controller.rb +2 -1
- data/app/controllers/contacts_controller.rb +25 -2
- data/app/controllers/groups_controller.rb +12 -2
- data/app/controllers/notifications_controller.rb +72 -0
- data/app/controllers/permissions_controller.rb +10 -0
- data/app/controllers/relation/customs_controller.rb +8 -0
- data/app/controllers/spheres_controller.rb +12 -0
- data/app/helpers/contacts_helper.rb +24 -0
- data/app/helpers/location_helper.rb +26 -12
- data/app/helpers/notifications_helper.rb +23 -0
- data/app/helpers/permissions_helper.rb +16 -0
- data/app/helpers/profiles_helper.rb +31 -0
- data/app/helpers/subjects_helper.rb +0 -83
- data/app/helpers/toolbar_helper.rb +83 -0
- data/app/models/activity.rb +43 -36
- data/app/models/actor.rb +71 -14
- data/app/models/contact.rb +121 -0
- data/app/models/group.rb +3 -3
- data/app/models/permission.rb +33 -2
- data/app/models/relation.rb +1 -1
- data/app/models/relation/custom.rb +12 -1
- data/app/models/relation/public.rb +1 -1
- data/app/models/sphere.rb +3 -1
- data/app/models/tie.rb +35 -18
- data/app/views/activities/_walls.html.erb +2 -2
- data/app/views/api/activity_atom_feed.atom.builder +38 -38
- data/app/views/avatars/index.html.erb +12 -40
- data/app/views/comments/_new.html.erb +9 -8
- data/app/views/contacts/_contact.html.erb +20 -0
- data/app/views/contacts/_edit.html.erb +76 -0
- data/app/views/contacts/_form.html.erb +72 -0
- data/app/views/contacts/_index.html.erb +1 -1
- data/app/views/{ties → contacts}/_pendings.html.erb +3 -3
- data/app/views/{ties → contacts}/_suggestions.html.erb +5 -5
- data/app/views/contacts/_suggestions_and_pendings.html.erb +6 -0
- data/app/views/contacts/edit.html.erb +5 -0
- data/app/views/contacts/index.html.erb +1 -1
- data/app/views/contacts/new.html.erb +5 -0
- data/app/views/conversations/_conversation.html.erb +1 -1
- data/app/views/conversations/_index.html.erb +0 -5
- data/app/views/conversations/_show.html.erb +1 -2
- data/app/views/conversations/index.html.erb +4 -0
- data/app/views/conversations/index.js.erb +1 -0
- data/app/views/frontpage/index.html.erb +2 -3
- data/app/views/groups/_index.html.erb +5 -1
- data/app/views/groups/_new.html.erb +4 -3
- data/app/views/groups/_sidebar_index.html.erb +3 -10
- data/app/views/groups/_sidebar_show.html.erb +1 -9
- data/app/views/groups/index.html.erb +6 -8
- data/app/views/groups/show.html.erb +11 -4
- data/app/views/home/_sidebar.html.erb +1 -15
- data/app/views/home/index.html.erb +3 -2
- data/app/views/layouts/_account.html.erb +1 -1
- data/app/views/layouts/_flash.html.erb +5 -0
- data/app/views/layouts/_footer.html.erb +5 -4
- data/app/views/layouts/_representation.html.erb +5 -12
- data/app/views/layouts/application.html.erb +23 -20
- data/app/views/layouts/frontpage.html.erb +22 -10
- data/app/views/location/_location.html.erb +1 -1
- data/app/views/messages/_new.html.erb +0 -2
- data/app/views/notification_mailer/new_notification_email.html.erb +21 -0
- data/app/views/notification_mailer/new_notification_email.text.erb +11 -0
- data/app/views/notifications/_index.html.erb +21 -0
- data/app/views/notifications/_notification.html.erb +47 -0
- data/app/views/notifications/_show.html.erb +3 -0
- data/app/views/notifications/activities/_follow_body.html.erb +2 -0
- data/app/views/notifications/activities/_follow_subject.html.erb +2 -0
- data/app/views/notifications/activities/_like_body.html.erb +5 -0
- data/app/views/notifications/activities/_like_object_body.html.erb +2 -0
- data/app/views/notifications/activities/_like_object_subject.html.erb +2 -0
- data/app/views/notifications/activities/_like_subject.html.erb +5 -0
- data/app/views/notifications/activities/_like_subject_body.html.erb +1 -0
- data/app/views/notifications/activities/_like_subject_subject.html.erb +2 -0
- data/app/views/notifications/activities/_make-friend_body.html.erb +3 -0
- data/app/views/notifications/activities/_make-friend_subject.html.erb +2 -0
- data/app/views/notifications/activities/_post_body.html.erb +2 -0
- data/app/views/notifications/activities/_post_subject.html.erb +1 -0
- data/app/views/notifications/activities/_update_body.html.erb +1 -0
- data/app/views/notifications/activities/_update_subject.html.erb +1 -0
- data/app/views/notifications/index.html.erb +19 -0
- data/app/views/notifications/index.js.erb +8 -0
- data/app/views/notifications/show.html.erb +5 -0
- data/app/views/permissions/_index.html.erb +39 -0
- data/app/views/permissions/index.js.erb +10 -0
- data/app/views/profiles/_contact.html.erb +81 -0
- data/app/views/profiles/_experience.html.erb +22 -0
- data/app/views/profiles/_personal.html.erb +74 -0
- data/app/views/profiles/_profile.html.erb +12 -181
- data/app/views/profiles/_tags.html.erb +22 -0
- data/app/views/profiles/edit.html.erb +0 -14
- data/app/views/profiles/show.html.erb +14 -0
- data/app/views/profiles/update.js.erb +2 -28
- data/app/views/relation/customs/_form.html.erb +29 -0
- data/app/views/relation/customs/_index.html.erb +30 -0
- data/app/views/relation/customs/_list.html.erb +36 -0
- data/app/views/relation/customs/create.js.erb +20 -0
- data/app/views/relation/customs/index.js.erb +2 -0
- data/app/views/relation/customs/update.js.erb +6 -0
- data/app/views/spheres/_form.html.erb +28 -0
- data/app/views/spheres/_jquery.erb +130 -0
- data/app/views/spheres/_list.html.erb +19 -0
- data/app/views/spheres/create.js.erb +20 -0
- data/app/views/spheres/index.html.erb +74 -0
- data/app/views/ties/_edit.html.erb +1 -33
- data/app/views/toolbar/_home.html.erb +9 -0
- data/app/views/{subjects/_toolbar_home_menu.html.erb → toolbar/_home_menu.html.erb} +1 -1
- data/app/views/{subjects/_toolbar_home_menu_options.html.erb → toolbar/_home_menu_options.html.erb} +7 -3
- data/app/views/{subjects/_toolbar_home_menu_options_subjects.html.erb → toolbar/_home_menu_options_subjects.html.erb} +0 -0
- data/app/views/{subjects/_toolbar_logo.html.erb → toolbar/_logo.html.erb} +1 -1
- data/app/views/{subjects/_toolbar_message_menu.html.erb → toolbar/_message_menu.html.erb} +0 -0
- data/app/views/toolbar/_notifications_menu.html.erb +3 -0
- data/app/views/{subjects/_toolbar_profile.html.erb → toolbar/_profile.html.erb} +2 -2
- data/app/views/toolbar/_profile_menu.html.erb +15 -0
- data/app/views/toolbar/_profile_menu_basic_options.html.erb +5 -0
- data/app/views/toolbar/_profile_menu_tie_options.html.erb +35 -0
- data/app/views/users/_index.html.erb +1 -1
- data/app/views/users/_sidebar_index.html.erb +1 -6
- data/app/views/users/index.html.erb +3 -3
- data/app/views/users/show.html.erb +12 -2
- data/config/locales/en.yml +106 -79
- data/config/routes.rb +19 -5
- data/lib/generators/social_stream/templates/initializer.rb +2 -2
- data/lib/generators/social_stream/templates/migration.rb +3 -1
- data/lib/generators/social_stream/templates/public/images/HTML5.png +0 -0
- data/lib/generators/social_stream/templates/public/images/HTML5_Semantics.png +0 -0
- data/lib/generators/social_stream/templates/public/images/HTML5_Styling.png +0 -0
- data/lib/generators/social_stream/templates/public/images/Jcrop.gif +0 -0
- data/lib/generators/social_stream/templates/public/images/btn/btn_notification.png +0 -0
- data/lib/generators/social_stream/templates/public/images/btn/btn_notification_delete.png +0 -0
- data/lib/generators/social_stream/templates/public/images/btn/error.png +0 -0
- data/lib/generators/social_stream/templates/public/images/btn/info.png +0 -0
- data/lib/generators/social_stream/templates/public/images/btn/success.png +0 -0
- data/lib/generators/social_stream/templates/public/images/btn/warning.png +0 -0
- data/lib/generators/social_stream/templates/public/images/cancel.png +0 -0
- data/lib/generators/social_stream/templates/public/images/html5-badge-h-css3-semantics.png +0 -0
- data/lib/generators/social_stream/templates/public/images/icon_checkbox.png +0 -0
- data/lib/generators/social_stream/templates/public/images/logos/actor/remote_subject.png +0 -0
- data/lib/generators/social_stream/templates/public/images/logos/actor/remote_user.png +0 -0
- data/lib/generators/social_stream/templates/public/images/logos/representation/group.png +0 -0
- data/lib/generators/social_stream/templates/public/images/logos/representation/user.png +0 -0
- data/lib/generators/social_stream/templates/public/images/pbar-ani.gif +0 -0
- data/lib/generators/social_stream/templates/public/javascripts/jquery.fileupload-ui.js +259 -0
- data/lib/generators/social_stream/templates/public/javascripts/jquery.fileupload.js +475 -0
- data/lib/generators/social_stream/templates/public/javascripts/jquery.form.js +815 -0
- data/lib/generators/social_stream/templates/public/javascripts/jquery.ui.mouse.js +156 -0
- data/lib/generators/social_stream/templates/public/javascripts/jquery.ui.slider.js +684 -0
- data/lib/generators/social_stream/templates/public/javascripts/jquery.ui.widget.js +236 -0
- data/lib/generators/social_stream/templates/public/javascripts/ui.checkbox.js +309 -0
- data/lib/generators/social_stream/templates/public/stylesheets/default/base.css +13 -12
- data/lib/generators/social_stream/templates/public/stylesheets/default/contacts.css +88 -0
- data/lib/generators/social_stream/templates/public/stylesheets/default/footer.css +1 -0
- data/lib/generators/social_stream/templates/public/stylesheets/default/header.css +5 -3
- data/lib/generators/social_stream/templates/public/stylesheets/default/home.css +1 -1
- data/lib/generators/social_stream/templates/public/stylesheets/default/images/loading.gif +0 -0
- data/lib/generators/social_stream/templates/public/stylesheets/default/jquery.fileupload-ui.css +73 -0
- data/lib/generators/social_stream/templates/public/stylesheets/default/jquery.ui.slider.css +24 -0
- data/lib/generators/social_stream/templates/public/stylesheets/default/jquery.ui.slidertheme.css +32 -0
- data/lib/generators/social_stream/templates/public/stylesheets/default/messages.css +4 -0
- data/lib/generators/social_stream/templates/public/stylesheets/default/spheres.css +226 -0
- data/lib/generators/social_stream/templates/relations.yml +12 -12
- data/lib/social_stream.rb +2 -1
- data/lib/social_stream/ability.rb +5 -4
- data/lib/social_stream/controllers/helpers.rb +19 -0
- data/lib/social_stream/models/object.rb +3 -1
- data/lib/social_stream/models/subject.rb +19 -6
- data/lib/social_stream/rails.rb +23 -1
- data/lib/social_stream/test_helpers/controllers.rb +1 -1
- data/lib/social_stream/version.rb +1 -1
- data/lib/tasks/db/populate.rake +6 -9
- data/social_stream.gemspec +7 -4
- data/spec/controllers/comments_controller_spec.rb +1 -1
- data/spec/controllers/contacts_controller_spec.rb +23 -0
- data/spec/controllers/groups_controller_spec.rb +12 -1
- data/spec/controllers/permissions_controller_spec.rb +48 -0
- data/spec/controllers/posts_controller_spec.rb +4 -4
- data/spec/controllers/relation_customs_controller_spec.rb +130 -0
- data/spec/controllers/representations_spec.rb +74 -0
- data/spec/controllers/spheres_controller_spec.rb +108 -0
- data/spec/dummy/config/initializers/mailboxer.rb +8 -0
- data/spec/dummy/config/initializers/social_stream.rb +2 -2
- data/spec/dummy/config/relations.yml +12 -12
- data/spec/factories/relation_custom.rb +4 -0
- data/spec/factories/sphere.rb +5 -0
- data/spec/factories/tie.rb +4 -4
- data/spec/models/activity_spec.rb +58 -38
- data/spec/models/actor_spec.rb +1 -1
- data/spec/models/group_spec.rb +12 -0
- data/spec/models/like_spec.rb +68 -0
- data/spec/models/profile_spec.rb +2 -1
- data/spec/models/relation_custom_spec.rb +14 -0
- data/spec/models/tie_spec.rb +26 -2
- metadata +195 -94
- data/app/controllers/avatars_controller.rb +0 -51
- data/app/controllers/representations_controller.rb +0 -19
- data/app/controllers/ties_controller.rb +0 -22
- data/app/helpers/ties_helper.rb +0 -37
- data/app/models/avatar.rb +0 -91
- data/app/models/representation.rb +0 -35
- data/app/views/avatars/_form.html.erb +0 -12
- data/app/views/avatars/_precrop.html.erb +0 -66
- data/app/views/avatars/edit.html.erb +0 -6
- data/app/views/avatars/new.html.erb +0 -32
- data/app/views/avatars/show.html.erb +0 -5
- data/app/views/groups/_location.html.erb +0 -3
- data/app/views/groups/_logo.html.erb +0 -5
- data/app/views/home/_location.html.erb +0 -3
- data/app/views/subjects/_toolbar_home.html.erb +0 -9
- data/app/views/subjects/_toolbar_profile_menu.html.erb +0 -12
- data/app/views/subjects/_toolbar_profile_menu_basic_options.html.erb +0 -13
- data/app/views/subjects/_toolbar_profile_menu_tie_options.html.erb +0 -41
- data/app/views/ties/_new.html.erb +0 -64
- data/app/views/ties/_tie.html.erb +0 -23
- data/app/views/ties/new.html.erb +0 -1
- data/app/views/users/_location.html.erb +0 -3
- data/lib/generators/social_stream/templates/public/images/w3c_css.png +0 -0
- data/lib/generators/social_stream/templates/public/images/w3c_xhtml.png +0 -0
- data/lib/generators/social_stream/templates/public/javascripts/addContact.js +0 -100
- data/lib/generators/social_stream/templates/public/stylesheets/default/addContact.css +0 -29
- data/spec/controllers/representations_controller_spec.rb +0 -51
- data/spec/controllers/ties_controller_spec.rb +0 -19
- data/spec/models/representation_spec.rb +0 -16
@@ -11,17 +11,17 @@ user:
|
|
11
11
|
friend:
|
12
12
|
name: friend
|
13
13
|
permissions:
|
14
|
-
- [ follow ]
|
15
|
-
- [ create, activity ]
|
16
|
-
- [ read, activity,
|
17
|
-
- [ update, activity ]
|
18
|
-
- [ destroy, activity ]
|
14
|
+
- [ follow ] # follow the activities of the friend
|
15
|
+
- [ create, activity ] # let the friend create activities
|
16
|
+
- [ read, activity, weak_star_ties ] # friend can read activities from the other friends and below
|
17
|
+
- [ update, activity ] # update her activities
|
18
|
+
- [ destroy, activity ] # delete her activities
|
19
19
|
sphere: personal
|
20
20
|
acquaintance:
|
21
21
|
name: acquaintance
|
22
22
|
parent: friend # friend relation is stronger than acquaintance
|
23
23
|
permissions:
|
24
|
-
- [ read, activity,
|
24
|
+
- [ read, activity, weak_star_ties ]
|
25
25
|
sphere: personal
|
26
26
|
|
27
27
|
group:
|
@@ -29,15 +29,15 @@ group:
|
|
29
29
|
name: member
|
30
30
|
permissions:
|
31
31
|
- [ represent ] # let the member act as the group
|
32
|
-
- [ create, activity
|
33
|
-
- [ read, activity,
|
34
|
-
- [ update, activity
|
35
|
-
- [ destroy, activity
|
32
|
+
- [ create, activity ] # let them member create activities
|
33
|
+
- [ read, activity, weak_star_ties ] # read activities from other members
|
34
|
+
- [ update, activity ] # update her activities
|
35
|
+
- [ destroy, activity ] # delete her activities
|
36
36
|
- [ read, tie, weak_star_ties ]
|
37
37
|
sphere: organization
|
38
38
|
partner:
|
39
39
|
name: partner
|
40
40
|
parent: member # member is stronger than partner
|
41
41
|
permissions:
|
42
|
-
- [ read, activity,
|
43
|
-
sphere:
|
42
|
+
- [ read, activity, weak_star_ties ]
|
43
|
+
sphere: external_relations
|
data/lib/social_stream.rb
CHANGED
@@ -2,6 +2,7 @@ module SocialStream
|
|
2
2
|
class Ability
|
3
3
|
include CanCan::Ability
|
4
4
|
|
5
|
+
# Create a new ability for this user, who is currently representing subject
|
5
6
|
def initialize(subject)
|
6
7
|
|
7
8
|
# Activity Objects
|
@@ -74,10 +75,10 @@ module SocialStream
|
|
74
75
|
p.subject.represented_by?(subject)
|
75
76
|
end
|
76
77
|
|
77
|
-
#
|
78
|
-
can :create,
|
79
|
-
|
80
|
-
|
78
|
+
# Privacy
|
79
|
+
can [:create, :read, :update, :destroy], Sphere, :actor_id => subject.try(:actor_id)
|
80
|
+
can [:create, :read, :update, :destroy], Relation::Custom, :sphere => { :actor_id => subject.try(:actor_id) }
|
81
|
+
can :read, Permission
|
81
82
|
end
|
82
83
|
end
|
83
84
|
end
|
@@ -32,6 +32,7 @@ module SocialStream
|
|
32
32
|
# Current subject represented by the user. Defaults to the own user
|
33
33
|
def current_subject
|
34
34
|
@current_subject ||=
|
35
|
+
current_subject_from_params ||
|
35
36
|
current_subject_from_session ||
|
36
37
|
current_user
|
37
38
|
end
|
@@ -43,6 +44,11 @@ module SocialStream
|
|
43
44
|
|
44
45
|
@current_subject = instance
|
45
46
|
end
|
47
|
+
|
48
|
+
def current_actor
|
49
|
+
return current_subject.actor
|
50
|
+
end
|
51
|
+
|
46
52
|
|
47
53
|
# Override Cancan#current_ability method to use {#current_subject}
|
48
54
|
def current_ability
|
@@ -52,6 +58,19 @@ module SocialStream
|
|
52
58
|
|
53
59
|
private
|
54
60
|
|
61
|
+
# Get represented subject from params[:s]
|
62
|
+
def current_subject_from_params
|
63
|
+
return unless params[:s].present?
|
64
|
+
|
65
|
+
subject = Actor.find_by_slug!(params[:s]).subject
|
66
|
+
|
67
|
+
unless subject.represented_by?(current_user)
|
68
|
+
raise CanCan::AccessDenied.new("Not authorized!", :represent, subject.name)
|
69
|
+
end
|
70
|
+
|
71
|
+
self.current_subject = subject
|
72
|
+
end
|
73
|
+
|
55
74
|
# Get represented subject from session
|
56
75
|
def current_subject_from_session
|
57
76
|
return unless session[:subject_type].present? && session[:subject_id].present?
|
@@ -13,7 +13,9 @@ module SocialStream
|
|
13
13
|
belongs_to :activity_object, :dependent => :destroy, :autosave => true
|
14
14
|
has_many :activity_object_activities, :through => :activity_object
|
15
15
|
|
16
|
-
delegate :post_activity,
|
16
|
+
delegate :post_activity,
|
17
|
+
:like_count,
|
18
|
+
:to => :activity_object
|
17
19
|
|
18
20
|
alias_method_chain :create_activity_object, :type
|
19
21
|
before_create :create_activity_object
|
@@ -18,7 +18,8 @@ module SocialStream
|
|
18
18
|
# alphabetic:: sort subjects by name
|
19
19
|
# search:: simple search by name
|
20
20
|
# distinct_initials:: get only the first letter of the name
|
21
|
-
#
|
21
|
+
# followed:: sort by most following incoming {Tie ties}
|
22
|
+
# liked:: sort by most likes
|
22
23
|
#
|
23
24
|
module Subject
|
24
25
|
extend ActiveSupport::Concern
|
@@ -52,12 +53,24 @@ module SocialStream
|
|
52
53
|
|
53
54
|
scope :distinct_initials, joins(:actor).merge(Actor.distinct_initials)
|
54
55
|
|
55
|
-
scope :
|
56
|
-
joins(:actor
|
57
|
-
|
58
|
-
group("#{ table_name }.id").
|
59
|
-
order("popularity DESC")
|
56
|
+
scope :followed, lambda {
|
57
|
+
joins(:actor).
|
58
|
+
order("actors.follower_count DESC")
|
60
59
|
}
|
60
|
+
|
61
|
+
scope :liked, lambda {
|
62
|
+
joins(:actor => :activity_object).
|
63
|
+
order('activity_objects.like_count DESC')
|
64
|
+
}
|
65
|
+
|
66
|
+
scope :most, lambda { |m|
|
67
|
+
types = %w( followed liked )
|
68
|
+
|
69
|
+
if types.include?(m)
|
70
|
+
__send__ m
|
71
|
+
end
|
72
|
+
}
|
73
|
+
|
61
74
|
end
|
62
75
|
|
63
76
|
module InstanceMethods
|
data/lib/social_stream/rails.rb
CHANGED
@@ -19,6 +19,7 @@ require 'has_scope'
|
|
19
19
|
# Logo attachments
|
20
20
|
require 'paperclip'
|
21
21
|
require 'paperclip/social_stream'
|
22
|
+
require 'avatars_for_rails'
|
22
23
|
# Pagination
|
23
24
|
require 'will_paginate'
|
24
25
|
# Oauth
|
@@ -27,6 +28,10 @@ require 'omniauth/oauth'
|
|
27
28
|
require 'rails_css_themes'
|
28
29
|
#Tags
|
29
30
|
require 'acts-as-taggable-on'
|
31
|
+
#Files
|
32
|
+
#require 'social_stream-files'
|
33
|
+
# HTML forms
|
34
|
+
require 'formtastic'
|
30
35
|
|
31
36
|
module SocialStream
|
32
37
|
class Engine < ::Rails::Engine #:nodoc:
|
@@ -42,8 +47,12 @@ module SocialStream
|
|
42
47
|
# https://rails.lighthouseapp.com/projects/8994/tickets/1905-apphelpers-within-plugin-not-being-mixed-in
|
43
48
|
ApplicationController.helper ActivitiesHelper
|
44
49
|
ApplicationController.helper SubjectsHelper
|
45
|
-
ApplicationController.helper TiesHelper
|
46
50
|
ApplicationController.helper LocationHelper
|
51
|
+
ApplicationController.helper ToolbarHelper
|
52
|
+
ApplicationController.helper ProfilesHelper
|
53
|
+
ApplicationController.helper PermissionsHelper
|
54
|
+
ApplicationController.helper NotificationsHelper
|
55
|
+
ApplicationController.helper ContactsHelper
|
47
56
|
|
48
57
|
ActsAsTaggableOn::TagsHelper
|
49
58
|
end
|
@@ -63,5 +72,18 @@ module SocialStream
|
|
63
72
|
include SocialStream::Controllers::Helpers
|
64
73
|
end
|
65
74
|
end
|
75
|
+
|
76
|
+
initializer "social_stream.avatars_for_rails" do
|
77
|
+
AvatarsForRails.setup do |config|
|
78
|
+
config.avatarable_model = :actor
|
79
|
+
config.current_avatarable_object = :current_actor
|
80
|
+
config.avatarable_filters = [:authenticate_user!]
|
81
|
+
config.avatarable_styles = { :representation => "20x20>",
|
82
|
+
:contact => "30x30>",
|
83
|
+
:actor => '35x35>',
|
84
|
+
:profile => '94x94'}
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
66
88
|
end
|
67
89
|
end
|
data/lib/tasks/db/populate.rake
CHANGED
@@ -12,18 +12,15 @@ namespace :db do
|
|
12
12
|
|
13
13
|
LOGOS_PATH = File.join(Rails.root, 'lib', 'logos')
|
14
14
|
|
15
|
+
Mailboxer.setup do |config|
|
16
|
+
config.uses_emails = false
|
17
|
+
end
|
18
|
+
|
15
19
|
def set_logos(klass)
|
16
20
|
klass.all.each do |i|
|
17
21
|
logo = Dir[File.join(LOGOS_PATH, klass.to_s.tableize, "#{ i.id }.*")].first
|
18
22
|
avatar = Dir[File.join(LOGOS_PATH, klass.to_s.tableize, "#{ i.id }.*")].first
|
19
|
-
|
20
|
-
if logo.present? && File.exists?(logo)
|
21
|
-
Logo.copy_to_temp_file(logo)
|
22
|
-
dimensions = Logo.get_image_dimensions(logo)
|
23
|
-
l = Logo.new(:actor => i.actor,:logo => File.open(logo), :name => File.basename(logo), :crop_x => 0, :crop_y => 0, :crop_w => dimensions[:width], :crop_h => dimensions[:height] )
|
24
|
-
l.save(false)
|
25
|
-
end
|
26
|
-
=end
|
23
|
+
|
27
24
|
if avatar.present? && File.exists?(avatar)
|
28
25
|
Avatar.copy_to_temp_file(avatar)
|
29
26
|
dimensions = Avatar.get_image_dimensions(avatar)
|
@@ -100,7 +97,7 @@ namespace :db do
|
|
100
97
|
# = Ties
|
101
98
|
available_actors.each do |a|
|
102
99
|
actors = available_actors.dup - Array(a)
|
103
|
-
relations = a.
|
100
|
+
relations = a.relation_customs
|
104
101
|
|
105
102
|
Forgery::Basic.number(:at_most => actors.size).times do
|
106
103
|
actor = actors.delete_at((rand * actors.size).to_i)
|
data/social_stream.gemspec
CHANGED
@@ -19,11 +19,12 @@ Gem::Specification.new do |s|
|
|
19
19
|
# Authentication
|
20
20
|
s.add_runtime_dependency('devise', '~> 1.2.rc')
|
21
21
|
# CRUD controllers
|
22
|
-
s.add_runtime_dependency('inherited_resources', '~> 1.
|
22
|
+
s.add_runtime_dependency('inherited_resources', '~> 1.2.2')
|
23
23
|
# Slug generation
|
24
24
|
s.add_runtime_dependency('stringex', '~> 1.2.0')
|
25
25
|
# Avatar attachments
|
26
26
|
s.add_runtime_dependency('paperclip', '~> 2.3.4')
|
27
|
+
s.add_runtime_dependency('avatars_for_rails', '~> 0.0.9')
|
27
28
|
# jQuery
|
28
29
|
s.add_runtime_dependency('jquery-rails', '~> 0.2.5')
|
29
30
|
# Authorization
|
@@ -31,18 +32,20 @@ Gem::Specification.new do |s|
|
|
31
32
|
# Pagination
|
32
33
|
s.add_runtime_dependency('will_paginate', '~> 3.0.pre2')
|
33
34
|
# OAuth client
|
34
|
-
s.add_runtime_dependency('omniauth','~> 0.2.
|
35
|
+
s.add_runtime_dependency('omniauth','~> 0.2.5')
|
35
36
|
# OAuth provider
|
36
37
|
s.add_runtime_dependency('oauth-plugin','~> 0.4.0.pre1')
|
37
38
|
# Theme support
|
38
39
|
s.add_runtime_dependency('rails_css_themes','~> 1.0.0')
|
39
40
|
# Messages
|
40
|
-
s.add_runtime_dependency('mailboxer','~> 0.
|
41
|
+
s.add_runtime_dependency('mailboxer','~> 0.1.4')
|
41
42
|
# Avatar manipulation
|
42
43
|
s.add_runtime_dependency('rmagick','~> 2.13.1')
|
43
44
|
# Tagging
|
44
45
|
s.add_runtime_dependency('acts-as-taggable-on','~> 2.0.6')
|
45
|
-
|
46
|
+
# HTML Forms
|
47
|
+
s.add_runtime_dependency('formtastic','~> 1.2.3')
|
48
|
+
|
46
49
|
# Development Gem dependencies
|
47
50
|
s.add_development_dependency('rails', '~> 3.0.7')
|
48
51
|
# Integration testing
|
@@ -13,7 +13,7 @@ describe CommentsController do
|
|
13
13
|
|
14
14
|
describe "comment from user" do
|
15
15
|
before do
|
16
|
-
model_assigned_to @user.sent_ties.received_by(@user).related_by(@user.
|
16
|
+
model_assigned_to @user.sent_ties.received_by(@user).related_by(@user.relation_customs.sort.first).first
|
17
17
|
end
|
18
18
|
|
19
19
|
it_should_behave_like "Allow Creating"
|
@@ -15,4 +15,27 @@ describe ContactsController do
|
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
+
describe "when authenticated" do
|
19
|
+
before do
|
20
|
+
@user = Factory(:user)
|
21
|
+
|
22
|
+
sign_in @user
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should render edit" do
|
26
|
+
get :edit, :id => Factory(:user).actor_id
|
27
|
+
|
28
|
+
assert_response :success
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should render update" do
|
32
|
+
contact = Factory(:user)
|
33
|
+
|
34
|
+
put :update, :id => contact.actor_id,
|
35
|
+
:contact => { "relation_ids" => [ "gotcha", @user.relations.first.id ] }
|
36
|
+
|
37
|
+
response.should redirect_to(contact)
|
38
|
+
@user.sent_ties.received_by(contact).first.relation.should == @user.relations.first
|
39
|
+
end
|
40
|
+
end
|
18
41
|
end
|
@@ -81,9 +81,20 @@ describe GroupsController do
|
|
81
81
|
context "a new own group" do
|
82
82
|
before do
|
83
83
|
model_attributes[:_founder] = @user.slug
|
84
|
+
model_attributes[:_participants] = [Factory(:user).slug]
|
84
85
|
end
|
85
86
|
|
86
|
-
|
87
|
+
it "should allow creating" do
|
88
|
+
count = Group.count
|
89
|
+
post :create, attributes
|
90
|
+
|
91
|
+
group = assigns(:group)
|
92
|
+
|
93
|
+
Group.count.should eq(count + 1)
|
94
|
+
group.should be_valid
|
95
|
+
assigns(:current_subject).should eq(group)
|
96
|
+
response.should redirect_to(:home)
|
97
|
+
end
|
87
98
|
end
|
88
99
|
|
89
100
|
context "a new fake group" do
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
+
|
3
|
+
describe PermissionsController do
|
4
|
+
include SocialStream::TestHelpers::Controllers
|
5
|
+
|
6
|
+
render_views
|
7
|
+
|
8
|
+
describe "when authenticated" do
|
9
|
+
before do
|
10
|
+
@user = Factory(:user)
|
11
|
+
|
12
|
+
sign_in @user
|
13
|
+
end
|
14
|
+
|
15
|
+
context "with an existing relation" do
|
16
|
+
before do
|
17
|
+
@sphere = Factory(:sphere, :actor_id => @user.actor_id)
|
18
|
+
@relation = Factory(:relation_custom, :sphere_id => @sphere.id)
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should render index" do
|
22
|
+
get :index, :relation_id => @relation.id, :format => "js"
|
23
|
+
|
24
|
+
response.should be_success
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
context "a external relation" do
|
29
|
+
before do
|
30
|
+
@relation = Factory(:relation_custom)
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should not render index" do
|
34
|
+
pending
|
35
|
+
|
36
|
+
begin
|
37
|
+
get :index, :relation_id => @relation.id, :format => "js"
|
38
|
+
|
39
|
+
assert false
|
40
|
+
rescue CanCan::AccessDenied
|
41
|
+
assigns(:permissions).should be_nil
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
|
@@ -16,7 +16,7 @@ describe PostsController do
|
|
16
16
|
describe "posts to user" do
|
17
17
|
describe "with first relation" do
|
18
18
|
before do
|
19
|
-
tie = @user.sent_ties.received_by(@user).related_by(@user.
|
19
|
+
tie = @user.sent_ties.received_by(@user).related_by(@user.relation_customs.sort.first).first
|
20
20
|
model_assigned_to tie
|
21
21
|
@current_model = Factory(:post, :_activity_tie_id => tie)
|
22
22
|
end
|
@@ -27,7 +27,7 @@ describe PostsController do
|
|
27
27
|
|
28
28
|
describe "with last relation" do
|
29
29
|
before do
|
30
|
-
tie = @user.sent_ties.received_by(@user).related_by(@user.
|
30
|
+
tie = @user.sent_ties.received_by(@user).related_by(@user.relation_customs.sort.last).first
|
31
31
|
model_assigned_to tie
|
32
32
|
@current_model = Factory(:post, :_activity_tie_id => tie)
|
33
33
|
end
|
@@ -92,7 +92,7 @@ describe PostsController do
|
|
92
92
|
|
93
93
|
describe "with first relation" do
|
94
94
|
before do
|
95
|
-
tie = @group.sent_ties.received_by(@group).related_by(@group.
|
95
|
+
tie = @group.sent_ties.received_by(@group).related_by(@group.relation_customs.sort.first).first
|
96
96
|
model_assigned_to tie
|
97
97
|
@current_model = Factory(:post, :_activity_tie_id => tie)
|
98
98
|
end
|
@@ -103,7 +103,7 @@ describe PostsController do
|
|
103
103
|
|
104
104
|
describe "with last relation" do
|
105
105
|
before do
|
106
|
-
tie = @group.sent_ties.received_by(@group).related_by(@group.
|
106
|
+
tie = @group.sent_ties.received_by(@group).related_by(@group.relation_customs.sort.last).first
|
107
107
|
model_assigned_to tie
|
108
108
|
@current_model = Factory(:post, :_activity_tie_id => tie)
|
109
109
|
end
|