social_stream-base 0.6.3 → 0.6.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. data/app/assets/stylesheets/base.css +1 -0
  2. data/app/assets/stylesheets/contacts.css +2 -1
  3. data/app/assets/stylesheets/fcbkComplete.css +1 -1
  4. data/app/assets/stylesheets/header.css +2 -2
  5. data/app/assets/stylesheets/messages.css +3 -3
  6. data/app/assets/stylesheets/{spheres.css → relation_customs.css} +0 -0
  7. data/app/controllers/contacts_controller.rb +9 -4
  8. data/app/controllers/messages_controller.rb +69 -68
  9. data/app/controllers/relation/customs_controller.rb +1 -11
  10. data/app/helpers/activities_helper.rb +1 -2
  11. data/app/helpers/notifications_helper.rb +3 -2
  12. data/app/helpers/permissions_helper.rb +5 -5
  13. data/app/helpers/subjects_helper.rb +9 -0
  14. data/app/helpers/toolbar_helper.rb +10 -89
  15. data/app/models/activity.rb +39 -15
  16. data/app/models/actor.rb +30 -71
  17. data/app/models/contact.rb +15 -0
  18. data/app/models/group.rb +1 -3
  19. data/app/models/permission.rb +9 -72
  20. data/app/models/profile.rb +7 -2
  21. data/app/models/relation/custom.rb +6 -33
  22. data/app/models/relation.rb +15 -39
  23. data/app/models/user.rb +5 -1
  24. data/app/views/activities/_new.html.erb +5 -2
  25. data/app/views/activities/_options.html.erb +2 -2
  26. data/app/views/activities/_walls.html.erb +1 -1
  27. data/app/views/contacts/_contact.html.erb +3 -3
  28. data/app/views/contacts/_form.html.erb +14 -20
  29. data/app/views/contacts/_index.html.erb +1 -1
  30. data/app/views/contacts/_suggestions.html.erb +1 -13
  31. data/app/views/contacts/destroy.js.erb +6 -0
  32. data/app/views/contacts/edit.html.erb +1 -1
  33. data/app/views/conversations/_conversation.html.erb +1 -1
  34. data/app/views/groups/_group.html.erb +1 -1
  35. data/app/views/groups/_index.html.erb +1 -1
  36. data/app/views/groups/show.html.erb +1 -1
  37. data/app/views/invitation_mailer/send_invitation.html.erb +17 -6
  38. data/app/views/invitation_mailer/send_invitation.text.erb +7 -2
  39. data/app/views/layouts/_representation.html.erb +10 -6
  40. data/app/views/layouts/_settings.html.erb +1 -1
  41. data/app/views/messages/_message.html.erb +1 -1
  42. data/app/views/messages/new.html.erb +1 -1
  43. data/app/views/notifications/_notification.html.erb +7 -3
  44. data/app/views/objects/_new.html.erb +0 -6
  45. data/app/views/profiles/edit.html.erb +5 -9
  46. data/app/views/relation/customs/_form.html.erb +2 -2
  47. data/app/views/{spheres → relation/customs}/_jquery.erb +0 -58
  48. data/app/views/relation/customs/_list.html.erb +9 -26
  49. data/app/views/relation/customs/create.js.erb +2 -3
  50. data/app/views/relation/customs/index.html.erb +67 -0
  51. data/app/views/users/_index.html.erb +1 -1
  52. data/app/views/users/show.html.erb +1 -1
  53. data/config/locales/en.yml +16 -41
  54. data/config/routes.rb +1 -6
  55. data/db/migrate/20110705103202_empty_ties_count.rb +4 -0
  56. data/db/migrate/20110712090343_remove_spheres.rb +30 -0
  57. data/db/migrate/20110712142140_remove_permission_function.rb +26 -0
  58. data/lib/generators/social_stream/base/install_generator.rb +4 -0
  59. data/lib/generators/social_stream/base/templates/mailboxer_custom.rb +13 -0
  60. data/lib/generators/social_stream/base/templates/navigation.rb +4 -0
  61. data/lib/generators/social_stream/base/templates/relations.yml +14 -20
  62. data/lib/social_stream/ability.rb +1 -2
  63. data/lib/social_stream/base/version.rb +1 -1
  64. data/lib/social_stream/migration_finder.rb +19 -0
  65. data/lib/social_stream/toolbar_config.rb +113 -0
  66. data/lib/social_stream-base.rb +1 -0
  67. data/lib/tasks/db/populate.rake +1 -1
  68. data/social_stream-base.gemspec +4 -2
  69. data/spec/controllers/contacts_controller_spec.rb +1 -1
  70. data/spec/controllers/permissions_controller_spec.rb +1 -2
  71. data/spec/controllers/posts_controller_spec.rb +2 -2
  72. data/spec/controllers/relation_customs_controller_spec.rb +69 -62
  73. data/spec/dummy/config/database.yml +7 -0
  74. data/spec/dummy/config/relations.yml +14 -20
  75. data/spec/factories/relation_custom.rb +1 -1
  76. data/spec/factories/tie.rb +4 -0
  77. data/spec/models/activity_spec.rb +11 -2
  78. data/spec/models/user_spec.rb +68 -9
  79. data/spec/spec_helper.rb +0 -3
  80. data/spec/support/db.rb +9 -0
  81. data/spec/support/migrations.rb +3 -12
  82. metadata +19 -25
  83. data/app/controllers/spheres_controller.rb +0 -12
  84. data/app/models/sphere.rb +0 -9
  85. data/app/views/relation/customs/_index.html.erb +0 -28
  86. data/app/views/relation/customs/index.js.erb +0 -2
  87. data/app/views/spheres/_form.html.erb +0 -28
  88. data/app/views/spheres/_list.html.erb +0 -19
  89. data/app/views/spheres/create.js.erb +0 -20
  90. data/app/views/spheres/index.html.erb +0 -74
  91. data/spec/controllers/spheres_controller_spec.rb +0 -116
  92. data/spec/factories/sphere.rb +0 -5
  93. data/spec/models/relation_custom_spec.rb +0 -14
