Change order of announcements in admin page to sort them newest-first (#15091)
* Change order of announcements in admin page to sort show newly-created first Fixes #15090 * Use reverse-chronological rather than creation date only
This commit is contained in:
		
							parent
							
								
									d6fe0c94ca
								
							
						
					
					
						commit
						b29defb851
					
				
					 2 changed files with 2 additions and 1 deletions
				
			
		|  | @ -22,6 +22,7 @@ class Announcement < ApplicationRecord | |||
|   scope :published, -> { where(published: true) } | ||||
|   scope :without_muted, ->(account) { joins("LEFT OUTER JOIN announcement_mutes ON announcement_mutes.announcement_id = announcements.id AND announcement_mutes.account_id = #{account.id}").where('announcement_mutes.id IS NULL') } | ||||
|   scope :chronological, -> { order(Arel.sql('COALESCE(announcements.starts_at, announcements.scheduled_at, announcements.published_at, announcements.created_at) ASC')) } | ||||
|   scope :reverse_chronological, -> { order(Arel.sql('COALESCE(announcements.starts_at, announcements.scheduled_at, announcements.published_at, announcements.created_at) DESC')) } | ||||
| 
 | ||||
|   has_many :announcement_mutes, dependent: :destroy | ||||
|   has_many :announcement_reactions, dependent: :destroy | ||||
|  |  | |||
		Reference in a new issue