Commit 22243571fc147fcf8af8d7b46371b39e9325d8ee

Authored by Rodrigo Souto
2 parents b2cc9def 32f88e65

Merge branch 'master' of gitlab.com:noosfero/noosfero

INSTALL.chat.md
1   -XMPP/Chat Client Setup
2   -======================
  1 +XMPP/Chat Setup
  2 +===============
3 3  
4   -To configure XMPP/BOSH in Noosfero you need:
  4 +The samples of config file to configure a XMPP/BOSH server with ejabberd,
  5 +postgresql and apache2 can be found at util/chat directory.
5 6  
6   -* REST Client - http://github.com/archiloque/rest-client
7   -* SystemTimer - http://ph7spot.com/musings/system-timer
8   -* Pidgin data files - http://www.pidgin.im/
  7 +This setup supposes that you are using Noosfero installed via Debian package
  8 +in a production environment.
9 9  
10   -If you use Debian 6.0 (squeeze):
11   -
12   - # apt-get install librestclient-ruby pidgin-data ruby1.8-dev
13   - # gem install SystemTimer
14   -
15   -The samples of config file to configure a XMPP/BOSH server with ejabberd, postgresql and apache2 can be found at util/chat directory.
16   -
17   -XMPP/Chat Server Setup
18   -======================
  10 +Steps
  11 +=====
19 12  
20 13 This is a step-by-step guide to get a XMPP service working, in a Debian system.
21 14  
22 15 ## 1. Install the required packages
23 16  
24   - # apt-get install ejabberd odbc-postgresql
  17 + # apt-get install ejabberd odbc-postgresql librestclient-ruby pidgin-data ruby1.8-dev
  18 + # gem install SystemTimer
25 19  
26 20 ## 2. Ejabberd configuration
27 21  
28   -All the following changes must be done in config file: `/etc/ejabberd/ejabberd.cfg`
29   -
30   -### 2.1. Set the default admin user
31   -
32   - { acl, admin, { user, "john", "www.example.com" } }.
33   - { acl, admin, { user, "bart", "www.example.com" } }.
34   -
35   -### 2.2. Set the default host
36   -
37   - { hosts, [ "www.example.com" ] }.
38   -
39   -### 2.3. Http-Bind activation
40   -
41   - { 5280, ejabberd_http, [
42   - http_bind,
43   - web_admin
44   - ]
45   - }
46   -
47   - (...)
48   -
49   - { modules, [
50   - {mod_http_bind, []},
51   - ...
52   - ] }.
53   -
54   -Ejabberd creates semi-anonymous rooms by default, but Noosfero's Jabber client needs non-anonymous room, then we need to change default params of creation rooms in ejabberd to create non-anonymous rooms.
55   -
56   -In non-anonymous rooms the jabber service sends the new occupant's full JID to all occupants in the room [[1]].
  22 + # cp /usr/share/noosfero/util/chat/ejabberd.cfg /etc/ejabberd/
57 23  
58   -Add option "`{default_room_options, [{anonymous, false}]}`" to `/etc/ejabberd/ejabberd.cfg` in mod_muc session. See below:
  24 +Edit the /etc/ejabberd/ejabberd.cfg file and set your domain on the first 2 lines.
59 25  
60   - { mod_muc, [
61   - %%{host, "conference.@HOST@"},
62   - {access, muc},
63   - {access_create, muc},
64   - {access_persistent, muc},
65   - {access_admin, muc_admin},
66   - {max_users, 500},
67   - {default_room_options, [{anonymous, false}]}
68   - ]},
69   -
70   -[1]: http://xmpp.org/extensions/xep-0045.html#enter-nonanon
71   -
72   -
73   -### 2.4. Authentication method
74   -
75   -To use Postgresql through ODBC, the following modifications must be done:
76   -
77   - * Disable the default method:
78   - `{auth_method, internal}.`
79   -
80   - * Enable autheticantion through ODBC:
81   - `{auth_method, odbc}.`
  26 +## 3. Configuring Postgresql
82 27  
83   - * Set database server name
84   - `{odbc_server, "DSN=PostgreSQLEjabberdNoosfero"}.`
  28 +Give permission to noosfero user create new roles, login as
  29 +postgres user and execute:
85 30  
  31 + $ psql
  32 + postgres=# GRANT CREATE ON DATABASE noosfero TO noosfero;
86 33  
87   -### 2.5. Increase the shaper traffic limit
  34 +Change the postgresql authentication method to md5 instead of ident,
  35 +add the following line to the file /etc/postgresql/8.4/main/pg_hba.conf:
88 36  
89   - { shaper, normal, { maxrate, 10000000 } }.
  37 + # Noosfero user
  38 + local noosfero noosfero md5
90 39  
  40 +(add this line before the following line)
91 41  
92   -### 2.6. Disable unused modules
  42 + # "local" is for Unix domain socket connections only
  43 + local all all ident
93 44  
94   -Unused modules can be disabled, for example:
  45 +Restart postgresql server:
95 46  
96   - * s2s
97   - * web_admin
98   - * mod_pubsub
99   - * mod_irc
100   - * mod_offline
101   - * mod_admin_extra
102   - * mod_register
  47 + # service postgresql restart
103 48  
  49 +Login as noosfero user, and execute:
104 50  
105   -### 2.7. Enable ODBC modules
  51 + $ psql -U noosfero -W noosfero < /usr/share/noosfero/util/chat/postgresql/ejabberd.sql
106 52  
107   - * mod_privacy -> mod_privacy_odbc
108   - * mod_private -> mod_private_odbc
109   - * mod_roster -> mod_roster_odbc
  53 +(see database password in the /etc/noosfero/database.yml file)
110 54  
111   -## 3. Configuring Postgresql
  55 +This will create a new schema inside the noosfero database, called `ejabberd`.
112 56  
113   -Login as noosfero user, and execute:
  57 +Note that there should be at least one domain with `is_default = true` in
  58 +`domains` table, otherwise people won't be able to see their friends online.
114 59  
115   - $ psql noosfero < /path/to/noosfero/util/chat/postgresql/ejabberd.sql
  60 +## 4. ODBC configuration
116 61  
117   -Where `noosfero` may need to be replace by the name of the database used for Noosfero.
  62 +Create the following files:
118 63  
119   -This will create a new schema inside the noosfero database, called `ejabberd`.
  64 + # cp /usr/share/noosfero/util/chat/odbc.ini /etc/
  65 + # cp /usr/share/noosfero/util/chat/odbcinst.ini /etc/
120 66  
121   -Note `noosfero` user should have permission to create Postgresql schemas. Also, there should be at least one domain with `is_default = true` in `domains` table, otherwise people won't be able to see their friends online.
  67 +Edit the odbc.ini file and set the password for the database user, see
  68 +the file /etc/noosfero/database.yml to get the password.
122 69  
123   -## 4. ODBC configuration
  70 +Adjust premissions:
