Commit Graph

68 Commits

Author SHA1 Message Date
Javi Martín
ae2576020e Extract method to use WYSIWYGSanitizer in views
This is similar to methods we use like `sanitize` or `markdown`.
2019-10-21 21:32:02 +02:00
Javi Martín
6b1864fbcd Sanitize translations instead of using _html
Using the `_html` suffix in an i18n key is the same as using `html_safe`
on it, which means that translation could potentially be used for XSS
attacks.
2019-10-09 19:46:47 +02:00
Javi Martín
b66859945e Remove _html suffix from already sanitized texts
Using the `_html` suffix automatically marks texts as HTML safe, so
doing so on sanitized texts is redundant.

Note flash texts are not sanitized the moment they are generated, but
are sanitized when displayed in the view.
2019-10-09 19:46:47 +02:00
Javi Martín
928312e218 Use sanitize in translations with links
Sometimes we're interpolating a link inside a translation, and marking
the whole translations as HTML safe.

However, some translations added by admins to the database or through
crowdin are not entirely under our control.

Although AFAIK crowdin checks for potential cross-site scripting
attacks, it's a good practice to sanitize parts of a string potentially
out of our control before marking the string as HTML safe.
2019-10-08 18:46:21 +02:00
Javi Martín
56f690b8a9 Use attributes in translations with sanitize
There's a slight chance an attribute like an author's name might contain
an attempt to perform XSS attacks. So, instead of marking the whole text
as HTML safe, we can sanitize it.

Also note I'm removing the `_html` suffix in the i18n key, since it's
got the same effect as using `html_safe`.
2019-10-08 18:46:21 +02:00
Javi Martín
2aabf79fb4 Rename methods to add auto links to HTML
The name `safe_html_with_links` was confusing and could make you think
it takes care of making the HTML safe. So I've renamed it in a way that
makes it a bit more intuitive that it expects its input to be already
sanitized.

I've changed `text_with_links` as well so now the two method names
complement each other.
2019-10-08 18:46:20 +02:00
Javi Martín
0f485308b7 Sanitize CKEditor content before displaying it
It's possible to create a newsletter or a proposed action with
<script> tags by filling in the body using a textarea instead of a
CKEditor. While we trust our administrators not to do so, it's better to
completely eliminate that possibility.
2019-10-08 18:46:20 +02:00
Javi Martín
f9ed186909 Add rubocop spacing rules
We were following these rules in most places; we just didn't define them
anywhere.
2019-09-10 21:04:56 +02:00
Javi Martín
c62da726b8 Apply SpaceAroundErbTag ERB Lint rule 2019-09-10 20:02:15 +02:00
Javi Martín
71d9ddd849 Apply rule to end files with a newline character 2019-09-10 20:02:15 +02:00
lalo
28815cb290 Create new email template for new evaluation comment created and add it to system_emails view 2019-06-05 16:22:12 +02:00
voodoorai2000
d0b8fef6b3 Delete spending proposals 2019-05-31 18:22:59 +02:00
Julian Herrero
f6489bc604 Use double quotes in app/views 2019-03-19 12:33:07 +01:00
Julian Herrero
00bd7008bb Show all system emails in Admin section 2019-02-22 16:13:49 +01:00
decabeza
f2ec836587 Removes custom content on mailers 2018-07-30 17:57:25 +02:00
Bertocq
ac9f85e208 Change Proposal Notification Digest link to anchor
On the proposal notification digest messages there was a link to each
notification. Instead we need that link to point towards the notifications
tab of the proposal.
2018-07-25 20:20:33 +02:00
María Checa
20173f9870 Added newsletter mailer method and view 2018-02-13 13:12:00 +01:00
decabeza
962dd097b7 fixes i18n 2017-05-12 19:12:19 +02:00
decabeza
e8be4508fd improves i18n of budgets mailers 2017-05-12 18:50:03 +02:00
rgarcia
712e576e75 adds email delivery of selected and unselected investments 2017-05-12 13:57:31 +02:00
decabeza
6217dbae63 adds new i18n on budget investment unselected mailer 2017-05-12 12:47:57 +02:00
decabeza
7a803999bd adds missing td tag on budget investment created mailer 2017-05-12 12:43:52 +02:00
decabeza
53d3282d8b adds budget mailer for selected and unselected 2017-05-12 12:43:30 +02:00
Alberto Garcia Cabeza
1de39edf92 adds styles and i18n for mailer budget investment created 2017-01-15 13:52:09 +01:00
rgarcia
68bf119c18 sends unfeasible budget investment 2017-01-14 17:02:33 +01:00
rgarcia
82322ee233 sends budget investment created email 2017-01-14 16:10:43 +01:00
Alberto Garcia Cabeza
e8312ff86a fixes text format on direct messages 2016-10-18 16:40:59 +02:00
rgarcia
745de9bb77 sends invitation email to users 2016-06-27 23:37:58 +02:00
Alberto Garcia Cabeza
0bb948a013 Updates mailer texts 2016-06-27 16:01:03 +02:00
Alberto Garcia Cabeza
a2a2960867 Adds mailer template for user invites 2016-06-27 15:37:45 +02:00
Alberto Garcia Cabeza
3299b595aa Adds info text on proposal notification digest 2016-06-20 16:28:56 +02:00
rgarcia
18dd9c95f3 fixes specs 2016-06-16 12:06:26 +02:00
Alberto Garcia Cabeza
9f7b49838d Improves texts for the sender's email 2016-06-15 21:37:36 +02:00
Alberto Garcia Cabeza
c83e831cb7 Adds link to not receive direct messages 2016-06-15 21:28:17 +02:00
Alberto Garcia Cabeza
017ccfb378 Changes title and subject in email 2016-06-15 20:49:29 +02:00
Alberto Garcia Cabeza
0f1d6c1f19 Adds text in footer about not replying 2016-06-15 20:44:32 +02:00
Alberto Garcia Cabeza
0366d7efb2 Adds translations on mailer message 2016-06-15 17:55:42 +02:00
Alberto Garcia Cabeza
f606a3bcbe Adds link to unsubscribe in digest email 2016-06-15 17:33:25 +02:00
rgarcia
90148ffdca adds missing translation 2016-06-15 11:34:33 +02:00
rgarcia
cdc2bd67a4 adds correct order for email action links 2016-06-15 10:51:58 +02:00
rgarcia
28d12fe55b removes sending individual proposal notifications via email 2016-06-15 10:43:02 +02:00
rgarcia
ce6072d17b sends a copy of the direct message to the sender 2016-06-14 18:55:28 +02:00
rgarcia
6e800c5120 adds email digest for proposal notifications 2016-06-14 17:53:36 +02:00
rgarcia
0fba15b1e5 Merge branch 'proposal-notifications' of github.com:AyuntamientoMadrid/participacion into proposal-notifications 2016-06-13 16:13:22 +02:00
rgarcia
143089603c fixes specs 2016-06-13 12:33:46 +02:00
Alberto Garcia Cabeza
a417d88f91 Adds proposal notification digest mailer 2016-06-10 18:03:03 +02:00
Alberto Garcia Cabeza
988f1f645a Improves proposal notification mailer and fixes settings.scss 2016-06-10 18:02:37 +02:00
Alberto Garcia Cabeza
15af94928b Adds styles and texts for direct messages mailer 2016-06-09 16:01:38 +02:00
rgarcia
c3d06c8bd0 adds direct messages 2016-06-08 20:44:54 +02:00
Alberto Garcia Cabeza
e550a40f90 Adds share and comment button on email 2016-06-07 16:12:16 +02:00