@@ -1,4 +1,4 @@
1
1
  Factory.define(:relation_custom, :class => Relation::Custom) do |c|
2
2
  c.sequence(:name) { |n| "Relation custom #{ n }" }
3
- c.association :sphere
3
+ c.association :actor
4
4
  end
@@ -33,3 +33,7 @@ Factory.define :partner, :parent => :g2g_tie do |t|
33
33
  t.after_build { |u| u.relation = u.sender.relation_custom('partner') }
34
34
  end
35
35
 
36
+ Factory.define :group_public, :parent => :g2g_tie do |t|
37
+ t.after_build { |u| u.relation = u.sender.relation_public }
38
+ end
39
+
@@ -263,7 +263,7 @@ describe Activity do
263
263
  create_ability_accessed_by_related :friend
264
264
  end
265
265
 
266
- it_should_behave_like "Denies Creating"
266
+ it_should_behave_like "Denies Creating"
267
267
  it_should_behave_like "Allows Reading"
268
268
  it_should_behave_like "Denies Updating"
269
269
  it_should_behave_like "Denies Destroying"
@@ -274,7 +274,6 @@ describe Activity do
274
274
  create_ability_accessed_by_related :acquaintance
275
275
  end
276
276
 
277
-
278
277
  it_should_behave_like "Denies Creating"
279
278
  it_should_behave_like "Denies Reading"
280
279
  it_should_behave_like "Denies Updating"
@@ -462,4 +461,14 @@ describe Activity do
462
461
  end
463
462
  end
464
463
  end
464
+
465
+ context "without relations" do
466
+ it "should allow create to friend" do
467
+ tie = Factory(:friend)
468
+
469
+ activity = Activity.new :contact_id => tie.contact.inverse!.id
470
+
471
+ assert activity.allow?(tie.receiver, 'create')
472
+ end
473
+ end
465
474
  end
@@ -1,22 +1,81 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
2
 
3
3
  describe User do
4
+ before do
5
+ @user = Factory(:user)
6
+ end
7
+
4
8
  it "should find by slug" do
