Skip to content

selective newsletter for space admins#3

Merged
isaacmg410 merged 7 commits intoselective_newsletterfrom
feat/space_admin-selective_newsletter
Apr 29, 2019
Merged

selective newsletter for space admins#3
isaacmg410 merged 7 commits intoselective_newsletterfrom
feat/space_admin-selective_newsletter

Conversation

@agustibr
Copy link
Copy Markdown

@agustibr agustibr commented Apr 25, 2019

🎩 What? Why?

Adds the ability of sending (selective) newsletters to space admins.

📌 Related Issues

@agustibr agustibr requested a review from isaacmg410 April 25, 2019 15:09
Copy link
Copy Markdown

@isaacmg410 isaacmg410 left a comment

Choose a reason for hiding this comment

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

@agustibr good job!
@tramuntanal we are waiting your review :)

@isaacmg410 isaacmg410 requested a review from tramuntanal April 26, 2019 07:31
Copy link
Copy Markdown
Collaborator

@tramuntanal tramuntanal left a comment

Choose a reason for hiding this comment

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

Simple solution 👍 I thought it would be harder. Great job @agustibr!
Just some readability improvements

@agustibr
Copy link
Copy Markdown
Author

agustibr commented Apr 26, 2019

Thanks for the review and the suggestions @tramuntanal 😃

@agustibr agustibr force-pushed the feat/space_admin-selective_newsletter branch from 113106f to bc0317c Compare April 26, 2019 11:21
@agustibr agustibr requested a review from tramuntanal April 26, 2019 13:06
@agustibr
Copy link
Copy Markdown
Author

@tramuntanal all checks green! ✔️ ✔️

@isaacmg410
Copy link
Copy Markdown

@tramuntanal Can this PR be merged? The changes you have requested have been applied? If so, can you approve the PR?

Copy link
Copy Markdown
Collaborator

@tramuntanal tramuntanal left a comment

Choose a reason for hiding this comment

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

👍 just hesitating on what a couple of methods are doing.

.participatory_spaces.call(current_organization)&.published&.order(title: :asc)
end

def spaces_user_can_admin
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

is this method returning spaces_user_can_admin_as_options_for_select?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Returns the structure for the select, used in:

def spaces_for_select(manifest_name)
return unless Decidim.participatory_space_manifests.map(&:name).include?(manifest_name)
return spaces_user_can_admin[manifest_name] unless current_user.admin?
[[I18n.t("select_recipients_to_deliver.all_spaces", scope: "decidim.admin.newsletters"), "all"]] + spaces_user_can_admin[manifest_name]
end

but it's also used to check which spaces the user can manage:

def participatory_space_types_form_object(form_object, space_type)
return if spaces_user_can_admin[space_type.manifest_name.to_sym].blank?

@spaces_user_can_admin
end

def space_datum(space)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

space_as_options_for_select?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

ok I'll rename it

@agustibr agustibr requested a review from tramuntanal April 29, 2019 09:51
Copy link
Copy Markdown
Collaborator

@tramuntanal tramuntanal left a comment

Choose a reason for hiding this comment

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

👍

@isaacmg410 isaacmg410 merged commit 79aecee into selective_newsletter Apr 29, 2019
agustibr pushed a commit that referenced this pull request Apr 30, 2019
* initial commit selective newsletter

* working on queries recipients

* working on queries

* improve view

* start querying scopes

* send newsletter to users, pending filter participants

* some new improvements on selective newsletter

* initial queries filtering participants

* run rubocop to fix offenses

* remove unnecessary css

* change no_recipients and recipients_query

* adding some translations

* add some translations

* extract participants code to each module

* add class to select option

* fix lint errors

* fix rubocop offenses

* missing locales and fix i18n specs

* add documentation

* add changelog line

* remove unnecessary comma

* working specs

* wip working on specs

* fix offenses

* fix rubocop lambda

* working with specs newsletter

* improve specs query

* fix rubocop on decidim dev

* improve specs

* add newsletters js to manifest and fix newsletter helper

* change translation from any to none

* selective newsletter for space admins (#3)

* selective newsletter for space admins

* refactor space_allows_admin_access? to be more performant

* improve spaces_user_can_admin memoization

* update CHANGELOG entry

* renamed admin_newsletter_action? to apply_newsletter_permissions_for_admin!

* update (space)_user_admins return user objects not ids

* rename Decidim::Admin::NewslettersHelper#space_datum to :space_as_option_for_select

* fix rubocop offense

* A space admin can't send to all users

* add space admin user examples to deliver_newsletter_spec

* remove comments
tramuntanal pushed a commit that referenced this pull request Feb 10, 2021
* revert keys type in smtp_settings from symbol to strings

* switch smtp_settings keys from symbols to strings

* Fix smtp settings specs (#2)

* light cleanup application mailer specs

* add tests in register organization specs

* Revert "Fix smtp settings specs (#2)" (#3)

This reverts commit 9838bec.

* Update organization seeds (#1)

* Update organization seeds

* Fix migration

* Clean tests

* Complete migration by adding down

* Fix smtp settings specs (#4)

* light cleanup application mailer specs

* add tests in register organization specs

* Remove migration and update CHANGELOG

* Remove CHANGELOG entry

Co-authored-by: Quentin Champ <26109239+Quentinchampenois@users.noreply.github.com>
Co-authored-by: Armand Fardeau <armandfardeau@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants