social_stream-base 0.9.28 → 0.9.29
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.
- data/app/models/activity.rb +48 -1
- data/app/views/comments/_comment.html.erb +1 -1
- data/app/views/notification_mailer/new_notification_email.html.erb +5 -3
- data/app/views/notification_mailer/new_notification_email.text.erb +5 -3
- data/app/views/notifications/activities/_follow.html.erb +4 -4
- data/app/views/notifications/activities/_follow.text.erb +7 -7
- data/app/views/notifications/activities/_like.html.erb +1 -1
- data/app/views/notifications/activities/_like.text.erb +5 -5
- data/app/views/notifications/activities/_make-friend.text.erb +5 -5
- data/app/views/notifications/activities/_post.html.erb +1 -1
- data/app/views/notifications/activities/_post.text.erb +6 -6
- data/app/views/notifications/activities/_update.html.erb +1 -1
- data/app/views/notifications/activities/_update.text.erb +6 -6
- data/app/views/posts/_post.html.erb +1 -1
- data/config/locales/en.yml +3 -0
- data/config/locales/es.yml +16 -8
- data/lib/social_stream-base.rb +3 -0
- data/lib/social_stream/base.rb +5 -0
- data/lib/social_stream/base/version.rb +1 -1
- data/lib/social_stream/controllers/cancan_devise_integration.rb +22 -0
- data/social_stream-base.gemspec +3 -1
- metadata +37 -22
- data/app/helpers/notifications_helper.rb +0 -3
- data/lib/mailboxer/notification_decoder.rb +0 -89
data/app/models/activity.rb
CHANGED
|
@@ -206,7 +206,7 @@ class Activity < ActiveRecord::Base
|
|
|
206
206
|
#Avaible verbs: follow, like, make-friend, post, update
|
|
207
207
|
|
|
208
208
|
if ['like','follow','make-friend','post','update'].include? verb and !contact.reflexive?
|
|
209
|
-
receiver.notify(
|
|
209
|
+
receiver.notify(notification_subject, "Youre not supposed to see this", self)
|
|
210
210
|
end
|
|
211
211
|
true
|
|
212
212
|
end
|
|
@@ -307,6 +307,53 @@ class Activity < ActiveRecord::Base
|
|
|
307
307
|
end
|
|
308
308
|
end
|
|
309
309
|
|
|
310
|
+
#
|
|
311
|
+
# Get the email subject for the activity's notification
|
|
312
|
+
#
|
|
313
|
+
def notification_subject
|
|
314
|
+
sender_name= sender.name.truncate(30, :separator => ' ')
|
|
315
|
+
receiver_name= receiver.name.truncate(30, :separator => ' ')
|
|
316
|
+
case verb
|
|
317
|
+
when 'like'
|
|
318
|
+
if direct_object.is_a? Actor or direct_object.respond_to? :actor
|
|
319
|
+
I18n.t('notification.fan',
|
|
320
|
+
:sender => sender_name,
|
|
321
|
+
:whose => I18n.t('notification.whose.'+ receiver.subject.class.to_s.underscore,
|
|
322
|
+
:receiver => receiver_name))
|
|
323
|
+
else
|
|
324
|
+
I18n.t('notification.like.'+ receiver.subject.class.to_s.underscore,
|
|
325
|
+
:sender => sender_name,
|
|
326
|
+
:whose => I18n.t('notification.whose.'+ receiver.subject.class.to_s.underscore,
|
|
327
|
+
:receiver => receiver_name),
|
|
328
|
+
:thing => I18n.t(direct_object.class.to_s.underscore+'.name'))
|
|
329
|
+
end
|
|
330
|
+
when 'follow'
|
|
331
|
+
I18n.t('notification.follow.'+ receiver.subject.class.to_s.underscore,
|
|
332
|
+
:sender => sender_name,
|
|
333
|
+
:who => I18n.t('notification.who.'+ receiver.subject.class.to_s.underscore,
|
|
334
|
+
:name => receiver_name))
|
|
335
|
+
when 'make-friend'
|
|
336
|
+
I18n.t('notification.makefriend.'+ receiver.subject.class.to_s.underscore,
|
|
337
|
+
:sender => sender_name,
|
|
338
|
+
:who => I18n.t('notification.who.'+ receiver.subject.class.to_s.underscore,
|
|
339
|
+
:name => receiver_name))
|
|
340
|
+
when 'post'
|
|
341
|
+
I18n.t('notification.post.'+ receiver.subject.class.to_s.underscore,
|
|
342
|
+
:sender => sender_name,
|
|
343
|
+
:whose => I18n.t('notification.whose.'+ receiver.subject.class.to_s.underscore,
|
|
344
|
+
:receiver => receiver_name),
|
|
345
|
+
:thing => I18n.t(direct_object.class.to_s.underscore+'.one'))
|
|
346
|
+
when 'update'
|
|
347
|
+
I18n.t('notification.update.'+ receiver.subject.class.to_s.underscore,
|
|
348
|
+
:sender => sender_name,
|
|
349
|
+
:whose => I18n.t('notification.whose.'+ receiver.subject.class.to_s.underscore,
|
|
350
|
+
:receiver => receiver_name),
|
|
351
|
+
:thing => I18n.t(direct_object.class.to_s.underscore+'.one'))
|
|
352
|
+
else
|
|
353
|
+
t('notification.default')
|
|
354
|
+
end
|
|
355
|
+
end
|
|
356
|
+
|
|
310
357
|
#Send notifications to actors based on proximity, interest and permissions
|
|
311
358
|
def send_notifications
|
|
312
359
|
notify
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<%= comment.text %>
|
|
1
|
+
<%= simple_format auto_link(comment.text) %>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<% self.class.send :include,
|
|
1
|
+
<% self.class.send :include, SubjectsHelper, ActionView::Helpers::TextHelper %>
|
|
2
2
|
<!DOCTYPE html>
|
|
3
3
|
<html>
|
|
4
4
|
<head>
|
|
@@ -6,7 +6,9 @@
|
|
|
6
6
|
</head>
|
|
7
7
|
<body>
|
|
8
8
|
<div>
|
|
9
|
-
|
|
9
|
+
<div >
|
|
10
|
+
<%= t('notification.hello', :receiver => @receiver.name)%>
|
|
11
|
+
</div>
|
|
10
12
|
<div style="position: static;padding: 5px; border: #2A3890 solid 2px; background-color: #E1EEF5; margin:10px; min-height: 125px; width: 500px;">
|
|
11
13
|
<div style="float:left; margin-right:7px; border: thin solid #D4E4EA; background-color: white; max-height: 119px;">
|
|
12
14
|
<img src="<%= root_url + @notification.notified_object.sender.logo.url(:profile)%>" alt="<%=@notification.notified_object.sender.name%>">
|
|
@@ -25,7 +27,7 @@
|
|
|
25
27
|
</div>
|
|
26
28
|
<div style="padding: 10px 5px 5px 5px;">
|
|
27
29
|
<p>
|
|
28
|
-
|
|
30
|
+
<%= raw t('notification.visit', :url=> link_to(notifications_url,notifications_url))%>
|
|
29
31
|
</p>
|
|
30
32
|
</div>
|
|
31
33
|
</div>
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
<% self.class.send :include,
|
|
1
|
+
<% self.class.send :include, SubjectsHelper, ActionView::Helpers::TextHelper %>
|
|
2
|
+
<%= t('notification.hello', :receiver => @receiver.name)%>
|
|
2
3
|
|
|
3
|
-
-----------------------------------------------
|
|
4
4
|
<%= render :partial => "notifications/activities/#{ @notification.notified_object.verb }",
|
|
5
5
|
:locals =>{:activity => @notification.notified_object}%>
|
|
6
|
+
|
|
7
|
+
|
|
6
8
|
-----------------------------------------------
|
|
7
|
-
|
|
9
|
+
<%= raw t('notification.visit', :url=> notifications_url)%>
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<div class="subject">
|
|
2
2
|
<%= raw t('notification.follow.'+ activity.receiver.subject.class.to_s.underscore,
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
:sender => link_to(truncate_name(activity.sender.name), polymorphic_url(activity.sender.subject)),
|
|
4
|
+
:who => t('notification.who.'+ activity.receiver.subject.class.to_s.underscore,
|
|
5
|
+
:name => truncate_name(activity.receiver.name))) %>
|
|
6
6
|
</div>
|
|
7
7
|
<div class="briefing">
|
|
8
|
-
<%= link_to(t('notification.confirm', :sender => truncate_name(activity.sender.name)),
|
|
8
|
+
<%= raw link_to(t('notification.confirm', :sender => truncate_name(activity.sender.name)),
|
|
9
9
|
edit_contact_url(activity.receiver.contact_to!(activity.sender),:s => activity.receiver.slug)) %>
|
|
10
10
|
</div>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<%= raw t('notification.follow.'+ activity.receiver.subject.class.to_s.underscore,
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
<%= t('notification.look', :sender => truncate_name(activity.sender.name))%>: <%=polymorphic_url(activity.sender.subject)%>
|
|
7
|
-
<%= t('notification.confirm', :sender => truncate_name(activity.sender.name)) %> <%= edit_contact_url(activity.receiver.contact_to!(activity.sender),
|
|
8
|
-
:s => activity.receiver.slug)%>
|
|
2
|
+
:sender => truncate_name(activity.sender.name),
|
|
3
|
+
:who => t('notification.who.'+ activity.receiver.subject.class.to_s.underscore,
|
|
4
|
+
:name => truncate_name(activity.receiver.name))) %>
|
|
5
|
+
|
|
6
|
+
<%= raw t('notification.look', :sender => truncate_name(activity.sender.name))%>: <%=polymorphic_url(activity.sender.subject)%>
|
|
7
|
+
<%= raw t('notification.confirm', :sender => truncate_name(activity.sender.name)) %> <%= edit_contact_url(activity.receiver.contact_to!(activity.sender),
|
|
8
|
+
:s => activity.receiver.slug)%>
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
</div>
|
|
21
21
|
<div class="briefing">
|
|
22
22
|
<% if activity.direct_object.respond_to? :text %>
|
|
23
|
-
"<%= link_to(activity.direct_object.text.truncate(100, :separator =>' '),
|
|
23
|
+
"<%= link_to(sanitize(activity.direct_object.text.truncate(100, :separator =>' ')),
|
|
24
24
|
polymorphic_url( activity.direct_object))%>"
|
|
25
25
|
<% else%>
|
|
26
26
|
<%= link_to(t('notification.watch_it'),
|
|
@@ -3,19 +3,19 @@
|
|
|
3
3
|
:sender => truncate_name(activity.sender.name),
|
|
4
4
|
:whose => t('notification.whose.'+ activity.receiver.subject.class.to_s.underscore,
|
|
5
5
|
:receiver => truncate_name(activity.receiver.name)))%>
|
|
6
|
-
|
|
6
|
+
|
|
7
7
|
<% else %>
|
|
8
8
|
<%= raw t('notification.like.'+ activity.receiver.subject.class.to_s.underscore,
|
|
9
9
|
:sender => truncate_name(activity.sender.name),
|
|
10
10
|
:whose => t('notification.whose.'+ activity.receiver.subject.class.to_s.underscore,
|
|
11
11
|
:receiver => truncate_name(activity.receiver.name)),
|
|
12
12
|
:thing => t(activity.direct_object.class.to_s.underscore+'.name')) %>
|
|
13
|
-
|
|
13
|
+
|
|
14
14
|
<% if activity.direct_object.respond_to? :text %>
|
|
15
|
-
"<%= activity.direct_object.text.truncate(100, :separator =>' ')%>"
|
|
16
|
-
|
|
15
|
+
"<%= sanitize(activity.direct_object.text.truncate(100, :separator =>' '))%>"
|
|
16
|
+
<%= raw t('notification.all_text', :url => polymorphic_url(activity.direct_object))%>
|
|
17
17
|
<% else%>
|
|
18
|
-
--><%= t('notification.watch', :url => polymorphic_url( activity.direct_object))%>
|
|
18
|
+
--><%= raw t('notification.watch', :url => polymorphic_url( activity.direct_object))%>
|
|
19
19
|
<%end%>
|
|
20
20
|
<% end %>
|
|
21
21
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<%= raw t('notification.makefriend.'+ activity.receiver.subject.class.to_s.underscore,
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
:sender => truncate_name(activity.sender.name),
|
|
3
|
+
:who => t('notification.who.'+ activity.receiver.subject.class.to_s.underscore,
|
|
4
|
+
:name => truncate_name(activity.receiver.name))) %>
|
|
5
|
+
|
|
6
6
|
<%= raw t('notification.look',
|
|
7
|
-
|
|
7
|
+
:sender => truncate_name(activity.sender.name)) %>: <%=polymorphic_url(activity.sender.subject)%>
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
</div>
|
|
10
10
|
<div class="briefing">
|
|
11
11
|
<% if activity.direct_object.respond_to? :text %>
|
|
12
|
-
"<%= link_to(activity.direct_object.text.truncate(100, :separator =>' '),
|
|
12
|
+
"<%= link_to(sanitize(activity.direct_object.text.truncate(100, :separator =>' ')),
|
|
13
13
|
polymorphic_url(activity.direct_object))%>"
|
|
14
14
|
<% else%>
|
|
15
15
|
<%= link_to(t('notification.watch_it'),
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
|
|
2
2
|
<%= raw t('notification.post.'+ activity.receiver.subject.class.to_s.underscore,
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
:sender => truncate_name(activity.sender.name),
|
|
4
|
+
:whose => t('notification.whose.'+ activity.receiver.subject.class.to_s.underscore,
|
|
5
|
+
:receiver => truncate_name(activity.receiver.name)),
|
|
6
|
+
:thing => t(activity.direct_object.class.to_s.underscore+'.one')) %>
|
|
7
|
+
|
|
8
8
|
|
|
9
9
|
<% if activity.direct_object.respond_to? :text %>
|
|
10
|
-
"<%=activity.direct_object.text.truncate(100, :separator =>' ')%>"
|
|
10
|
+
"<%= sanitize(activity.direct_object.text.truncate(100, :separator =>' '))%>"
|
|
11
11
|
--><%= t('notification.all_text', :url => polymorphic_url(activity.direct_object))%>
|
|
12
12
|
<% else%>
|
|
13
13
|
<%= t('notification.watch', :url => polymorphic_url(activity.direct_object))%>
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
</div>
|
|
10
10
|
<div class="briefing">
|
|
11
11
|
<% if activity.direct_object.respond_to? :text %>
|
|
12
|
-
"<%= link_to(activity.direct_object.text.truncate(100, :separator =>' '),
|
|
12
|
+
"<%= link_to(sanitize(activity.direct_object.text.truncate(100, :separator =>' ')),
|
|
13
13
|
polymorphic_url(activity.direct_object))%>"
|
|
14
14
|
<% else%>
|
|
15
15
|
<%= link_to(t('notification.watch_it'),
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<%= raw t('notification.update.'+ activity.receiver.subject.class.to_s.underscore,
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
:sender => truncate_name(activity.sender.name),
|
|
3
|
+
:whose => t('notification.whose.'+ activity.receiver.subject.class.to_s.underscore,
|
|
4
|
+
:receiver => truncate_name(activity.receiver.name)),
|
|
5
|
+
:thing => t(activity.direct_object.class.to_s.underscore+'.one')) %>
|
|
6
|
+
|
|
7
7
|
<% if activity.direct_object.respond_to? :text %>
|
|
8
|
-
"<%=activity.direct_object.text.truncate(100, :separator =>' ')%>"
|
|
8
|
+
"<%= sanitize activity.direct_object.text.truncate(100, :separator =>' ')%>"
|
|
9
9
|
--><%= t('notification.all_text', :url => polymorphic_url(activity.direct_object))%>
|
|
10
10
|
<% else%>
|
|
11
11
|
<%= t('notification.watch', :url => polymorphic_url( activity.direct_object))%>
|
data/config/locales/en.yml
CHANGED
|
@@ -276,11 +276,13 @@ en:
|
|
|
276
276
|
notification:
|
|
277
277
|
all_text: "Read the whole text at %{url}"
|
|
278
278
|
confirm: "Confirm %{sender} as contact?"
|
|
279
|
+
default: "You have a new notification"
|
|
279
280
|
destroy_sure: "Do you want to delete this notification?"
|
|
280
281
|
fan: "%{sender} is now %{whose} fan."
|
|
281
282
|
follow:
|
|
282
283
|
group: "%{sender} added %{who} as contact."
|
|
283
284
|
user: "%{sender} added %{who} as contact."
|
|
285
|
+
hello: "Hi %{receiver},"
|
|
284
286
|
like:
|
|
285
287
|
group: "%{sender} likes %{whose} %{thing}."
|
|
286
288
|
user: "%{sender} likes %{whose} %{thing}."
|
|
@@ -299,6 +301,7 @@ en:
|
|
|
299
301
|
update:
|
|
300
302
|
group: "%{sender} updated %{thing} in %{whose} wall."
|
|
301
303
|
user: "%{sender} updated %{thing} in %{whose} wall."
|
|
304
|
+
visit: "Visit %{url} and check all your notifications."
|
|
302
305
|
watch: "Watch it at %{url}"
|
|
303
306
|
watch_it: "Watch it!"
|
|
304
307
|
who:
|
data/config/locales/es.yml
CHANGED
|
@@ -85,6 +85,7 @@ es:
|
|
|
85
85
|
browse: "Descubrir"
|
|
86
86
|
button:
|
|
87
87
|
cancel: "Cancelar"
|
|
88
|
+
create: "Crear"
|
|
88
89
|
save: "Guardar"
|
|
89
90
|
update: "Actualizar"
|
|
90
91
|
comment:
|
|
@@ -158,9 +159,11 @@ es:
|
|
|
158
159
|
collaborate:
|
|
159
160
|
default: "Colabora"
|
|
160
161
|
sentence1: "Organice sus proyectos y actividades"
|
|
161
|
-
sentence2: "
|
|
162
|
+
sentence2: "Participe en grupos y conferencias"
|
|
163
|
+
sentence3: "Cree sus propios grupos y conferencias"
|
|
162
164
|
elements:
|
|
163
165
|
comments: "Comentarios"
|
|
166
|
+
conferences: "Conferencias"
|
|
164
167
|
networks: "Redes sociales"
|
|
165
168
|
organizers: "Organizadores"
|
|
166
169
|
participants: "Participantes"
|
|
@@ -241,13 +244,13 @@ es:
|
|
|
241
244
|
mark_as_read: "Marcar como leido"
|
|
242
245
|
message_mailer:
|
|
243
246
|
has_sent_new:
|
|
244
|
-
event: "ha
|
|
245
|
-
group: "ha
|
|
246
|
-
user: "te ha
|
|
247
|
+
event: "ha mandado un nuevo mensaje a %{receiver}"
|
|
248
|
+
group: "ha mandado un nuevo mensaje a %{receiver}"
|
|
249
|
+
user: "te ha mandado un nuevo mensaje"
|
|
247
250
|
has_sent_reply:
|
|
248
|
-
event: "ha
|
|
249
|
-
group: "ha
|
|
250
|
-
user: "te ha
|
|
251
|
+
event: "ha mandado una respuesta a %{receiver}"
|
|
252
|
+
group: "ha mandado una respuesta a %{receiver}"
|
|
253
|
+
user: "te ha mandado una respuesta"
|
|
251
254
|
subject_new: "%{subject}"
|
|
252
255
|
subject_reply: "%{subject}"
|
|
253
256
|
notification_mailer:
|
|
@@ -273,11 +276,13 @@ es:
|
|
|
273
276
|
notification:
|
|
274
277
|
all_text: "Lee el texto entero en %{url}"
|
|
275
278
|
confirm: "¿Confirmar contacto con %{sender}?"
|
|
279
|
+
default: "Tienes una nueva notificación"
|
|
276
280
|
destroy_sure: "¿Borrar notificación?"
|
|
277
281
|
fan: "%{sender} es ahora fan %{whose}."
|
|
278
|
-
follow:
|
|
282
|
+
follow:
|
|
279
283
|
group: "%{sender} añadió a %{who} como contacto."
|
|
280
284
|
user: "%{sender} te añadió como contacto."
|
|
285
|
+
hello: "Hola %{receiver},"
|
|
281
286
|
like:
|
|
282
287
|
group: "A %{sender} le gusta el %{thing} %{whose}."
|
|
283
288
|
user: "A %{sender} le gusta tu %{thing}."
|
|
@@ -296,6 +301,7 @@ es:
|
|
|
296
301
|
update:
|
|
297
302
|
group: "%{sender} actualizó %{thing} en el muro %{whose}."
|
|
298
303
|
user: "%{sender} actualizó %{thing} en tu muro."
|
|
304
|
+
visit: "Visita %{url} y comprueba todas tus notificaciones."
|
|
299
305
|
watch: "Échale un vistazo en %{url}"
|
|
300
306
|
watch_it: "¡Échale un vistazo!"
|
|
301
307
|
who:
|
|
@@ -312,6 +318,8 @@ es:
|
|
|
312
318
|
name: "publicación"
|
|
313
319
|
one: "una publicación"
|
|
314
320
|
title: "Textos"
|
|
321
|
+
preposition:
|
|
322
|
+
and: "y"
|
|
315
323
|
profile:
|
|
316
324
|
one: "Perfil"
|
|
317
325
|
age: "Edad"
|
data/lib/social_stream-base.rb
CHANGED
|
@@ -39,6 +39,8 @@ require 'modernizr-rails'
|
|
|
39
39
|
require 'thinking-sphinx'
|
|
40
40
|
# Syntactically Awesome Stylesheets
|
|
41
41
|
require 'sass-rails'
|
|
42
|
+
# Autolink text blocks
|
|
43
|
+
require 'rails_autolink'
|
|
42
44
|
|
|
43
45
|
# Provides your Rails application with social network and activity stream support
|
|
44
46
|
module SocialStream
|
|
@@ -50,6 +52,7 @@ module SocialStream
|
|
|
50
52
|
|
|
51
53
|
module Controllers
|
|
52
54
|
autoload :Helpers, 'social_stream/controllers/helpers'
|
|
55
|
+
autoload :CancanDeviseIntegration, 'social_stream/controllers/cancan_devise_integration'
|
|
53
56
|
end
|
|
54
57
|
|
|
55
58
|
module Models
|
data/lib/social_stream/base.rb
CHANGED
|
@@ -21,9 +21,14 @@ module SocialStream
|
|
|
21
21
|
initializer "social_stream-base.controller_helpers" do
|
|
22
22
|
ActiveSupport.on_load(:action_controller) do
|
|
23
23
|
include SocialStream::Controllers::Helpers
|
|
24
|
+
include SocialStream::Controllers::CancanDeviseIntegration
|
|
24
25
|
end
|
|
25
26
|
end
|
|
26
27
|
|
|
28
|
+
initializer "social_stream-base.cancan_devise_integration" do
|
|
29
|
+
ApplicationController.rescue_handlers += [["CanCan::AccessDenied", :rescue_from_access_denied]]
|
|
30
|
+
end
|
|
31
|
+
|
|
27
32
|
initializer "social_stream-base.toolbar_config" do
|
|
28
33
|
SocialStream::ToolbarConfig.module_eval do
|
|
29
34
|
include SocialStream::ToolbarConfig::Base
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
module SocialStream
|
|
2
|
+
module Controllers
|
|
3
|
+
# Common methods added to ApplicationController
|
|
4
|
+
module CancanDeviseIntegration
|
|
5
|
+
extend ActiveSupport::Concern
|
|
6
|
+
|
|
7
|
+
module InstanceMethods
|
|
8
|
+
|
|
9
|
+
private
|
|
10
|
+
|
|
11
|
+
# Redirect to login if the user is trying to access a protected resource
|
|
12
|
+
# and she is not authenticated
|
|
13
|
+
def rescue_from_access_denied
|
|
14
|
+
unless user_signed_in?
|
|
15
|
+
redirect_to new_user_session_path
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
data/social_stream-base.gemspec
CHANGED
|
@@ -51,8 +51,10 @@ Gem::Specification.new do |s|
|
|
|
51
51
|
s.add_runtime_dependency('modernizr-rails', '~> 2.0.6')
|
|
52
52
|
# Sphinx search engine
|
|
53
53
|
s.add_runtime_dependency('thinking-sphinx', '~> 2.0.8')
|
|
54
|
-
#Syntactically Awesome Stylesheets
|
|
54
|
+
# Syntactically Awesome Stylesheets
|
|
55
55
|
s.add_runtime_dependency('sass-rails', '~> 3.1.0')
|
|
56
|
+
# Autolink text blocks
|
|
57
|
+
s.add_runtime_dependency('rails_autolink', '~> 1.0.4')
|
|
56
58
|
|
|
57
59
|
# Development gem dependencies
|
|
58
60
|
#
|
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:
|
|
4
|
+
hash: 1
|
|
5
5
|
prerelease:
|
|
6
6
|
segments:
|
|
7
7
|
- 0
|
|
8
8
|
- 9
|
|
9
|
-
-
|
|
10
|
-
version: 0.9.
|
|
9
|
+
- 29
|
|
10
|
+
version: 0.9.29
|
|
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-11-
|
|
19
|
+
date: 2011-11-16 00:00:00 +01:00
|
|
20
20
|
default_executable:
|
|
21
21
|
dependencies:
|
|
22
22
|
- !ruby/object:Gem::Dependency
|
|
@@ -340,9 +340,25 @@ dependencies:
|
|
|
340
340
|
type: :runtime
|
|
341
341
|
version_requirements: *id020
|
|
342
342
|
- !ruby/object:Gem::Dependency
|
|
343
|
-
name:
|
|
343
|
+
name: rails_autolink
|
|
344
344
|
prerelease: false
|
|
345
345
|
requirement: &id021 !ruby/object:Gem::Requirement
|
|
346
|
+
none: false
|
|
347
|
+
requirements:
|
|
348
|
+
- - ~>
|
|
349
|
+
- !ruby/object:Gem::Version
|
|
350
|
+
hash: 31
|
|
351
|
+
segments:
|
|
352
|
+
- 1
|
|
353
|
+
- 0
|
|
354
|
+
- 4
|
|
355
|
+
version: 1.0.4
|
|
356
|
+
type: :runtime
|
|
357
|
+
version_requirements: *id021
|
|
358
|
+
- !ruby/object:Gem::Dependency
|
|
359
|
+
name: capybara
|
|
360
|
+
prerelease: false
|
|
361
|
+
requirement: &id022 !ruby/object:Gem::Requirement
|
|
346
362
|
none: false
|
|
347
363
|
requirements:
|
|
348
364
|
- - ~>
|
|
@@ -354,11 +370,11 @@ dependencies:
|
|
|
354
370
|
- 9
|
|
355
371
|
version: 0.3.9
|
|
356
372
|
type: :development
|
|
357
|
-
version_requirements: *
|
|
373
|
+
version_requirements: *id022
|
|
358
374
|
- !ruby/object:Gem::Dependency
|
|
359
375
|
name: sqlite3-ruby
|
|
360
376
|
prerelease: false
|
|
361
|
-
requirement: &
|
|
377
|
+
requirement: &id023 !ruby/object:Gem::Requirement
|
|
362
378
|
none: false
|
|
363
379
|
requirements:
|
|
364
380
|
- - ">="
|
|
@@ -368,11 +384,11 @@ dependencies:
|
|
|
368
384
|
- 0
|
|
369
385
|
version: "0"
|
|
370
386
|
type: :development
|
|
371
|
-
version_requirements: *
|
|
387
|
+
version_requirements: *id023
|
|
372
388
|
- !ruby/object:Gem::Dependency
|
|
373
389
|
name: ruby-debug
|
|
374
390
|
prerelease: false
|
|
375
|
-
requirement: &
|
|
391
|
+
requirement: &id024 !ruby/object:Gem::Requirement
|
|
376
392
|
none: false
|
|
377
393
|
requirements:
|
|
378
394
|
- - ">="
|
|
@@ -382,11 +398,11 @@ dependencies:
|
|
|
382
398
|
- 0
|
|
383
399
|
version: "0"
|
|
384
400
|
type: :development
|
|
385
|
-
version_requirements: *
|
|
401
|
+
version_requirements: *id024
|
|
386
402
|
- !ruby/object:Gem::Dependency
|
|
387
403
|
name: rspec-rails
|
|
388
404
|
prerelease: false
|
|
389
|
-
requirement: &
|
|
405
|
+
requirement: &id025 !ruby/object:Gem::Requirement
|
|
390
406
|
none: false
|
|
391
407
|
requirements:
|
|
392
408
|
- - ~>
|
|
@@ -398,11 +414,11 @@ dependencies:
|
|
|
398
414
|
- 1
|
|
399
415
|
version: 2.6.1
|
|
400
416
|
type: :development
|
|
401
|
-
version_requirements: *
|
|
417
|
+
version_requirements: *id025
|
|
402
418
|
- !ruby/object:Gem::Dependency
|
|
403
419
|
name: factory_girl
|
|
404
420
|
prerelease: false
|
|
405
|
-
requirement: &
|
|
421
|
+
requirement: &id026 !ruby/object:Gem::Requirement
|
|
406
422
|
none: false
|
|
407
423
|
requirements:
|
|
408
424
|
- - ~>
|
|
@@ -414,11 +430,11 @@ dependencies:
|
|
|
414
430
|
- 2
|
|
415
431
|
version: 1.3.2
|
|
416
432
|
type: :development
|
|
417
|
-
version_requirements: *
|
|
433
|
+
version_requirements: *id026
|
|
418
434
|
- !ruby/object:Gem::Dependency
|
|
419
435
|
name: forgery
|
|
420
436
|
prerelease: false
|
|
421
|
-
requirement: &
|
|
437
|
+
requirement: &id027 !ruby/object:Gem::Requirement
|
|
422
438
|
none: false
|
|
423
439
|
requirements:
|
|
424
440
|
- - ~>
|
|
@@ -430,11 +446,11 @@ dependencies:
|
|
|
430
446
|
- 2
|
|
431
447
|
version: 0.4.2
|
|
432
448
|
type: :development
|
|
433
|
-
version_requirements: *
|
|
449
|
+
version_requirements: *id027
|
|
434
450
|
- !ruby/object:Gem::Dependency
|
|
435
451
|
name: ci_reporter
|
|
436
452
|
prerelease: false
|
|
437
|
-
requirement: &
|
|
453
|
+
requirement: &id028 !ruby/object:Gem::Requirement
|
|
438
454
|
none: false
|
|
439
455
|
requirements:
|
|
440
456
|
- - ~>
|
|
@@ -446,11 +462,11 @@ dependencies:
|
|
|
446
462
|
- 4
|
|
447
463
|
version: 1.6.4
|
|
448
464
|
type: :development
|
|
449
|
-
version_requirements: *
|
|
465
|
+
version_requirements: *id028
|
|
450
466
|
- !ruby/object:Gem::Dependency
|
|
451
467
|
name: nifty-generators
|
|
452
468
|
prerelease: false
|
|
453
|
-
requirement: &
|
|
469
|
+
requirement: &id029 !ruby/object:Gem::Requirement
|
|
454
470
|
none: false
|
|
455
471
|
requirements:
|
|
456
472
|
- - ~>
|
|
@@ -462,7 +478,7 @@ dependencies:
|
|
|
462
478
|
- 5
|
|
463
479
|
version: 0.4.5
|
|
464
480
|
type: :development
|
|
465
|
-
version_requirements: *
|
|
481
|
+
version_requirements: *id029
|
|
466
482
|
description: |-
|
|
467
483
|
Social Stream is a Ruby on Rails engine providing your application with social networking features and activity streams.
|
|
468
484
|
|
|
@@ -718,7 +734,6 @@ files:
|
|
|
718
734
|
- app/helpers/contacts_helper.rb
|
|
719
735
|
- app/helpers/groups_helper.rb
|
|
720
736
|
- app/helpers/location_helper.rb
|
|
721
|
-
- app/helpers/notifications_helper.rb
|
|
722
737
|
- app/helpers/permissions_helper.rb
|
|
723
738
|
- app/helpers/profiles_helper.rb
|
|
724
739
|
- app/helpers/search_helper.rb
|
|
@@ -949,12 +964,12 @@ files:
|
|
|
949
964
|
- lib/generators/social_stream/base/templates/navigation.rb
|
|
950
965
|
- lib/generators/social_stream/base/templates/relations.yml
|
|
951
966
|
- lib/generators/social_stream/base/templates/sphinx.yml
|
|
952
|
-
- lib/mailboxer/notification_decoder.rb
|
|
953
967
|
- lib/paperclip/social_stream.rb
|
|
954
968
|
- lib/social_stream-base.rb
|
|
955
969
|
- lib/social_stream/ability.rb
|
|
956
970
|
- lib/social_stream/base.rb
|
|
957
971
|
- lib/social_stream/base/version.rb
|
|
972
|
+
- lib/social_stream/controllers/cancan_devise_integration.rb
|
|
958
973
|
- lib/social_stream/controllers/helpers.rb
|
|
959
974
|
- lib/social_stream/d3.rb
|
|
960
975
|
- lib/social_stream/migrations/base.rb
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
module Mailboxer
|
|
2
|
-
module NotificationDecoder
|
|
3
|
-
include SubjectsHelper, ActionView::Helpers::TextHelper
|
|
4
|
-
def decode_notification notification_text, activity
|
|
5
|
-
return if activity.nil?
|
|
6
|
-
notification_text = notification_text.gsub(/\%\{sender\}/, link_to(truncate_name(activity.sender.name),
|
|
7
|
-
url_for(:controller=> activity.sender.subject.class.to_s.underscore.pluralize,
|
|
8
|
-
:action=> :show, :id=> activity.sender.subject.slug, :only_path => false)))
|
|
9
|
-
notification_text = notification_text.gsub(/\%\{confirm\}/,link_to(t('notification.confirm'),edit_contact_url(activity.receiver.contact_to!(activity.sender), :s => activity.receiver.slug)))
|
|
10
|
-
notification_text = notification_text.gsub(/\%\{look\}/,link_to(t('notification.look'),
|
|
11
|
-
url_for(:controller=> activity.sender.subject.class.to_s.underscore.pluralize,
|
|
12
|
-
:action=> :show, :id=> activity.sender.subject.slug, :only_path => false)))
|
|
13
|
-
notification_text = notification_text.gsub(/\%\{sender.name\}/,truncate_name(activity.sender.name))
|
|
14
|
-
|
|
15
|
-
if activity.receiver.subject.is_a?(User)
|
|
16
|
-
notification_text = notification_text.gsub(/\%\{whose\}/,t('notification.whose.user'))
|
|
17
|
-
notification_text = notification_text.gsub(/\%\{who\}/,t('notification.who.user'))
|
|
18
|
-
else
|
|
19
|
-
notification_text = notification_text.gsub(/\%\{whose\}/,t('notification.whose.others',
|
|
20
|
-
:receiver => truncate_name(activity.receiver.name)))
|
|
21
|
-
notification_text = notification_text.gsub(/\%\{who\}/,truncate_name(activity.receiver.name))
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
if activity.direct_object.present?
|
|
25
|
-
object = activity.direct_object
|
|
26
|
-
object = object.subject if object.is_a? Actor
|
|
27
|
-
notification_text=notification_text.gsub(/\%\{object\}/,link_to(t(object.class.to_s.underscore+".name"),
|
|
28
|
-
url_for(:controller=> object.class.to_s.underscore.pluralize, :action=> :show,
|
|
29
|
-
:id=> object.id, :only_path => false)))
|
|
30
|
-
notification_text=notification_text.gsub(/\%\{object.name\}/,t(object.class.to_s.underscore+".name"))
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
if object.respond_to? :text
|
|
35
|
-
notification_text=notification_text.gsub(/\%\{object.text\}/,link_to(object.text.truncate(100, :separator =>' '),
|
|
36
|
-
url_for(:controller=> object.class.to_s.underscore.pluralize, :action=> :show,
|
|
37
|
-
:id=> object.id, :only_path => false)))
|
|
38
|
-
elsif SocialStream.objects.include? :document and object.is_a? Document
|
|
39
|
-
notification_text=notification_text.gsub(/\%\{object.text\}/,link_to(object.file_file_name.truncate(100, :separator =>' '),
|
|
40
|
-
url_for(:controller=> object.class.to_s.underscore.pluralize, :action=> :show,
|
|
41
|
-
:id=> object.id, :only_path => false)))
|
|
42
|
-
|
|
43
|
-
end
|
|
44
|
-
#notification_text=notification_text.gsub(/\%\{object.image\}/,thumb_for(object)) if SocialStream.activity_forms.include? :document and object.is_a? Document
|
|
45
|
-
|
|
46
|
-
else
|
|
47
|
-
notification_text=notification_text.gsub(/\%\{object\}/,t('unknown'))
|
|
48
|
-
notification_text=notification_text.gsub(/\%\{object.name\}/,t('unknown'))
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
notification_text
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
def decode_basic_notification notification_text, activity
|
|
55
|
-
return if activity.nil?
|
|
56
|
-
notification_text = notification_text.gsub(/\%\{sender\}/, truncate_name(activity.sender.name))
|
|
57
|
-
notification_text = notification_text.gsub(/\%\{confirm\}/,t('notification.confirm'))
|
|
58
|
-
notification_text = notification_text.gsub(/\%\{look\}/,t('notification.look') + ": "+
|
|
59
|
-
url_for(:controller=> activity.sender.subject.class.to_s.underscore.pluralize,
|
|
60
|
-
:action=> :show, :id=> activity.sender.subject.slug, :only_path => false))
|
|
61
|
-
notification_text = notification_text.gsub(/\%\{sender.name\}/,truncate_name(activity.sender.name))
|
|
62
|
-
|
|
63
|
-
if activity.receiver.subject.is_a?(User)
|
|
64
|
-
notification_text = notification_text.gsub(/\%\{whose\}/,t('notification.whose.user'))
|
|
65
|
-
notification_text = notification_text.gsub(/\%\{who\}/,t('notification.who.user'))
|
|
66
|
-
else
|
|
67
|
-
notification_text = notification_text.gsub(/\%\{whose\}/,t('notification.whose.others',
|
|
68
|
-
:receiver => truncate_name(activity.receiver.name)))
|
|
69
|
-
notification_text = notification_text.gsub(/\%\{who\}/,truncate_name(activity.receiver.name))
|
|
70
|
-
end
|
|
71
|
-
|
|
72
|
-
if activity.direct_object.present?
|
|
73
|
-
object = activity.direct_object
|
|
74
|
-
object = object.subject if object.is_a? Actor
|
|
75
|
-
notification_text=notification_text.gsub(/\%\{object\}/,t(object.class.to_s.underscore+".name"))
|
|
76
|
-
notification_text=notification_text.gsub(/\%\{object.name\}/,t(object.class.to_s.underscore+".name"))
|
|
77
|
-
notification_text=notification_text.gsub(/\%\{object.text\}/,object.text.truncate(100, :separator =>' ')) if object.respond_to? :text
|
|
78
|
-
|
|
79
|
-
#notification_text=notification_text.gsub(/\%\{object.image\}/,thumb_for(object)) if SocialStream.activity_forms.include? :document and object.is_a? Document
|
|
80
|
-
|
|
81
|
-
else
|
|
82
|
-
notification_text=notification_text.gsub(/\%\{object\}/,t('unknown'))
|
|
83
|
-
notification_text=notification_text.gsub(/\%\{object.name\}/,t('unknown'))
|
|
84
|
-
end
|
|
85
|
-
|
|
86
|
-
notification_text
|
|
87
|
-
end
|
|
88
|
-
end
|
|
89
|
-
end
|