social_stream 2.2.0 → 2.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/base/app/assets/javascripts/social_stream/actor.js +7 -1
  3. data/base/app/assets/javascripts/social_stream/contact.js +8 -0
  4. data/base/app/assets/javascripts/social_stream/flash.js +11 -1
  5. data/base/app/controllers/groups_controller.rb +1 -1
  6. data/base/app/controllers/profiles_controller.rb +7 -2
  7. data/base/app/controllers/search_controller.rb +9 -11
  8. data/base/app/models/permission.rb +4 -3
  9. data/base/app/models/relation/custom.rb +5 -5
  10. data/base/app/models/user.rb +2 -0
  11. data/base/app/views/contacts/_new_modal.html.erb +2 -2
  12. data/base/app/views/contacts/index.html.erb +3 -2
  13. data/base/app/views/devise/registrations/edit.html.erb +1 -15
  14. data/base/app/views/groups/_form.html.erb +1 -1
  15. data/base/app/views/groups/_new_modal.html.erb +1 -1
  16. data/base/app/views/groups/new.html.erb +1 -1
  17. data/base/app/views/profiles/_comunication-info_edit.html.erb +1 -1
  18. data/base/app/views/profiles/_experience_edit.html.erb +2 -2
  19. data/base/app/views/profiles/_personal_edit.html.erb +3 -3
  20. data/base/app/views/relation/customs/destroy.js.erb +1 -0
  21. data/base/app/views/relation/customs/update.js.erb +1 -1
  22. data/base/app/views/settings/index.html.erb +1 -1
  23. data/base/config/locales/en.yml +3 -0
  24. data/base/config/locales/es.yml +1 -1
  25. data/base/lib/social_stream/base/autoload.rb +15 -8
  26. data/base/lib/social_stream/base/version.rb +1 -1
  27. data/base/lib/social_stream/population.rb +14 -0
  28. data/base/lib/social_stream/search.rb +4 -2
  29. data/base/lib/tasks/db/populate.rake +108 -160
  30. data/lib/social_stream/version.rb +1 -1
  31. data/oauth2_server/app/assets/images/logos/{app-default.png → medium/site.png} +0 -0
  32. data/oauth2_server/app/assets/stylesheets/social_stream/oauth2_server/applications/layout/_applications-oauth2server.css.sass +3 -0
  33. data/oauth2_server/app/assets/stylesheets/social_stream/oauth2_server/mixins/_mixin.css.sass +46 -1
  34. data/oauth2_server/app/controllers/site/clients_controller.rb +21 -2
  35. data/oauth2_server/app/views/site/clients/_list.html.erb +2 -0
  36. data/oauth2_server/app/views/site/clients/index.html.erb +9 -2
  37. data/oauth2_server/app/views/site/clients/show.html.erb +11 -12
  38. data/oauth2_server/config/locales/en.yml +2 -1
  39. data/oauth2_server/config/locales/es.yml +1 -1
  40. data/oauth2_server/lib/social_stream/oauth2_server/controllers/helpers.rb +4 -6
  41. data/oauth2_server/lib/social_stream/oauth2_server/version.rb +1 -1
  42. data/oauth2_server/social_stream-oauth2_server.gemspec +1 -1
  43. data/oauth2_server/spec/controllers/dummy_controller_spec.rb +9 -2
  44. data/social_stream.gemspec +2 -2
  45. metadata +8 -7
@@ -1,5 +1,5 @@
1
1
  module SocialStream
2
2
  module Base
3
- VERSION = "2.2.0".freeze
3
+ VERSION = "2.2.1".freeze
4
4
  end
5
5
  end
@@ -0,0 +1,14 @@
1
+ module SocialStream
2
+ module Population
3
+ class << self
4
+ def task message
5
+ puts message
6
+ time = Time.now
7
+
8
+ yield
9
+
10
+ puts " -> #{ (Time.now - time).round(4) }s"
11
+ end
12
+ end
13
+ end
14
+ end
@@ -117,8 +117,10 @@ module SocialStream
117
117
 
118
118
  [
119
119
  query,
120
- :classes => models,
121
- :with => with
120
+ classes: models,
121
+ with: with,
122
+ limit: options[:limit],
123
+ page: options[:page]
122
124
  ]
123
125
  end
124
126
  end
