From 05756c9a14864655ae6777505a4ee5cfa9b0ee93 Mon Sep 17 00:00:00 2001 From: Alexander Date: Fri, 10 Jan 2020 22:58:16 +0100 Subject: improve status title (#8596) * improve shown status title, useful for atom/rss * use single quotes to satisfy codeclimate * fix tests, make message more pretty * fix tests * fix codestyle * fix codestyle * remove atom_serializer_spec Co-authored-by: Yamagishi Kazutoshi --- app/models/status.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'app/models') diff --git a/app/models/status.rb b/app/models/status.rb index 1cb381400..670109762 100644 --- a/app/models/status.rb +++ b/app/models/status.rb @@ -194,8 +194,12 @@ class Status < ApplicationRecord def title if destroyed? "#{account.acct} deleted status" + elsif reblog? + preview = sensitive ? '' : text.slice(0, 10).split("\n")[0] + "#{account.acct} shared #{reblog.account.acct}'s: #{preview}" else - reblog? ? "#{account.acct} shared a status by #{reblog.account.acct}" : "New status by #{account.acct}" + preview = sensitive ? '' : text.slice(0, 20).split("\n")[0] + "#{account.acct}: #{preview}" end end -- cgit