Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create user notifications while seeding #12828

Merged
merged 20 commits into from
May 27, 2024

Conversation

alecslupu
Copy link
Contributor

@alecslupu alecslupu commented May 4, 2024

🎩 What? Why?

Currently, Decidim is not adding user notifications while seeding, making it hard for users to actually see the notication page functionality.

This PR adds the Comments, Proposals and Meetings created in the Participatory Processes to the notifications list.

Testing

  1. Reseed your db or create a new dev app
  2. Boot the application
  3. Login as admin
  4. Visit notifications page
  5. See there are no notifications
  6. Apply Patch
  7. Repeat steps 1,2,3 and 4
  8. See there are notifications

♥️ Thank you!

github-actions[bot]
github-actions bot previously approved these changes May 4, 2024
github-actions[bot]
github-actions bot previously approved these changes May 4, 2024
@alecslupu alecslupu marked this pull request as ready for review May 6, 2024 07:24
@andreslucena
Copy link
Member

@alecslupu I might be doing something wrong, but I can't see the seeded notifications as admin@example.org:

Screenshot of the no notifications page

github-actions[bot]
github-actions bot previously approved these changes May 8, 2024
github-actions[bot]
github-actions bot previously approved these changes May 9, 2024
github-actions[bot]
github-actions bot previously approved these changes May 9, 2024
github-actions[bot]
github-actions bot previously approved these changes May 9, 2024
@andreslucena
Copy link
Member

More insteresting is that if i run bin/rails db:seed there is no error!

I could reproduce it in Gitpod, I don't know if that's relevant. I can try tomorrow with my desktop

@andreslucena
Copy link
Member

I could reproduce it in Gitpod, I don't know if that's relevant. I can try tomorrow with my desktop

I could play a bit more with this PR today. The buggy line is the change in the ActiveJob queue:

ActiveJob::Base.queue_adapter = :inline

By applying that change in develop and then running reseding:

bin/rails db:drop db:create db:migrate db:seed

I have the same exception.

More insteresting is that if i run bin/rails db:seed there is no error!

On this case (i.e. having that line, and running)

bin/rails db:drop db:create db:migrate
bin/rails db:seed

Gives me another exception:

Running via Spring preloader in process 396681
Creating seeds for decidim-core...
rake aborted!
Errno::ECONNREFUSED: Failed to open TCP connection to localhost:3000 (Connection refused - connect(2) for "localhost" port 3000) (Errno::ECONNREFUSED)
/home/apereira/Work/decidim/decidim/decidim-core/app/models/decidim/user.rb:315:in `send_devise_notification'
/home/apereira/Work/decidim/decidim/decidim-core/lib/decidim/core/seeds.rb:58:in `call'
/home/apereira/Work/decidim/decidim/decidim-core/db/seeds.rb:5:in `<main>'
/home/apereira/Work/decidim/decidim/decidim-core/lib/decidim/core.rb:151:in `block in seed!'
/home/apereira/Work/decidim/decidim/decidim-core/lib/decidim/core.rb:148:in `each'
/home/apereira/Work/decidim/decidim/decidim-core/lib/decidim/core.rb:148:in `seed!'
/home/apereira/Work/decidim/decidim/development_app/db/seeds.rb:9:in `<main>'
<internal:/home/apereira/.local/share/mise/installs/ruby/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:136:in `require'
<internal:/home/apereira/.local/share/mise/installs/ruby/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:136:in `require'
-e:1:in `<main>'