124 71  
125   -The following files must be created:
126   -
127   -`/etc/odbc.ini`:
128   -
129   - [PostgreSQLEjabberdNoosfero]
130   - Description = PostgreSQL Noosfero ejabberd database
131   - Driver = PostgreSQL Unicode
132   - Trace = No
133   - TraceFile = /tmp/psqlodbc.log
134   - Database = noosfero
135   - Servername = localhost
136   - UserName = <DBUSER>
137   - Password = <DBPASS>
138   - Port =
139   - ReadOnly = No
140   - RowVersioning = No
141   - ShowSystemTables = No
142   - ShowOidColumn = No
143   - FakeOidIndex = No
144   - ConnSettings = SET search_path TO ejabberd
145   -
146   -`/etc/odbcinst.ini`:
147   -
148   - [PostgreSQL Unicode]
149   - Description = PostgreSQL ODBC driver (Unicode version)
150   - Driver = /usr/lib/odbc/psqlodbcw.so
151   - Setup = /usr/lib/odbc/libodbcpsqlS.so
152   - Debug = 0
153   - CommLog = 1
154   - UsageCount = 3
  72 + # chmod 640 /etc/odbc.ini
  73 + # chown ejabberd /etc/odbc.ini
155 74  
156 75 ## 4.1 testing all:
157 76  
... ... @@ -159,7 +78,6 @@ The following files must be created:
159 78  
160 79 If the configuration was done right, the message "Connected!" will be displayed.
161 80  
162   -
163 81 ## 5. Enabling kernel polling and SMP in `/etc/default/ejabberd`
164 82  
165 83 POLL=true
... ... @@ -205,32 +123,45 @@ Note: module proxy_http must be enabled:
205 123  
206 124 # a2enmod proxy_http
207 125  
208   -## 8. DNS configuration
  126 +Restart services:
209 127  
210   -For this point, we assume you are using BIND as your DNS server. You need to add the following entries to the DNS zone file corresponding to the domain of your noosfero site:
  128 + # service ejabberd restart
  129 + # service noosfero restart
  130 + # service apache2 restart
211 131  
212   - _xmpp-client._tcp SRV 5 100 5222 master
213   - conference CNAME master
214   - _xmpp-client._tcp.conference SRV 5 100 5222 master
  132 +## 8. Test Apache Configuration
215 133  
216   -If you are running a DNS server other than BIND, you will have to figure out how to create equivalente rules for your zone file. Patches to this documentation are welcome.
  134 +Open in your browser the address:
217 135  
218   -## 9. Testing this Setup
  136 + http://<yout domain>/http-bind
219 137  
220   -Adjust shell limits to proceed with some benchmarks and load tests:
  138 +You should see a page with a message like that:
221 139  
222   - # ulimit −s 256
223   - # ulimit −n 8192
224   - # echo 10 > /proc/sys/net/ipv4/tcp_syn_retries
  140 + ejabberd mod_http_bind
  141 + An implementation of XMPP over BOSH (XEP-0206)
  142 + This web page is only informative. To use HTTP-Bind you need a Jabber/XMPP
  143 + client that supports it.
225 144  
226   -To measure the bandwidth between server and client:
  145 +## 9. Test chat session
227 146  
228   - * at server side:
229   - `# iperf −s`
  147 +Open Noosfero console and execute:
230 148  
231   - * at client side:
232   - `# iperf −c server_ip`
  149 +>> environment = Environment.default
  150 +>> user = Person['guest']
  151 +>> password = user.user.crypted_password
  152 +>> login = user.jid
  153 +>> RubyBOSH.initialize_session(login, password, "http://#{environment.default_hostname}/http-bind", :wait => 30, :hold => 1, :window => 5
233 154  
234   -For heavy load tests, clone and use this software:
  155 +If you have luck, should see something like that:
235 156  
236   - $ git clone http://git.holoscopio.com/git/metal/tester.git
  157 +Ruby-BOSH - SEND
  158 +<body window="5" rid="60265" xmlns="http://jabber.org/protocol/httpbind" xmlns:xmpp="urn:xmpp:xbosh" to="vagrant-debian-squeeze.vagrantup.com" wait="30" xmpp:version="1.0" hold="1"/>
  159 +Ruby-BOSH - SEND
  160 +<body rid="60266" xmlns="http://jabber.org/protocol/httpbind" sid="24cdfc43646a2af1059a7060b677c2e11b26f34f" xmlns:xmpp="urn:xmpp:xbosh" xmpp:version="1.0"><auth mechanism="PLAIN" xmlns="urn:ietf:params:xml:ns:xmpp-sasl">Z3Vlc3RAdmFncmFudC1kZWJpYW4tc3F1ZWV6ZS52YWdyYW50dXAuY29tAGd1ZXN0ADEzZTFhYWVlYjRhYjZlMTA0MmRkNWI1YWY0MzM4MjA1OGJiOWZmNzk=</auth></body>
  161 +Ruby-BOSH - SEND
  162 +<body xmpp:restart="true" rid="60267" xmlns="http://jabber.org/protocol/httpbind" sid="24cdfc43646a2af1059a7060b677c2e11b26f34f" xmlns:xmpp="urn:xmpp:xbosh" xmpp:version="1.0"/>
  163 +Ruby-BOSH - SEND
  164 +<body rid="60268" xmlns="http://jabber.org/protocol/httpbind" sid="24cdfc43646a2af1059a7060b677c2e11b26f34f" xmlns:xmpp="urn:xmpp:xbosh" xmpp:version="1.0"><iq type="set" xmlns="jabber:client" id="bind_29330"><bind xmlns="urn:ietf:params:xml:ns:xmpp-bind"><resource>bosh_9631</resource></bind></iq></body>
  165 +Ruby-BOSH - SEND
  166 +<body rid="60269" xmlns="http://jabber.org/protocol/httpbind" sid="24cdfc43646a2af1059a7060b677c2e11b26f34f" xmlns:xmpp="urn:xmpp:xbosh" xmpp:version="1.0"><iq type="set" xmlns="jabber:client" id="sess_21557"><session xmlns="urn:ietf:params:xml:ns:xmpp-session"/></iq></body>
  167 +=> ["guest@vagrant-debian-squeeze.vagrantup.com", "24cdfc43646a2af1059a7060b677c2e11b26f34f", 60270]
... ...
INSTALL.https.md 0 → 100644
... ... @@ -0,0 +1,115 @@
  1 +Setup Noosfero to use HTTPS
  2 +===========================
  3 +
  4 +This document assumes that you have a fully and clean Noosfero
  5 +installation as explained at the `INSTALL.md` file.
  6 +
  7 +SSL certificate
  8 ++++++++++++++++
  9 +
  10 +You should get a valid SSL certificate, but if you want to test
  11 +your setup before, you could generate a self-signed certificate
  12 +as below:
  13 +
  14 + # mkdir /etc/noosfero/ssl
  15 + # cd /etc/noosfero/ssl
  16 + # openssl genrsa 1024 > noosfero.key
  17 + # openssl req -new -x509 -nodes -sha1 -days $[10*365] -key noosfero.key > noosfero.cert
  18 + # cat noosfero.key noosfero.cert > noosfero.pem
  19 +
  20 +There are two ways of using SSL with Noosfero: 1) If you are not using
  21 +Varnish; and 2) If you are using Varnish.
  22 +
  23 +1) If you are are not using Varnish
  24 ++++++++++++++++++++++++++++++++++++
  25 +
  26 +Simply do a redirect in apache to force all connections with SSL:
  27 +
  28 + <VirtualHost *:8080>
  29 + ServerName test.stoa.usp.br
  30 +
  31 + Redirect / https://example.com/
  32 + </VirtualHost>
  33 +
  34 +And set a vhost to receive then:
  35 +
  36 + <VirtualHost *:443>
  37 + ServerName example.com
  38 +
  39 + SSLEngine On
  40 + SSLCertificateFile /etc/ssl/certs/cert.pem
  41 + SSLCertificateKeyFile /etc/ssl/private/cert.key
  42 +
  43 + Include /etc/noosfero/apache/virtualhost.conf
  44 + </VirtualHost>
  45 +
  46 +Be aware that if you had configured varnish, the requests won't reach
  47 +it with this configuration.
  48 +
  49 +2) If you are using Varnish
  50 ++++++++++++++++++++++++++++
  51 +
  52 +Varnish isn't able to communicate with the SSL protocol, so we will
  53 +need some one who do this and Pound[1] can do the job. In order to
  54 +install it in Debian based systems:
  55 +
  56 + $ sudo apt-get install pound
  57 +
  58 +Set Varnish to listen in other port than 80:
  59 +
  60 +/etc/defaults/varnish
  61 +---------------------
  62 +
  63 + DAEMON_OPTS="-a localhost:6081 \
  64 + -T localhost:6082 \
  65 + -f /etc/varnish/default.vcl \
  66 + -S /etc/varnish/secret \
  67 + -s file,/var/lib/varnish/$INSTANCE/varnish_storage.bin,1G"
  68 +
  69 +Configure Pound:
  70 +
  71 + # cp /usr/share/noosfero/etc/pound.cfg /etc/pound/
  72 +
  73 +Edit /etc/pound.cfg and set the IP and domain of your server.
  74 +
  75 +Configure Pound to start at system initialization:
  76 +
  77 +/etc/default/pound
  78 +------------------
  79 +
  80 + startup=1
  81 +
  82 +Set Apache to only listen to localhost:
  83 +
  84 +/etc/apache2/ports.conf
  85 +-----------------------
  86 +
  87 + Listen 127.0.0.1:8080
  88 +
  89 +Restart the services:
  90 +
  91 + $ sudo service apache2 restart
  92 + $ sudo service varnish restart
  93 +
  94 +Start pound:
  95 +
  96 + $ sudo service pound start
  97 +
  98 +[1] http://www.apsis.ch/pound
  99 +
  100 +Noosfero XMPP chat
  101 +++++++++++++++++++
  102 +
  103 +If you want to use chat over HTTPS, then you should add the domain
  104 +and IP of your server in the /etc/hosts file, example:
  105 +
  106 +/etc/hosts
  107 +----------
  108 +
  109 + 192.168.1.86 mydomain.example.com
  110 +
  111 +Also, it's recomended that you remove lines above from the file
  112 +`/etc/apache2/sites-enabled/noosfero`:
  113 +
  114 + RewriteEngine On
  115 + Include /usr/share/noosfero/util/chat/apache/xmpp.conf
