浏览代码

Merge pull request #2900 from pixelfed/staging

Staging
daniel 3 年之前
父节点
当前提交
78a277d125
共有 3 个文件被更改,包括 3 次插入2 次删除
  1. 1 0
      CHANGELOG.md
  2. 1 1
      app/Console/Commands/StoryGC.php
  3. 1 1
      app/Http/Controllers/StoryComposeController.php

+ 1 - 0
CHANGELOG.md

@@ -104,6 +104,7 @@
 - Updated snowflake id generation to improve randomness. ([e5aea490](https://github.com/pixelfed/pixelfed/commit/e5aea490))
 - Updated Timeline, remove recent posts. ([7641b731](https://github.com/pixelfed/pixelfed/commit/7641b731))
 - Updated InstanceCrawlPipeline, remove unused variable. ([e73cf531](https://github.com/pixelfed/pixelfed/commit/e73cf531))
+- Updated StoryComposeController, fix expiry bug. ([7dee8f58](https://github.com/pixelfed/pixelfed/commit/7dee8f58))
 -  ([](https://github.com/pixelfed/pixelfed/commit/))
 
 ## [v0.11.0 (2021-06-01)](https://github.com/pixelfed/pixelfed/compare/v0.10.10...v0.11.0)

+ 1 - 1
app/Console/Commands/StoryGC.php

@@ -51,7 +51,7 @@ class StoryGC extends Command
 	protected function archiveExpiredStories()
 	{
 		$stories = Story::whereActive(true)
-		->where('expires_at', '<', now())
+		->where('created_at', '<', now()->subHours(24))
 		->get();
 
 		foreach($stories as $story) {

+ 1 - 1
app/Http/Controllers/StoryComposeController.php

@@ -68,6 +68,7 @@ class StoryComposeController extends Controller
 		$story->local = true;
 		$story->size = $photo->getSize();
 		$story->bearcap_token = str_random(64);
+		$story->expires_at = now()->addMinutes(1440);
 		$story->save();
 
 		$url = $story->path;
@@ -179,7 +180,6 @@ class StoryComposeController extends Controller
 			->findOrFail($id);
 
 		$story->active = true;
-		$story->expires_at = now()->addMinutes(1440);
 		$story->duration = $request->input('duration', 10);
 		$story->can_reply = $request->input('can_reply');
 		$story->can_react = $request->input('can_react');