@@ -45,171 +45,127 @@ namespace :db do
45
45
  # USERS
46
46
  desc "Create users"
47
47
  task :users => :read_environment do
48
- puts 'User population (Demo and ' + @USERS.to_s + ' users more)'
49
- users_start = Time.now
50
-
51
- # Create demo user if not present
52
- if Actor.find_by_slug('demo').blank?
53
- u = User.create! :name => '<Demo>',
54
- :email => 'demo@social-stream.dit.upm.es',
55
- :password => 'demonstration',
56
- :password_confirmation => 'demonstration'
57
- u.actor!.update_attribute :slug, 'demo'
58
- end
48
+ SocialStream::Population.task "User population (Demo and #{ @USERS } users more)" do
59
49
 
60
- @USERS.times do
61
- User.create! :name => Forgery::Name.full_name,
62
- :email => Forgery::Internet.email_address,
63
- :password => 'demonstration',
64
- :password_confirmation => 'demonstration'
65
- end
50
+ # Create demo user if not present
51
+ if Actor.find_by_slug('demo').blank?
52
+ u = User.create! :name => '<Demo>',
53
+ :email => 'demo@social-stream.dit.upm.es',
54
+ :password => 'demonstration',
55
+ :password_confirmation => 'demonstration'
56
+ u.actor!.update_attribute :slug, 'demo'
57
+ end
66
58
 
67
- # Reload actors to include new users
68
- @available_actors = Actor.all
59
+ @USERS.times do
60
+ User.create! :name => Forgery::Name.full_name,
61
+ :email => Forgery::Internet.email_address,
62
+ :password => 'demonstration',
63
+ :password_confirmation => 'demonstration'
64
+ end
69
65
 
70
- users_end = Time.now
71
- puts ' -> ' + (users_end - users_start).round(4).to_s + 's'
66
+ # Reload actors to include new users
67
+ @available_actors = Actor.all
68
+ end
72
69
  end
73
70
 
74
71
 
75
72
  # GROUPS
76
73
  desc "Create groups"
77
74
  task :groups => :read_environment do
78
- puts 'Groups population (' + @GROUPS.to_s + ' groups)'
79
- groups_start = Time.now
75
+ SocialStream::Population.task "Groups population (#{ @GROUPS } groups)" do
76
+ @GROUPS.times do
77
+ founder = @available_actors[rand(@available_actors.size)]
80
78
 
81
- @GROUPS.times do
82
- founder = @available_actors[rand(@available_actors.size)]
79
+ Group.create! :name => Forgery::Name.company_name,
80
+ :email => Forgery::Internet.email_address,
81
+ :author_id => founder.id,
82
+ :user_author_id => founder.id
83
+ end
83
84
 
84
- Group.create! :name => Forgery::Name.company_name,
85
- :email => Forgery::Internet.email_address,
86
- :author_id => founder.id,
87
- :user_author_id => founder.id
85
+ # Reload actors to include groups
86
+ @available_actors = Actor.all
88
87
  end
89
-
90
- # Reload actors to include groups
91
- @available_actors = Actor.all
92
-
93
- groups_end = Time.now
94
- puts ' -> ' + (groups_end - groups_start).round(4).to_s + 's'
95
88
  end
96
89
 
97
90
  desc "Populate profiles"
98
91
 
99
92
  task :profiles => :read_environment do
100
- puts "Profiles population"
101
- time = Time.now
93
+ SocialStream::Population.task "Profiles population" do
94
+ SocialStream::Population::Actor.available.each do |a|
95
+ p = a.profile
102
96
 
103
- SocialStream::Population::Actor.available.each do |a|
104
- p = a.profile
97
+ if rand < 0.2
98
+ a.tag_list = Forgery::LoremIpsum.words(3, random: true).gsub(' ', ',')
99
+ end
105
100
 
106
- if rand < 0.2
107
- a.tag_list = Forgery::LoremIpsum.words(3, random: true).gsub(' ', ',')
108
- end
101
+ if rand < 0.2
102
+ p.organization = Forgery::Name.company_name
103
+ end
109
104
 
110
- if rand < 0.2
111
- p.organization = Forgery::Name.company_name
112
- end
105
+ if rand < 0.2
106
+ p.birthday = Time.at(Time.now.to_i - (18.years + rand(60.years)))
107
+ end
113
108
 