... ...
INSTALL.varnish.md
... ... @@ -24,10 +24,6 @@ Install the RPAF apache module (or skip this step if not using apache):
24 24  
25 25 3b) Edit `/etc/apache2/sites-enabled/*`, and change `<VirtualHost *:80>` to `<VirtualHost *:8080>`
26 26  
27   -3c) Restart apache
28   -
29   - # invoke-rc.d apache2 restart
30   -
31 27 4) Varnish configuration
32 28  
33 29 4a) Edit `/etc/default/varnish`
... ... @@ -44,10 +40,6 @@ On manual installations, change `/etc/noosfero/*` to `{Rails.root}/etc/noosfero/
44 40  
45 41 **NOTE**: it is very important that the `*.vcl` files are included in that order, i.e. *first* include `varnish-noosfero.vcl`, and *after* `noosfero-accept-language.cvl`.
46 42  
47   -4c) Restart Varnish
48   -
49   - # invoke-rc.d varnish restart
50   -
51 43 5) Enable varnish logging:
52 44  
53 45 5a) Edit `/etc/default/varnishncsa` and uncomment the line that contains:
... ... @@ -56,8 +48,10 @@ On manual installations, change `/etc/noosfero/*` to `{Rails.root}/etc/noosfero/
56 48  
57 49 The varnish log will be written to `/var/log/varnish/varnishncsa.log` in an apache-compatible format. You should change your statistics generation software (e.g. awstats) to use that instead of apache logs.
58 50  
59   -5b) Restart Varnish Logging service
  51 +Thanks to Cosimo Streppone for varnish-accept-language. See http://github.com/cosimo/varnish-accept-language for more information.
60 52  
61   - # invoke-rc.d varnishncsa restart
  53 +6) Restart services
62 54  
63   -Thanks to Cosimo Streppone for varnish-accept-language. See http://github.com/cosimo/varnish-accept-language for more information.
  55 + # service apache2 restart
  56 + # service varnish restart
  57 + # service varnishncsa restart
... ...
app/controllers/my_profile/cms_controller.rb
... ... @@ -248,12 +248,15 @@ class CmsController &lt; MyProfileController
248 248 end.compact unless params[:marked_groups].nil?
249 249 if request.post?
250 250 @failed = {}
  251 + if @marked_groups.empty?
  252 + return session[:notice] = _("Select some group to publish your article")
  253 + end
251 254 @marked_groups.each do |item|
252 255 task = ApproveArticle.create!(:article => @article, :name => item[:name], :target => item[:group], :requestor => profile)
253 256 begin
254 257 task.finish unless item[:group].moderated_articles?
255 258 rescue Exception => ex
256   - @failed[ex.message] ? @failed[ex.message] << item[:group].name : @failed[ex.message] = [item[:group].name]
  259 + @failed[ex.message] ? @failed[ex.message] << item[:group].name : @failed[ex.message] = [item[:group].name]
257 260 end
258 261 end
259 262 if @failed.blank?
... ...
app/controllers/my_profile/friends_controller.rb
... ... @@ -11,7 +11,7 @@ class FriendsController &lt; MyProfileController
11 11 def remove
12 12 @friend = profile.friends.find(params[:id])
13 13 if request.post? && params[:confirmation]
14   - profile.remove_friend(@friend)
  14 + Friendship.remove_friendship(profile, @friend)
15 15 redirect_to :action => 'index'
16 16 end
17 17 end
... ...
app/controllers/my_profile/memberships_controller.rb
... ... @@ -7,9 +7,9 @@ class MembershipsController &lt; MyProfileController
7 7 ra = profile.role_assignments.find_by_role_id(role.id)
8 8 ra.present? && ra.resource_type == 'Profile'
9 9 end
10   - @filter = params[:filter_type].blank? ? nil : params[:filter_type]
  10 + @filter = params[:filter_type].to_i
11 11 begin
12   - @memberships = @filter.nil? ? profile.memberships : profile.memberships_by_role(environment.roles.find(@filter))
  12 + @memberships = @filter.zero? ? profile.memberships : profile.memberships_by_role(environment.roles.find(@filter))
13 13 rescue ActiveRecord::RecordNotFound
14 14 @memberships = []
15 15 end
... ...
app/controllers/public/content_viewer_controller.rb
... ... @@ -31,8 +31,8 @@ class ContentViewerController &lt; ApplicationController
31 31  
32 32 if request.post? && @page.forum?
33 33 process_forum_terms_of_use(user, params[:terms_accepted])
34   - elsif is_a_forum_topic?(@page)
35   - redirect_to @page.parent.url unless @page.parent.agrees_with_terms?(user)
  34 + elsif is_a_forum_topic?(@page) && !@page.parent.agrees_with_terms?(user)
  35 + redirect_to @page.parent.url
36 36 return
37 37 end
38 38  
... ...
app/helpers/application_helper.rb
... ... @@ -671,7 +671,7 @@ module ApplicationHelper
671 671  
672 672 def theme_javascript_ng
673 673 script = File.join(theme_path, 'theme.js')
674   - if File.join(Rails.root, 'public', script)
  674 + if File.exists?(File.join(Rails.root, 'public', script))
675 675 javascript_include_tag script
676 676 else
677 677 nil
... ...
app/models/article.rb
... ... @@ -2,7 +2,7 @@ require &#39;hpricot&#39;
2 2  
3 3 class Article < ActiveRecord::Base
4 4  
5   - attr_accessible :name, :body, :abstract, :profile, :tag_list, :parent, :allow_members_to_edit, :translation_of_id, :language, :license_id, :parent_id, :display_posts_in_current_language, :category_ids, :posts_per_page, :moderate_comments, :accept_comments, :feed, :published, :source, :highlighted, :notify_comments, :display_hits, :slug, :external_feed_builder, :display_versions, :external_link
  5 + attr_accessible :name, :body, :abstract, :profile, :tag_list, :parent, :allow_members_to_edit, :translation_of_id, :language, :license_id, :parent_id, :display_posts_in_current_language, :category_ids, :posts_per_page, :moderate_comments, :accept_comments, :feed, :published, :source, :highlighted, :notify_comments, :display_hits, :slug, :external_feed_builder, :display_versions, :external_link, :image_builder
6 6  
7 7 acts_as_having_image
8 8  
... ...
app/models/friendship.rb
... ... @@ -15,4 +15,9 @@ class Friendship &lt; ActiveRecord::Base
15 15 Friendship.update_cache_counter(:friends_count, friendship.person, -1)
16 16 Friendship.update_cache_counter(:friends_count, friendship.friend, -1)
17 17 end
  18 +
  19 + def self.remove_friendship(person1, person2)
  20 + person1.remove_friend(person2)
  21 + person2.remove_friend(person1)
  22 + end
18 23 end
... ...
app/models/person_notifier.rb
... ... @@ -82,7 +82,7 @@ class PersonNotifier
82 82 @url = @profile.environment.top_url
83 83 mail(
84 84 content_type: "text/html",
85   - from: "#{@profile.environment.name} <#{@profile.environment.contact_email}>",
  85 + from: "#{@profile.environment.name} <#{@profile.environment.noreply_email}>",
86 86 to: @profile.email,
87 87 subject: _("[%s] Network Activity") % [@profile.environment.name]
88 88 )
... ...
app/models/slideshow_block.rb
... ... @@ -6,6 +6,8 @@ class SlideshowBlock &lt; Block
6 6 settings_items :navigation, :type => 'boolean', :default => false
7 7 settings_items :image_size, :type => 'string', :default => 'thumb'
8 8  
  9 + attr_accessible :gallery_id, :image_size, :interval, :shuffle, :navigation
  10 +
9 11 def self.description
10 12 _('Slideshow')
11 13 end
... ...
app/views/cms/view.html.erb
... ... @@ -25,7 +25,9 @@
25 25 <div id='article-full-path'>
26 26 <strong><%= _('Current folder: ') %></strong>
27 27 <%= link_to profile.identifier, :action => 'index' %>
28   - <%= @article.hierarchy.map {|item| " / " + ((item == @article) ? item.name : link_to(item.slug, :id => item.id)) } %>
  28 + <% @article.hierarchy.each do |item| %>
  29 + <%= " / " + ((item == @article) ? item.name.html_safe : link_to(item.slug, :id => item.id).html_safe) %>
  30 + <% end %>
29 31 </div>
30 32 <% end %>
31 33  
... ...
app/views/content_viewer/view_page.html.erb
... ... @@ -80,8 +80,8 @@
80 80 </h3>
81 81 <% end %>
82 82  
83   - <% if @page.accept_comments? && @comments.present? && @comments.count > 1 %>
84   - <%= link_to(_('Post a comment'), '#', :class => 'display-comment-form', :id => 'top-post-comment-button', :onclick => "jQuery('#page-comment-form .display-comment-form').first().click();") %>
  83 + <% if @comments.present? && @comments.count > 1 %>
  84 + <%= link_to(_('Post a comment'), '#', :class => 'display-comment-form', :id => 'top-post-comment-button', :onclick => "jQuery('#page-comment-form .display-comment-form').first().click();") if @page.accept_comments? %>
85 85  
86 86 <%= hidden_field_tag("page_url", url_for(:controller=>'content_viewer', :action=>'view_page', :profile=>profile.identifier, :page => @page.explode_path)) %>
87 87 <%= javascript_include_tag "comment_order.js" %>
... ... @@ -90,12 +90,14 @@
90 90 <%= select_tag 'comment_order', options_for_select({_('Oldest first')=>'oldest', _('Newest first')=>'newest'}, @comment_order) %>
91 91 <% end %>
92 92 </div>
  93 + <% end %>
93 94  
94   - <ul class="article-comments-list">
  95 + <ul class="article-comments-list">
  96 + <% if @comments.present? %>
95 97 <%= render :partial => 'comment/comment', :collection => @comments %>
96 98 <%= pagination_links @comments, :param_name => 'comment_page' %>
97   - </ul>
98   - <% end %>
  99 + <% end %>
  100 + </ul>
99 101  
100 102 <% if @page.accept_comments? %>
101 103 <div id='page-comment-form' class='page-comment-form'><%= render :partial => 'comment/comment_form', :locals =>{:url => {:controller => :comment, :action => :create}, :display_link => true, :cancel_triggers_hide => true}%></div>
... ...
app/views/memberships/index.html.erb
... ... @@ -8,11 +8,12 @@
8 8 <%= button :back, _('Go back'), :controller => 'profile_editor' %>
9 9 <% end %>
10 10  
11   -<% type_collection = [[nil, _('All')]] %>
  11 +<% type_collection = [[0, _('All')]] %>
12 12 <% type_collection += @roles.sort_by {|role| role.id}.map{|r| ["#{r.id}", r.name]} %>
13 13  
  14 +<%= javascript_include_tag "memberships_filter.js" %>
14 15 <p>
15   - <%= labelled_select(_('Filter')+': ', :filter_type, :first, :last, @filter, type_collection, :onchange => 'document.location.href = "?filter_type="+this.value')%>
  16 + <%= labelled_select(_('Filter')+': ', :filter_type, :first, :last, @filter, type_collection, :id => 'memberships_filter')%>
16 17 </p>
17 18  
18 19 <% if @memberships.empty? %>
... ...
db/migrate/20140724134601_fix_yaml_encoding.rb 0 → 100644
... ... @@ -0,0 +1,30 @@
  1 +class FixYamlEncoding < ActiveRecord::Migration
  2 + def self.up
  3 + fix_encoding(Block, 'settings')
  4 + fix_encoding(Product, 'data')
  5 + fix_encoding(Environment, 'settings')
  6 + fix_encoding(Profile, 'data')
  7 + fix_encoding(ActionTracker::Record, 'params')
  8 + fix_encoding(Article, 'setting')
  9 + end
  10 +
  11 + def self.down
  12 + puts "Warning: cannot restore original encoding"
  13 + end
  14 +
  15 + private
  16 +
  17 + def self.fix_encoding(model, param)
  18 + result = model.find(:all, :conditions => "#{param} LIKE '%!binary%'")
  19 + puts "Fixing #{result.count} rows of #{model} (#{param})"
  20 + result.each {|r| r.update_column(param, deep_fix(r.send(param)).to_yaml)}
  21 + end
  22 +
  23 + def self.deep_fix(hash)
  24 + hash.each do |value|
  25 + value.force_encoding('UTF-8') if value.is_a?(String) && !value.frozen? && value.encoding == Encoding::ASCII_8BIT
  26 + deep_fix(value) if value.respond_to?(:each)
  27 + end
  28 + end
  29 +
  30 +end
... ...
etc/pound.cfg 0 → 100644
... ... @@ -0,0 +1,44 @@
  1 +LogLevel 1
  2 +Alive 10
  3 +Client 120
  4 +TimeOut 300
  5 +Control "/var/run/pound/poundctl.socket"
  6 +
  7 +ListenHTTP
  8 + Address 192.168.1.86
  9 + Port 80
  10 + xHTTP 1
  11 + # uncomment code above if you are using chat
  12 + #Service
  13 + # URL "/http-bind.*"
  14 + # Backend
  15 + # Address 127.0.0.1
  16 + # Port 5280
  17 + # End
  18 + #End
  19 + Service
  20 + Redirect "https://mydomain.example.com"
  21 + End
  22 +End
  23 +
  24 +ListenHTTPS
  25 + Address 192.168.1.86
  26 + Port 443
  27 + Cert "/etc/noosfero/ssl/noosfero.pem"
  28 + Ciphers "ECDHE-RSA-AES256-SHA384:AES256-SHA256:RC4:HIGH:!MD5:!aNULL:!EDH:!AESGCM"
  29 + xHTTP 1
  30 + # uncomment code above if you are using chat
  31 + #Service
  32 + # URL "/http-bind.*"
  33 + # Backend
  34 + # Address 127.0.0.1
  35 + # Port 5280
  36 + # End
  37 + #End
  38 + Service
  39 + BackEnd
  40 + Address 127.0.0.1
  41 + Port 6081
  42 + End
  43 + End
  44 +End
... ...
features/manage_users.feature
... ... @@ -15,7 +15,7 @@ Background:
15 15 Scenario: deactive user
16 16 When I follow "Deactivate user" within "tr[title='Joao Silva']"
17 17 And I confirm the "Do you want to deactivate this user?" dialog
18   - Then I should see "Activate user" within "tr[title='Joao Silva']"
  18 + Then the "tr[title='Joao Silva'] td.actions a.icon-activate-user" button should be enabled
19 19  
20 20 @selenium
21 21 Scenario: activate user
... ... @@ -23,7 +23,7 @@ Background:
23 23 Given I confirm the "Do you want to deactivate this user?" dialog
24 24 When I follow "Activate user" within "tr[title='Paulo Santos']"
25 25 And I confirm the "Do you want to activate this user?" dialog
26   - Then I should see "Deactivate user" within "tr[title='Paulo Santos']"
  26 + Then the "tr[title='Paulo Santos'] td.actions a.icon-deactivate-user" button should be enabled
27 27  
28 28 @selenium
29 29 Scenario: remove user
... ... @@ -36,7 +36,7 @@ Background:
36 36 Scenario: admin user
37 37 When I follow "Set admin role" within "tr[title='Joao Silva']"
38 38 And I confirm the "Do you want to set this user as administrator?" dialog
39   - Then I should see "Reset admin role" within "tr[title='Joao Silva']"
  39 + Then the "tr[title='Joao Silva'] td.actions a.icon-reset-admin-role" button should be enabled
40 40  
41 41 @selenium
42 42 Scenario: unadmin user
... ... @@ -44,4 +44,4 @@ Background:
44 44 And I confirm the "Do you want to set this user as administrator?" dialog
45 45 When I follow "Reset admin role" within "tr[title='Paulo Santos']"
46 46 And I confirm the "Do you want to reset this user as administrator?" dialog
47   - Then I should see "Set admin role" within "tr[title='Paulo Santos']"
  47 + Then the "tr[title='Paulo Santos'] td.actions a.icon-set-admin-role" button should be enabled
... ...
features/support/selenium.rb
... ... @@ -10,7 +10,7 @@ end
10 10  
11 11 # FIXME: 'DELETE FROM ...' is being ran 3x - see cucumber.log
12 12 DatabaseCleaner.clean_with :truncation
13   -DatabaseCleaner.strategy = :truncation
  13 +DatabaseCleaner.strategy = :truncation, {:pre_count => true, :reset_ids => false}
14 14  
15 15 Before do
16 16 DatabaseCleaner.start
... ...
lib/noosfero/plugin/routes.rb
... ... @@ -24,7 +24,7 @@ Dir.glob(Rails.root.join(plugins_root, &#39;*&#39;, &#39;controllers&#39;)) do |controllers_dir|
24 24 end
25 25  
26 26 match 'plugin/' + plugin_name + '(/:action(/:id))', :controller => plugin_name + '_plugin'
27   - match 'profile/:profile/plugin/' + plugin_name + '(/:action(/:id))', :controller => plugin_name + '_plugin_profile'
28   - match 'myprofile/:profile/plugin/' + plugin_name + '(/:action(/:id))', :controller => plugin_name + '_plugin_myprofile'
  27 + match 'profile/:profile/plugin/' + plugin_name + '(/:action(/:id))', :controller => plugin_name + '_plugin_profile', :profile => /#{Noosfero.identifier_format}/
  28 + match 'myprofile/:profile/plugin/' + plugin_name + '(/:action(/:id))', :controller => plugin_name + '_plugin_myprofile', :profile => /#{Noosfero.identifier_format}/
29 29 match 'admin/plugin/' + plugin_name + '(/:action(/:id))', :controller => plugin_name + '_plugin_admin'
30 30 end
... ...
lib/tasks/plugins_tests.rake
1 1 @all_plugins = Dir.glob('plugins/*').map { |f| File.basename(f) } - ['template']
  2 +@all_plugins.sort!
2 3 @all_tasks = [:units, :functionals, :integration, :cucumber, :selenium]
3 4  
4 5 def enabled_plugins
... ... @@ -110,7 +111,7 @@ def run_cucumber(profile, files)
110 111 sh 'xvfb-run', 'ruby', '-S', 'cucumber', '--profile', profile.to_s, '--format', ENV['CUCUMBER_FORMAT'] || 'progress' , *files
111 112 end
112 113  
113   -def custom_run(name, files, run=:individually)
  114 +def custom_run(name, files, run=:all)
114 115 case run
115 116 when :all
116 117 run_test name, files
... ... @@ -122,7 +123,7 @@ def custom_run(name, files, run=:individually)
122 123 end
123 124 end
124 125  
125   -def run_tests(name, plugins, run=:individually)
  126 +def run_tests(name, plugins, run=:all)
126 127 plugins = Array(plugins)
127 128 glob = "plugins/{#{plugins.join(',')}}/test/#{task2folder(name)}/**/*.#{task2ext(name)}"
128 129 files = Dir.glob(glob)
... ... @@ -169,7 +170,7 @@ def test_sequence(plugins, tasks)
169 170 fail 'There are broken tests to be fixed!' if fail_flag
170 171 end
171 172  
172   -def plugin_test_task(plugin, task, run=:individually)
  173 +def plugin_test_task(plugin, task, run=:all)
