decidim-core 0.8.2 → 0.8.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4e4b88a2a26f466db5e822152586aad3206415e1
4
- data.tar.gz: 741277dfe657952f64342c07edbc71fad3457053
3
+ metadata.gz: 57b7690831d061951bff19709653676583f7ef7e
4
+ data.tar.gz: 24e3aa8fbbc19862a9891cb7f501430e98a3ab4c
5
5
  SHA512:
6
- metadata.gz: d361b7c1a7d0ff0612f37046d2893dd5fc02fbc98ff42b57fd08a12d6d7cc6b9fe445f86ec62f913bc501a8aa2968e368efce41cec796a524336ab38b35d974a
7
- data.tar.gz: fa050d48ed48265c60d141378133eb8b2fa0fe5d903f3114acee96a9e6371787b371f947c5ce5f93c692e5cdaaae40c9ac85b26a22b9a1e24076c3f7992a2c78
6
+ metadata.gz: dfeedbe421c2b4a64b1e2870e9b5f51f8c981cc57c38b9aa26b0399ad8e0abebadb7fc5ad60c8ca4496dbf1f72433631b1abe4fc0ed9d0dc01f06feb8d3890f3
7
+ data.tar.gz: 1c8fe1ffcef6c25e84c40e88c472303ffc026166716cceb766392296353aee3ecbb54e208c8413e2e16f64b98aa68a3a4059a5854d561449ad6e6f6f06067b5a
@@ -4,8 +4,10 @@ module Decidim
4
4
  module Messaging
5
5
  # The controller to handle the user's conversations.
6
6
  class ConversationsController < Decidim::ApplicationController
7
+ include ConversationHelper
7
8
  include FormFactory
8
9
 
10
+ helper ConversationHelper
9
11
  helper Decidim::DatetimeHelper
10
12
 
11
13
  before_action :authenticate_user!
@@ -14,8 +16,11 @@ module Decidim
14
16
 
15
17
  def new
16
18
  authorize! :create, Conversation
17
-
18
19
  @form = form(ConversationForm).from_params(params)
20
+
21
+ conversation = conversation_between(current_user, @form.recipient)
22
+
23
+ redirect_to conversation_path(conversation) if conversation
19
24
  end
20
25
 
21
26
  def create
@@ -21,16 +21,20 @@ module Decidim
21
21
  def link_to_current_or_new_conversation_with(user)
22
22
  return decidim.new_user_session_path unless user_signed_in?
23
23
 
24
- conversation_between = UserConversations.for(current_user).find do |conversation|
25
- conversation.participants.to_set == [current_user, user].to_set
26
- end
24
+ conversation = conversation_between(current_user, user)
27
25
 
28
- if conversation_between
29
- decidim.conversation_path(conversation_between)
26
+ if conversation
27
+ decidim.conversation_path(conversation)
30
28
  else
31
29
  decidim.new_conversation_path(recipient_id: user.id)
32
30
  end
33
31
  end
32
+
33
+ def conversation_between(one_user, another_user)
34
+ UserConversations.for(one_user).find do |conversation|
35
+ conversation.participants.to_set == [one_user, another_user].to_set
36
+ end
37
+ end
34
38
  end
35
39
  end
36
40
  end
@@ -1,5 +1,6 @@
1
1
  <li><%= link_to t(".profile"), decidim.account_path %></li>
2
2
  <li><%= link_to t(".notifications"), decidim.notifications_path %></li>
3
+ <li><%= link_to t(".conversations"), decidim.conversations_path %></li>
3
4
  <% if can? :read, :admin_dashboard %>
4
5
  <li><%= link_to t(".admin_dashboard"), decidim_admin.root_path %></li>
5
6
  <% end %>
@@ -351,6 +351,7 @@ ca:
351
351
  title: Notificacions
352
352
  user_menu:
353
353
  admin_dashboard: Tauler d'administració
354
+ conversations: Converses
354
355
  notifications: Notificacions
355
356
  profile: El meu compte
356
357
  sign_out: Surt
@@ -349,6 +349,7 @@ en:
349
349
  title: Notifications
350
350
  user_menu:
351
351
  admin_dashboard: Admin dashboard
352
+ conversations: Conversations
352
353
  notifications: Notifications
353
354
  profile: My account
354
355
  sign_out: Sign out
@@ -349,6 +349,7 @@ es:
349
349
  title: Notificaciones
350
350
  user_menu:
351
351
  admin_dashboard: Tablero de administración
352
+ conversations: Conversaciones
352
353
  notifications: Notificaciones
353
354
  profile: Mi cuenta
354
355
  sign_out: Sal
@@ -4,7 +4,7 @@ module Decidim
4
4
  # This holds the decidim-core version.
5
5
  module Core
6
6
  def self.version
7
- "0.8.2"
7
+ "0.8.3"
8
8
  end
9
9
  end
10
10
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: decidim-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.2
4
+ version: 0.8.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josep Jaume Rey Peroy
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2017-12-12 00:00:00.000000000 Z
13
+ date: 2017-12-15 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: active_link_to
@@ -508,28 +508,28 @@ dependencies:
508
508
  requirements:
509
509
  - - '='
510
510
  - !ruby/object:Gem::Version
511
- version: 0.8.2
511
+ version: 0.8.3
512
512
  type: :runtime
513
513
  prerelease: false
514
514
  version_requirements: !ruby/object:Gem::Requirement
515
515
  requirements:
516
516
  - - '='
517
517
  - !ruby/object:Gem::Version
518
- version: 0.8.2
518
+ version: 0.8.3
519
519
  - !ruby/object:Gem::Dependency
520
520
  name: decidim-dev
521
521
  requirement: !ruby/object:Gem::Requirement
522
522
  requirements:
523
523
  - - '='
524
524
  - !ruby/object:Gem::Version
525
- version: 0.8.2
525
+ version: 0.8.3
526
526
  type: :development
527
527
  prerelease: false
528
528
  version_requirements: !ruby/object:Gem::Requirement
529
529
  requirements:
530
530
  - - '='
531
531
  - !ruby/object:Gem::Version
532
- version: 0.8.2
532
+ version: 0.8.3
533
533
  description: Adds core features so other engines can hook into the framework.
534
534
  email:
535
535
  - josepjaume@gmail.com