social_stream-base 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.
- checksums.yaml +4 -4
 - data/Rakefile +3 -17
 - data/app/assets/javascripts/social_stream/actor.js +7 -1
 - data/app/assets/javascripts/social_stream/contact.js +8 -0
 - data/app/assets/javascripts/social_stream/flash.js +11 -1
 - data/app/controllers/groups_controller.rb +1 -1
 - data/app/controllers/profiles_controller.rb +7 -2
 - data/app/controllers/search_controller.rb +9 -11
 - data/app/models/permission.rb +4 -3
 - data/app/models/relation/custom.rb +5 -5
 - data/app/models/user.rb +2 -0
 - data/app/views/contacts/_new_modal.html.erb +2 -2
 - data/app/views/contacts/index.html.erb +3 -2
 - data/app/views/devise/registrations/edit.html.erb +1 -15
 - data/app/views/groups/_form.html.erb +1 -1
 - data/app/views/groups/_new_modal.html.erb +1 -1
 - data/app/views/groups/new.html.erb +1 -1
 - data/app/views/profiles/_comunication-info_edit.html.erb +1 -1
 - data/app/views/profiles/_experience_edit.html.erb +2 -2
 - data/app/views/profiles/_personal_edit.html.erb +3 -3
 - data/app/views/relation/customs/destroy.js.erb +1 -0
 - data/app/views/relation/customs/update.js.erb +1 -1
 - data/app/views/settings/index.html.erb +1 -1
 - data/config/locales/en.yml +3 -0
 - data/config/locales/es.yml +1 -1
 - data/lib/social_stream/base/autoload.rb +15 -8
 - data/lib/social_stream/base/version.rb +1 -1
 - data/lib/social_stream/population.rb +14 -0
 - data/lib/social_stream/search.rb +4 -2
 - data/lib/tasks/db/populate.rake +108 -160
 - metadata +4 -3
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 3e5124e3850b3a546d1aec128165eac20a19e4f0
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 1e56c930444d1e6ba3728aec673b4403ddcd1e73
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: ba14732b219222209d925080c14bccd9c5933f5b5de8eec56975d488582a6acc806988550a7aa6ee9d8d3315227de016f83a90ae8ccf618dab2857e728e313e0
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: d180b4b9abc79343be9ab0291468be68111e4319638158c23c7461da2cff3fb3150103bfd71962bbb43bc87ff1113b59ec817b3adf649b15242c5220ab8e58d0
         
     | 
    
        data/Rakefile
    CHANGED
    
    | 
         @@ -1,21 +1,9 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # encoding: UTF-8
         
     | 
| 
       2 
     | 
    
         
            -
            require ' 
     | 
| 
       3 
     | 
    
         
            -
            require 'rdoc/task'
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
            require 'rubygems'
         
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
     | 
    
         
            -
            require 'rspec/core/rake_task'
         
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
       9 
     | 
    
         
            -
            require 'ci/reporter/rake/rspec'
         
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
            require 'bundler'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'bundler/gem_tasks'
         
     | 
| 
       12 
3 
     | 
    
         | 
| 
       13 
     | 
    
         
            -
            require  
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
            RSpec::Core::RakeTask.new(:spec)
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'rdoc/task'
         
     | 
| 
       17 
5 
     | 
    
         | 
| 
       18 
     | 
    
         
            -
            task :default => : 
     | 
| 
      
 6 
     | 
    
         
            +
            task :default => :rdoc
         
     | 
| 
       19 
7 
     | 
    
         | 
| 
       20 
8 
     | 
    
         
             
            Rake::RDocTask.new(:rdoc) do |rdoc|
         
     | 
| 
       21 
9 
     | 
    
         
             
              rdoc.rdoc_dir = 'rdoc'
         
     | 
| 
         @@ -25,8 +13,6 @@ Rake::RDocTask.new(:rdoc) do |rdoc| 
     | 
|
| 
       25 
13 
     | 
    
         
             
              rdoc.rdoc_files.include('lib/**/*.rb', 'app/**/*.rb')
         
     | 
| 
       26 
14 
     | 
    
         
             
            end
         
     | 
| 
       27 
15 
     | 
    
         | 
| 
       28 
     | 
    
         
            -
            Bundler::GemHelper.install_tasks
         
     | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
       30 
16 
     | 
    
         
             
            # Modify this gem's tags
         
     | 
| 
       31 
17 
     | 
    
         
             
            class Bundler::GemHelper
         
     | 
| 
       32 
