Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Refresh.Database/GameDatabaseContext.Notifications.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public void DeleteNotification(GameNotification notification)
});
}

public IEnumerable<GameAnnouncement> GetAnnouncements() => this.GameAnnouncements;
public IEnumerable<GameAnnouncement> GetAnnouncements() => this.GameAnnouncements.OrderByDescending(a => a.CreatedAt);

public GameAnnouncement? GetAnnouncementById(ObjectId id) => this.GameAnnouncements.FirstOrDefault(a => a.AnnouncementId == id);

Expand Down
6 changes: 6 additions & 0 deletions Refresh.Interfaces.APIv3/Endpoints/InstanceApiEndpoints.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ public ApiResponse<ApiStatisticsResponse> GetStatistics(RequestContext context,
};
}

[ApiV3Endpoint("announcements"), Authentication(false), AllowDuringMaintenance]
[DocSummary("Retrieves all current announcements.")]
[RateLimitSettings(300, 60, 240, "announcements-api")]
public ApiResponse<List<ApiGameAnnouncementResponse>> GetAllAnnouncements(RequestContext context, DataContext dataContext)
=> ApiGameAnnouncementResponse.FromOldList(dataContext.Database.GetAnnouncements().ToArray(), dataContext).ToList();

[ApiV3Endpoint("instance"), Authentication(false), AllowDuringMaintenance]
[ClientCacheResponse(3600)] // One hour
[DocSummary("Retrieves various information and metadata about the Refresh instance.")]
Expand Down
2 changes: 1 addition & 1 deletion Refresh.Interfaces.Game/Endpoints/AnnouncementEndpoints.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ private static bool AnnounceGetAnnouncements(StringBuilder output, GameDatabaseC
{
IEnumerable<GameAnnouncement> announcements = database.GetAnnouncements().ToList();
foreach (GameAnnouncement announcement in announcements)
output.Append($"{announcement.Title}: {announcement.Text}\n");
output.Append($"{announcement.Title}: {announcement.Text}\n\n");

return announcements.Any();
}
Expand Down
Loading