News Loader Changes (#4788)

Some changes to the news loader to prep for player news.
This commit is contained in:
Werner
2018-05-24 20:59:35 +03:00
committed by Erki
parent 088e13ca10
commit aab67e5e2e
2 changed files with 14 additions and 1 deletions
@@ -0,0 +1,13 @@
--
-- Serverside changes to allow News published by players
--
ALTER TABLE `ss13_news_stories`
CHANGE COLUMN `time_stamp` `publish_at` DATETIME NULL DEFAULT NULL AFTER `is_admin_message`,
ADD COLUMN `publish_until` DATETIME NULL DEFAULT NULL AFTER `publish_at`,
ADD COLUMN `ic_timestamp` DATETIME NULL DEFAULT NULL AFTER `publish_until`,
ADD COLUMN `approved_by` VARCHAR(50) NULL DEFAULT NULL AFTER `created_at`,
ADD COLUMN `approved_at` DATETIME NULL DEFAULT NULL AFTER `approved_by`,
ADD COLUMN `url` VARCHAR(250) NULL DEFAULT NULL AFTER `publish_until`;
ALTER TABLE `ss13_news_channels`
CHANGE COLUMN `announcement` `announcement` VARCHAR(200) NULL DEFAULT NULL COLLATE 'utf8_bin' AFTER `is_admin_channel`;
+1 -1
View File
@@ -40,7 +40,7 @@
catch(var/exception/ec)
log_debug("SSnews: Error when loading channel: [ec]")
continue
var/DBQuery/news_query = dbcon.NewQuery("SELECT body, author, is_admin_message, message_type, time_stamp FROM ss13_news_stories WHERE deleted_at IS NULL AND channel_id = :channel_id: ORDER BY created_at DESC")
var/DBQuery/news_query = dbcon.NewQuery("SELECT body, author, is_admin_message, message_type, ic_timestamp, url FROM ss13_news_stories WHERE deleted_at IS NULL AND channel_id = :channel_id: AND publish_at < NOW() AND (publish_until > NOW() OR publish_until IS NULL) AND approved_at IS NOT NULL ORDER BY publish_at DESC")
news_query.Execute(list("channel_id" = channel_query.item[1]))
while(news_query.NextRow())
CHECK_TICK