Project

General

Profile

Actions

Feature #34025

closed

Raise the maximum length of the title element in the Atom feed from 100 to 300 characters

Added by Iker Mendiola over 4 years ago. Updated 11 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Feeds
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed

Description

The atom feed from a Project does not truncate the subjects, but using the link for All Projects does it.
Even using redmine.org > Projects > View all issues > Atom, issue 33965 is truncated:

    <title>Redmine - Defect #33965 (New): REST API: Method Not Available see used Status list as per the tra...</title>
    <link rel="alternate" href="https://www.redmine.org/issues/33965"/>

Files

34025.diff (2.16 KB) 34025.diff Go MAEDA, 2022-03-23 03:17

Related issues

Related to Redmine - Patch #1356: In Activity views, changesets titles can be multiline while they should notClosedJean-Philippe Lang2008-06-02

Actions
Actions #1

Updated by Iker Mendiola over 4 years ago

In fact, all atom feeds (not only for all project, but aslo por an individual project) are truncating issue subject to 100 chars.
Example in Redmine project:

    <title>Defect #33953 (Confirmed): Repository Tab will not showing if no repository is set as "Main repos...</title>
    <link rel="alternate" href="https://www.redmine.org/issues/33953"/>

The probelm with "all projects" is that it adds the Project's name as prefix, so it is easier to truncate the value
Regards

Actions #2

Updated by Go MAEDA over 4 years ago

  • Category set to Feeds

I agree that 100 chars is too short because the maximum length of Issue#title can be 255 chars. So, at least 255 chars of titles are handled without truncation.

Atom feeds are added in r670 in 2007. At that time, Redmine already trimmed down the title to 100 chars.

Actions #3

Updated by Iker Mendiola about 4 years ago

Also take into account that generating the atom from All Projects > View all issues, it adds the project's name as prefix in the title field, so it will have more characters....

Actions #4

Updated by Go MAEDA about 4 years ago

Go MAEDA wrote:

I agree that 100 chars is too short because the maximum length of Issue#title can be 255 chars. So, at least 255 chars of titles are handled without truncation.

The following patch changes the length limit of the title to 300. Since the maximum length of Issue#title is 255 chars, I think 300 is enough for most cases.

diff --git a/app/views/common/feed.atom.builder b/app/views/common/feed.atom.builder
index 0fbe1063c..c151cf99a 100644
--- a/app/views/common/feed.atom.builder
+++ b/app/views/common/feed.atom.builder
@@ -4,7 +4,7 @@ protocol = Setting.protocol
 host = Setting.host_name
 xml.instruct!
 xml.feed "xmlns" => "http://www.w3.org/2005/Atom" do
-  xml.title truncate_single_line_raw(@title, 100)
+  xml.title truncate_single_line_raw(@title, 300)
   xml.link(
     "rel" => "self",
     "href" =>
@@ -37,9 +37,9 @@ xml.feed "xmlns" => "http://www.w3.org/2005/Atom" do
     xml.entry do
       url = url_for(item.event_url(:only_path => false, :protocol => protocol, :host => host))
       if @project == item.project
-        xml.title truncate_single_line_raw(item.event_title, 100)
+        xml.title truncate_single_line_raw(item.event_title, 300)
       else
-        xml.title truncate_single_line_raw("#{item.project} - #{item.event_title}", 100)
+        xml.title truncate_single_line_raw("#{item.project} - #{item.event_title}", 300)
       end
       xml.link "rel" => "alternate", "href" => url
       xml.id URL
Actions #5

Updated by Go MAEDA almost 4 years ago

  • Status changed from New to Confirmed
Actions #6

Updated by Marius BĂLTEANU almost 4 years ago

Why truncate to 300 if the column length is 255?

Maybe it's better to not truncate anymore.

Actions #7

Updated by Go MAEDA almost 4 years ago

Marius BALTEANU wrote:

Why truncate to 300 if the column length is 255?

Although the maximum length of a subject is 255, a feed title includes additional information such as tracker name and project name.

Maybe it's better to not truncate anymore.

I agree. The max length of a project name and a tracker name is 255 and 30, so I don't think there is any problem without truncate.

Actions #8

Updated by Go MAEDA almost 3 years ago

Attaching a patch.

Actions #9

Updated by Holger Just almost 3 years ago

  • Related to Patch #1356: In Activity views, changesets titles can be multiline while they should not added
Actions #10

Updated by Holger Just almost 3 years ago

The truncate was initially introduced in #1356.

When changing this to not truncate titles, we should still try to avoiding multi-line event titles (e.g. by cutting of on the first newline or at least transforming newlines to spaces as currently done in ApplicationHelper#truncate_single_line)

Actions #11

Updated by Marius BĂLTEANU over 2 years ago

  • Target version changed from Candidate for next major release to 5.1.0
Actions #12

Updated by Marius BĂLTEANU over 2 years ago

  • Target version changed from 5.1.0 to Candidate for next major release
Actions #13

Updated by Go MAEDA 11 months ago

  • Tracker changed from Defect to Feature
  • Subject changed from Issue subject truncated to 100 chars in the list from Projects > View all issues > Atom to Raise the maximum length of the title element in the Atom feed from 100 to 300 characters
  • Target version changed from Candidate for next major release to 6.0.0

Holger Just wrote in #note-10:

The truncate was initially introduced in #1356.

When changing this to not truncate titles, we should still try to avoiding multi-line event titles (e.g. by cutting of on the first newline or at least transforming newlines to spaces as currently done in ApplicationHelper#truncate_single_line)

Thank you for the explanation.
I think my first patch in #note-4 is better than 34025.diff.

Setting the target version to 6.0.0.

Actions #14

Updated by Go MAEDA 11 months ago

  • Status changed from Confirmed to New
Actions #15

Updated by Go MAEDA 11 months ago

  • Status changed from New to Closed
  • Assignee set to Go MAEDA
  • Resolution set to Fixed

Committed the patch in r22685.

Actions

Also available in: Atom PDF