Intense API use floods staff log?

(Robert) #1


when a mail comes in, I plan to query the Discourse API to find out the mail address of the corresponding Discourse acount using the Discourse API:

As @riking mentioned, this leads to one logged staff action per request. For many mails, this means a very long (useless) staff log. Is the log shortened at some point? Can I clean it? Do I have to expect any scalability issues?


(Kane York) #2

The admin users list has a bulk email check button for each filter:


which creates a single staff log.

I’m not sure if you can select multiple usernames or filter by group, though…

EDIT: Try doing this:

GET /admin/users/list/active.json?

will show all users with an email, up to the page size.

You should also save the list and only refetch it when you have reason to believe it changed.

(Robert) #3

This functionality is indeed interesting and I have looked for it. Unfortunately, it is not really helping my case.

Somebody sends a mail to . Using qmail, maildrop/mailfilter and ruby with Discourse gem, I do API look ups to try to find the mail address for a user ‘first.lastname’. Of course, the mail address of the actual user, won’t be, but it’s GMail address for intstance.

Ideally, I would use the webhook plugin (Webhooks plugin) and listen to user-profile-changed or user-mail-changed events to update the cache of the routing script. Unfortunately, this is not (yet) supported.

As I don’t see how reasonable assumptions can be made on when users change their mail address, I think I need to request every time. :confused: That’s not too bad, except if the staff log doesn’t scale. Further disadvantage: the staff can see who received an incoming mail at which time…

(Robert) #4

My current idea to prevent flooding is to patch the users controller to not log this action. I found already the line. I keep watching the webhook plugin and switch to a more efficient solution once I can listen to user-profile-changed events.

Monkey patching a model from a plugin
(Robert) #5

I ended up to put the following snipet in my app.yml:

    - replace:
        global: true
        filename: /var/www/discourse/app/controllers/users_controller.rb
        from: /^.*StaffActionLogger\.new\(current_user\)\.log_check_email.*$/
        to: ""

I just updated to 1.7.0.betaX using docker_manager and find that apparently the hook was not executed. I double-checked that the regex is still matching.

Should I take another hook than after_code? Is this intentional?

Replace hook in container is ignored when updating using docker_manager