114
- if rand < 0.2
115
- p.birthday = Time.at(Time.now.to_i - (18.years + rand(60.years)))
116
- end
109
+ if rand < 0.2
110
+ p.city = Forgery::Address.city
111
+ end
117
112
 
118
- if rand < 0.2
119
- p.city = Forgery::Address.city
120
- end
113
+ if rand < 0.2
114
+ p.country = Forgery::Address.country
115
+ end
121
116
 
122
- if rand < 0.2
123
- p.country = Forgery::Address.country
124
- end
117
+ if rand < 0.2
118
+ p.description = Forgery::LoremIpsum.sentences(2, random: true)
119
+ end
125
120
 
126
- if rand < 0.2
127
- p.description = Forgery::LoremIpsum.sentences(2, random: true)
128
- end
121
+ if rand < 0.2
122
+ p.phone = Forgery::Address.phone
123
+ end
129
124
 
130
- if rand < 0.2
131
- p.phone = Forgery::Address.phone
132
- end
125
+ if rand < 0.2
126
+ p.address = Forgery::Address.street_address
127
+ end
133
128
 
134
- if rand < 0.2
135
- p.address = Forgery::Address.street_address
136
- end
129
+ if rand < 0.2
130
+ p.website = "http://#{ Forgery::Internet.domain_name }"
131
+ end
137
132
 
138
- if rand < 0.2
139
- p.website = "http://#{ Forgery::Internet.domain_name }"
140
- end
133
+ if rand < 0.2
134
+ p.experience = Forgery::LoremIpsum.sentences(3, random: true)
135
+ end
141
136
 
142
- if rand < 0.2
143
- p.experience = Forgery::LoremIpsum.sentences(3, random: true)
137
+ p.save!
144
138
  end
145
-
146
- p.save!
147
139
  end
148
-
149
- puts ' -> ' + (Time.now - time).round(4).to_s + 's'
150
140
  end
151
141
 
152
142
  # TIES
153
143
  desc "Create ties"
154
144
  task :ties => :read_environment do
155
- puts 'Ties population'
156
- ties_start = Time.now
157
-
158
- SocialStream::Population::Actor.available.each do |a|
159
- actors = SocialStream::Population::Actor.available
160
- actors.delete(a)
161
-
162
- relations = a.relation_customs + [ Relation::Reject.instance ]
163
-
164
- Forgery::Basic.number(:at_most => actors.size).times do
165
- actor = actors.delete_at((rand * actors.size).to_i)
166
- contact = a.contact_to!(actor)
167
- contact.user_author = a.user_author if a.subject_type != "User"
168
- contact.relation_ids = [ Forgery::Extensions::Array.new(relations).random.id ]
145
+ SocialStream::Population.task 'Ties population' do
146
+ SocialStream::Population::Actor.available.each do |a|
147
+ actors = SocialStream::Population::Actor.available
148
+ actors.delete(a)
149
+
150
+ relations = a.relation_customs + [ Relation::Reject.instance ]
151
+
152
+ Forgery::Basic.number(:at_most => actors.size).times do
153
+ actor = actors.delete_at((rand * actors.size).to_i)
154
+ contact = a.contact_to!(actor)
155
+ contact.user_author = a.user_author if a.subject_type != "User"
156
+ contact.relation_ids = [ Forgery::Extensions::Array.new(relations).random.id ]
157
+ end
169
158
  end
170
- end
171
-
172
- Activity.includes(:activity_verb).merge(ActivityVerb.verb_name(["follow", "make-friend"])).each do |a|
173
- t = SocialStream::Population::Timestamps.new
174
-
175
- a.update_attributes :created_at => t.created,
176
- :updated_at => t.updated
177
- end
178
-
179
- ties_end = Time.now
180
- puts ' -> ' + (ties_end - ties_start).round(4).to_s + 's'
181
- end
182
159
 
160
+ Activity.includes(:activity_verb).merge(ActivityVerb.verb_name(["follow", "make-friend"])).each do |a|
161
+ t = SocialStream::Population::Timestamps.new
183
162
 
