salla_serializers is a Discourse plugin that extends and customizes the default serializers and controllers to provide additional data and behavior for Salla's community forum integration. It introduces new attributes to various serializers, customizes API responses, and adds new endpoints for enhanced forum functionality.
- Extended Serializers:
- Adds new attributes to
BasicCategorySerializer
,PostSerializer
,SuggestedTopicSerializer
, andTopicListItemSerializer
. - Includes custom fields such as
only_admin_can_post
,emoji
,topic_creator
,first_post_details
, and more.
- Adds new attributes to
- Controller Extensions:
- Modifies API responses to remove sensitive user data unless accessed by an admin.
- Adds logic to filter out certain keys from responses for privacy.
- Custom Middleware Patch:
- Ensures API username headers are properly resolved to usernames.
- Custom Routes and Controllers:
- Adds a new endpoint:
POST /t/:id/increment_count
to increment topic view counts.
- Adds a new endpoint:
- Tag Controller Patch:
- Enhances tag filtering options in topic lists.
- Clone or download this repository into your Discourse
plugins
directory:git clone <repository-url> plugins/salla_serializers
- Rebuild your Discourse application:
./launcher rebuild app
The plugin can be enabled or disabled via site settings:
- Setting:
salla_serializers_enabled
- Default:
true
- Location: Admin > Settings > Plugins
- The plugin automatically extends the following serializers:
BasicCategorySerializer
PostSerializer
SuggestedTopicSerializer
TopicListItemSerializer
- These serializers now include additional fields such as
emoji
,only_admin_can_post
, and user-related details.
- Increment Topic View Count:
POST /t/:id/increment_count
- Increments the view count for a topic. Used for custom analytics or integrations.
- Non-admin API responses will have sensitive user fields (
admin
,moderator
,trust_level
, and theusers
key) removed for privacy.
- Added Domain in session cookies
- Main plugin logic is in
plugin.rb
. - Serializer extensions are in
app/serializers/
. - Controller and middleware patches are in
lib/salla_serializers/
. - Custom controller is in
app/controllers/
. - Routes are defined in
app/config/routes.rb
. - Plugin settings are in
config/settings.yml
.
- Ahsan Afzal