5
- user = Factory(:user)
9
+ assert @user.should == User.find_by_slug(@user.slug)
10
+ end
11
+
12
+ context "member of a group" do
13
+ before do
14
+ tie = Factory(:member, :contact => Factory(:group_contact, :receiver => @user.actor))
15
+ @group = tie.sender_subject
16
+ end
17
+
18
+ context "without accept the group" do
19
+ it "should not represent" do
20
+ @user.represented.should_not include(@group)
21
+ end
22
+ end
23
+
24
+ context "accepting the group" do
25
+ before do
26
+ Factory(:friend, :contact => @user.contact_to!(@group))
27
+ end
28
+
29
+ it "should represent" do
30
+ @user.represented.should include(@group)
31
+ end
32
+ end
33
+ end
34
+
35
+ context "partner of a group" do
36
+ before do
37
+ tie = Factory(:partner, :contact => Factory(:group_contact, :receiver => @user.actor))
38
+ @group = tie.receiver_subject
39
+ end
40
+
41
+ context "without accept the group" do
42
+ it "should not represent" do
43
+ @user.represented.should_not include(@group)
44
+ end
45
+ end
46
+
47
+ context "accepting the group" do
48
+ before do
49
+ Factory(:friend, :contact => @user.contact_to!(@group))
50
+ end
6
51
 
7
- assert user.should == User.find_by_slug(user.slug)
52
+ it "should not represent" do
53
+ @user.represented.should_not include(@group)
54
+ end
55
+ end
8
56
  end
9
57
 
10
- it "should represent" do
11
- tie = Factory(:member)
12
- group = tie.sender_subject
13
- user = tie.receiver_subject
58
+ context "public of a group" do
59
+ before do
60
+ tie = Factory(:group_public, :contact => Factory(:group_contact, :receiver => @user.actor))
61
+ @group = tie.receiver_subject
62
+ end
14
63
 
15
- assert user.represented.should include(group)
64
+ context "without accept the group" do
65
+ it "should not represent" do
66
+ @user.represented.should_not include(@group)
67
+ end
68
+ end
16
69
 
17
- tie = Factory(:partner, :receiver => user.actor)
70
+ context "accepting the group" do
71
+ before do
72
+ Factory(:friend, :contact => @user.contact_to!(@group))
73
+ end
18
74
 
19
- assert ! user.represented.include?(tie.sender_subject)
75
+ it "should not represent" do
76
+ @user.represented.should_not include(@group)
77
+ end
78
+ end
20
79
  end
21
80
 
22
81
  it "should have activity object" do
data/spec/spec_helper.rb CHANGED
@@ -21,9 +21,6 @@ ActiveRecord::Migration.verbose = false
21
21
  # Load support files
22
22
  Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
23
23
 
24
- # Run any available migration
25
- ActiveRecord::Migrator.migrate File.expand_path("../dummy/db/migrate/", __FILE__)
26
-
27
24
  # Load Factories
28
25
  require 'factory_girl'
29
26
  Dir["#{File.dirname(__FILE__)}/factories/*.rb"].each {|f| require f}
data/spec/support/db.rb CHANGED
@@ -14,7 +14,16 @@ end
14
14
  end
15
15
  end
16
16
 
17
+ begin
18
+ ActiveRecord::Migrator.migrate File.expand_path("../../dummy/db/migrate/", __FILE__), 0
19
+ rescue
20
+ puts "WARNING: Social Stream Base failed to rollback"
21
+ end
22
+
17
23
  CreateMailboxer.up
18
24
  ActsAsTaggableOnMigration.up
19
25
 
26
+ # Run any available migration
27
+ ActiveRecord::Migrator.migrate File.expand_path("../../dummy/db/migrate/", __FILE__)
28
+
20
29
  require File.expand_path("../../dummy/db/seeds", __FILE__)
@@ -1,19 +1,10 @@
1
- class MigrationFinder
2
- def initialize gem, path
3
- finder = Gem::GemPathSearcher.new
4
- taggable_spec = finder.find(gem)
5
- taggable_migration = finder.matching_files(taggable_spec,
6
- File.join(*path)).first
7
-
8
- require taggable_migration
9
- end
10
- end
1
+ require 'social_stream/migration_finder'
11
2
 
