Commit Graph

31 Commits

Author SHA1 Message Date
Andy Sims
74fbde09f1 Support creates follow (Merge pull request #3895)
* Supporting a proposal will create a follow relationship
* Only followers receive notifications
2020-04-06 15:26:47 +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
7ca55c44e0 Apply Rails/SaveBang rubocop rule
Having exceptions is better than having silent bugs.

There are a few methods I've kept the same way they were.

The `RelatedContentScore#score_with_opposite` method is a bit peculiar:
it creates scores for both itself and the opposite related content,
which means the opposite related content will try to create the same
scores as well.

We've already got a test to check `Budget::Ballot#add_investment` when
creating a line fails ("Edge case voting a non-elegible investment").

Finally, the method `User#send_oauth_confirmation_instructions` doesn't
update the record when the email address isn't already present, leading
to the test "Try to register with the email of an already existing user,
when an unconfirmed email was provided by oauth" fo fail if we raise an
exception for an invalid user. That's because updating a user's email
doesn't update the database automatically, but instead a confirmation
email is sent.

There are also a few false positives for classes which don't have bang
methods (like the GraphQL classes) or destroying attachments.

For these reasons, I'm adding the rule with a "Refactor" severity,
meaning it's a rule we can break if necessary.
2019-10-23 14:39:31 +02:00
Javi Martín
d0d1c9972c Remove unused variables following their parent
There's a very common pattern in our test, where the setup only has two
lines:

variable = create(:something)
unused_variable = create(:something_else, something: variable)

In this case, since there's a blank line below these ones and then we'll
get to the body of the test, and the second variable is going to be
created based on the first variable, we can remove the useless
assignment and the readability is still OK.

Another option we almost unanimously discarded was:

variable = create(:something)
_unused_variable = create(:something_else, something: variable)

We don't use it anywhere else, either.

One more option we considered but found a bit too much for simple tests:

variable = create(:something) do |something|
  create(:something_else, something: variable)
end

Then of course we could move the setup to `let` and `before` blocks, but
the tests could get over-structured really quickly.
2019-09-30 15:47:13 +02:00
decabeza
abf04bea4c Add related content section on proposal dashboard 2019-09-11 19:45:19 +02:00
Javi Martín
a21240b230 Use Date.current and Time.current
Using Date.today and Time.now might lead to inconsistencies if the time
zone the application uses is not the same as the system time zone.
2019-08-28 20:32:40 +02:00
decabeza
4c5b2723f4 Create new messages section for proposal's dashboard 2019-05-31 11:42:15 +02:00
Javi Martín
307cf24846 Use describe on feature tests
The `type: :feature` is automatically detected by RSpec because these
tests are inside the `spec/features` folder. Using `feature` re-adds a
`type: :feature` to these files, which will result in a conflict when we
upgrade to Rails 5.1's system tests.

Because of this change, we also need to change `background` to `before`
or else these tests will fail.
2019-05-28 16:36:54 +02:00
decabeza
9f973bf789 Add message on dashboard request to archived proposals 2019-04-29 15:46:44 +02:00
voodoorai2000
dfbdc0568c Allow actions to be unexecuted
Before actions could be marked as executed. With this commit we are also allowing actions to be marked as unexecuted.
2019-04-29 15:43:53 +02:00
decabeza
0994ef2342 Hide request to admin button for archived proposals 2019-04-24 14:08:22 +02:00
decabeza
4100bf2ddf Update dashboard specs 2019-04-24 14:00:38 +02:00
decabeza
c76b465ce8 Show message when request a resource to admins 2019-04-24 13:58:42 +02:00
decabeza
5b8fe4bb98 Add truncate to proposed action description
The show description link only appears if the description is longer than defined length.
2019-04-24 13:58:37 +02:00
decabeza
91be3cf775 Fix more hound warnings 2019-03-27 15:22:14 +01:00
Alberto
29a87e2746 Merge branch 'dashboard' into dashboard-polish 2019-03-26 12:19:20 +01:00
taitus
a1de5b2334 Display tag "new" on actions
An author will see a "new" tag on each action or resource that has appeared on his dashboard since his last login.
Too add "new" tag on dashbord menu when there are new resources.
2019-03-21 12:29:31 +01:00
decabeza
d07a8712bf Remove duplicated spec
Same spec on line 115
2019-03-19 18:25:48 +01:00
decabeza
3f1d3f3443 Fix hound warnings 2019-03-19 18:24:49 +01:00
Alberto
7b2258aeb0 Merge pull request #3263 from Platoniq/dashboard-recommended-actions-page
Dashboard recommended actions page
2019-03-19 16:21:28 +01:00
taitus
9fac661f0c Create scope by_proposal
Add to active_for class method and to active_resources controller method the new scope by_proposal.
 - Published proposal: display all actions.
 - Draft proposal: only display actions for draft proposals.
2019-02-10 00:18:50 +01:00
Alessandro Cuoghi
2e9973cd4a Add new texts
- Changed texts
- Fixed Spec
2019-02-04 16:20:44 +01:00
taitus
487c485fe0 Add new section on sidebar menu for recommended proposals
- Display recommended_proposals on new section as goals with toogle.
- Divide recommended actions into actions done and actions pending to clarify the information to the user as summary_recomended_actions.
2019-02-04 11:48:47 +01:00
taitus
45afbc0b10 New summary for recommended actions section on progress page
- Divide recommended actions into actions done and actions pending.
- Display recomended actions as goals (diplay four by defalut) without toggle but with link to new recommended actions page.
- Display description over short_description
2019-02-04 11:39:04 +01:00
decabeza
4ea1f7732b Updates i18n on specs 2018-10-08 11:26:53 +02:00
decabeza
b7c3a918e3 Updates js class name and id name 2018-10-05 18:18:42 +02:00
Juan Salvador Pérez García
42d448248c Routes have been refactored
Dashboard routes have been refactored. Now instead of having resources
for dashboard and routes inside a dashboard namespace the proposal
routes contain a dashboar singleton containing everything related to it.
2018-09-17 15:44:45 +02:00
Juan Salvador Pérez García
5b5095b37b Bugfixing and several enhancements
* Added missing specs
* Removed models that were refactored previously
* Added simplecov when executing specs locally
* Fixed bug in poll model validation that was causing an 500 error.
2018-08-01 13:26:30 +02:00
Juan Salvador Pérez García
6cc1ddb9af Fixes #231
Implements a poster feature for the proposals dashboard
2018-07-31 12:50:25 +02:00
Juan Salvador Pérez García
8876b285ce Fixes #229
Adds email feature for proposals dashboard
2018-07-25 13:28:44 +02:00
Juan Salvador Pérez García
e5f9cf6710 Fixed #239
Proposals dashboard refactored to dashboard.
Added missing specs for the dashboard.
2018-07-24 15:52:43 +02:00