173 174 desc "Run #{task} tests for #{plugin_name(plugin)}"
174 175 task task do
175 176 test_sequence(plugin, task)
... ...
plugins/display_content/lib/display_content_block.rb
... ... @@ -120,7 +120,7 @@ class DisplayContentBlock &lt; Block
120 120 nodes_conditions = nodes.blank? ? '' : " AND articles.id IN(:nodes) "
121 121 nodes_conditions += ' OR articles.parent_id IN(:nodes) ' if !nodes.blank? && display_folder_children
122 122  
123   - docs = owner.articles.find(:all, :conditions => ["articles.type IN(:types) #{nodes.blank? ? '' : nodes_conditions}", {:nodes => self.nodes, :types => self.types}], :include => :profile)
  123 + docs = owner.articles.find(:all, :conditions => ["articles.type IN(:types) #{nodes.blank? ? '' : nodes_conditions}", {:nodes => self.nodes, :types => self.types}], :include => [:profile, :image, :tags])
124 124 proc do
125 125 block.block_title(block.title) +
126 126 content_tag('ul', docs.map {|item|
... ...
plugins/people_block/controllers/people_block_plugin_profile_controller.rb
... ... @@ -4,7 +4,7 @@ class PeopleBlockPluginProfileController &lt; ProfileController
4 4  
5 5 def members
6 6 if is_cache_expired?(profile.members_cache_key(params))
7   - if(params[:role_key])
  7 + unless params[:role_key].blank?
8 8 role = Role.find_by_key_and_environment_id(params[:role_key], profile.environment)
9 9 @members = profile.members.with_role(role.id).includes(relations_to_include).paginate(:per_page => members_per_page, :page => params[:npage])
10 10 @members_title = role.name
... ...
plugins/people_block/test/functional/people_block_plugin_profile_controller_test.rb
... ... @@ -34,7 +34,7 @@ class PeopleBlockPluginProfileControllerTest &lt; ActionController::TestCase
34 34 attr_accessor :profile, :block, :admin, :member, :moderator
35 35  
36 36 should 'list members without role_key' do
37   - get :members, :profile => profile.identifier
  37 + get :members, :profile => profile.identifier, :role_key => ""
38 38 assert_response :success
39 39 assert_template 'members'
40 40 assert_equivalent [@admin, @member, @moderator], assigns(:members)
... ...
plugins/relevant_content/lib/relevant_content_plugin/relevant_content_block.rb
... ... @@ -18,6 +18,8 @@ class RelevantContentPlugin::RelevantContentBlock &lt; Block
18 18 settings_items :show_most_disliked, :type => :boolean, :default => 0
19 19 settings_items :show_most_voted, :type => :boolean, :default => 1
20 20  
  21 + attr_accessible :limit, :show_most_voted, :show_most_disliked, :show_most_liked, :show_most_commented, :show_most_read
  22 +
21 23 include ActionView::Helpers
22 24 include Rails.application.routes.url_helpers
23 25  
... ...
public/javascripts/chat.js
... ... @@ -99,7 +99,7 @@ jQuery(function($) {
99 99 },
100 100  
101 101 render_body_message: function(body) {
102   - body = body.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/\r?\n/g, '<br>');
  102 + body = body.replace(/\r?\n/g, '<br>');
103 103 body = $().emoticon(body);
104 104 body = linkify(body, {
105 105 callback: function(text, href) {
... ... @@ -320,7 +320,7 @@ jQuery(function($) {
320 320 var jid_id = Jabber.jid_to_id(jid);
321 321 var name = Jabber.name_of(jid_id);
322 322 create_conversation_tab(name, jid_id);
323   - Jabber.show_message(jid, name, message.body, 'other', Strophe.getNodeFromJid(jid));
  323 + Jabber.show_message(jid, name, escape_html(message.body), 'other', Strophe.getNodeFromJid(jid));
324 324 $.sound.play('/sounds/receive.wav');
325 325 return true;
326 326 },
... ... @@ -336,7 +336,7 @@ jQuery(function($) {
336 336 // is a message from another user, not mine
337 337 else if ($own_name != name) {
338 338 var jid = Jabber.rooms[Jabber.jid_to_id(message.from)][name];
339   - Jabber.show_message(message.from, name, message.body, name, Strophe.getNodeFromJid(jid));
  339 + Jabber.show_message(message.from, name, escape_html(message.body), name, Strophe.getNodeFromJid(jid));
340 340 $.sound.play('/sounds/receive.wav');
341 341 }
342 342 return true;
... ... @@ -432,7 +432,7 @@ jQuery(function($) {
432 432 .c('body').t(body).up()
433 433 .c('active', {xmlns: Strophe.NS.CHAT_STATES});
434 434 Jabber.connection.send(message);
435   - Jabber.show_message(jid, $own_name, body, 'self', Strophe.getNodeFromJid(Jabber.connection.jid));
  435 + Jabber.show_message(jid, $own_name, escape_html(body), 'self', Strophe.getNodeFromJid(Jabber.connection.jid));
436 436 },
437 437  
438 438 is_a_room: function(jid_id) {
... ... @@ -632,6 +632,13 @@ jQuery(function($) {
632 632 }
633 633 }
634 634  
  635 + function escape_html(body) {
  636 + return body
  637 + .replace(/&/g, '&amp;')
  638 + .replace(/</g, '&lt;')
  639 + .replace(/>/g, '&gt;');
  640 + }
  641 +
635 642 });
636 643  
637 644 function checkTime(i) {
... ...
public/javascripts/memberships_filter.js 0 → 100644
... ... @@ -0,0 +1,6 @@
  1 +jQuery(document).ready(function($){
  2 + $("#memberships_filter").change(function(){
  3 + var filter = $(this).find("option:selected").val();
  4 + redirect_to('?filter_type=' + filter);
  5 + });
  6 +});
... ...
test/functional/cms_controller_test.rb
... ... @@ -1791,6 +1791,14 @@ class CmsControllerTest &lt; ActionController::TestCase
1791 1791 assert_equal other_person, a.created_by
1792 1792 end
1793 1793  
  1794 + should 'continue on the same page, when no group is selected' do
  1795 + c = Community.create!(:name => 'test comm', :identifier => 'test_comm')
  1796 + c.affiliate(profile, Profile::Roles.all_roles(c.environment.id))
  1797 + article = profile.articles.create!(:name => 'something intresting', :body => 'ruby on rails')
  1798 + post :publish, :profile => profile.identifier, :id => article.id, :marked_groups => {c.id.to_s => {}}
  1799 + assert_template 'cms/publish'
  1800 + end
  1801 +
1794 1802 protected
1795 1803  
1796 1804 # FIXME this is to avoid adding an extra dependency for a proper JSON parser.
... ...
test/functional/friends_controller_test.rb
... ... @@ -36,12 +36,12 @@ class FriendsControllerTest &lt; ActionController::TestCase
36 36  
37 37 should 'actually remove friend' do
38 38 profile.add_friend(friend)
  39 + friend.add_friend(profile)
39 40  
40   - assert_difference 'Friendship.count', -1 do
  41 + assert_difference 'Friendship.count', -2 do
41 42 post :remove, :id => friend.id, :confirmation => '1'
42 43 assert_redirected_to :action => 'index'
43 44 end
44   - assert_equal friend, Profile.find(friend.id)
45 45 end
46 46  
47 47 should 'display find people button' do
... ...
test/integration/manage_friendships_test.rb 0 → 100644
... ... @@ -0,0 +1,37 @@
  1 +require "#{File.dirname(__FILE__)}/../test_helper"
  2 +
  3 +class ManageFriendshipsTest < ActionController::IntegrationTest
  4 +
  5 + def setup
  6 + FriendsController.any_instance.stubs(:get_layout).returns('application')
  7 + ProfileController.any_instance.stubs(:get_layout).returns('application')
  8 +
  9 + Friendship.delete_all
  10 + Person.delete_all
  11 + @person = create_user("albert", :password => 'test',
  12 + :password_confirmation => 'test').person
  13 + @person.user.activate
  14 +
  15 + @friend = fast_create(Person, :identifier => "isaac")
  16 +
  17 + login(@person.identifier, 'test')
  18 + end
  19 +
  20 + should 'remove friendships' do
  21 + @person.add_friend(@friend)
  22 + @friend.add_friend(@person)
  23 +
  24 + get "/myprofile/#{@person.identifier}/friends/remove/#{@friend.id}"
  25 + assert_response :success
  26 +
  27 + post "/myprofile/#{@person.identifier}/friends/remove/#{@friend.id}",
  28 + :confirmation => '1'
  29 + assert_response :redirect
  30 +
  31 + follow_redirect!
  32 +
  33 + assert assigns(:friends).empty?
  34 + assert !@person.is_a_friend?(@friend)
  35 + assert !@friend.is_a_friend?(@person)
  36 + end
  37 +end
... ...
test/test_helper.rb
... ... @@ -277,16 +277,4 @@ class ActionController::IntegrationTest
277 277  
278 278 end
279 279  
280   -def with_constants(constants, &block)
281   - old_constants = Hash.new
282   - constants.each do |constant, val|
283   - old_constants[constant] = Object.const_get(constant)
284   - silence_stderr{ Object.const_set(constant, val) }
285   - end
286   - block.call
287   - old_constants.each do |constant, val|
288   - silence_stderr{ Object.const_set(constant, val) }
289   - end
290   -end
291   -
292 280 Profile
... ...
test/unit/application_helper_test.rb
... ... @@ -472,13 +472,13 @@ class ApplicationHelperTest &lt; ActionView::TestCase
472 472 profile = mock
473 473 profile.stubs(:theme).returns('some-theme')
474 474 stubs(:profile).returns(profile)
475   - with_constants :NOOSFERO_CONF => {'gravatar' => 'crazyvatar'} do
476   - assert_equal gravatar_default, 'crazyvatar'
477   - end
  475 +
  476 + NOOSFERO_CONF.stubs(:[]).with('gravatar').returns('crazyvatar')
  477 + assert_equal gravatar_default, 'crazyvatar'
  478 +
478 479 stubs(:theme_option).returns('gravatar' => 'nicevatar')
479   - with_constants :NOOSFERO_CONF => {'gravatar' => 'crazyvatar'} do
480   - assert_equal gravatar_default, 'nicevatar'
481   - end
  480 + NOOSFERO_CONF.stubs(:[]).with('gravatar').returns('nicevatar')
  481 + assert_equal gravatar_default, 'nicevatar'
482 482 end
483 483  
484 484 should 'use theme passed via param when in development mode' do
... ...
test/unit/external_feed_test.rb
... ... @@ -142,7 +142,7 @@ class ExternalFeedTest &lt; ActiveSupport::TestCase
142 142 should 'save hour when feed was fetched' do
143 143 external_feed = create(:external_feed)
144 144  
145   - now = Time.parse('2009-01-23 09:35')
  145 + now = Time.zone.parse('2009-01-23 09:35')
146 146 Time.stubs(:now).returns(now)
147 147  
148 148 external_feed.finish_fetch
... ...
test/unit/friendship_test.rb
... ... @@ -58,4 +58,18 @@ class FriendshipTest &lt; ActiveSupport::TestCase
58 58 assert_equal ['a'], ta.get_friend_name
59 59 end
60 60  
  61 + should 'remove friendships when a friend removal occurs' do
  62 + p1 = create_user('testuser1').person
  63 + p2 = create_user('testuser2').person
  64 + p1.add_friend(p2, 'friends')
  65 + p2.add_friend(p1, 'friends')
  66 +
  67 + assert_difference 'Friendship.count', -2 do
  68 + Friendship.remove_friendship(p1, p2)
  69 + end
  70 +
  71 + assert_not_includes p1.friends(true), p2
  72 + assert_not_includes p2.friends(true), p1
  73 + end
  74 +
61 75 end
... ...
test/unit/google_maps_test.rb
... ... @@ -3,13 +3,12 @@ require File.dirname(__FILE__) + &#39;/../test_helper&#39;
3 3 class GoogleMapsTest < ActiveSupport::TestCase
4 4  
5 5 should 'provide initial_zoom setting' do
6   - with_constants :NOOSFERO_CONF => {'googlemaps_initial_zoom' => 2} do
7   - assert_equal 2, GoogleMaps.initial_zoom
8   - end
  6 + NOOSFERO_CONF.stubs(:[]).with('googlemaps_initial_zoom').returns(2)
  7 + assert_equal 2, GoogleMaps.initial_zoom
9 8 end
10 9  
11 10 should 'use 4 as default initial_zoom' do
12   - GoogleMaps.stubs(:config).returns({})
  11 + NOOSFERO_CONF.stubs(:[]).with('googlemaps_initial_zoom').returns(nil)
13 12 assert_equal 4, GoogleMaps.initial_zoom
14 13 end
15 14  
... ...
test/unit/mail_conf_test.rb
... ... @@ -3,22 +3,22 @@ require File.dirname(__FILE__) + &#39;/../test_helper&#39;
3 3 class MailConfTest < ActiveSupport::TestCase
4 4  
5 5 should 'enable if told to' do
6   - NOOSFERO_CONF['mail_enabled'] = true
  6 + NOOSFERO_CONF.stubs(:[]).with('mail_enabled').returns(true)
7 7 assert_equal true, MailConf.enabled?
8 8 end
9 9  
10 10 should 'disable if told to' do
11   - NOOSFERO_CONF['mail_enabled'] = false
  11 + NOOSFERO_CONF.stubs(:[]).with('mail_enabled').returns(false)
12 12 assert_equal false, MailConf.enabled?
13 13 end
14 14  
15 15 should 'disable by default' do
16   - NOOSFERO_CONF['mail_enabled'] = nil
  16 + NOOSFERO_CONF.stubs(:[]).with('mail_enabled').returns(nil)
17 17 assert_equal false, MailConf.enabled?
18 18 end
19 19  
20 20 should 'provide webmail url preference' do
21   - NOOSFERO_CONF['webmail_url'] = 'http://some.url/webmail/%s/%s'
  21 + NOOSFERO_CONF.stubs(:[]).with('webmail_url').returns('http://some.url/webmail/%s/%s')
22 22 assert_equal 'http://some.url/webmail/login/example.com', MailConf.webmail_url('login', 'example.com')
23 23 end
24 24  
... ...
util/chat/ejabberd.cfg 0 → 100644
... ... @@ -0,0 +1,74 @@
  1 +%%%
  2 +%%% Noosfero ejabberd configuration file
  3 +%%% This config must be in UTF-8 encoding
  4 +%%%
  5 +
  6 +{acl, admin, {user, "admin", "mydomain.example.com"}}.
  7 +{hosts, ["mydomain.example.com"]}.
  8 +
  9 +{loglevel, 4}.
  10 +{listen,
  11 + [
  12 + {5222, ejabberd_c2s, [
  13 + {access, c2s},
  14 + {shaper, c2s_shaper},
  15 + {max_stanza_size, 65536},
  16 + starttls, {certfile, "/etc/ejabberd/ejabberd.pem"}
  17 + ]},
  18 + {5280, ejabberd_http, [
  19 + http_bind,
  20 + http_poll
  21 + ]}
  22 + ]}.
  23 +{max_fsm_queue, 1000}.
  24 +{auth_method, odbc}.
  25 +{odbc_server, "DSN=PostgreSQLEjabberdNoosfero"}.
  26 +{shaper, normal, {maxrate, 10000000}}.
  27 +{shaper, fast, {maxrate, 50000}}.
  28 +{acl, local, {user_regexp, ""}}.
  29 +{access, max_user_sessions, [{10, all}]}.
  30 +{access, local, [{allow, local}]}.
  31 +{access, c2s, [{deny, blocked},
  32 + {allow, all}]}.
  33 +{access, c2s_shaper, [{none, admin},
  34 + {normal, all}]}.
  35 +{access, announce, [{allow, admin}]}.
  36 +{access, configure, [{allow, admin}]}.
  37 +{access, muc_admin, [{allow, admin}]}.
  38 +{access, muc, [{allow, all}]}.
  39 +{access, pubsub_createnode, [{allow, all}]}.
  40 +{language, "pt"}.
  41 +{modules,
  42 + [
  43 + {mod_adhoc, []},
  44 + {mod_announce, [{access, announce}]}, % requires mod_adhoc
  45 + {mod_caps, []},
  46 + {mod_configure,[]}, % requires mod_adhoc
  47 + {mod_disco, []},
  48 + {mod_last, []},
  49 + {mod_muc, [
  50 + {access, muc},
  51 + {access_create, muc},
  52 + {access_persistent, muc},
  53 + {access_admin, muc_admin},
  54 + {max_users, 500},
  55 + {default_room_options, [{anonymous, false}]}
  56 + ]},
  57 + {mod_privacy_odbc, []},
  58 + {mod_private_odbc, []},
  59 + {mod_proxy65, [
  60 + {access, local},
  61 + {shaper, c2s_shaper}
  62 + ]},
  63 + {mod_roster_odbc, []},
  64 + {mod_stats, []},
  65 + {mod_time, []},
  66 + {mod_vcard, []},
  67 + {mod_http_bind, []},
  68 + {mod_version, []}
  69 + ]}.
  70 +
  71 +%%% Local Variables:
  72 +%%% mode: erlang
  73 +%%% End:
  74 +%%% vim: set filetype=erlang tabstop=8:
... ...
util/chat/odbc.ini 0 → 100644
... ... @@ -0,0 +1,16 @@
  1 +[PostgreSQLEjabberdNoosfero]
  2 +Description = PostgreSQL Noosfero ejabberd database
  3 +Driver = PostgreSQL Unicode
  4 +Trace = No
  5 +TraceFile = /tmp/psqlodbc.log
  6 +Database = noosfero
  7 +Servername = localhost
  8 +UserName = noosfero
  9 +Password = <copy the password present in the database.yml file>
  10 +Port =
  11 +ReadOnly = No
  12 +RowVersioning = No
  13 +ShowSystemTables = No
  14 +ShowOidColumn = No
  15 +FakeOidIndex = No
  16 +ConnSettings = SET search_path TO ejabberd
... ...
util/chat/odbcinst.ini 0 → 100644
... ... @@ -0,0 +1,7 @@
  1 +[PostgreSQL Unicode]
  2 +Description = PostgreSQL ODBC driver (Unicode version)
  3 +Driver = /usr/lib/odbc/psqlodbcw.so
  4 +Setup = /usr/lib/odbc/libodbcpsqlS.so
  5 +Debug = 0
  6 +CommLog = 1
  7 +UsageCount = 3
... ...