12
3
  # acts-as-taggable-on
13
- MigrationFinder.new 'acts-as-taggable-on',
4
+ SocialStream::MigrationFinder.new 'acts-as-taggable-on',
14
5
  ["generators", "acts_as_taggable_on", "migration", "templates", "active_record", "migration"]
15
6
 
16
7
  # Mailboxer
17
- MigrationFinder.new 'mailboxer',
8
+ SocialStream::MigrationFinder.new 'mailboxer',
18
9
  ['generators', 'mailboxer', 'templates', 'migration']
19
10
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: social_stream-base
3
3
  version: !ruby/object:Gem::Version
4
- hash: 1
4
+ hash: 13
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 6
9
- - 3
10
- version: 0.6.3
9
+ - 5
10
+ version: 0.6.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - GING - DIT - UPM
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-07-06 00:00:00 +02:00
19
+ date: 2011-07-13 00:00:00 +02:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -205,12 +205,12 @@ dependencies:
205
205
  requirements:
206
206
  - - ~>
207
207
  - !ruby/object:Gem::Version
208
- hash: 31
208
+ hash: 23
209
209
  segments:
210
210
  - 0
211
+ - 3
211
212
  - 2
212
- - 4
213
- version: 0.2.4
213
+ version: 0.3.2
214
214
  type: :runtime
215
215
  version_requirements: *id012
216
216
  - !ruby/object:Gem::Dependency
@@ -345,14 +345,12 @@ dependencies:
345
345
  requirement: &id021 !ruby/object:Gem::Requirement
346
346
  none: false
347
347
  requirements:
348
- - - ~>
348
+ - - ">="
349
349
  - !ruby/object:Gem::Version
350
- hash: 49
350
+ hash: 3
351
351
  segments:
352
352
  - 0
353
- - 10
354
- - 3
355
- version: 0.10.3
353
+ version: "0"
356
354
  type: :development
357
355
  version_requirements: *id021
358
356
  - !ruby/object:Gem::Dependency
@@ -847,6 +845,7 @@ files:
847
845
  - app/assets/stylesheets/jquery.ui.slidertheme.css
848
846
  - app/assets/stylesheets/menu.css
849
847
  - app/assets/stylesheets/messages.css
848
+ - app/assets/stylesheets/relation_customs.css
850
849
  - app/assets/stylesheets/settings.css
851
850
  - app/assets/stylesheets/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png
852
851
  - app/assets/stylesheets/smoothness/images/ui-bg_flat_75_ffffff_40x100.png
@@ -863,7 +862,6 @@ files:
863
862
  - app/assets/stylesheets/smoothness/images/ui-icons_cd0a0a_256x240.png
864
863
  - app/assets/stylesheets/smoothness/jquery-ui-1.7.3.custom.css
865
864
  - app/assets/stylesheets/smoothness/jquery-ui-1.8.4.custom.css
866
- - app/assets/stylesheets/spheres.css
867
865
  - app/controllers/activities_controller.rb
868
866
  - app/controllers/api_controller.rb
869
867
  - app/controllers/authentications_controller.rb
@@ -883,7 +881,6 @@ files:
883
881
  - app/controllers/profiles_controller.rb
884
882
  - app/controllers/relation/customs_controller.rb
885
883
  - app/controllers/settings_controller.rb
886
- - app/controllers/spheres_controller.rb
887
884
  - app/controllers/subjects_controller.rb
888
885
  - app/controllers/tags_controller.rb
889
886
  - app/controllers/users_controller.rb
@@ -917,7 +914,6 @@ files:
917
914
  - app/models/relation/custom.rb
918
915
  - app/models/relation/public.rb
919
916
  - app/models/relation_permission.rb
920
- - app/models/sphere.rb
921
917
  - app/models/tie.rb
922
918
  - app/models/user.rb
923
919
  - app/views/activities/_activity.html.erb
@@ -946,6 +942,7 @@ files:
946
942
  - app/views/contacts/_pendings.html.erb
