Commit Graph
93 Commits
Author SHA1 Message Date
Douglas Barbosa Alexandre 39a51f9e1c Rename Event#proper? to Event#visible_to_user? 2016-03-24 14:24:22 -03:00
Douglas Barbosa Alexandre 239560331a Comments on confidential issues doesn't show in activity feed to non-members 2016-03-24 14:22:01 -03:00
Douglas Barbosa Alexandre 9222459ea3 Restrict access to confidential issues on activity feed 2016-03-17 20:56:00 -03:00
Josh Frye 2ad094132d Various filter fixes 2016-02-04 13:03:41 -05:00
Yorick Peterse de7c9c7ab1 Use Atom update times of the first event
By simply loading the first event from the already sorted set we save
ourselves extra (slow) queries just to get the latest update timestamp.
This removes the need for Event.latest_update_time and significantly
reduces the time needed to build an Atom feed.

Fixes gitlab-org/gitlab-ce#12415
2016-01-27 10:33:33 +01:00
Yorick Peterse 128a6411d2 Don't pluck project IDs for events
By instead using a sub-query we save ourselves the overhead of loading
any data into memory only to pass it on to another query.
2016-01-26 10:51:53 +01:00
Douwe Maan a8e463c8ac Don't show project fork event as imported 2015-12-02 10:56:05 +01:00
Yorick Peterse 01620dd7e7 Added Event.limit_recent
This will be used to move some querying logic from the users controller
to the Event model (where it belongs).
2015-11-18 13:05:45 +01:00
Yorick Peterse 054f2f98ed Faster way of obtaining latest event update time
Instead of using MAX(events.updated_at) we can simply sort the events in
descending order by the "id" column and grab the first row. In other
words, instead of this:

    SELECT max(events.updated_at) AS max_id
    FROM events
    LEFT OUTER JOIN projects   ON projects.id   = events.project_id
    LEFT OUTER JOIN namespaces ON namespaces.id = projects.namespace_id
    WHERE events.author_id IS NOT NULL
    AND events.project_id IN (13083);

we can use this:

    SELECT events.updated_at AS max_id
    FROM events
    LEFT OUTER JOIN projects   ON projects.id   = events.project_id
    LEFT OUTER JOIN namespaces ON namespaces.id = projects.namespace_id
    WHERE events.author_id IS NOT NULL
    AND events.project_id IN (13083)
    ORDER BY events.id DESC
    LIMIT 1;

This has the benefit that on PostgreSQL a backwards index scan can be
used, which due to the "LIMIT 1" will at most process only a single row.
This in turn greatly speeds up the process of grabbing the latest update
time. This can be confirmed by looking at the query plans. The first
query produces the following plan:

    Aggregate  (cost=43779.84..43779.85 rows=1 width=12) (actual time=2142.462..2142.462 rows=1 loops=1)
      ->  Index Scan using index_events_on_project_id on events  (cost=0.43..43704.69 rows=30060 width=12) (actual time=0.033..2138.086 rows=32769 loops=1)
            Index Cond: (project_id = 13083)
            Filter: (author_id IS NOT NULL)
    Planning time: 1.248 ms
    Execution time: 2142.548 ms

The second query in turn produces the following plan:

    Limit  (cost=0.43..41.65 rows=1 width=16) (actual time=1.394..1.394 rows=1 loops=1)
      ->  Index Scan Backward using events_pkey on events  (cost=0.43..1238907.96 rows=30060 width=16) (actual time=1.394..1.394 rows=1 loops=1)
            Filter: ((author_id IS NOT NULL) AND (project_id = 13083))
            Rows Removed by Filter: 2104
    Planning time: 0.166 ms
    Execution time: 1.408 ms

According to the above plans the 2nd query is around 1500 times faster.
However, re-running the first query produces timings of around 80 ms,
making the 2nd query "only" around 55 times faster.
2015-11-18 13:02:43 +01:00
Yorick Peterse 7eb502c036 Change "recent" scopes to sort by "id"
These scopes can just sort by the "id" column in descending order to
achieve the same result. An added benefit is being able to perform a
backwards index scan (depending on the rest of the final query) instead
of having to actually sort data.
2015-11-11 15:17:12 +01:00
Stan Hu d3d03d1362 Create a "destroyed Milestone" event and keep Milestone events around in the DB
for posterity.

Also fix issue where destroying a Milestone would cause odd, transient messages like
"created milestone" or "imported milestone".

Add "in" preposition when creating and destroying milestones

