FriendsOfFlarum / gamification

Add upvotes, downvotes, and ranks to your Flarum Community
https://discuss.flarum.org/d/20671-friendsofflarum-gamification
MIT License
36 stars 17 forks source link

Auto Assigned Groups feature #91

Closed clarkwinkelmann closed 1 year ago

clarkwinkelmann commented 2 years ago

Changes proposed in this pull request: Add a new feature that allows auto-assigning (and removing) groups based on custom thresholds.

This feature is sponsored by a Blomstra client.

Reviewers should focus on:

Screenshot image

Confirmed

clarkwinkelmann commented 2 years ago

I have added the missing translations, added some tooltips to the buttons and documented the new command in the README (as well as the existing undocumented command)

I have also added some events. I'm not too sure about those. My original idea was to have a single event extend Flarum's GroupsChanged event, but it seems like existing event listeners don't pick up event classes that extend the original. So I triggered 2 different events.

Dispatching only the original group changed event wouldn't be very practical because extensions could not tell where it comes from, and I plan to support logging this into my Audit Log extension. But I think we should still trigger the original Flarum event as well since extensions might be looking at it for other reasons.

luceos commented 1 year ago

@clarkwinkelmann your job AutoAssignUserGroups does not implement Job and is breaking discuss

clarkwinkelmann commented 1 year ago

Oops. It was intentionally not using ShouldQueue and SerializesModel, but I didn't realize there was a missing interface.

Unfortunately I don't have time to look into this until Monday.

luceos commented 1 year ago

Oops. It was intentionally not using ShouldQueue and SerializesModel, but I didn't realize there was a missing interface.

Unfortunately I don't have time to look into this until Monday.

no problem, it's just a job failing in the queue, I have provided a patch as PR but it might have too many interfaces