947
943
  - app/views/contacts/_suggestions.html.erb
948
944
  - app/views/contacts/_suggestions_and_pendings.html.erb
945
+ - app/views/contacts/destroy.js.erb
949
946
  - app/views/contacts/edit.html.erb
950
947
  - app/views/contacts/index.html.erb
951
948
  - app/views/contacts/index.js.erb
@@ -1045,21 +1042,16 @@ files:
1045
1042
  - app/views/profiles/show.html.erb
1046
1043
  - app/views/profiles/update.js.erb
1047
1044
  - app/views/relation/customs/_form.html.erb
1048
- - app/views/relation/customs/_index.html.erb
1045
+ - app/views/relation/customs/_jquery.erb
1049
1046
  - app/views/relation/customs/_list.html.erb
1050
1047
  - app/views/relation/customs/create.js.erb
1051
- - app/views/relation/customs/index.js.erb
1048
+ - app/views/relation/customs/index.html.erb
1052
1049
  - app/views/relation/customs/update.js.erb
1053
1050
  - app/views/settings/_api_key.html.erb
1054
1051
  - app/views/settings/_index.html.erb
1055
1052
  - app/views/settings/_notifications.html.erb
1056
1053
  - app/views/settings/index.html.erb
1057
1054
  - app/views/settings/index.js.erb
1058
- - app/views/spheres/_form.html.erb
1059
- - app/views/spheres/_jquery.erb
1060
- - app/views/spheres/_list.html.erb
1061
- - app/views/spheres/create.js.erb
1062
- - app/views/spheres/index.html.erb
1063
1055
  - app/views/subjects/_contacts.html.erb
1064
1056
  - app/views/subjects/_tabs.html.erb
1065
1057
  - app/views/toolbar/_home.html.erb
@@ -1079,10 +1071,13 @@ files:
1079
1071
  - config/routes.rb
1080
1072
  - db/migrate/20110610112023_create_social_stream.rb
1081
1073
  - db/migrate/20110705103202_empty_ties_count.rb
1074
+ - db/migrate/20110712090343_remove_spheres.rb
1075
+ - db/migrate/20110712142140_remove_permission_function.rb
1082
1076
  - lib/acts_as_taggable_on/acts_as_taggable_on/dirty.rb
1083
1077
  - lib/acts_as_taggable_on/social_stream.rb
1084
1078
  - lib/generators/social_stream/base/install_generator.rb
1085
1079
  - lib/generators/social_stream/base/templates/initializer.rb
1080
+ - lib/generators/social_stream/base/templates/mailboxer_custom.rb
1086
1081
  - lib/generators/social_stream/base/templates/navigation.rb
1087
1082
  - lib/generators/social_stream/base/templates/relations.yml
1088
1083
  - lib/paperclip/social_stream.rb
@@ -1091,12 +1086,14 @@ files:
1091
1086
  - lib/social_stream/base.rb
1092
1087
  - lib/social_stream/base/version.rb
1093
1088
  - lib/social_stream/controllers/helpers.rb
1089
+ - lib/social_stream/migration_finder.rb
1094
1090
  - lib/social_stream/models/object.rb
1095
1091
  - lib/social_stream/models/subject.rb
1096
1092
  - lib/social_stream/models/supertype.rb
1097
1093
  - lib/social_stream/populate.rb
1098
1094
  - lib/social_stream/test_helpers.rb
1099
1095
  - lib/social_stream/test_helpers/controllers.rb
1096
+ - lib/social_stream/toolbar_config.rb
1100
1097
  - lib/tasks/db/populate.rake
1101
1098
  - lib/tasks/resque.rake
1102
1099
  - social_stream-base.gemspec
@@ -1112,7 +1109,6 @@ files:
1112
1109
  - spec/controllers/profiles_controller_spec.rb
1113
1110
  - spec/controllers/relation_customs_controller_spec.rb
1114
1111
  - spec/controllers/representations_spec.rb
1115
- - spec/controllers/spheres_controller_spec.rb
1116
1112
  - spec/controllers/subjects_controller.rb