18 
     | 
    
         
             
              def version_tag
         
     | 
| 
         @@ -3,6 +3,7 @@ SocialStream.Actor = (function(SS, $, undefined) { 
     | 
|
| 
       3 
3 
     | 
    
         
             
              var select2 = function(selector) {
         
     | 
| 
       4 
4 
     | 
    
         
             
                $(selector).select2({
         
     | 
| 
       5 
5 
     | 
    
         
             
                  multiple: true,
         
     | 
| 
      
 6 
     | 
    
         
            +
                  minimumInputLength: 1,
         
     | 
| 
       6 
7 
     | 
    
         
             
                  ajax: {
         
     | 
| 
       7 
8 
     | 
    
         
             
                    url: $(selector).attr('data-path'),
         
     | 
| 
       8 
9 
     | 
    
         
             
                    dataType: 'json',
         
     | 
| 
         @@ -15,7 +16,8 @@ SocialStream.Actor = (function(SS, $, undefined) { 
     | 
|
| 
       15 
16 
     | 
    
         
             
                  },
         
     | 
| 
       16 
17 
     | 
    
         
             
                  id: function(object) { return object.id.toString(); },
         
     | 
| 
       17 
18 
     | 
    
         
             
                  formatResult: select2FormatResult,
         
     | 
| 
       18 
     | 
    
         
            -
                  formatSelection: select2FormatSelection
         
     | 
| 
      
 19 
     | 
    
         
            +
                  formatSelection: select2FormatSelection,
         
     | 
| 
      
 20 
     | 
    
         
            +
                  initSelection: select2InitSelection
         
     | 
| 
       19 
21 
     | 
    
         
             
                });
         
     | 
| 
       20 
22 
     | 
    
         
             
              };
         
     | 
| 
       21 
23 
     | 
    
         | 
| 
         @@ -27,6 +29,10 @@ SocialStream.Actor = (function(SS, $, undefined) { 
     | 
|
| 
       27 
29 
     | 
    
         
             
                return '<img src="' + object.image.url + '"> ' + object.name;
         
     | 
| 
       28 
30 
     | 
    
         
             
              };
         
     | 
| 
       29 
31 
     | 
    
         | 
| 
      
 32 
     | 
    
         
            +
              var select2InitSelection = function(element, callback) {
         
     | 
| 
      
 33 
     | 
    
         
            +
                callback([ { id: element.val(), name: element.attr('data-actor_name'), locked: true } ]);
         
     | 
| 
      
 34 
     | 
    
         
            +
              };
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
       30 
36 
     | 
    
         
             
              return {
         
     | 
| 
       31 
37 
     | 
    
         
             
                select2: select2
         
     | 
| 
       32 
38 
     | 
    
         
             
              };
         
     | 
| 
         @@ -171,6 +171,13 @@ SocialStream.Contact = (function($, SS, undefined) { 
     | 
|
| 
       171 
171 
     | 
    
         | 
| 
       172 
172 
     | 
    
         
             
              // new_ callbacks
         
     | 
| 
       173 
173 
     | 
    
         | 
| 
      
 174 
     | 
    
         
            +
              var initHideModal = function() {
         
     | 
| 
      
 175 
     | 
    
         
            +
                $('#add-contact-modal').on('hide', function () {
         
     | 
| 
      
 176 
     | 
    
         
            +
                  $('input[name="actors"]').select2('close');
         
     | 
| 
      
 177 
     | 
    
         
            +
                  $('select[name="relations[]"]').select2('close');
         
     | 
| 
      
 178 
     | 
    
         
            +
                });
         
     | 
| 
      
 179 
     | 
    
         
            +
              };
         
     | 
| 
      
 180 
     | 
    
         
            +
             
     | 
| 
       174 
181 
     | 
    
         
             
              var initActorSelect2 = function() {
         
     | 
| 
       175 
182 
     | 
    
         
             
                SS.Actor.select2('input[name="actors"]');
         
     | 
| 
       176 
183 
     | 
    
         
             
              };
         
     | 
| 
         @@ -298,6 +305,7 @@ SocialStream.Contact = (function($, SS, undefined) { 
     | 
|
| 
       298 
305 
     | 
    
         
             
                                hideLoading);
         
     | 
| 
       299 
306 
     | 
    
         | 
| 
       300 
307 
     | 
    
         
             
              callback.register('new_',
         
     | 
| 
      
 308 
     | 
    
         
            +
                                initHideModal,
         
     | 
| 
       301 
309 
     | 
    
         
             
                                initActorSelect2,
         
     | 
| 
       302 
310 
     | 
    
         
             
                                initRelationSelect2);
         
     | 
| 
       303 
311 
     | 
    
         | 
| 
         @@ -1,4 +1,8 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            SocialStream.Flash = (function(Flashy, undefined) {
         
     | 
| 
      
 2 
     | 
    
         
            +
              var notice = function(message) {
         
     | 
| 
      
 3 
     | 
    
         
            +
                Flashy.message('notice', message);
         
     | 
| 
      
 4 
     | 
    
         
            +
              };
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
       2 
6 
     | 
    
         
             
              var error = function(message) {
         
     | 
| 
       3 
7 
     | 
    
         
             
                if (message === undefined) {
         
     | 
| 
       4 
8 
     | 
    
         
             
                  message = I18n.t('ajax.error');
         
     | 
| 
         @@ -11,8 +15,14 @@ SocialStream.Flash = (function(Flashy, undefined) { 
     | 
|
| 
       11 
15 
     | 
    
         
             
                Flashy.message('success', message);
         
     | 
| 
       12 
16 
     | 
    
         
             
              };
         
     | 
| 
       13 
17 
     | 
    
         | 
| 
      
 18 
     | 
    
         
            +
              var warning = function(message) {
         
     | 
| 
      
 19 
     | 
    
         
            +
                Flashy.message('warning', message);
         
     | 
| 
      
 20 
     | 
    
         
            +
              };
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
       14 
22 
     | 
    
         
             
              return {
         
     | 
| 
      
 23 
     | 
    
         
            +
                notice: notice,
         
     | 
| 
       15 
24 
     | 
    
         
             
                error: error,
         
     | 
| 
       16 
     | 
    
         
            -
                success: success
         
     | 
| 
      
 25 
     | 
    
         
            +
                success: success,
         
     | 
| 
      
 26 
     | 
    
         
            +
                warning: warning
         
     | 
| 
       17 
27 
     | 
    
         
             
              };
         
     | 
| 
       18 
28 
     | 
    
         
             
            })(Flashy);
         
     | 
| 
         @@ -1,6 +1,8 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            class ProfilesController < ApplicationController
         
     | 
| 
       2 
2 
     | 
    
         
             
              before_filter :authenticate_user!, :except => [ :show ]
         
     | 
| 
       3 
3 
     | 
    
         | 
| 
      
 4 
     | 
    
         
            +
              before_filter :authorize_update, except: [ :show ]
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
       4 
6 
     | 
    
         
             
              respond_to :html, :js
         
     | 
| 
       5 
7 
     | 
    
         | 
| 
       6 
8 
     | 
    
         
             
              def show
         
     | 
| 
         @@ -14,11 +16,10 @@ class ProfilesController < ApplicationController 
     | 
|
| 
       14 
16 
     | 
    
         
             
              end
         
     | 
| 
       15 
17 
     | 
    
         | 
| 
       16 
18 
     | 
    
         
             
              def edit
         
     | 
| 
       17 
     | 
    
         
            -
                current_profile
         
     | 
| 
       18 
19 
     | 
    
         
             
              end
         
     | 
| 
       19 
20 
     | 
    
         | 
| 
       20 
21 
     | 
    
         
             
              def update
         
     | 
| 
       21 
     | 
    
         
            -
                 
     | 
| 
      
 22 
     | 
    
         
            +
                subject_profile.update_attributes profile_params
         
     | 
| 
       22 
23 
     | 
    
         | 
| 
       23 
24 
     | 
    
         
             
                respond_to do |format|
         
     | 
| 
       24 
25 
     | 
    
         
             
                  format.html{ redirect_to [profile_subject, :profile] }
         
     | 
| 
         @@ -53,4 +54,8 @@ class ProfilesController < ApplicationController 
     | 
|
| 
       53 
54 
     | 
    
         | 
| 
       54 
55 
     | 
    
         
             
                current_subject.profile
         
     | 
| 
       55 
56 
     | 
    
         
             
              end
         
     | 
| 
      
 57 
     | 
    
         
            +
             
     | 
| 
      
 58 
     | 
    
         
            +
              def authorize_update
         
     | 
| 
      
 59 
     | 
    
         
            +
                authorize! :update, subject_profile
         
     | 
| 
      
 60 
     | 
    
         
            +
              end
         
     | 
| 
       56 
61 
     | 
    
         
             
            end
         
     | 
| 
         @@ -45,17 +45,15 @@ class SearchController < ApplicationController 
     | 
|
| 
       45 
45 
     | 
    
         
             
              private
         
     | 
| 
       46 
46 
     | 
    
         | 
| 
       47 
47 
     | 
    
         
             
              def search mode
         
     | 
| 
       48 
     | 
    
         
            -
                 
     | 
| 
       49 
     | 
    
         
            -
             
     | 
| 
       50 
     | 
    
         
            -
             
     | 
| 
       51 
     | 
    
         
            -
             
     | 
| 
       52 
     | 
    
         
            -
             
     | 
| 
       53 
     | 
    
         
            -
             
     | 
| 
       54 
     | 
    
         
            -
             
     | 
| 
       55 
     | 
    
         
            -
             
     | 
| 
       56 
     | 
    
         
            -
             
     | 
| 
       57 
     | 
    
         
            -
                end
         
     | 
| 
      
 48 
     | 
    
         
            +
                page =  ( mode == "quick" ? 1 : params[:page] )
         
     | 
| 
      
 49 
     | 
    
         
            +
                limit = ( mode == "quick" ? 7 : RESULTS_SEARCH_PER_PAGE )
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
      
 51 
     | 
    
         
            +
                SocialStream::Search.search(params[:q],
         
     | 
| 
      
 52 
     | 
    
         
            +
                                            current_subject,
         
     | 
| 
      
 53 
     | 
    
         
            +
                                            mode:  mode,
         
     | 
| 
      
 54 
     | 
    
         
            +
                                            key:   params[:type],
         
     | 
| 
      
 55 
     | 
    
         
            +
                                            page:  page,
         
     | 
| 
      
 56 
     | 
    
         
            +
                                            limit: limit)
         
     | 
| 
       58 
57 
     | 
    
         | 
| 
       59 
     | 
    
         
            -
                result
         
     | 
| 
       60 
58 
     | 
    
         
             
              end
         
     | 
| 
       61 
59 
     | 
    
         
             
            end
         
     | 
    
        data/app/models/permission.rb
    CHANGED
    
    | 
         @@ -51,18 +51,19 @@ class Permission < ActiveRecord::Base 
     | 
|
| 
       51 
51 
     | 
    
         
             
                # if the class is not found
         
     | 
| 
       52 
52 
     | 
    
         
             
                def available(subject)
         
     | 
| 
       53 
53 
     | 
    
         
             
                  class_name = subject.class.to_s.underscore
         
     | 
| 
      
 54 
     | 
    
         
            +
                  # TODO add further classes
         
     | 
| 
       54 
55 
     | 
    
         
             
                  base_class_name = subject.class.base_class.to_s.underscore
         
     | 
| 
       55 
56 
     | 
    
         | 
| 
       56 
     | 
    
         
            -
                  candidates = [ class_name 
     | 
| 
      
 57 
     | 
    
         
            +
                  candidates = [ class_name ]
         
     | 
| 
       57 
58 
     | 
    
         | 
| 
       58 
59 
     | 
    
         
             
                  if class_name != base_class_name
         
     | 
| 
       59 
     | 
    
         
            -
                    candidates += [ base_class_name 
     | 
| 
      
 60 
     | 
    
         
            +
                    candidates += [ base_class_name ]
         
     | 
| 
       60 
61 
     | 
    
         
             
                  end
         
     | 
| 
       61 
62 
     | 
    
         | 
| 
       62 
63 
     | 
    
         
             
                  list = nil
         
     | 
| 
       63 
64 
     | 
    
         | 
| 
       64 
65 
     | 
    
         
             
                  candidates.each do |n|
         
     | 
| 
       65 
     | 
    
         
            -
                    list = SocialStream.available_permissions[n]
         
     | 
| 
      
 66 
     | 
    
         
            +
                    list = SocialStream.available_permissions.with_indifferent_access[n]
         
     | 
| 
       66 
67 
     | 
    
         | 
| 
       67 
68 
     | 
    
         
             
                    break if list.present?
         
     | 
| 
       68 
69 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -24,8 +24,8 @@ class Relation::Custom < Relation 
     | 
|
| 
       24 
24 
     | 
    
         
             
              class << self
         
     | 
| 
       25 
25 
     | 
    
         
             
                def defaults_for(actor)
         
     | 
| 
       26 
26 
     | 
    
         
             
                  subject_type = actor.subject.class.to_s.underscore
         
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
       28 
     | 
    
         
            -
             
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
                  cfg_rels = SocialStream.custom_relations.with_indifferent_access[subject_type]
         
     | 
| 
       29 
29 
     | 
    
         | 
| 
       30 
30 
     | 
    
         
             
                  if cfg_rels.nil?
         
     | 
| 
       31 
31 
     | 
    
         
             
                    raise "Undefined relations for subject type #{ subject_type }. Please, add an entry to config/initializers/social_stream.rb"
         
     | 
| 
         @@ -36,10 +36,10 @@ class Relation::Custom < Relation 
     | 
|
| 
       36 
36 
     | 
    
         
             
                  cfg_rels.each_pair do |name, cfg_rel|
         
     | 
| 
       37 
37 
     | 
    
         
             
                    rels[name] =
         
     | 
| 
       38 
38 
     | 
    
         
             
                      create! :actor =>         actor,
         
     | 
| 
       39 
     | 
    
         
            -
                              :name  =>         cfg_rel[ 
     | 
| 
       40 
     | 
    
         
            -
                              :receiver_type => cfg_rel[ 
     | 
| 
      
 39 
     | 
    
         
            +
                              :name  =>         cfg_rel[:name],
         
     | 
| 
      
 40 
     | 
    
         
            +
                              :receiver_type => cfg_rel[:receiver_type]
         
     | 
| 
       41 
41 
     | 
    
         | 
| 
       42 
     | 
    
         
            -
                    if (ps = cfg_rel[ 
     | 
| 
      
 42 
     | 
    
         
            +
                    if (ps = cfg_rel[:permissions]).present?
         
     | 
| 
       43 
43 
     | 
    
         
             
                      ps.each do |p| 
         
     | 
| 
       44 
44 
     | 
    
         
             
                        p.push(nil) if p.size == 1
         
     | 
| 
       45 
45 
     | 
    
         | 
    
        data/app/models/user.rb
    CHANGED
    
    
| 
         @@ -6,10 +6,10 @@ 
     | 
|
| 
       6 
6 
     | 
    
         
             
                </div>
         
     | 
| 
       7 
7 
     | 
    
         
             
                <div class="modal-body">
         
     | 
| 
       8 
8 
     | 
    
         
             
                  <%= label_tag 'actors', t('actor.title.other') %>
         
     | 
| 
       9 
     | 
    
         
            -
                  <%= text_field_tag 'actors', '', 'data-path' => actors_path(stranger: true, sender_id: Actor.normalize_id(sender)), 'data-type' => Array.wrap(type).compact.join(',') %>
         
     | 
| 
      
 9 
     | 
    
         
            +
                  <%= text_field_tag 'actors', '', 'data-path' => actors_path(stranger: true, sender_id: Actor.normalize_id(sender)), 'data-type' => Array.wrap(type).compact.join(','), placeholder: t('contact.new.modal.placeholder.actors') %>
         
     | 
| 
       10 
10 
     | 
    
         | 
| 
       11 
11 
     | 
    
         
             
                  <%= label_tag 'relations', t('activerecord.attributes.contact.relation_ids') %>
         
     | 
| 
       12 
     | 
    
         
            -
                  <%= select_tag 'relations', contact_select_options(sender.options_for_contact_select), multiple: true %>
         
     | 
| 
      
 12 
     | 
    
         
            +
                  <%= select_tag 'relations', contact_select_options(sender.options_for_contact_select), multiple: true, "data-placeholder" => t('contact.new.modal.placeholder.actors') %>
         
     | 
| 
       13 
13 
     | 
    
         
             
                </div>
         
     | 
| 
       14 
14 
     | 
    
         
             
                <div class="modal-footer">
         
     | 
| 
       15 
15 
     | 
    
         
             
                  <%= submit_tag t('contact.new.modal.button') %>
         
     | 
| 
         @@ -20,10 +20,11 @@ 
     | 
|
| 
       20 
20 
     | 
    
         
             
                    <div id="<%= type %>" class="tab-pane <%= 'active' if current_contact_section?(type) %>">
         
     | 
| 
       21 
21 
     | 
    
         
             
                      <%= text_field_tag "contact-filter-#{ type }", (current_contact_section?(type) ? params[:q] : ""), class: "pull-right contact-filter", placeholder: "filter", autocomplete: "off" %>
         
     | 
| 
       22 
22 
     | 
    
         | 
| 
       23 
     | 
    
         
            -
                      <% if type == :group %>
         
     | 
| 
      
 23 
     | 
    
         
            +
                      <% if user_signed_in? && type == :group %>
         
     | 
| 
       24 
24 
     | 
    
         
             
                        <%= link_to t('group.new.link'), new_group_path, class: 'new_group-modal-link', 'data-toggle' => 'modal' %>
         
     | 
| 
       25 
25 
     | 
    
         | 
| 
       26 
     | 
    
         
            -
                        <%= render partial: 'groups/new_modal' 
     | 
| 
      
 26 
     | 
    
         
            +
                        <%= render partial: 'groups/new_modal',
         
     | 
| 
      
 27 
     | 
    
         
            +
                                   locals: { resource_class: Group } %>
         
     | 
| 
       27 
28 
     | 
    
         
             
                      <% end %>
         
     | 
| 
       28 
29 
     | 
    
         | 
| 
       29 
30 
     | 
    
         
             
                      <div class="contact-list">
         
     | 
| 
         @@ -1,15 +1 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            <%=  
     | 
| 
       2 
     | 
    
         
            -
              link_to(t('settings.main'), settings_path)
         
     | 
| 
       3 
     | 
    
         
            -
            ) %>
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
            <h2>
         
     | 
| 
       6 
     | 
    
         
            -
            	<%= t('settings.for')%> <%= current_subject.name %>
         
     | 
| 
       7 
     | 
    
         
            -
            </h2>
         
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
       9 
     | 
    
         
            -
            <%= render :partial => "edit_user"%>
         
     | 
| 
       10 
     | 
    
         
            -
            <%= render :partial => "settings/language" %>
         
     | 
| 
       11 
     | 
    
         
            -
            <%= render :partial => "settings/notifications" %>
         
     | 
| 
       12 
     | 
    
         
            -
            <% if current_subject.respond_to? :authentication_token%>
         
     | 
| 
       13 
     | 
    
         
            -
              <%= render :partial => "settings/api_key" %>
         
     | 
| 
       14 
     | 
    
         
            -
            <% end %>
         
     | 
| 
       15 
     | 
    
         
            -
            <%= render :partial => "delete_account"%>
         
     | 
| 
      
 1 
     | 
    
         
            +
            <%= render template: 'settings/index' %>
         
     | 
| 
         @@ -18,7 +18,7 @@ 
     | 
|
| 
       18 
18 
     | 
    
         
             
              </section>
         
     | 
| 
       19 
19 
     | 
    
         
             
              <section class="owners">
         
     | 
| 
       20 
20 
     | 
    
         
             
                <%= f.label :owners %>
         
     | 
| 
       21 
     | 
    
         
            -
                <%= f.hidden_field :owners, 'data-path' => actors_path(format: :json) %>
         
     | 
| 
      
 21 
     | 
    
         
            +
                <%= f.hidden_field :owners, 'data-path' => actors_path(format: :json), "data-actor_name" => current_subject.name %>
         
     | 
| 
       22 
22 
     | 
    
         
             
              </section>
         
     | 
| 
       23 
23 
     | 
    
         
             
              <section class="tags">
         
     | 
| 
       24 
24 
     | 
    
         
             
                <%= f.label :tags_list %>
         
     | 
| 
         @@ -1,10 +1,10 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            <%= form_for(@profile, :url => [ 
     | 
| 
      
 1 
     | 
    
         
            +
            <%= form_for(@profile, :url => [@profile.subject, :profile]) do |f| %>
         
     | 
| 
       2 
2 
     | 
    
         
             
              <span class="required">*</span>
         
     | 
| 
       3 
3 
     | 
    
         
             
              <%= f.label :name %>
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
       5 
5 
     | 
    
         
             
              <%= f.text_field :name, :class => "required" %>
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
     | 
    
         
            -
              <%= f.label :description, t("profile.#{  
     | 
| 
      
 7 
     | 
    
         
            +
              <%= f.label :description, t("profile.#{ f.object.subject.class.to_s.downcase }.about") %>
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
       9 
9 
     | 
    
         
             
              <%= f.text_area :description, :maxlength => 200, :rows => 10 %>
         
     | 
| 
       10 
10 
     | 
    
         | 
| 
         @@ -12,7 +12,7 @@ 
     | 
|
| 
       12 
12 
     | 
    
         | 
| 
       13 
13 
     | 
    
         
             
              <%= f.text_field :organization %>
         
     | 
| 
       14 
14 
     | 
    
         | 
| 
       15 
     | 
    
         
            -
              <%= f.label :birthday, t('profile.' +  
     | 
| 
      
 15 
     | 
    
         
            +
              <%= f.label :birthday, t('profile.' + f.object.subject.class.to_s.downcase + '.birthday') %>
         
     | 
| 
       16 
16 
     | 
    
         | 
| 
       17 
17 
     | 
    
         
             
              <%= date_select "profile", "birthday", :order => [:day, :month, :year], :end_year => Date.today.year, :start_year => (Date.today.year - 100), :prompt => {:day => 'Day', :month => 'Month', :year => 'Year'} %>
         
     | 
| 
       18 
18 
     | 
    
         | 
    
        data/config/locales/en.yml
    CHANGED
    
    
    
        data/config/locales/es.yml
    CHANGED
    
    | 
         @@ -586,7 +586,7 @@ es: 
     | 
|
| 
       586 
586 
     | 
    
         
             
                  query: Más resultados para %{query} >
         
     | 
| 
       587 
587 
     | 
    
         
             
                name: Buscar
         
     | 
| 
       588 
588 
     | 
    
         
             
                no_subject_found: No se encontró a %{subject}.
         
     | 
| 
       589 
     | 
    
         
            -
                nothing: No se ha  
     | 
| 
      
 589 
     | 
    
         
            +
                nothing: No se ha encontrado nada.
         
     | 
| 
       590 
590 
     | 
    
         
             
                searching: 'Buscando: %{query}'
         
     | 
| 
       591 
591 
     | 
    
         
             
                show_all: Todos
         
     | 
| 
       592 
592 
     | 
    
         
             
                write: Escribe tu búsqueda...
         
     | 
| 
         @@ -1,17 +1,16 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            module SocialStream
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
       2 
3 
     | 
    
         
             
              autoload :Ability, 'social_stream/ability'
         
     | 
| 
       3 
4 
     | 
    
         
             
              autoload :ActivityStreams, 'social_stream/activity_streams'
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
       4 
6 
     | 
    
         
             
              module ActivityStreams
         
     | 
| 
       5 
7 
     | 
    
         
             
                autoload :Supertype, 'social_stream/activity_streams/supertype'
         
     | 
| 
       6 
8 
     | 
    
         
             
                autoload :Subtype,   'social_stream/activity_streams/subtype'
         
     | 
| 
       7 
9 
     | 
    
         
             
              end
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
       8 
11 
     | 
    
         
             
              module Base
         
     | 
| 
       9 
12 
     | 
    
         
             
                autoload :Ability,   'social_stream/base/ability'
         
     | 
| 
       10 
13 
     | 
    
         
             
              end
         
     | 
| 
       11 
     | 
    
         
            -
              autoload :D3,        'social_stream/d3'
         
     | 
| 
       12 
     | 
    
         
            -
              autoload :Populate,  'social_stream/populate'
         
     | 
| 
       13 
     | 
    
         
            -
              autoload :Relations, 'social_stream/relations'
         
     | 
| 
       14 
     | 
    
         
            -
              autoload :TestHelpers, 'social_stream/test_helpers'
         
     | 
| 
       15 
14 
     | 
    
         | 
| 
       16 
15 
     | 
    
         
             
              module Controllers
         
     | 
| 
       17 
16 
     | 
    
         
             
                autoload :Authorship,              'social_stream/controllers/authorship'
         
     | 
| 
         @@ -23,6 +22,8 @@ module SocialStream 
     | 
|
| 
       23 
22 
     | 
    
         
             
                autoload :Subjects, 'social_stream/controllers/subjects'
         
     | 
| 
       24 
23 
     | 
    
         
             
              end
         
     | 
| 
       25 
24 
     | 
    
         | 
| 
      
 25 
     | 
    
         
            +
              autoload :D3,          'social_stream/d3'
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
       26 
27 
     | 
    
         
             
              module Devise
         
     | 
| 
       27 
28 
     | 
    
         
             
                module Controllers
         
     | 
| 
       28 
29 
     | 
    
         
             
                  autoload :UserSignIn, 'social_stream/devise/controllers/user_sign_in'
         
     | 
| 
         @@ -36,6 +37,8 @@ module SocialStream 
     | 
|
| 
       36 
37 
     | 
    
         
             
                autoload :Supertype, 'social_stream/models/supertype'
         
     | 
| 
       37 
38 
     | 
    
         
             
              end
         
     | 
| 
       38 
39 
     | 
    
         | 
| 
      
 40 
     | 
    
         
            +
              autoload :Population,  'social_stream/population'
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
       39 
42 
     | 
    
         
             
              module Population
         
     | 
| 
       40 
43 
     | 
    
         
             
                autoload :ActivityObject, 'social_stream/population/activity_object'
         
     | 
| 
       41 
44 
     | 
    
         
             
                autoload :Actor,          'social_stream/population/actor'
         
     | 
| 
         @@ -43,6 +46,8 @@ module SocialStream 
     | 
|
| 
       43 
46 
     | 
    
         
             
                autoload :Timestamps,     'social_stream/population/timestamps'
         
     | 
| 
       44 
47 
     | 
    
         
             
              end
         
     | 
| 
       45 
48 
     | 
    
         | 
| 
      
 49 
     | 
    
         
            +
              autoload :Relations,   'social_stream/relations'
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
       46 
51 
     | 
    
         
             
              module Routing
         
     | 
| 
       47 
52 
     | 
    
         
             
                module Constraints
         
     | 
| 
       48 
53 
     | 
    
         
             
                  autoload :Custom, 'social_stream/routing/constraints/custom'
         
     | 
| 
         @@ -53,12 +58,14 @@ module SocialStream 
     | 
|
| 
       53 
58 
     | 
    
         | 
| 
       54 
59 
     | 
    
         
             
              autoload :Search, 'social_stream/search'
         
     | 
| 
       55 
60 
     | 
    
         | 
| 
       56 
     | 
    
         
            -
               
     | 
| 
       57 
     | 
    
         
            -
                autoload :List,     'social_stream/views/list'
         
     | 
| 
       58 
     | 
    
         
            -
                autoload :Location, 'social_stream/views/location'
         
     | 
| 
       59 
     | 
    
         
            -
              end
         
     | 
| 
      
 61 
     | 
    
         
            +
              autoload :TestHelpers, 'social_stream/test_helpers'
         
     | 
| 
       60 
62 
     | 
    
         | 
| 
       61 
63 
     | 
    
         
             
              module TestHelpers
         
     | 
| 
       62 
64 
     | 
    
         
             
                autoload :Controllers, 'social_stream/test_helpers/controllers'
         
     | 
| 
       63 
65 
     | 
    
         
             
              end
         
     | 
| 
      
 66 
     | 
    
         
            +
             
     | 
| 
      
 67 
     | 
    
         
            +
              module Views
         
     | 
| 
      
 68 
     | 
    
         
            +
                autoload :List,     'social_stream/views/list'
         
     | 
| 
      
 69 
     | 
    
         
            +
                autoload :Location, 'social_stream/views/location'
         
     | 
| 
      
 70 
     | 
    
         
            +
              end
         
     | 
| 
       64 
71 
     | 
    
         
             
            end
         
     | 
    
        data/lib/social_stream/search.rb
    CHANGED
    
    
    
        data/lib/tasks/db/populate.rake
    CHANGED
    
    | 
         @@ -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
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: social_stream-base
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 2.2. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 2.2.1
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - GING - DIT - UPM
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2013-08- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2013-08-13 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: deep_merge
         
     | 
| 
         @@ -1145,6 +1145,7 @@ files: 
     | 
|
| 
       1145 
1145 
     | 
    
         
             
            - lib/social_stream/models/subject.rb
         
     | 
| 
       1146 
1146 
     | 
    
         
             
            - lib/social_stream/models/subtype.rb
         
     | 
| 
       1147 
1147 
     | 
    
         
             
            - lib/social_stream/models/supertype.rb
         
     | 
| 
      
 1148 
     | 
    
         
            +
            - lib/social_stream/population.rb
         
     | 
| 
       1148 
1149 
     | 
    
         
             
            - lib/social_stream/population/activity_object.rb
         
     | 
| 
       1149 
1150 
     | 
    
         
             
            - lib/social_stream/population/actor.rb
         
     | 
| 
       1150 
1151 
     | 
    
         
             
            - lib/social_stream/population/power_law.rb
         
     | 
| 
         @@ -1281,7 +1282,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       1281 
1282 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       1282 
1283 
     | 
    
         
             
            requirements: []
         
     | 
| 
       1283 
1284 
     | 
    
         
             
            rubyforge_project: 
         
     | 
| 
       1284 
     | 
    
         
            -
            rubygems_version: 2.0. 
     | 
| 
      
 1285 
     | 
    
         
            +
            rubygems_version: 2.0.6
         
     | 
| 
       1285 
1286 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       1286 
1287 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       1287 
1288 
     | 
    
         
             
            summary: Basic features for Social Stream, the core for building social network websites
         
     |