Commit Graph

34 Commits

Author SHA1 Message Date
Javi Martín
3cd4f3827e Hide what users are following unless they allow it
It could be argued that seeing which proposals a user follows is a good
indicator of which proposals a user has supported, since we're
automatically creating follows for supported proposals since commit
74fbde09f. So now, we're extending the `public_interests` funcionality,
so it only shows elements users are following if they've enabled it.

This is an improvement over using the `public_activity` attribute in two
ways:

* The `public_interests` attribute is disabled by default, so by default
  other users won't be able to see what a user is following
* Who has created proposals/debates/investments/comments is public
  information, while who is following which elements is not; so enabling
  `public_activity` shouldn't imply potentially private information should
  be displayed as well

We've considered removing the `public_interests` attribute completely
and just hiding the "following" page for everyone except its owner, but
keeping it provides more compatibility with existing installations.
2021-10-05 14:43:09 +02:00
Javi Martín
64258baf97 Refactor getting the public activity information
We had similar conditions many times and some duplication, particularly
between the code getting records and the code counting records. We can
remove it by returning a generic scope and calling the `count` method to
count the records and the `order` and `page` methods when we want to
pass the records to the view. And, since we only display one partial per
request, we can simplify the code to render all the partials. There's
one minor disadvantage to this approach: searching the code for the
place where these partials are rendered is now a bit harder since
searching the code for something like "render (.+) budget_investments"
won't return any results.

We're also writing conditions about a certain filter just once, by
setting `valid_filters`. This greatly simplifies the logic, although
again there's one minor disadvantage: we have to implement the
`current_filter` method, duplicating the logic already defined in the
`HasFilters` concern.
2021-10-05 14:40:36 +02:00
Javi Martín
62b23f1e56 Extract component to show a user's public activity 2021-10-05 13:26:30 +02:00
Javi Martín
274abaf290 Remove unused method in users controller
It isn't used since commit fc57bad1c.
2021-10-05 13:26:30 +02:00
Javi Martín
1b34c061bb Use where.not instead of where(NOT IN)
This way we simplify the code a bit and reduce our usage of raw SQL.
2020-07-14 12:32:12 +02:00
Javi Martín
db97f9d08c Add and apply rubocop rules for empty lines
We were very inconsistent regarding these rules.

Personally I prefer no empty lines around blocks, clases, etc... as
recommended by the Ruby style guide [1], and they're the default values
in rubocop, so those are the settings I'm applying.

The exception is the `private` access modifier, since we were leaving
empty lines around it most of the time. That's the default rubocop rule
as well. Personally I don't have a strong preference about this one.


[1] https://rubystyle.guide/#empty-lines-around-bodies
2019-10-24 17:11:47 +02:00
Javi Martín
b5b07bccd3 Apply PercentLiteralDelimiters rubocop rule 2019-09-10 20:02:15 +02:00
Javi Martín
e445e14d65 Use ActiveSupport::HashWithIndifferentAccess
Using `HashWithIndifferentAccess` directly will be deprecated in Rails
5.1.
2019-05-28 14:23:54 +02:00
decabeza
eda6ea7f12 Merge branch 'master' into dashboard 2019-03-26 16:45:48 +01:00
Julian Herrero
c82b2a975a Add new settings tab for participation processes
- Rename setting keys
- New tab por participation processes
- Hide these settings from features tab
2019-03-19 19:45:32 +01:00
Julian Herrero
d24376f6ad Use double quotes in controllers/ 2019-03-13 22:19:49 +01:00
Juan Salvador Pérez García
77dd60427d Implements story #136
Adds draft state for proposals
2018-07-17 17:46:54 +02:00
rgarcia
88cde6d018 Deal gracefully with hidden followable in my activity
We were seeing an exception when a user was following a proposal and
that proposal becomes hidden

With this commit we are skipping this proposals and hopefully fixing
this exception

We are also adjusting the count of followed proposals, without
including hidden proposals. It might be cleaner, to remove a `Follow`
when its `Followable` becomes hidden. But then we should probably
activate the `Follow` again if the `Followable` becomes non-hidden…

For now this commit should suffice 😌
2018-07-10 17:50:51 +02:00
Bertocq
c0dcd03bab Prevent valuation comments from appearing in public pages 2018-01-31 18:14:11 +01:00
Bertocq
7d406cae76 Rubocop autocorrections 2017-07-25 13:01:03 +02:00
rgarcia
b7ef755b16 minor refactoring for follows 2017-07-19 13:52:38 +02:00
taitus
cef67c50a8 Increased test coverage to Following user public page. 2017-07-13 20:33:58 +02:00
taitus
b0c571e658 Do not display send notification button when proposal is from another author. 2017-07-13 20:33:57 +02:00
Alessandro Cuoghi
556e2598c3 Remove margin bottom in the table inside accordion. Divided into groups of 10 interests. Inserted interests in columns. 2017-07-13 20:29:36 +02:00
taitus
7e2e94d709 Add following tab to user public page. 2017-07-13 20:29:34 +02:00
Senén Rodero Rodríguez
4b2310c135 Move and refactor method from follow to user model to get user interests. Add specification to check the discard of duplicate interests. 2017-07-07 15:18:34 +02:00
taitus
19820e4432 Add public interests validation and show interests on user profile 2017-07-07 13:34:43 +02:00
Bertocq
c9bc028524 Remove all unnecesary extra spacing and Layout/ExtraSpacing list from rubocop file 2017-06-28 14:12:51 +02:00
Bertocq
78efccc197 Fix all Layout/EmptyLinesAroundAccessModifier rubocop issues and remove files from rubocop_todo list 2017-06-25 15:46:46 +02:00
Juanjo Bazán
053a3e7b41 makes user page to show only active feature comments 2017-01-10 21:28:04 +01:00
kikito
cb7ea79aaf Replaces spending proposals by budget investments in user/show 2016-09-09 12:19:38 +02:00
rgarcia
6e4ed0b895 adds link to send message from my activity 2016-06-01 21:01:24 +02:00
Juanjo Bazán
fd8fb49015 hides retire link if no author/admin 2016-05-06 12:18:38 +02:00
rgarcia
6221c70027 does not display spending proposals when filtering my activity 2016-02-21 21:35:10 +01:00
rgarcia
7699b99655 allows authors and admins to view their spending proposals in my activity 2016-02-21 18:02:55 +01:00
Juanjo Bazán
19212a6b46 fixes 'My activity' comments count for admins/mods 2015-11-17 19:40:18 +01:00
Juanjo Bazán
1ca7ca6e05 hides comments posted as mod/admin from user page 2015-11-12 12:22:21 +01:00
Juanjo Bazán
f57eef4929 makes public activity toggleable 2015-11-04 13:51:31 +01:00
Juanjo Bazán
7f1fe034a3 adds user's public show page 2015-11-03 19:29:35 +01:00