1117
1113
  - spec/controllers/users_controller_spec.rb
1118
1114
  - spec/dummy/.gitignore
@@ -1155,7 +1151,6 @@ files:
1155
1151
  - spec/factories/group.rb
1156
1152
  - spec/factories/post.rb
1157
1153
  - spec/factories/relation_custom.rb
1158
- - spec/factories/sphere.rb
1159
1154
  - spec/factories/tie.rb
1160
1155
  - spec/factories/user.rb
1161
1156
  - spec/integration/navigation_spec.rb
@@ -1166,7 +1161,6 @@ files:
1166
1161
  - spec/models/like_spec.rb
1167
1162
  - spec/models/post_spec.rb
1168
1163
  - spec/models/profile_spec.rb
1169
- - spec/models/relation_custom_spec.rb
1170
1164
  - spec/models/relation_spec.rb
1171
1165
  - spec/models/tie_spec.rb
1172
1166
  - spec/models/user_spec.rb
@@ -1,12 +0,0 @@
1
- class SpheresController < InheritedResources::Base
2
- before_filter :authenticate_user!
3
- load_and_authorize_resource
4
-
5
- respond_to :html, :js
6
-
7
- protected
8
-
9
- def begin_of_association_chain
10
- current_subject
11
- end
12
- end
data/app/models/sphere.rb DELETED
@@ -1,9 +0,0 @@
1
- class Sphere < ActiveRecord::Base
2
- belongs_to :actor
3
-
4
- has_many :customs, :class_name => "Relation::Custom"
5
-
6
- validates_presence_of :name
7
- validates_uniqueness_of :name, :scope => :actor_id
8
-
9
- end
@@ -1,28 +0,0 @@
1
- <%= javascript_include_tag 'jquery-ui'%>
2
-
3
- <p class="sectionTitle"><%= raw t('relation_custom.in_sphere.choose', :name => h(@sphere.name)) %> </p>
4
-
5
-
6
- <div class="privacy_add_element">
7
- <div id="new_relation_custom_title_block">
8
- <a href="#"><span id="new_relation_custom_title" class="privacy_span_new"><%= t 'relation_custom.new' %></span></a>
9
- </div>
10
- <div id="new_relation_custom_input_block">
11
- <%= render :partial => 'relation/customs/form' %>
12
- </div>
13
- </div>
14
-
15
- <div id="relation_custom_list">
16
- <%= render :partial => 'relation/customs/list', :object => @customs %>
17
- </div>
18
-
19
- <%= javascript_tag do %>
20
- $(function() {
21
- $("#new_relation_custom_input_block").hide();
22
-
23
- $("#new_relation_custom_title").click(function() {
24
- $("#new_relation_custom_title_block").hide();
25
- $("#new_relation_custom_input_block").show();
26
- });
27
- })
28
- <% end %>
@@ -1,2 +0,0 @@
1
- $('#relations').html("<%= escape_javascript render(:partial => 'index') %>");
2
- $('#relations').show();
@@ -1,28 +0,0 @@
1
- <% @sphere ||= Sphere.new %>
2
-
3
- <%= form_for @sphere, :remote => true do |f| %>
4
-
5
- <% if @sphere.errors.any? %>
6
- <div id="error_explanation">
7
- <h2><%= pluralize(@sphere.errors.count, "error") %> prohibited this sphere from being saved:</h2>
8
-
9
- <ul>
10
- <% @sphere.errors.full_messages.each do |msg| %>
11
- <li><%= msg %></li>
12
- <% end %>
13
- </ul>
14
- </div>
15
- <% end %>
16
-
17
- <p><%= f.text_field :name, :class => "privacy_input_new", :size => 20 %></p>
18
- <%= f.submit nil, :class => "button" %>
19
- <button class="button" id="cancel_new_sphere" ><%= t('button.cancel') %></button>
20
- <% end %>
21
-
22
- <%= javascript_tag do %>
23
- $("#cancel_new_sphere").click(function() {
24
- $("#new_sphere_input_block").hide();
25
- $("#new_sphere_title_block").show();
26
- return false;
27
- });
28
- <% end %>