From 094261e0c7300d1eb26e20510bac78e7e53b77bf Mon Sep 17 00:00:00 2001 From: Min Khant Kyaw Date: Wed, 3 Sep 2025 11:26:07 +0630 Subject: [PATCH] Update channel ordering to use name only Modified the `ordered_pos_name` scope in the Community model to order channels by name only, removing position from the ordering. Updated channel_feeds and newsmast_channels actions to use the revised ordering. --- app/controllers/api/v1/channels_controller.rb | 4 ++-- app/models/community.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/api/v1/channels_controller.rb b/app/controllers/api/v1/channels_controller.rb index d157d964..c7aecfd1 100644 --- a/app/controllers/api/v1/channels_controller.rb +++ b/app/controllers/api/v1/channels_controller.rb @@ -73,12 +73,12 @@ def my_channel end def channel_feeds - channel_feeds = Community.filter_channel_feeds.exclude_incomplete_channels.exclude_deleted_channels.exclude_not_recommended.with_all_includes + channel_feeds = Community.filter_channel_feeds.exclude_incomplete_channels.exclude_deleted_channels.exclude_not_recommended.with_all_includes.ordered_pos_name render json: Api::V1::ChannelSerializer.new(channel_feeds , { params: { current_account: current_account } }).serializable_hash.to_json end def newsmast_channels - newsmast_channels = Community.filter_newsmast_channels.exclude_incomplete_channels.exclude_deleted_channels.exclude_not_recommended.with_all_includes + newsmast_channels = Community.filter_newsmast_channels.exclude_incomplete_channels.exclude_deleted_channels.exclude_not_recommended.with_all_includes.ordered_pos_name if newsmast_channels.present? render json: Api::V1::ChannelSerializer.new(newsmast_channels , { params: { current_account: current_remote_account } }).serializable_hash.to_json else diff --git a/app/models/community.rb b/app/models/community.rb index 28069811..e5eea206 100644 --- a/app/models/community.rb +++ b/app/models/community.rb @@ -215,7 +215,7 @@ def formatted_error_messages .order('patchwork_community_types.sorting_index ASC') } - scope :ordered_pos_name, -> { order('patchwork_communities.position ASC, patchwork_communities.name ASC') } + scope :ordered_pos_name, -> { order('patchwork_communities.name ASC') } scope :filter_channels, -> { where(patchwork_communities: { channel_type: Community.channel_types[:channel] }).exclude_deleted_channels }