social_stream 2.2.0 → 2.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/base/app/assets/javascripts/social_stream/actor.js +7 -1
- data/base/app/assets/javascripts/social_stream/contact.js +8 -0
- data/base/app/assets/javascripts/social_stream/flash.js +11 -1
- data/base/app/controllers/groups_controller.rb +1 -1
- data/base/app/controllers/profiles_controller.rb +7 -2
- data/base/app/controllers/search_controller.rb +9 -11
- data/base/app/models/permission.rb +4 -3
- data/base/app/models/relation/custom.rb +5 -5
- data/base/app/models/user.rb +2 -0
- data/base/app/views/contacts/_new_modal.html.erb +2 -2
- data/base/app/views/contacts/index.html.erb +3 -2
- data/base/app/views/devise/registrations/edit.html.erb +1 -15
- data/base/app/views/groups/_form.html.erb +1 -1
- data/base/app/views/groups/_new_modal.html.erb +1 -1
- data/base/app/views/groups/new.html.erb +1 -1
- data/base/app/views/profiles/_comunication-info_edit.html.erb +1 -1
- data/base/app/views/profiles/_experience_edit.html.erb +2 -2
- data/base/app/views/profiles/_personal_edit.html.erb +3 -3
- data/base/app/views/relation/customs/destroy.js.erb +1 -0
- data/base/app/views/relation/customs/update.js.erb +1 -1
- data/base/app/views/settings/index.html.erb +1 -1
- data/base/config/locales/en.yml +3 -0
- data/base/config/locales/es.yml +1 -1
- data/base/lib/social_stream/base/autoload.rb +15 -8
- data/base/lib/social_stream/base/version.rb +1 -1
- data/base/lib/social_stream/population.rb +14 -0
- data/base/lib/social_stream/search.rb +4 -2
- data/base/lib/tasks/db/populate.rake +108 -160
- data/lib/social_stream/version.rb +1 -1
- data/oauth2_server/app/assets/images/logos/{app-default.png → medium/site.png} +0 -0
- data/oauth2_server/app/assets/stylesheets/social_stream/oauth2_server/applications/layout/_applications-oauth2server.css.sass +3 -0
- data/oauth2_server/app/assets/stylesheets/social_stream/oauth2_server/mixins/_mixin.css.sass +46 -1
- data/oauth2_server/app/controllers/site/clients_controller.rb +21 -2
- data/oauth2_server/app/views/site/clients/_list.html.erb +2 -0
- data/oauth2_server/app/views/site/clients/index.html.erb +9 -2
- data/oauth2_server/app/views/site/clients/show.html.erb +11 -12
- data/oauth2_server/config/locales/en.yml +2 -1
- data/oauth2_server/config/locales/es.yml +1 -1
- data/oauth2_server/lib/social_stream/oauth2_server/controllers/helpers.rb +4 -6
- data/oauth2_server/lib/social_stream/oauth2_server/version.rb +1 -1
- data/oauth2_server/social_stream-oauth2_server.gemspec +1 -1
- data/oauth2_server/spec/controllers/dummy_controller_spec.rb +9 -2
- data/social_stream.gemspec +2 -2
- metadata +8 -7
@@ -45,171 +45,127 @@ namespace :db do
|
|
45
45
|
# USERS
|
46
46
|
desc "Create users"
|
47
47
|
task :users => :read_environment do
|
48
|
-
|
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
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
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
|
-
|
68
|
-
|
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
|
-
|
71
|
-
|
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
|
-
|
79
|
-
|
75
|
+
SocialStream::Population.task "Groups population (#{ @GROUPS } groups)" do
|
76
|
+
@GROUPS.times do
|
77
|
+
founder = @available_actors[rand(@available_actors.size)]
|
80
78
|
|
81
|
-
|
82
|
-
|
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
|
-
|
85
|
-
|
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
|
-
|
101
|
-
|
93
|
+
SocialStream::Population.task "Profiles population" do
|
94
|
+
SocialStream::Population::Actor.available.each do |a|
|
95
|
+
p = a.profile
|
102
96
|
|
103
|
-
|
104
|
-
|
97
|
+
if rand < 0.2
|
98
|
+
a.tag_list = Forgery::LoremIpsum.words(3, random: true).gsub(' ', ',')
|
99
|
+
end
|
105
100
|
|
106
|
-
|
107
|
-
|
108
|
-
|
101
|
+
if rand < 0.2
|
102
|
+
p.organization = Forgery::Name.company_name
|
103
|
+
end
|
109
104
|
|
110
|
-
|
111
|
-
|
112
|
-
|
105
|
+
if rand < 0.2
|
106
|
+
p.birthday = Time.at(Time.now.to_i - (18.years + rand(60.years)))
|
107
|
+
end
|
113
108
|
|
114
|
-
|
115
|
-
|
116
|
-
|
109
|
+
if rand < 0.2
|
110
|
+
p.city = Forgery::Address.city
|
111
|
+
end
|
117
112
|
|
118
|
-
|
119
|
-
|
120
|
-
|
113
|
+
if rand < 0.2
|
114
|
+
p.country = Forgery::Address.country
|
115
|
+
end
|
121
116
|
|
122
|
-
|
123
|
-
|
124
|
-
|
117
|
+
if rand < 0.2
|
118
|
+
p.description = Forgery::LoremIpsum.sentences(2, random: true)
|
119
|
+
end
|
125
120
|
|
126
|
-
|
127
|
-
|
128
|
-
|
121
|
+
if rand < 0.2
|
122
|
+
p.phone = Forgery::Address.phone
|
123
|
+
end
|
129
124
|
|
130
|
-
|
131
|
-
|
132
|
-
|
125
|
+
if rand < 0.2
|
126
|
+
p.address = Forgery::Address.street_address
|
127
|
+
end
|
133
128
|
|
134
|
-
|
135
|
-
|
136
|
-
|
129
|
+
if rand < 0.2
|
130
|
+
p.website = "http://#{ Forgery::Internet.domain_name }"
|
131
|
+
end
|
137
132
|
|
138
|
-
|
139
|
-
|
140
|
-
|
133
|
+
if rand < 0.2
|
134
|
+
p.experience = Forgery::LoremIpsum.sentences(3, random: true)
|
135
|
+
end
|
141
136
|
|
142
|
-
|
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
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
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
|
-
|
185
|
-
|
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
|
-
|
227
|
-
|
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
|
-
|
235
|
-
actors = @available_actors.dup
|
191
|
+
mult_recp = actors.uniq
|
236
192
|
|
237
|
-
|
193
|
+
actor = mult_recp.sample
|
238
194
|
|
239
|
-
|
195
|
+
mult_recp.delete(actor)
|
240
196
|
|
241
|
-
|
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
|
-
|
199
|
+
[ 'Well', 'Ok', 'Pretty well', 'Finally' ].inject(mail) do |st|
|
200
|
+
break if rand < 0.2
|
244
201
|
|
245
|
-
|
246
|
-
break if rand < 0.2
|
202
|
+
actor = mult_recp.sample
|
247
203
|
|
248
|
-
|
204
|
+
mail = actor.reply_to_all(mail, "#{ st }, I am #{actor.name}. #{Forgery::LoremIpsum.sentences(2,:random => true)}")
|
249
205
|
|
250
|
-
|
251
|
-
|
252
|
-
mail
|
253
|
-
end
|
206
|
+
mail
|
207
|
+
end
|
254
208
|
|
255
|
-
|
256
|
-
|
257
|
-
|
209
|
+
if rand > 0.75
|
210
|
+
mail.conversation.move_to_trash(demo)
|
211
|
+
end
|
258
212
|
|
259
|
-
|
213
|
+
@available_actors = (Actor.all.sample(Actor.count / 3) - [ demo ])
|
260
214
|
|
261
|
-
|
262
|
-
|
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
|
-
|
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
|
-
|
299
|
-
|
300
|
-
|
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
|
File without changes
|
data/oauth2_server/app/assets/stylesheets/social_stream/oauth2_server/mixins/_mixin.css.sass
CHANGED
@@ -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
|
+
|