184
- # TIES, special version for cheesecake testing
185
- desc "Create cheesecake ties"
186
- task :cheesecake_ties => :read_environment do
187
- puts 'Ties population (Cheesecake version)'
188
- ties_start = Time.now
189
-
190
- SocialStream::Population::Actor.available.each do |a|
191
- actors = SocialStream::Population::Actor.available - Array(a)
192
- relations = a.relation_customs + Array.wrap(Relation::Reject.instance)
193
- break if actors.size==0
194
- actor = Actor.first
195
- unless a==actor
196
- puts a.name + " connecting with " + actor.name
197
- # DRY! :-S
198
- contact = a.contact_to!(actor)
199
- contact.user_author = a.user_author if a.subject_type != "User"
200
- contact.relation_ids = Array(Forgery::Extensions::Array.new(a.relation_customs).random.id)
201
-
202
- contact = actor.contact_to!(a)
203
- contact.user_author = actor.user_author if actor.subject_type != "User"
204
- contact.relation_ids = Array(Forgery::Extensions::Array.new(actor.relation_customs).random.id)
163
+ a.update_attributes :created_at => t.created,
164
+ :updated_at => t.updated
205
165
  end
206
166
  end
207
-
208
- ties_end = Time.now
209
- puts ' -> ' + (ties_end - ties_start).round(4).to_s + 's'
210
167
  end
211
168
 
212
-
213
169
  # POSTS
214
170
  desc "Create posts"
215
171
  task :posts => :read_environment do
@@ -223,58 +179,52 @@ namespace :db do
223
179
  # MESSAGES
224
180
  desc "Create messages using mailboxer"
225
181
  task :messages => :read_environment do
226
- puts 'Mailboxer population'
227
- mailboxer_start = Time.now
182
+ SocialStream::Population.task 'Mailboxer population' do
183
+ demo = SocialStream::Population::Actor.demo
184
+ @available_actors = Actor.all.sample(Actor.count / 3)
185
+ @available_actors |= [ demo ]
228
186
 
229
- demo = SocialStream::Population::Actor.demo
230
- @available_actors = Actor.all.sample(Actor.count / 3)
231
- @available_actors |= [ demo ]
232
187
 
188
+ 5.times do
189
+ actors = @available_actors.dup
233
190
 
234
- 5.times do
235
- actors = @available_actors.dup
191
+ mult_recp = actors.uniq
236
192
 
237
- mult_recp = actors.uniq
193
+ actor = mult_recp.sample
238
194
 
239
- actor = mult_recp.sample
195
+ mult_recp.delete(actor)
240
196
 
241
- mult_recp.delete(actor)
197
+ mail = actor.send_message(mult_recp, "Hello all, I am #{actor.name}. #{Forgery::LoremIpsum.sentences(2,:random => true)}", Forgery::LoremIpsum.words(10,:random => true))
242
198
 
243
- mail = actor.send_message(mult_recp, "Hello all, I am #{actor.name}. #{Forgery::LoremIpsum.sentences(2,:random => true)}", Forgery::LoremIpsum.words(10,:random => true))
199
+ [ 'Well', 'Ok', 'Pretty well', 'Finally' ].inject(mail) do |st|
200
+ break if rand < 0.2
244
201
 
245
- [ 'Well', 'Ok', 'Pretty well', 'Finally' ].inject(mail) do |st|
246
- break if rand < 0.2
202
+ actor = mult_recp.sample
247
203
 
248
- actor = mult_recp.sample
204
+ mail = actor.reply_to_all(mail, "#{ st }, I am #{actor.name}. #{Forgery::LoremIpsum.sentences(2,:random => true)}")
249
205
 
250
- mail = actor.reply_to_all(mail, "#{ st }, I am #{actor.name}. #{Forgery::LoremIpsum.sentences(2,:random => true)}")
251
-
252
- mail
253
- end
206
+ mail
207
+ end
254
208
 
255
- if rand > 0.75
256
- mail.conversation.move_to_trash(demo)
257
- end
209
+ if rand > 0.75
210
+ mail.conversation.move_to_trash(demo)
211
+ end
258
212
 
259
- @available_actors = (Actor.all.sample(Actor.count / 3) - [ demo ])
213
+ @available_actors = (Actor.all.sample(Actor.count / 3) - [ demo ])
260
214
 
