Commit Graph

19 Commits

Author SHA1 Message Date
GitLab Bot 552cf9f9c4 Add latest changes from gitlab-org/gitlab@master 2021-05-20 03:10:37 +00:00
schwedenmut 00e42e3c45 Resolve "<link href=""> and <a href=""> not properly filled in activity RSS feed" 2018-09-05 11:29:04 +00:00
Clement Ho ab3d194cbe Replace <blockquote> with .blockquote 2018-04-09 11:41:31 -05:00
Yorick Peterse b4aaced71a
Fix display of push events for removed refs
This changes the style of push events that remove tags or branches so
they don't display the commit details. This prevents displaying commit
details such as:

    000000 . --broken encoding

Instead we now simply display the header such as:

    Administrator deleted branch example-branch

This is displayed in the same style as events for newly created
branches/tags.

This commit also ensures that if no commit message is present we simply
don't display anything, instead of "--broken encoding".

Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/36685
Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/36722
2017-08-22 20:15:45 +02:00
Yorick Peterse 0395c47193
Migrate events into a new format
This commit migrates events data in such a way that push events are
stored much more efficiently. This is done by creating a shadow table
called "events_for_migration", and a table called "push_event_payloads"
which is used for storing push data of push events. The background
migration in this commit will copy events from the "events" table into
the "events_for_migration" table, push events in will also have a row
created in "push_event_payloads".

This approach allows us to reclaim space in the next release by simply
swapping the "events" and "events_for_migration" tables, then dropping
the old events (now "events_for_migration") table.

The new table structure is also optimised for storage space, and does
not include the unused "title" column nor the "data" column (since this
data is moved to "push_event_payloads").

== Newly Created Events

Newly created events are inserted into both "events" and
"events_for_migration", both using the exact same primary key value. The
table "push_event_payloads" in turn has a foreign key to the _shadow_
table. This removes the need for recreating and validating the foreign
key after swapping the tables. Since the shadow table also has a foreign
key to "projects.id" we also don't have to worry about orphaned rows.

This approach however does require some additional storage as we're
duplicating a portion of the events data for at least 1 release. The
exact amount is hard to estimate, but for GitLab.com this is expected to
be between 10 and 20 GB at most. The background migration in this commit
deliberately does _not_ update the "events" table as doing so would put
a lot of pressure on PostgreSQL's auto vacuuming system.

== Supporting Both Old And New Events

Application code has also been adjusted to support push events using
both the old and new data formats. This is done by creating a PushEvent
class which extends the regular Event class. Using Rails' Single Table
Inheritance system we can ensure the right class is used for the right
data, which in this case is based on the value of `events.action`. To
support displaying old and new data at the same time the PushEvent class
re-defines a few methods of the Event class, falling back to their
original implementations for push events in the old format.

Once all existing events have been migrated the various push event
related methods can be removed from the Event model, and the calls to
`super` can be removed from the methods in the PushEvent model.

The UI and event atom feed have also been slightly changed to better
handle this new setup, fortunately only a few changes were necessary to
make this work.

== API Changes

The API only displays push data of events in the new format. Supporting
both formats in the API is a bit more difficult compared to the UI.
Since the old push data was not really well documented (apart from one
example that used an incorrect "action" nmae) I decided that supporting
both was not worth the effort, especially since events will be migrated
in a few days _and_ new events are created in the correct format.
2017-08-10 17:45:44 +02:00
Douwe Maan fe13f11041 Create and use project path helpers that only need a project, no namespace 2017-07-05 11:11:59 -05:00
Kushal Pandya fb3e365412 HAMLLint: Fix `SpaceInsideHashAttributes` offences 2016-12-31 11:58:36 +05:30
Yorick Peterse 25c08d11bb
Added author to various Markdown calls in views
This ensures all these calls have an author set, allowing the use of
"all" mentions where possible.
2016-05-26 17:14:06 +02:00
Robert Speicher 3b690891f3 Basic support for an Atom-specific rendering pipeline 2015-09-03 17:47:15 -04:00
Douwe Maan 9a60441ce4 Fix Atom feeds. 2015-05-21 11:39:33 +02:00
Douwe Maan cd52cef1c0 Fix reference links in dashboard activity and ATOM feeds. 2015-05-14 13:05:33 +02:00
Douwe Maan e4ac6bbf82 Merge branch 'atom-xhtml-squashed' into 'master'
Fix invalid Atom feeds when using emoji, horizontal rules, or images

This is a fix for issues #880, #723, #1113.

Markdown must be rendered to XHTML, not HTML, when generating summary content for Atom feeds. Otherwise, content-less tags like *img* and *hr* are not terminated and make the Atom XML invalid. Such tags are generated when issue descriptions, merge request descriptions, comments, or commit messages use emoji, horizontal rules, or images.

To pass this option through from the relevant Haml templates to the proper place in the `gfm()` method, a new method `gfm_with_options()` is introduced. It reuses the options dictionary passed to `markdown()` and interprets options `xhtml` and `parse_tasks` from it (the latter was a convenient replacement for `gfm_with_tasks()`). `xhtml` is already interpreted by Redcarpet::Render::HTML, but that alone was not sufficient, because the post-processing in `gfm()` would convert its XHTML tags back to HTML.

I found no way of passing additional optional options to the existing `gfm()` method without requiring updates to existing callers and without getting in the way of the existing optional arguments, but maybe someone who knows more about Ruby than I can think of one.

Thorough review appreciated since this is the first time I have used Ruby.

See merge request !344
2015-03-17 08:38:38 +00:00
Christian Walther 90aa870c36 Fix invalid Atom feeds when using emoji, horizontal rules, or images.
Fixes issues #880, #723, #1113: Markdown must be rendered to XHTML, not HTML, when generating summary content for Atom feeds. Otherwise, content-less tags like <img> and <hr>, generated when issue descriptions, merge request descriptions, comments, or commit messages use emoji, horizontal rules, or images, are not terminated and make the Atom XML invalid.
2015-03-16 22:05:52 +01:00
Vinnie Okada 76aad9b76e Upgrade to Rails 4.1.9
Make the following changes to deal with new behavior in Rails 4.1.2:

* Use nested resources to avoid slashes in arguments to path helpers.
2015-02-14 11:09:23 -07:00
Dmitriy Zaporozhets 0189be0831
Use short_id instead of [0..N] for short version of commit sha
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-10-10 15:39:48 +03:00
Kyle Fazzari 1f976a646d Updated ATOM feed partials to use markdown instead of simple_format. 2014-07-01 06:29:58 -07:00
Dmitriy Zaporozhets ff4471a3cd Get rid of event decorator. Use event data hash instead commit objects to increase perfomance 2013-04-05 19:47:12 +03:00
Alex Leutgöb 987e351de7 Escape html entities in commit messages 2012-10-04 10:06:17 +02:00
Alex Leutgöb 0b8e956f32 Add a more verbose dashboard event feed
- Add project name to event title
- Push: Entry links to single commit or commits overview depending on number of pushed commits
- Push: Display first 15 commits with commit message and author and link to single commit
- Issues: Display issue description
2012-09-24 15:12:44 +02:00