social_stream-base 0.9.20 → 0.9.21

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.
@@ -275,9 +275,9 @@ class Activity < ActiveRecord::Base
275
275
  relations.select{ |r| r.actor_id == Actor.normalize_id(subject)}
276
276
 
277
277
  if visible_relations.present?
278
- [ :visible, visible_relations.map(&:name).join(", ") ]
278
+ [ :visible, visible_relations.map(&:name).uniq.join(", ") ]
279
279
  else
280
- [ :hidden, relations.map(&:actor).map(&:name).join(", ") ]
280
+ [ :hidden, relations.map(&:actor).map(&:name).uniq.join(", ") ]
281
281
  end
282
282
  end
283
283
 
@@ -107,6 +107,11 @@ class Contact < ActiveRecord::Base
107
107
  inverse.ties_count > 0
108
108
  end
109
109
 
110
+ def positive_replied?
111
+ inverse_id.present? &&
112
+ self.class.positive.where(:id => inverse.id).any?
113
+ end
114
+
110
115
  # The {ActivityVerb} corresponding to this {Contact}. If this contact is pending,
111
116
  # the other one was establised already, so this is going to "make-friend".
112
117
  # If it is not pending, the contact in the other way was not established, so this
@@ -135,6 +135,11 @@ class Relation < ActiveRecord::Base
135
135
  Relation.mode(sender_type, receiver_type)
136
136
  end
137
137
 
138
+ # Is this {Relation} a Positive one?
139
+ def positive?
140
+ self.class.positive_names.include?(self.class.to_s)
141
+ end
142
+
138
143
  private
139
144
 
140
145
  # Before create callback
data/app/models/tie.rb CHANGED
@@ -82,6 +82,21 @@ class Tie < ActiveRecord::Base
82
82
  receiver.subject
83
83
  end
84
84
 
85
+ # The {Tie} is positive if its {Relation} is
86
+ def positive?
87
+ relation.positive?
88
+ end
89
+
90
+ # Does this {Tie} have positive {Tie ties} in the other way?
91
+ def positive_replied?
92
+ contact.positive_replied?
93
+ end
94
+
95
+ # This {Tie} is {#positive? positive} and {#positive_replied? positive replied}
96
+ def bidirectional?
97
+ positive? && positive_replied?
98
+ end
99
+
85
100
  private
86
101
 
87
102
  # before_create callback
@@ -36,7 +36,7 @@
36
36
  <%= render :partial => "devise/shared/links" %>
37
37
  </div>
38
38
  <div class="form_row center">
39
- <div class="btn_login"><%= f.submit t('action.accept').capitalize,:class=>"button" %></div>
39
+ <div class="btn_login"><%= f.submit t('action.accept').capitalize,:class=>"button storePass"%></div>
40
40
  </div>
41
41
  <% end %>
42
42
  </div>
@@ -27,7 +27,7 @@
27
27
  </div>
28
28
 
29
29
  <div class="btn_login">
30
- <%= f.submit t('action.send'), :class =>"button" %>
30
+ <%= f.submit t('action.send'), :class =>"button storePass" %>
31
31
  </div>
32
32
  <% end %>
33
33
  </div>
@@ -1,7 +1,7 @@
1
1
  <% representations = current_user.represented.unshift(current_user) - [current_subject] %>
2
2
  <% unless representations.empty? %>
3
3
  <li>
4
- <%= link_to "Switch session", "javascript:;", :class=>"session_change" %>
4
+ <%= link_to t('representation.switch'), "javascript:;", :class=>"session_change" %>
5
5
  <ul>
6
6
  <% representations.each do |representation| %>
7
7
  <li>
@@ -10,4 +10,4 @@
10
10
  <% end %>
11
11
  </ul>
12
12
  </li>
13
- <% end %>
13
+ <% end %>
@@ -17,7 +17,7 @@
17
17
  </div>
18
18
 
19
19
  <div class="login_data_block">
20
- <%= f.submit t(:sign_in), :class => 'other_blue'%>
20
+ <%= f.submit t(:sign_in), :class => 'other_blue storePass'%>
21
21
  </div>
22
22
  </div>
23
23
  <div class="options">
@@ -10,7 +10,7 @@
10
10
  <div class ="content">
11
11
  <div class="contact space_center">
12
12
  <% cs.each do |contact| %>
13
- <%= link_to(image_tag(contact.logo.url(:contact), :alt => contact.name , :size => "28x28"), contact) %>
13
+ <%= link_to(image_tag(contact.logo.url(:contact), :alt => contact.name, :title => contact.name, :size => "28x28"), contact) %>
14
14
  <% end %>
15
15
  </div>
16
16
  </div>
@@ -371,6 +371,8 @@ en:
371
371
  title: "Privacy & context"
372
372
  relation_public:
373
373
  name: "Public"
374
+ representation:
375
+ switch: "Switch session"
374
376
  required: "(*) These fields are required"
375
377
  search:
376
378
  all_results: "Search all %{subject} (%{count})"
@@ -48,7 +48,7 @@ es:
48
48
  myself:
