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

Let podmin send private messages to local users #8246

Closed

Conversation

tclaus
Copy link
Member

@tclaus tclaus commented May 22, 2021

Hidden under this headline #7297 a podmin should be allowed to send a message to it's local users even when they don't share each others.

Together with improved report system (see PR #8239 ), there are some cases when a podmin needs to get in contact for a specific topic to its users.
There are also many other situations where a private message is very helpful between podmin and users.

@Flaburgan
Copy link
Member

This PR should be renamed to "private message" instead of "mails", it confused me 😛
Apart from that I'm all for it!

@@ -20,7 +20,11 @@ def index
format.json {
@people = if params[:q].present?
mutual = params[:mutual].present? && params[:mutual]
Person.search(params[:q], current_user, only_contacts: true, mutual: mutual).limit(15)
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure that's the good place to put that changes. If the comment above is right, "Used for mentions" means an admin will be able to @username the user when writing a post. I am not sure that gives access to the post to the user, and it will have to be put in an aspect etc, that's not practical. I think private messages are what we want to achieve here.

app/controllers/contacts_controller.rb Outdated Show resolved Hide resolved
@@ -37,7 +36,12 @@ def create
# This will have to be removed when mobile autocomplete is ported to Typeahead
recipients_param, column = [%i(contact_ids id), %i(person_ids person_id)].find {|param, _| params[param].present? }
if recipients_param
person_ids = current_user.contacts.mutual.where(column => params[recipients_param].split(",")).pluck(:person_id)
# As an admin, I want to send a message to all local user
Copy link
Member

Choose a reason for hiding this comment

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

Okay now I get why you modified the contacts controller, it was to get the autocomplete here to work. But as an admin is able to contact anyone, I guess to add a new route which returns every local user is fine, and this shouldn't be in the contacts controller I guess. Maybe it even already exists. Can you tell us @jhass, or where to put it if it doesn't exist?

Copy link
Member Author

Choose a reason for hiding this comment

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

Function differs if admin parses person_ids or a non-admin user parses person_ids. Different endpoints seems for me a bit complicated. (Check in frontend which role a user has, then change endpoints for same data with different filter) What do others think?

@@ -118,4 +121,11 @@ def contacts_data
{value: contact_id, name: ERB::Util.h(Person.name_from_attrs(*name_attrs)) }
}
end

def no_contacts?
Copy link
Member

Choose a reason for hiding this comment

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

Can you make that a bit more explicit? not_admin_and_no_contacts? for example?

Copy link
Member Author

Choose a reason for hiding this comment

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

"no_contacts_for_user" / "no_contacts_for_users_role"? .. For admin seems to specialized fo me for a methods' name?

app/controllers/conversations_controller.rb Outdated Show resolved Hide resolved
app/models/person.rb Outdated Show resolved Hide resolved
@tclaus tclaus changed the title Let podmin send mails to local users Let podmin send private messages to local users Jun 8, 2021
@tclaus tclaus closed this Mar 27, 2024
@tclaus tclaus deleted the let_podmin_send_mails_to_local_users branch March 27, 2024 20:21
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.

None yet

3 participants