Caused by:
Errno::ECONNREFUSED: Connection refused - connect(2) for "localhost" port 3000 (Errno::ECONNREFUSED)
/home/apereira/Work/decidim/decidim/decidim-core/app/models/decidim/user.rb:315:in `send_devise_notification'
/home/apereira/Work/decidim/decidim/decidim-core/lib/decidim/core/seeds.rb:58:in `call'
/home/apereira/Work/decidim/decidim/decidim-core/db/seeds.rb:5:in `<main>'
/home/apereira/Work/decidim/decidim/decidim-core/lib/decidim/core.rb:151:in `block in seed!'
/home/apereira/Work/decidim/decidim/decidim-core/lib/decidim/core.rb:148:in `each'
/home/apereira/Work/decidim/decidim/decidim-core/lib/decidim/core.rb:148:in `seed!'
/home/apereira/Work/decidim/decidim/development_app/db/seeds.rb:9:in `<main>'
<internal:/home/apereira/.local/share/mise/installs/ruby/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:136:in `require'
<internal:/home/apereira/.local/share/mise/installs/ruby/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:136:in `require'
-e:1:in `<main>'
Tasks: TOP => db:seed
(See full trace by running task with --trace)

github-actions[bot]
github-actions bot previously approved these changes May 17, 2024
github-actions[bot]
github-actions bot previously approved these changes May 17, 2024
@andreslucena
Copy link
Member

@alecslupu I still have this error when running the seeds:

Creating seeds for decidim-core...
rake aborted!
Errno::ECONNREFUSED: Failed to open TCP connection to localhost:3000 (Connection refused - connect(2) for "localhost" port 3000) (Errno::ECONNREFUSED)
/home/apereira/Work/decidim/decidim/decidim-core/app/models/decidim/user.rb:315:in send_devise_notification' /home/apereira/Work/decidim/decidim/decidim-core/lib/decidim/core/seeds.rb:59:in call'
/home/apereira/Work/decidim/decidim/decidim-core/db/seeds.rb:5:in <main>' /home/apereira/Work/decidim/decidim/decidim-core/lib/decidim/core.rb:151:in block in seed!'
/home/apereira/Work/decidim/decidim/decidim-core/lib/decidim/core.rb:148:in each' /home/apereira/Work/decidim/decidim/decidim-core/lib/decidim/core.rb:148:in seed!'
/home/apereira/Work/decidim/decidim/development_app/db/seeds.rb:9:in <main>' <internal:/home/apereira/.local/share/mise/installs/ruby/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:136:in require'
internal:/home/apereira/.local/share/mise/installs/ruby/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb:136:in require' -e:1:in

'

Can you check it out please?

The command that I do is bin/rails db:drop db:create db:migrate db:seed

@andreslucena
Copy link
Member

The command that I do is bin/rails db:drop db:create db:migrate db:seed

After seeing the changes in the code, I see that I need to do bin/rails db:drop db:create db:migrate assets:precompile db:seed. Now it works well, we should check out our docs to clarify this change whenever we mention the db:seeds command:

  • docs/modules/develop/pages/guide_development_app.adoc
  • docs/modules/install/pages/index.adoc
  • docs/modules/install/pages/manual.adoc

Copy link
Member

@andreslucena andreslucena left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can confirm that it works as expected once I change the command for seeds. We need to add this change in the docs (see #12828 (comment)).

We should add it to the Releases Notes too to communicate to implementers/developers.

@alecslupu
Copy link
Contributor Author

The command that I do is bin/rails db:drop db:create db:migrate db:seed

After seeing the changes in the code, I see that I need to do bin/rails db:drop db:create db:migrate assets:precompile db:seed. Now it works well, we should check out our docs to clarify this change whenever we mention the db:seeds command:

* docs/modules/develop/pages/guide_development_app.adoc

* docs/modules/install/pages/index.adoc

* docs/modules/install/pages/manual.adoc

fixed in e1b1299

github-actions[bot]
github-actions bot previously approved these changes May 26, 2024
@alecslupu
Copy link
Contributor Author

I can confirm that it works as expected once I change the command for seeds. We need to add this change in the docs (see #12828 (comment)).

We should add it to the Releases Notes too to communicate to implementers/developers.

done in b4beefd

github-actions[bot]
github-actions bot previously approved these changes May 26, 2024
RELEASE_NOTES.md Fixed Show fixed Hide fixed
@andreslucena andreslucena merged commit ffac9a5 into develop May 27, 2024
110 checks passed
@andreslucena andreslucena deleted the chore/add-notifications-to-seeds branch May 27, 2024 05:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

2 participants