Unable to add user to PM topic

On our 2.6.0.beta2 forum normal users (TL3) are unable to add someone to a PM topic. The Add or remove button is there, they can remove with the X, but the + button is missing. For admins and moderators it is there and works fine.
From other topics here on meta I understand that this should work for normal users as well. I cannot find a setting that seems to influence this.

I don’t know if it worked before. We’re online for 3 years and I just noticed, never had the impulse to add someone before and nobody ever complained.

4 Likes

I should know, but I’m not sure either. I’m finding the exact same behaviour as you are. I had thought that non-staff users had permissions to add users to a PM, but what I’m finding is that they can only remove users from a PM. If that’s the expected behaviour, then the button’s text should just say “Remove” instead of “Add or Remove”.

Can anyone confirm how this is expected to work?

3 Likes

I believe we’ve seen this bug before @joffreyjaffeux

4 Likes

I can’t repro this so far:

Gwen is a normal TL3 user invited to a PM created by system, and as you can see he can add people and remove himself. Which is the intended behavior.

@simon can you tell me more on your repro please?

2 Likes

Just to be sure I checked if this could be a browser thing, but it happens in all my browsers on all platforms (Windows, iOS, Android) and also if I switch the interface from our default Dutch to English. The elements for the + button <button class etc. and <svg class etc. are not in the page source for the TL3 user.

2 Likes

On my site the issue was caused by having max invites per day set to 0. That is something I’d previously enabled to test out ways of preventing non-staff users from sending invites. The can_invite_to? method does a check for this:

return false if (SiteSetting.max_invites_per_day.to_i == 0 && !is_staff?)

It looks like anything that causes the can_invite_to? method to return false will prevent the user from adding new users to a PM. For this case, the button’s text should probably be changed from “Add or Remove” to just “Remove”.

I’ve tested this on https://try.discourse.org/. With the settings on that site, my test users are able to add and remove users from PMs without any problem.

@willemb2, can you have a look at your site’s max invites per day setting to see if it has been set to 0?

6 Likes

Yes, thats it! We have that setting because ours is a closed forum, restricted to members of a club. From other topics here on meta I understood that this is the only way to prevent users from inviting outsiders.


I never realised that adding someone to a PM is an invite.
If there is no other way to keep our forum closed, this max invites per day wil have to stay at 0.

1 Like

Yes can_invite_to is the source, but as you said you tried the settings I wanted to be sure there was not another reason. Will have a fix beginning of next week.

5 Likes

Should be fixed by (once merged):

Details and screenshots of various states in the commit, it’s slightly more verbose than what I would usually write, but it makes the three cases very explicit.

7 Likes

It looks like this has regressed again @joffreyjaffeux (or the fix wasn’t merged). I just saw another example of users not being able to add others to a PM topic until I changed the max_invites_per_day setting above 0.

3 Likes

Where did you see it? It would help to know what version the forum was.

1 Like

Sorry, fair call. Hosted customer 2.6.0.beta3

1 Like

I don’t understand though @HAWK. What is the bug or regression here? Why would someone not staff on a max_invites_per_day=0 instance be allowed to invite someone?

@sam @simon I see you liked this, do you understand?

The initial bug, was that the UI was not reflecting this, and basically we were showing the + when you couldn’t in fact add anyone (and same issue for remove).

1 Like

Sorry for the confusion with that. You did fix the bug that was displaying the plus icon for users who are not able to invite other users to a PM.

I liked Hawk’s post because it seems strange to me that the max invites per day setting is used to prevent adding existing users to a PM. This isn’t a regression though. It is the expected behaviour.

4 Likes

Yes I do agree this might need a separate setting here. Although I don’t think this is very bad as it’s been created.

A solution could also be to show the + but disabled with title on hover explaining why it’s disabled. This would at least make it more clear.

What do you think @HAWK @sam ?

1 Like

It doesn’t make sense to me that the max invites per day stops a user from adding other existing users to a PM.

That said, your suggestion above would certainly make a workaround clear and easy.

1 Like

Yes what you ask would be complicated to accomplish, because we show the button (or not) before knowing who you are going to add.

1 Like

Ah yeah, that makes sense.

Cool, I think your suggestion is a good compromise then.

1 Like

Counter proposition, shouldn’t we just scratch all of this and go with a group setting? staff + selected groups can invite users, this way you can say TL2 for example, maybe with a max_pm_invites_non_staff_per_day setting if we want to be extra safe ?

2 Likes

The whole invite setting stuff is so hard to reason about.

You can invite people to a topic

  • via username
  • via email

You can invite people to a message

  • via username
  • via email

4 settings is a lot here, is this too much fidelity we are after? How many different flavors of “permission to invite people” do we need?

2 Likes