261
- @available_actors.each do |a|
262
- mail = a.send_message(demo, "Hello, #{demo.name}. #{Forgery::LoremIpsum.sentences(2,:random => true)}", Forgery::LoremIpsum.words(10,:random => true))
263
- if rand > 0.5
264
- mail = demo.reply_to_sender(mail, "Pretty well #{a.name}. #{Forgery::LoremIpsum.sentences(2,:random => true)}")
215
+ @available_actors.each do |a|
216
+ mail = a.send_message(demo, "Hello, #{demo.name}. #{Forgery::LoremIpsum.sentences(2,:random => true)}", Forgery::LoremIpsum.words(10,:random => true))
265
217
  if rand > 0.5
266
- a.reply_to_sender(mail, "Ok #{demo.name}. #{Forgery::LoremIpsum.sentences(2,:random => true)}")
218
+ mail = demo.reply_to_sender(mail, "Pretty well #{a.name}. #{Forgery::LoremIpsum.sentences(2,:random => true)}")
219
+ if rand > 0.5
220
+ a.reply_to_sender(mail, "Ok #{demo.name}. #{Forgery::LoremIpsum.sentences(2,:random => true)}")
221
+ end
267
222
  end
268
223
  end
269
224
  end
270
225
  end
271
-
272
- mailboxer_end = Time.now
273
- puts ' -> ' + (mailboxer_end - mailboxer_start).round(4).to_s + 's'
274
-
275
226
  end
276
227
 
277
-
278
228
  # AVATARS
279
229
  desc "Create avatars"
280
230
  task :avatars => :read_environment do
@@ -295,11 +245,9 @@ namespace :db do
295
245
  end
296
246
  end
297
247
 
298
- puts 'Avatar population'
299
- avatar_start = Time.now
300
- SocialStream.subjects.each {|a| set_logos(Kernel.const_get(a.to_s.classify)) }
301
- avatar_end = Time.now
302
- puts ' -> ' + (avatar_end - avatar_start).round(4).to_s + 's'
248
+ SocialStream::Population.task 'Avatar population' do
249
+ SocialStream.subjects.each {|a| set_logos(Kernel.const_get(a.to_s.classify)) }
250
+ end
303
251
  end
304
252
  end
305
253
  end
@@ -1,3 +1,3 @@
1
1
  module SocialStream
2
- VERSION = "2.2.0".freeze
2
+ VERSION = "2.2.1".freeze
3
3
  end
@@ -48,3 +48,6 @@
48
48
  input
49
49
  &[type="file"]
50
50
  line-height: 0px
51
+
52
+ .next-step
53
+ @include next-btn
@@ -1,5 +1,45 @@
1
1
  // menu horizontal
2
2
  // ----------------------------------
3
+ @mixin btn-secundary
4
+ @include ie7-inline-block()
5
+ padding: 4px 12px
6
+ margin-bottom: 0
7
+ font-size: $baseFontSize
8
+ line-height: $baseLineHeight
9
+ vertical-align: middle
10
+ cursor: pointer
11
+ background-color: $secundary-btnColorbackground
12
+ border: 1px solid $secundary-btnColorborder
13
+ *border: 0
14
+ color: $auxiliarColor
15
+ background-image: none
16
+ @include ie7-restore-left-whitespace()
17
+ @include box-shadow(inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05))
18
+ @include transition(background 1s, color, 1s)
19
+ @include border-radius(7px)
20
+ a
21
+ color: $gray
22
+
23
+ &:hover
24
+ border: 1px solid $secundary-btnColorbackground
25
+ background-color: $secundary-btnColorborder !important
26
+ color: $principalColor
27
+
28
+ &:focus
29
+ @include tab-focus()
30
+
31
+ &.active
32
+ border: 1px solid $secundary-btnColorborder
33
+ background-color: $secundary-btnColorbackground !important
34
+ color: $principalColor
35
+
36
+ &.disabled,
37
+ &[disabled]
38
+ cursor: default
39
+ @include opacity(85)
40
+ background-color: $secundary-btnColorbackground
41
+ color: $gray
42
+
3
43
 
4
44
  @mixin principal-box
5
45
  @include border-radius(5px)
@@ -7,4 +47,9 @@
7
47
  border: 1px solid
8
48
  border-color: rgba(0,0,0, 0.1)
9
49
  background-color: $auxiliarColor
10
- border-color: rgba(0,0,0, 0.1)
50
+ border-color: rgba(0,0,0, 0.1)
51
+
52
+
53
+ @mixin next-btn
54
+ @include btn-secundary
55
+