USLBot icon indicating copy to clipboard operation
USLBot copied to clipboard

Per-subreddit responses

Open Tjstretchalot opened this issue 7 years ago • 0 comments

I think it should be an option for subreddits to modify their responses where relevant (ban reason, ban message, modmail pm title, modmail pm message so far).

I think the best way to do this would be:

A new table that describes a "style" of response, ie.

response_types: id, str_id example row: 1, "propagated_ban_message"

And new table that maps monitored subreddit+response_types pairs to responses

monsub_responses_lookup: id, mon_sub_id, response_type_id, response_id

Then finally, remove the name column from responses. Where before there would be something like

db.getResponseMapping().fetchByName("propagated_ban_modmail_title")

it would become

db.getResponseMapping().fetchByID(
    db.getMonitoredSubredditResponsesLookup().fetchByMonitoredSubredditAndResponseType(
        monitoredSubreddit.id,
        db.getResponseTypeMapping().fetchIDByStringID("propagated_ban_modmail_title")
    )
)

Though that would be wrapped in a function so it's not so obtuse. Perhaps even one in ResponseMapping that does that works just like fetchByName except adds the monitored subreddit part. Not ideologically pretty since it references 2 other tables but this action is done enough that I think the convenience might be worth it

The actual creation/deletion/updating of this would be handled on the website

Tjstretchalot avatar Oct 19 '17 17:10 Tjstretchalot