Closes #2382
2015-09-15 05:51:11 -07:00
catatsuy 87ac590078 'created_at DESC' is performed twice
If you are already sorting in descending order in the created_at,
it is run twice when you run the .recent.
It has passed in the string 'created_at DESC'.
Ruby on Rails is directly given to the SQL.
It is a slow query in MySQL.
2015-07-02 21:28:31 +09:00
Douwe Maan 4740242a67 Change text of project creation event for imports. 2015-04-06 14:51:41 +02:00
Dmitriy Zaporozhets 43afe46bbd Refactor contributions events and write tests for calendar 2015-03-22 13:55:00 -07:00
Douwe Maan 9d938fd77d List new commits for newly pushed branch in activity view. 2015-03-18 14:28:50 +01:00
Douwe Maan 383c56efa1 Use Gitlab::Git helper methods and constants as much as possible. 2015-03-10 13:39:31 +01:00
Dmitriy Zaporozhets 63f11a68c5 Fix event loading with associations 2015-02-18 09:38:46 -08:00
Douwe Maan 9b917b4a73 Add "User created project Namespace / Project" event 2015-02-13 12:02:58 +01:00
Douwe Maan 522efa43fe Refactor event title generation for more consistent messages.
Example: "User joined project Namespace / Project" rather than "User joined project at Namespace / Project"
2015-02-13 12:02:58 +01:00
Douwe Maan 07d05d2df7 Move all event creation to EventCreateService. 2015-02-13 12:02:58 +01:00
Dmitriy Zaporozhets 62ed1c537e Explicitly define ordering in models using default_scope 2015-02-05 14:20:55 -08:00
Ciro Santilli a2afc5c3f9 Remove unused ex local variable from event.rb 2014-12-29 13:07:58 +01:00
Ciro Santilli c49cb40f65 Remove dead Event#new_branch? method 2014-11-03 20:17:02 +01: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
Jeroen van Baarsen 16eea49277 Moved some behaviour to one place
Signed-off-by: Jeroen van Baarsen <jeroenvanbaarsen@gmail.com>
2014-07-25 22:23:42 +02:00
Dmitriy Zaporozhets 119b02877d Merge branch 'bugfix/305/dashboard_feed_summaries' into 'master'
Incorporate Summaries for Notes and Merge Requests Into Dashboard Feed

This MR fixes #305 by adding summaries for notes and merge requests into the dashboard feed.
2014-07-02 07:00:16 +00:00
Dmitriy Zaporozhets 8f60b5b4fc Group and Event strong_params
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-06-26 16:57:10 +03:00
Dmitriy Zaporozhets 98ba075c32 User model to strong params. Comment other attr_accessible to let tests run
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-06-26 15:11:45 +03:00
Dmitriy Zaporozhets 66e068bbdf Fix event creation 2014-06-17 21:45:03 +03:00
Dmitriy Zaporozhets b3a90aba41 Remove ProjectActivityCacheObserver 2014-06-17 21:23:43 +03:00
Dmitriy Zaporozhets 1355ede49d Wipe wall notes feature
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-06-13 14:24:54 +03:00
Kyle Fazzari c1b1c32196 Add summaries for notes and merge requests to dashboard feed.
This fixes #305.
2014-05-29 07:55:55 -07:00
Dmitriy Zaporozhets 36f861f1b1 Re-annotate models
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-04-09 15:05:03 +03:00
Dmitriy Zaporozhets 6cc4ac7b98 Drop activity observer. User EventCreateService instead
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-03-25 15:07:54 +02:00
Dmitriy Zaporozhets 31386adf53 Fixed 500 error on branch and tag creation via UI
Also fixes issue with branch/tag removing via UI

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-02-24 14:55:27 +02:00
Jeroen van BaarsenandDmitriy Zaporozhets e5affcf1ee Fixed default scope deprecation warning 2013-12-10 12:11:27 +02:00
Dmitriy Zaporozhets 8b9bbeeba2 Prevent 500 if data[:commits] is nil for event
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2013-11-25 17:59:12 +02:00
Dmitriy Zaporozhets 31239d116a Add additional validation to push event
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2013-11-13 14:21:03 +02:00
Dmitriy Zaporozhets 395f3a1d20 Merge branch 'feature/internal_ids' of /home/git/repositories/gitlab/gitlabhq 2013-08-20 19:30:38 +00:00
Dmitriy Zaporozhets 25e629e460 Render small avatars for inline events 2013-08-20 21:31:37 +03:00
Dmitriy Zaporozhets 434c034159 Iid improvemets
* call set_iid before validation
* make rake task pass event if objects are invalid
* show iid in comment event at dashboard
2013-08-19 22:53:11 +03:00
Dmitriy Zaporozhets 20397091f1 Show iid in event feed and uatocomplete as default id for issues, mr 2013-08-19 22:12:59 +03:00
Dmitriy Zaporozhets 8587e3a357 create corresponding events when create branch/tag with UI 2013-07-17 15:11:03 +03:00
Dmitriy Zaporozhets 132caae734 Move repo tags to own controller. add ability to remove tags 2013-07-16 23:12:52 +03:00
Dmitriy Zaporozhets a165a0b23f Create event on dashboard when branch removed via UI 2013-07-16 22:43:14 +03:00
Dmitriy Zaporozhets 529feb4b40 Add comment title to rss feed 2013-06-22 16:00:39 +03:00
Dmitriy Zaporozhets 8df699a336 API: project events 2013-06-06 19:19:17 +03:00
Dmitriy Zaporozhets bcc4e4dc7e Merge branch 'gist' of https://github.com/Andrew8xx8/gitlabhq into Andrew8xx8-gist
Conflicts:
	Gemfile.lock
	app/models/ability.rb
	app/models/project.rb
	app/views/snippets/_form.html.haml
	db/schema.rb
	features/steps/shared/paths.rb
	spec/factories.rb
	spec/models/project_spec.rb
2013-06-04 18:36:22 +03:00
Dmitriy Zaporozhets f4ae433d90 Increase event title font size on dashboard activity feed 2013-04-06 15:53:35 +03:00
Dmitriy Zaporozhets cd6280f4fe Use data[:commits] hash from event to render push info on dashboard 2013-04-05 19:47:45 +03:00