49
49
  contacts:
50
50
  group: "Todos los integrantes"
51
- user: "Tus contacts"
51
+ user: "Tus contactos"
52
52
  outside:
53
53
  contacts:
54
54
  group: "Integrantes de %{receiver}"
@@ -137,7 +137,7 @@ es:
137
137
  confirm: "¿Borrar %{element}}?"
138
138
  devise:
139
139
  links:
140
- sign_in: "Entrar"
140
+ sign_in: "Ingresar"
141
141
  sign_up: "Registrarse"
142
142
  forgot_password: "¿Olvidaste tu contraseña?"
143
143
  confirmation_instructions: "¿No recibiste instrucciones de confirmación?"
@@ -366,6 +366,8 @@ es:
366
366
  title: "Privacidad y contexto"
367
367
  relation_public:
368
368
  name: "Público"
369
+ representation:
370
+ switch: "Cambiar sessión"
369
371
  required: "(*) Estos campos son obligatorios"
370
372
  search:
371
373
  all_subject_results: "Ver todos %{subject} (%{count})"
@@ -414,7 +416,7 @@ es:
414
416
  briefing: "Cambia tu contraseña"
415
417
  success: "Ajustes guardados con éxito"
416
418
  share: "Compartir"
417
- sign_in: "Entrar"
419
+ sign_in: "Ingresar"
418
420
  sign_out: "Salir"
419
421
  sign_up: "Registrarse"
420
422
  site:
@@ -1,5 +1,5 @@
1
1
  module SocialStream
2
2
  module Base
3
- VERSION = "0.9.20".freeze
3
+ VERSION = "0.9.21".freeze
4
4
  end
5
5
  end
@@ -59,6 +59,10 @@ describe Tie do
59
59
  end
60
60
 
61
61
  describe "with public relation" do
62
+ before do
63
+ @tie = Factory(:public)
64
+ end
65
+
62
66
  it "should create activity" do
63
67
  count = Activity.count
64
68
 
@@ -66,9 +70,55 @@ describe Tie do
66
70
 
67
71
  Activity.count.should eq(count + 1)
68
72
  end
73
+
74
+ it "should be positive" do
75
+ @tie.should be_positive
76
+ end
77
+
78
+ it "should not be positive replied" do
79
+ @tie.should_not be_positive_replied
80
+ end
81
+
82
+ context "with public reply" do
83
+ before do
84
+ Factory(:public, :contact => @tie.contact.inverse!)
85
+
86
+ # It should reload tie.contact again, as its inverse is now set
87
+ @tie.reload
88
+ end
89
+
90
+ it "should be positive replied" do
91
+ @tie.should be_positive_replied
92
+ end
93
+
94
+ it "should be bidirectional" do
95
+ @tie.should be_bidirectional
96
+ end
97
+ end
98
+
99
+ context "with reject reply" do
100
+ before do
101
+ Factory(:reject, :contact => @tie.contact.inverse!)
102
+
103
+ # It should reload tie.contact again, as its inverse is now set
104
+ @tie.reload
105
+ end
106
+
107
+ it "should not be positive replied" do
108
+ @tie.should_not be_positive_replied
109
+ end
110
+
111
+ it "should not be bidirectional" do
112
+ @tie.should_not be_bidirectional
113
+ end
114
+ end
69
115
  end
70
116
 
71
117
  describe "with reject relation" do
118
+ before do
119
+ @tie = Factory(:reject)
120
+ end
121
+
72
122
  it "should not create activity" do
73
123
  count = Activity.count
74
124
 
@@ -76,7 +126,44 @@ describe Tie do
76
126
 
77
127
  Activity.count.should eq(count)
78
128
  end
79
- end
80
129
 
130
+ it "should not be positive" do
131
+ @tie.should_not be_positive
132
+ end
133
+
134
+ context "with public reply" do
135
+ before do
136
+ Factory(:public, :contact => @tie.contact.inverse!)
137
+
138
+ # It should reload tie.contact again, as its inverse is now set
139
+ @tie.reload
140
+ end
141
+
142
+ it "should be positive replied" do
143
+ @tie.should be_positive_replied
144
+ end
145
+
146
+ it "should not be bidirectional" do
147
+ @tie.should_not be_bidirectional
148
+ end
149
+ end
150
+
151
+ context "with reject reply" do
152
+ before do
153
+ Factory(:reject, :contact => @tie.contact.inverse!)
154
+
155
+ # It should reload tie.contact again, as its inverse is now set
156
+ @tie.reload
157
+ end
158
+
159
+ it "should not be positive replied" do
160
+ @tie.should_not be_positive_replied
161
+ end
162
+
163
+ it "should not be bidirectional" do
164
+ @tie.should_not be_bidirectional
165
+ end
166
+ end
167
+ end
81
168
  end
82
169
 
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: 19
4
+ hash: 17
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 9
9
- - 20
10
- version: 0.9.20
9
+ - 21
10
+ version: 0.9.21
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-10-14 00:00:00 +02:00
19
+ date: 2011-10-17 00:00:00 +02:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency