From e38415c088f68e95a55b4ce48f2c455d0d8aec21 Mon Sep 17 00:00:00 2001 From: Wedge Date: Sun, 10 Feb 2019 17:07:38 +0300 Subject: [PATCH] Remove activity feeds --- .../angularjs/controllers/activity_feed.js | 39 --- .../angularjs/services/activity_service.js | 85 ------ app/controllers/home_controller.rb | 33 --- app/helpers/activity_feeds_helper.rb | 30 -- app/jobs/remove_outdated_items_job.rb | 5 - app/mailers/user_mailer.rb | 2 - app/models/activity_feed.rb | 19 -- app/models/build_list.rb | 1 - app/models/concerns/feed/build_list.rb | 44 --- app/models/user.rb | 2 - app/views/home/activity.atom.builder | 21 -- app/views/home/activity.json.jbuilder | 25 -- app/views/layouts/application.html.slim | 2 - app/views/layouts/sessions.html.slim | 2 - config/locales/models/activity_feed.en.yml | 56 ---- config/locales/models/activity_feed.ru.yml | 57 ---- config/routes.rb | 4 - .../20190210140249_destroy_activity_feeds.rb | 5 + db/schema.rb | 267 +++++++++--------- spec/models/activity_feed_spec.rb | 9 - 20 files changed, 133 insertions(+), 575 deletions(-) delete mode 100644 app/assets/javascripts/angularjs/controllers/activity_feed.js delete mode 100644 app/assets/javascripts/angularjs/services/activity_service.js delete mode 100644 app/helpers/activity_feeds_helper.rb delete mode 100644 app/models/activity_feed.rb delete mode 100644 app/models/concerns/feed/build_list.rb delete mode 100644 app/views/home/activity.atom.builder delete mode 100644 app/views/home/activity.json.jbuilder delete mode 100644 config/locales/models/activity_feed.en.yml delete mode 100644 config/locales/models/activity_feed.ru.yml create mode 100644 db/migrate/20190210140249_destroy_activity_feeds.rb delete mode 100644 spec/models/activity_feed_spec.rb diff --git a/app/assets/javascripts/angularjs/controllers/activity_feed.js b/app/assets/javascripts/angularjs/controllers/activity_feed.js deleted file mode 100644 index 7015a9a81..000000000 --- a/app/assets/javascripts/angularjs/controllers/activity_feed.js +++ /dev/null @@ -1,39 +0,0 @@ -RosaABF.controller('ActivityFeedController', ['$scope', 'ActivityService', 'ProjectSelectService', -function($scope, ActivityService, ProjectSelectService) { - $scope.feed = []; - $scope.next_link_present = false; - $scope.owner_tmp = ""; - $scope.project_tmp = ""; - $scope.no_loading = false; - - var owner_uname, project_name; - - $scope.getFeed = function(options, no_loading) { - if($scope.requesting) { - return; - } - $scope.no_loading = no_loading; - if(ProjectSelectService.project) { - if(!options) { - options = {}; - } - var split = ProjectSelectService.project.split('/'); - options.owner_uname = split[0]; - options.project_name = split[1]; - } - $scope.requesting = true; - ActivityService.getFeed(options).then(function(res) { - $scope.requesting = false; - $scope.next_link_present = res.next_link_present; - $scope.feed = res.feed; - }); - } - - $scope.$watch(function() { - return ProjectSelectService.project; - }, function() { - $scope.getFeed(); - }); - - $scope.getFeed(); -}]); \ No newline at end of file diff --git a/app/assets/javascripts/angularjs/services/activity_service.js b/app/assets/javascripts/angularjs/services/activity_service.js deleted file mode 100644 index 9506fb82f..000000000 --- a/app/assets/javascripts/angularjs/services/activity_service.js +++ /dev/null @@ -1,85 +0,0 @@ -angular.module("RosaABF").factory('ActivityService', ["$http", "$filter", function($http, $filter) { - var ActivityService = {}; - - var feed; - var next_page_link = null; - - var last_date; - var last_is_own = false; - var processFeed = function(feed) { - var res = []; - - _.each(feed, function(item) { - var cur_date = $filter('amDateFormat')(item.date, 'll') - if(cur_date != last_date) { - res.push({kind: 'new_day', date: cur_date, class: 'timeline-day'}); - last_date = cur_date; - } - res.push(item); - }); - - return res; - } - - ActivityService.getFeed = function(options) { - if(Object.prototype.toString.apply(options) != '[object Object]') { - options = {is_own: last_is_own, load_next_page: false}; - } - - var url; - if(!options['load_next_page']) { - last_date = null; - feed = {}; - params = {format: 'json'}; - if(options['owner_uname']) { - params['owner_filter'] = options['owner_uname']; - } - if(options['project_name']) { - params['project_name_filter'] = options['project_name']; - } - last_is_own = options['is_own']; - url = options['is_own'] ? Routes.own_activity_path(params) : Routes.activity_feeds_path(params); - } - else { - if(!next_page_link) { - return false; - } - - url = next_page_link; - } - - return $http.get(url).then(function(res) { - next_page_link = res.data.next_page_link; - - var new_feed = processFeed(res.data.feed); - var ret; - if(options['load_next_page']) { - ret = feed; - ret.push.apply(ret, new_feed); - } - else { - feed = ret = new_feed; - } - - return {feed: ret, next_link_present: !!next_page_link}; - }); - } - - ActivityService.getOwnersList = function(val) { - var path = Routes.get_owners_list_path({term: val}); - - return $http.get(path).then(function(res) { - return res.data; - }); - } - - ActivityService.getProjectNamesList = function(owner_uname, val) { - var path = Routes.get_project_names_list_path({owner_uname: owner_uname, term: val}); - - return $http.get(path).then(function(res) { - return res.data; - }); - } - - return ActivityService; -}]); \ No newline at end of file diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index 44b565b45..41dcf5ba1 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -6,39 +6,6 @@ class HomeController < ApplicationController redirect_to projects_path end - def activity(is_my_activity = false) - @activity_feeds = current_user.activity_feeds - .by_project_name(params[:project_name_filter]) - .by_owner_uname(params[:owner_filter]) - - @activity_feeds = if is_my_activity - @activity_feeds.where(creator_id: current_user) - else - @activity_feeds.where.not(creator_id: current_user) - end - - @activity_feeds = @activity_feeds.paginate page: current_page - - if @activity_feeds.next_page - if is_my_activity - method = :own_activity_path - else - method = :activity_feeds_path - end - @next_page_link = method.to_proc.call(self, page: @activity_feeds.next_page, owner_filter: params[:owner_filter], - project_name_filter: params[:project_name_filter], format: :json) - end - - respond_to do |format| - format.json { render 'activity' } - format.atom - end - end - - def own_activity - activity(true) - end - def get_owners_list if params[:term].present? users = User.opened.search(params[:term]).first(5) diff --git a/app/helpers/activity_feeds_helper.rb b/app/helpers/activity_feeds_helper.rb deleted file mode 100644 index 53d9180cf..000000000 --- a/app/helpers/activity_feeds_helper.rb +++ /dev/null @@ -1,30 +0,0 @@ -module ActivityFeedsHelper - def get_feed_title_from_content(content) - # removes html tags and haml generator indentation whitespaces and new line chars: - feed_title = strip_tags(content).gsub(/(^\s+|\n| )/, ' ') - # removes multiple whitespaces in a row and strip it: - feed_title = feed_title.gsub(/\s{2,}/, ' ').strip - end - - def get_user_from_activity_item(item) - email = item.data[:creator_email] - User.where(email: email).first || User.new(email: email) if email.present? - end - - def user_link(user, user_name, full_url = false) - user.persisted? ? link_to(user_name, full_url ? user_url(user) : user_path(user)) : user_name - end - - def get_feed_build_list_status_message(status) - message, error = case status - when BuildList::BUILD_PENDING - ['pending', nil] - when BuildList::BUILD_PUBLISHED - ['published', nil] - when BuildList::SUCCESS - ['success', nil] - else ['failed', t("layout.build_lists.statuses.#{BuildList::HUMAN_STATUSES[status]}")] - end - " #{t("notifications.bodies.build_status.#{message}", error: error)}" - end -end diff --git a/app/jobs/remove_outdated_items_job.rb b/app/jobs/remove_outdated_items_job.rb index a799ceaa5..c2b6e1e48 100644 --- a/app/jobs/remove_outdated_items_job.rb +++ b/app/jobs/remove_outdated_items_job.rb @@ -14,11 +14,6 @@ class RemoveOutdatedItemsJob < BaseActiveRecordJob end counter_pbl = ProductBuildList.outdated.count ProductBuildList.outdated.destroy_all - User.find_each(batch_size: 50) do |u| - u.activity_feeds.outdated.find_each(batch_size: 100) do |a| - a.destroy - end - end File.open(log_file, "w") do |f| f.puts "Build Lists deleted: #{counter_bl}" f.puts "Mass Builds deleted: #{counter_mb}" diff --git a/app/mailers/user_mailer.rb b/app/mailers/user_mailer.rb index ef007bac9..a3f98b290 100644 --- a/app/mailers/user_mailer.rb +++ b/app/mailers/user_mailer.rb @@ -1,6 +1,4 @@ class UserMailer < ActionMailer::Base - add_template_helper ActivityFeedsHelper - default from: "\"#{APP_CONFIG['project_name']}\" <#{APP_CONFIG['do-not-reply-email']}>" default_url_options.merge!(protocol: 'https') if APP_CONFIG['mailer_https_url'] diff --git a/app/models/activity_feed.rb b/app/models/activity_feed.rb deleted file mode 100644 index 348ff513d..000000000 --- a/app/models/activity_feed.rb +++ /dev/null @@ -1,19 +0,0 @@ -class ActivityFeed < ActiveRecord::Base - - BUILD = %w(build_list_notification) - - belongs_to :user - belongs_to :creator, class_name: 'User' - serialize :data - - default_scope { order created_at: :desc } - scope :outdated, -> { offset(1000) } - scope :by_project_name, ->(name) { where(project_name: name) if name.present? } - scope :by_owner_uname, ->(owner) { where(project_owner: owner) if owner.present? } - - self.per_page = 20 - - def partial - "home/partials/#{self.kind}" - end -end diff --git a/app/models/build_list.rb b/app/models/build_list.rb index 772e614b0..f870e9f93 100644 --- a/app/models/build_list.rb +++ b/app/models/build_list.rb @@ -2,7 +2,6 @@ class BuildList < ActiveRecord::Base include CommitAndVersion include FileStoreClean include AbfWorkerMethods - include Feed::BuildList include BuildListObserver include EventLoggable include ExternalNodable diff --git a/app/models/concerns/feed/build_list.rb b/app/models/concerns/feed/build_list.rb deleted file mode 100644 index 6cbe4529d..000000000 --- a/app/models/concerns/feed/build_list.rb +++ /dev/null @@ -1,44 +0,0 @@ -module Feed::BuildList - extend ActiveSupport::Concern - - included do - after_update :build_list_notifications - end - - private - - def build_list_notifications - if mass_build.blank? && ( # Do not show mass build activity in activity feeds - status_changed? && [ - BuildList::BUILD_PENDING, - BuildList::BUILD_PUBLISHED, - BuildList::SUCCESS, - BuildList::BUILD_ERROR, - BuildList::FAILED_PUBLISH, - BuildList::TESTS_FAILED - ].include?(status) - ) - - updater = publisher || user - (project.all_members | [publisher]).compact.each do |recipient| - ActivityFeed.create( - user: recipient, - kind: 'build_list_notification', - project_owner: project.owner_uname, - project_name: project.name, - creator_id: updater.id, - data: { - build_list_id: id, - status: status, - updated_at: updated_at, - project_id: project_id, - creator_name: updater.name, - creator_email: updater.email - } - ) - end - - end - end - -end \ No newline at end of file diff --git a/app/models/user.rb b/app/models/user.rb index 4dbc62d32..43a9d6494 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -20,8 +20,6 @@ class User < Avatar has_one :notifier, class_name: 'SettingsNotifier', dependent: :destroy #:notifier has_one :builds_setting, class_name: 'UserBuildsSetting', dependent: :destroy - has_many :activity_feeds, dependent: :destroy - has_many :authentications, dependent: :destroy has_many :build_lists, dependent: :destroy diff --git a/app/views/home/activity.atom.builder b/app/views/home/activity.atom.builder deleted file mode 100644 index f4849c1de..000000000 --- a/app/views/home/activity.atom.builder +++ /dev/null @@ -1,21 +0,0 @@ -atom_feed do |feed| - feed.title(t("layout.activity_feed.atom_title")) - feed.updated(@activity_feeds[0].created_at) if @activity_feeds.length > 0 - - @activity_feeds.each do |activity_feed| - feed.entry(activity_feed, url: root_url(anchor: "feed#{activity_feed.id}")) do |entry| - feed_content = raw(render(inline: true, partial: activity_feed.partial, - locals: activity_feed.data.merge(activity_feed: activity_feed, - project_owner: activity_feed.project_owner, - project_name: activity_feed.project_name))) - - entry.title(truncate(get_feed_title_from_content(feed_content), length: 50)) - entry.content(feed_content, type: 'html') - - entry.author do |author| - author.name(activity_feed.data[:creator_name]) - author.email(activity_feed.data[:creator_email]) - end if activity_feed.kind != 'git_delete_branch_notification' - end - end -end diff --git a/app/views/home/activity.json.jbuilder b/app/views/home/activity.json.jbuilder deleted file mode 100644 index f5748d915..000000000 --- a/app/views/home/activity.json.jbuilder +++ /dev/null @@ -1,25 +0,0 @@ -if @activity_feeds.next_page - json.next_page_link @next_page_link -end - -json.feed do - json.array!(@activity_feeds) do |item| - json.cache! item, expires_in: 10.minutes do - json.date item.created_at - json.kind item.kind - user = get_user_from_activity_item(item) - json.user do - json.link user_path(user) if user.persisted? - json.image avatar_url(user, :small) if user.persisted? - json.uname (user.fullname || user.email) - end if user - - project_name_with_owner = "#{item.project_owner}/#{item.project_name}" - @project = Project.find_by_owner_and_name(project_name_with_owner) - - json.project_name_with_owner project_name_with_owner - json.partial! item.partial, item: item, project_name_with_owner: project_name_with_owner - json.id item.id - end - end -end diff --git a/app/views/layouts/application.html.slim b/app/views/layouts/application.html.slim index f57a841aa..4dfcf3387 100644 --- a/app/views/layouts/application.html.slim +++ b/app/views/layouts/application.html.slim @@ -6,8 +6,6 @@ html base href="/" == csrf_meta_tag = display_meta_tags site: APP_CONFIG['project_name'], reverse: true, separator: '-' - - if user_signed_in? - = auto_discovery_link_tag :atom, atom_activity_feeds_path(format: 'atom', token: current_user.authentication_token), title: t("layout.atom_link_tag_title", nickname: current_user.uname, app_name: APP_CONFIG['project_name']) script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular.js" type="text/javascript" link href='//netdna.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css' rel='stylesheet' link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-T8Gy5hrqNKT+hzMclPo118YTQO6cYprQmhrYwIiQ/3axmI1hQomh7Ud2hPOy8SP1" crossorigin="anonymous" diff --git a/app/views/layouts/sessions.html.slim b/app/views/layouts/sessions.html.slim index e439485d3..9af388820 100644 --- a/app/views/layouts/sessions.html.slim +++ b/app/views/layouts/sessions.html.slim @@ -5,8 +5,6 @@ html meta content="text/html; charset=utf-8" http-equiv="Content-Type" == csrf_meta_tag = display_meta_tags site: APP_CONFIG['project_name'], reverse: true, separator: '-' - - if user_signed_in? - = auto_discovery_link_tag :atom, atom_activity_feeds_path(format: 'atom', token: current_user.authentication_token), title: t("layout.atom_link_tag_title", nickname: current_user.uname, app_name: APP_CONFIG['project_name']) script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular.js" type="text/javascript" link href='//netdna.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css' rel='stylesheet' link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-T8Gy5hrqNKT+hzMclPo118YTQO6cYprQmhrYwIiQ/3axmI1hQomh7Ud2hPOy8SP1" crossorigin="anonymous" diff --git a/config/locales/models/activity_feed.en.yml b/config/locales/models/activity_feed.en.yml deleted file mode 100644 index e1fe30da9..000000000 --- a/config/locales/models/activity_feed.en.yml +++ /dev/null @@ -1,56 +0,0 @@ -en: - layout: - activity_feed: - header: Activity Feed - own_header: Own Activity Feed - my_last_projects: My last projects - all_my_projects: All my projects - all_my_builds: All my builds - my_builds_by_day: My today builds - new_project: Create project - load_messages: show previous messages - atom_title: Activity Feed - - notifications: - subjects: - update_code: "[%{project_name}] Update of project" - new_comment_notification: New comment to your task - new_commit_comment_notification: New comment to commit - new_issue_notification: New task added to project - new_user_notification: Registered on project «%{ project_name }» - issue_assign_notification: New task assigned - invite_approve_notification: Invitation to ABF - for_arch: for arch %{arch}. - metadata_regeneration: Metadata regeneration «%{status}» - - bodies: - view_it_on: View it on - new_comment_notification: - title: '%{user_link} added a new comment' - content: in issue %{issue_link} - commit_content: in commit %{commit_link} - new_issue_notification: '%{user_link} added a new issue' - new_user_notification: - title: Hello, %{user_name}. - content: You have registered in project «ROSA ABF» and now you can sign in. - email: ==Your email %{user_email} - password: ==Your password %{user_password} - issue_assign_notification: You have been assigned to issue %{issue_link} - wiki_new_commit_notification: '%{user_link} has been updated %{history_link}' - invite_approve_notification: Invite to ABF - project: in project %{project_link} - delete_branch: '%{user_link} deleted a %{branch_name}' - create_branch: '%{user_link} created a new branch %{branch_name}' - update_branch: '%{user_link} pushed to branch %{branch_name}' - build_task: 'Build task #%{id}' - build_status: - published: published successfully - success: completed successfully - failed: completed with error "%{error}" - pending: build is pending - more_commits: '%{count} more %{commits}' - - footers: - support_team: Support team «ROSA ABF». - notifiers: You can configure notifications in - notification_center: Notification Center. diff --git a/config/locales/models/activity_feed.ru.yml b/config/locales/models/activity_feed.ru.yml deleted file mode 100644 index a466569f4..000000000 --- a/config/locales/models/activity_feed.ru.yml +++ /dev/null @@ -1,57 +0,0 @@ -ru: - layout: - activity_feed: - header: Лента активности - own_header: Мои действия - my_last_projects: Мои последние проекты - all_my_projects: Все мои проекты - all_my_builds: Все мои сборки - my_builds_by_day: Мои сборки за день - new_project: Создать проект - load_messages: показать предыдущие сообщения - atom_title: Лента активности - - notifications: - subjects: - update_code: "[%{project_name}] Обновление проекта" - new_comment_notification: Новый комментарий к Вашей задаче - new_commit_comment_notification: Новый комментарий к коммиту - new_issue_notification: Новая задача добавлена к проекту - new_user_notification: Регистрация на проекте «%{ project_name }» - issue_assign_notification: Вам назначили задачу - invite_approve_notification: Приглашение в ABF - for_arch: для архитектуры %{arch}. - metadata_regeneration: Регенерация метаданных «%{status}» - - bodies: - view_it_on: Смотрите это на - new_comment_notification: - title: '%{user_link} добавил новый комментарий' - content: к задаче %{issue_link} - commit_content: к коммиту %{commit_link} - new_issue_notification: '%{user_link} добавил новую задачу' - new_user_notification: - title: Здравствуйте, %{user_name}. - content: Вы зарегистрированы на проекте «ROSA ABF» и теперь можете войти в систему. - email: ==Ваш email %{user_email} - password: ==Ваш пароль %{user_password} - issue_assign_notification: Вам была назначена задача %{issue_link} - wiki_new_commit_notification: '%{user_link} обновил %{history_link}' - invite_approve_notification: Приглашение в ABF - project: в проекте %{project_link} - - delete_branch: '%{user_link} удалил ветку %{branch_name}' - create_branch: '%{user_link} создал новую ветку %{branch_name}' - update_branch: '%{user_link} внес изменения в ветку %{branch_name}' - build_task: 'Сборочное задание №%{id}' - build_status: - published: успешно опубликовано - success: успешно собрано - failed: завершилось с ошибкой "%{error}" - pending: ожидает сборки - more_commits: 'еще %{count} %{commits} ' - - footers: - support_team: Команда поддержки «ROSA ABF». - notifiers: Вы можете настроить уведомления в - notification_center: Центре уведомлений. diff --git a/config/routes.rb b/config/routes.rb index 523d48137..685fdb32d 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -124,10 +124,6 @@ Rails.application.routes.draw do get '/forbidden' => 'pages#forbidden', as: 'forbidden' get '/terms-of-service' => 'pages#tos', as: 'tos' - get '/activity.:format' => 'home#activity', as: 'activity_feeds', format: /json/ - get '/activity_feeds.:format' => 'home#activity', as: 'atom_activity_feeds', format: /atom/ - get '/own_activity.:format' => 'home#own_activity', as: 'own_activity', format: /json/ - if APP_CONFIG['anonymous_access'] authenticated do root to: 'home#index' diff --git a/db/migrate/20190210140249_destroy_activity_feeds.rb b/db/migrate/20190210140249_destroy_activity_feeds.rb new file mode 100644 index 000000000..d9cede46d --- /dev/null +++ b/db/migrate/20190210140249_destroy_activity_feeds.rb @@ -0,0 +1,5 @@ +class DestroyActivityFeeds < ActiveRecord::Migration + def change + drop_table :activity_feeds + end +end diff --git a/db/schema.rb b/db/schema.rb index 8da438c08..8611beee8 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,32 +11,21 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20160326104007) do +ActiveRecord::Schema.define(version: 20190210140249) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" enable_extension "hstore" - create_table "activity_feeds", force: :cascade do |t| - t.integer "user_id", null: false, index: {name: "index_activity_feeds_on_user_id_and_kind", with: ["kind"]} - t.string "kind" - t.text "data" - t.datetime "created_at" - t.datetime "updated_at" - t.string "project_owner", index: {name: "index_activity_feeds_on_project_owner"} - t.string "project_name", index: {name: "index_activity_feeds_on_project_name"} - t.integer "creator_id", index: {name: "index_activity_feeds_on_creator_id"} - end - create_table "arches", force: :cascade do |t| - t.string "name", null: false, index: {name: "index_arches_on_name", unique: true} + t.string "name", :null=>false, :index=>{:name=>"index_arches_on_name", :unique=>true} t.datetime "created_at" t.datetime "updated_at" end create_table "authentications", force: :cascade do |t| - t.integer "user_id", index: {name: "index_authentications_on_user_id"} - t.string "provider", index: {name: "index_authentications_on_provider_and_uid", with: ["uid"], unique: true} + t.integer "user_id", :index=>{:name=>"index_authentications_on_user_id"} + t.string "provider", :index=>{:name=>"index_authentications_on_provider_and_uid", :with=>["uid"], :unique=>true} t.string "uid" t.datetime "created_at" t.datetime "updated_at" @@ -46,58 +35,58 @@ ActiveRecord::Schema.define(version: 20160326104007) do t.string "name" t.integer "level" t.integer "status" - t.integer "build_list_id", index: {name: "index_build_list_items_on_build_list_id"} + t.integer "build_list_id", :index=>{:name=>"index_build_list_items_on_build_list_id"} t.datetime "created_at" t.datetime "updated_at" t.string "version" end create_table "build_list_packages", force: :cascade do |t| - t.integer "build_list_id", index: {name: "index_build_list_packages_on_build_list_id"} - t.integer "project_id", index: {name: "index_build_list_packages_on_project_id"} - t.integer "platform_id", index: {name: "index_build_list_packages_on_platform_id"} + t.integer "build_list_id", :index=>{:name=>"index_build_list_packages_on_build_list_id"} + t.integer "project_id", :index=>{:name=>"index_build_list_packages_on_project_id"} + t.integer "platform_id", :index=>{:name=>"index_build_list_packages_on_platform_id"} t.string "fullname" - t.string "name", index: {name: "index_build_list_packages_on_name_and_project_id", with: ["project_id"]} + t.string "name", :index=>{:name=>"index_build_list_packages_on_name_and_project_id", :with=>["project_id"]} t.string "version" t.string "release" t.string "package_type" t.datetime "created_at" t.datetime "updated_at" - t.boolean "actual", default: false, index: {name: "index_build_list_packages_on_actual_and_platform_id", with: ["platform_id"]} + t.boolean "actual", :default=>false, :index=>{:name=>"index_build_list_packages_on_actual_and_platform_id", :with=>["platform_id"]} t.string "sha1" t.integer "epoch" t.text "dependent_packages" - t.index name: "build_list_packages_ordering", expression: "lower((name)::text), length((name)::text)" + t.index :name=>"build_list_packages_ordering", :expression=>"lower((name)::text), length((name)::text)" end create_table "build_lists", force: :cascade do |t| t.integer "status" t.string "project_version" - t.integer "project_id", index: {name: "index_build_lists_on_project_id"} - t.integer "arch_id", index: {name: "index_build_lists_on_arch_id"} + t.integer "project_id", :index=>{:name=>"index_build_lists_on_project_id"} + t.integer "arch_id", :index=>{:name=>"index_build_lists_on_arch_id"} t.datetime "notified_at" t.datetime "created_at" - t.datetime "updated_at", index: {name: "index_build_lists_on_updated_at", order: {"updated_at"=>:desc}} - t.boolean "is_circle", default: false + t.datetime "updated_at", :index=>{:name=>"index_build_lists_on_updated_at", :order=>{"updated_at"=>:desc}} + t.boolean "is_circle", :default=>false t.text "additional_repos" t.string "name" t.string "update_type" t.integer "build_for_platform_id" t.integer "save_to_platform_id" t.text "include_repos" - t.integer "user_id", index: {name: "index_build_lists_on_user_id"} + t.integer "user_id", :index=>{:name=>"index_build_lists_on_user_id"} t.string "package_version" t.string "commit_hash" - t.integer "priority", default: 0, null: false + t.integer "priority", :default=>0, :null=>false t.datetime "started_at" t.integer "duration" - t.integer "mass_build_id", index: {name: "index_build_lists_on_mass_build_id_and_status", with: ["status"]} + t.integer "mass_build_id", :index=>{:name=>"index_build_lists_on_mass_build_id_and_status", :with=>["status"]} t.integer "save_to_repository_id" t.text "results" - t.boolean "new_core", default: true + t.boolean "new_core", :default=>true t.string "last_published_commit_hash" t.integer "container_status" - t.boolean "auto_create_container", default: false + t.boolean "auto_create_container", :default=>false t.text "extra_repositories" t.text "extra_build_lists" t.integer "publisher_id" @@ -106,21 +95,21 @@ ActiveRecord::Schema.define(version: 20160326104007) do t.string "external_nodes" t.integer "builder_id" t.boolean "include_testing_subrepository" - t.string "auto_publish_status", default: "default", null: false - t.boolean "use_cached_chroot", default: false, null: false - t.boolean "use_extra_tests", default: true, null: false - t.boolean "save_buildroot", default: false, null: false + t.string "auto_publish_status", :default=>"default", :null=>false + t.boolean "use_cached_chroot", :default=>false, :null=>false + t.boolean "use_extra_tests", :default=>true, :null=>false + t.boolean "save_buildroot", :default=>false, :null=>false t.string "hostname" t.string "fail_reason" - t.boolean "native_build", default: false + t.boolean "native_build", :default=>false end - add_index "build_lists", ["project_id", "save_to_repository_id", "build_for_platform_id", "arch_id"], name: "maintainer_search_index" + add_index "build_lists", ["project_id", "save_to_repository_id", "build_for_platform_id", "arch_id"], :name=>"maintainer_search_index" create_table "event_logs", force: :cascade do |t| - t.integer "user_id", index: {name: "index_event_logs_on_user_id"} + t.integer "user_id", :index=>{:name=>"index_event_logs_on_user_id"} t.string "user_name" t.integer "eventable_id" - t.string "eventable_type", index: {name: "index_event_logs_on_eventable_type_and_eventable_id", with: ["eventable_id"]} + t.string "eventable_type", :index=>{:name=>"index_event_logs_on_eventable_type_and_eventable_id", :with=>["eventable_id"]} t.string "eventable_name" t.string "ip" t.string "kind" @@ -133,10 +122,10 @@ ActiveRecord::Schema.define(version: 20160326104007) do end create_table "flash_notifies", force: :cascade do |t| - t.text "body_ru", null: false - t.text "body_en", null: false - t.string "status", null: false - t.boolean "published", default: true, null: false + t.text "body_ru", :null=>false + t.text "body_en", :null=>false + t.string "status", :null=>false + t.boolean "published", :default=>true, :null=>false t.datetime "created_at" t.datetime "updated_at" end @@ -146,7 +135,7 @@ ActiveRecord::Schema.define(version: 20160326104007) do t.datetime "created_at" t.datetime "updated_at" t.string "uname" - t.integer "own_projects_count", default: 0, null: false + t.integer "own_projects_count", :default=>0, :null=>false t.text "description" t.string "avatar_file_name" t.string "avatar_content_type" @@ -156,56 +145,56 @@ ActiveRecord::Schema.define(version: 20160326104007) do end create_table "key_pairs", force: :cascade do |t| - t.text "public", null: false - t.text "encrypted_secret", null: false - t.string "key_id", null: false - t.integer "user_id", null: false - t.integer "repository_id", null: false, index: {name: "index_key_pairs_on_repository_id", unique: true} + t.text "public", :null=>false + t.text "encrypted_secret", :null=>false + t.string "key_id", :null=>false + t.integer "user_id", :null=>false + t.integer "repository_id", :null=>false, :index=>{:name=>"index_key_pairs_on_repository_id", :unique=>true} t.datetime "created_at" t.datetime "updated_at" end create_table "key_pairs_backup", force: :cascade do |t| - t.integer "repository_id", null: false, index: {name: "index_key_pairs_backup_on_repository_id", unique: true} - t.integer "user_id", null: false - t.string "key_id", null: false - t.text "public", null: false + t.integer "repository_id", :null=>false, :index=>{:name=>"index_key_pairs_backup_on_repository_id", :unique=>true} + t.integer "user_id", :null=>false + t.string "key_id", :null=>false + t.text "public", :null=>false t.datetime "created_at" t.datetime "updated_at" end create_table "mass_builds", force: :cascade do |t| - t.integer "build_for_platform_id", null: false + t.integer "build_for_platform_id", :null=>false t.string "name" t.datetime "created_at" t.datetime "updated_at" t.string "arch_names" t.integer "user_id" - t.integer "build_lists_count", default: 0, null: false - t.boolean "stop_build", default: false, null: false + t.integer "build_lists_count", :default=>0, :null=>false + t.boolean "stop_build", :default=>false, :null=>false t.text "projects_list" - t.integer "missed_projects_count", default: 0, null: false + t.integer "missed_projects_count", :default=>0, :null=>false t.text "missed_projects_list" - t.boolean "new_core", default: true - t.integer "save_to_platform_id", null: false + t.boolean "new_core", :default=>true + t.integer "save_to_platform_id", :null=>false t.text "extra_repositories" t.text "extra_build_lists" - t.boolean "increase_release_tag", default: false, null: false - t.boolean "use_cached_chroot", default: true, null: false - t.boolean "use_extra_tests", default: false, null: false + t.boolean "increase_release_tag", :default=>false, :null=>false + t.boolean "use_cached_chroot", :default=>true, :null=>false + t.boolean "use_extra_tests", :default=>false, :null=>false t.string "description" - t.string "auto_publish_status", default: "none", null: false + t.string "auto_publish_status", :default=>"none", :null=>false t.text "extra_mass_builds" - t.boolean "include_testing_subrepository", default: false, null: false - t.boolean "auto_create_container", default: false, null: false - t.integer "status", default: 2000, null: false + t.boolean "include_testing_subrepository", :default=>false, :null=>false + t.boolean "auto_create_container", :default=>false, :null=>false + t.integer "status", :default=>2000, :null=>false t.string "external_nodes" end create_table "platform_arch_settings", force: :cascade do |t| - t.integer "platform_id", null: false, index: {name: "index_platform_arch_settings_on_platform_id_and_arch_id", with: ["arch_id"], unique: true} - t.integer "arch_id", null: false - t.integer "time_living", null: false + t.integer "platform_id", :null=>false, :index=>{:name=>"index_platform_arch_settings_on_platform_id_and_arch_id", :with=>["arch_id"], :unique=>true} + t.integer "arch_id", :null=>false + t.integer "time_living", :null=>false t.boolean "default" t.datetime "created_at" t.datetime "updated_at" @@ -213,27 +202,27 @@ ActiveRecord::Schema.define(version: 20160326104007) do create_table "platforms", force: :cascade do |t| t.string "description" - t.string "name", null: false, index: {name: "index_platforms_on_name", unique: true, case_sensitive: false} + t.string "name", :null=>false, :index=>{:name=>"index_platforms_on_name", :unique=>true, :case_sensitive=>false} t.integer "parent_platform_id" t.datetime "created_at" t.datetime "updated_at" - t.boolean "released", default: false, null: false + t.boolean "released", :default=>false, :null=>false t.integer "owner_id" t.string "owner_type" - t.string "visibility", default: "open", null: false - t.string "platform_type", default: "main", null: false + t.string "visibility", :default=>"open", :null=>false + t.string "platform_type", :default=>"main", :null=>false t.string "distrib_type" t.integer "status" t.datetime "last_regenerated_at" t.integer "last_regenerated_status" t.string "last_regenerated_log_sha1" t.string "automatic_metadata_regeneration" - t.string "default_branch", null: false + t.string "default_branch", :null=>false end create_table "product_build_lists", force: :cascade do |t| - t.integer "product_id", index: {name: "index_product_build_lists_on_product_id"} - t.integer "status", null: false + t.integer "product_id", :index=>{:name=>"index_product_build_lists_on_product_id"} + t.integer "status", :null=>false t.datetime "created_at" t.datetime "updated_at" t.integer "project_id" @@ -245,13 +234,13 @@ ActiveRecord::Schema.define(version: 20160326104007) do t.integer "arch_id" t.integer "time_living" t.integer "user_id" - t.boolean "not_delete", default: false - t.boolean "autostarted", default: false + t.boolean "not_delete", :default=>false + t.boolean "autostarted", :default=>false end create_table "products", force: :cascade do |t| - t.string "name", null: false - t.integer "platform_id", null: false + t.string "name", :null=>false + t.integer "platform_id", :null=>false t.datetime "created_at" t.datetime "updated_at" t.text "description" @@ -265,7 +254,7 @@ ActiveRecord::Schema.define(version: 20160326104007) do create_table "project_imports", force: :cascade do |t| t.integer "project_id" - t.string "name", index: {name: "index_project_imports_on_name_and_platform_id", with: ["platform_id"], unique: true, case_sensitive: false} + t.string "name", :index=>{:name=>"index_project_imports_on_name_and_platform_id", :with=>["platform_id"], :unique=>true, :case_sensitive=>false} t.string "version" t.datetime "file_mtime" t.datetime "created_at" @@ -274,70 +263,70 @@ ActiveRecord::Schema.define(version: 20160326104007) do end create_table "project_statistics", force: :cascade do |t| - t.integer "average_build_time", default: 0, null: false - t.integer "build_count", default: 0, null: false - t.integer "arch_id", null: false - t.integer "project_id", null: false, index: {name: "index_project_statistics_on_project_id_and_arch_id", with: ["arch_id"], unique: true} + t.integer "average_build_time", :default=>0, :null=>false + t.integer "build_count", :default=>0, :null=>false + t.integer "arch_id", :null=>false + t.integer "project_id", :null=>false, :index=>{:name=>"index_project_statistics_on_project_id_and_arch_id", :with=>["arch_id"], :unique=>true} t.datetime "created_at" t.datetime "updated_at" end create_table "project_to_repositories", force: :cascade do |t| t.integer "project_id" - t.integer "repository_id", index: {name: "index_project_to_repositories_on_repository_id_and_project_id", with: ["project_id"], unique: true} + t.integer "repository_id", :index=>{:name=>"index_project_to_repositories_on_repository_id_and_project_id", :with=>["project_id"], :unique=>true} t.datetime "created_at" t.datetime "updated_at" t.hstore "autostart_options" end create_table "projects", force: :cascade do |t| - t.string "name", index: {name: "index_projects_on_name_and_owner_id_and_owner_type", with: ["owner_id", "owner_type"], unique: true, case_sensitive: false} + t.string "name", :index=>{:name=>"index_projects_on_name_and_owner_id_and_owner_type", :with=>["owner_id", "owner_type"], :unique=>true, :case_sensitive=>false} t.datetime "created_at" t.datetime "updated_at" t.integer "owner_id" t.string "owner_type" - t.string "visibility", default: "open" + t.string "visibility", :default=>"open" t.string "ancestry" t.string "srpm_file_name" t.string "srpm_content_type" t.integer "srpm_file_size" t.datetime "srpm_updated_at" - t.string "default_branch", default: "master" - t.boolean "is_package", default: true, null: false + t.string "default_branch", :default=>"master" + t.boolean "is_package", :default=>true, :null=>false t.integer "maintainer_id" - t.boolean "publish_i686_into_x86_64", default: false - t.string "owner_uname", null: false - t.boolean "architecture_dependent", default: false, null: false + t.boolean "publish_i686_into_x86_64", :default=>false + t.string "owner_uname", :null=>false + t.boolean "architecture_dependent", :default=>false, :null=>false t.integer "autostart_status" - t.integer "alias_from_id", index: {name: "index_projects_on_alias_from_id"} + t.integer "alias_from_id", :index=>{:name=>"index_projects_on_alias_from_id"} t.string "github_organization" end create_table "relations", force: :cascade do |t| t.integer "actor_id" - t.string "actor_type", index: {name: "index_relations_on_actor_type_and_actor_id", with: ["actor_id"]} + t.string "actor_type", :index=>{:name=>"index_relations_on_actor_type_and_actor_id", :with=>["actor_id"]} t.integer "target_id" - t.string "target_type", index: {name: "index_relations_on_target_type_and_target_id", with: ["target_id"]} + t.string "target_type", :index=>{:name=>"index_relations_on_target_type_and_target_id", :with=>["target_id"]} t.datetime "created_at" t.datetime "updated_at" t.string "role" end create_table "repositories", force: :cascade do |t| - t.string "description", null: false - t.integer "platform_id", null: false, index: {name: "index_repositories_on_platform_id"} + t.string "description", :null=>false + t.integer "platform_id", :null=>false, :index=>{:name=>"index_repositories_on_platform_id"} t.datetime "created_at" t.datetime "updated_at" - t.string "name", null: false - t.boolean "publish_without_qa", default: true - t.boolean "synchronizing_publications", default: false, null: false + t.string "name", :null=>false + t.boolean "publish_without_qa", :default=>true + t.boolean "synchronizing_publications", :default=>false, :null=>false t.string "publish_builds_only_from_branch" end create_table "repository_statuses", force: :cascade do |t| - t.integer "repository_id", null: false, index: {name: "index_repository_statuses_on_repository_id_and_platform_id", with: ["platform_id"], unique: true} - t.integer "platform_id", null: false - t.integer "status", default: 0 + t.integer "repository_id", :null=>false, :index=>{:name=>"index_repository_statuses_on_repository_id_and_platform_id", :with=>["platform_id"], :unique=>true} + t.integer "platform_id", :null=>false + t.integer "status", :default=>0 t.datetime "last_regenerated_at" t.integer "last_regenerated_status" t.datetime "created_at" @@ -346,62 +335,62 @@ ActiveRecord::Schema.define(version: 20160326104007) do end create_table "settings_notifiers", force: :cascade do |t| - t.integer "user_id", null: false - t.boolean "can_notify", default: true + t.integer "user_id", :null=>false + t.boolean "can_notify", :default=>true t.datetime "created_at" t.datetime "updated_at" - t.boolean "new_build", default: true - t.boolean "new_associated_build", default: true + t.boolean "new_build", :default=>true + t.boolean "new_associated_build", :default=>true end create_table "statistics", force: :cascade do |t| - t.integer "user_id", null: false, index: {name: "index_statistics_on_user_id"} - t.string "email", null: false - t.integer "project_id", null: false, index: {name: "index_statistics_on_project_id"} - t.string "project_name_with_owner", null: false - t.string "key", null: false, index: {name: "index_statistics_on_key"} - t.integer "counter", default: 0, null: false - t.datetime "activity_at", null: false, index: {name: "index_statistics_on_activity_at"} + t.integer "user_id", :null=>false, :index=>{:name=>"index_statistics_on_user_id"} + t.string "email", :null=>false + t.integer "project_id", :null=>false, :index=>{:name=>"index_statistics_on_project_id"} + t.string "project_name_with_owner", :null=>false + t.string "key", :null=>false, :index=>{:name=>"index_statistics_on_key"} + t.integer "counter", :default=>0, :null=>false + t.datetime "activity_at", :null=>false, :index=>{:name=>"index_statistics_on_activity_at"} t.datetime "created_at" t.datetime "updated_at" end - add_index "statistics", ["key", "activity_at"], name: "index_statistics_on_key_and_activity_at" - add_index "statistics", ["project_id", "key", "activity_at"], name: "index_statistics_on_project_id_and_key_and_activity_at" - add_index "statistics", ["user_id", "key", "activity_at"], name: "index_statistics_on_user_id_and_key_and_activity_at" - add_index "statistics", ["user_id", "project_id", "key", "activity_at"], name: "index_statistics_on_all_keys", unique: true + add_index "statistics", ["key", "activity_at"], :name=>"index_statistics_on_key_and_activity_at" + add_index "statistics", ["project_id", "key", "activity_at"], :name=>"index_statistics_on_project_id_and_key_and_activity_at" + add_index "statistics", ["user_id", "key", "activity_at"], :name=>"index_statistics_on_user_id_and_key_and_activity_at" + add_index "statistics", ["user_id", "project_id", "key", "activity_at"], :name=>"index_statistics_on_all_keys", :unique=>true create_table "tokens", force: :cascade do |t| - t.integer "subject_id", null: false, index: {name: "index_tokens_on_subject_id_and_subject_type", with: ["subject_type"]} - t.string "subject_type", null: false - t.integer "creator_id", null: false + t.integer "subject_id", :null=>false, :index=>{:name=>"index_tokens_on_subject_id_and_subject_type", :with=>["subject_type"]} + t.string "subject_type", :null=>false + t.integer "creator_id", :null=>false t.integer "updater_id" - t.string "status", default: "active" + t.string "status", :default=>"active" t.text "description" - t.string "authentication_token", null: false, index: {name: "index_tokens_on_authentication_token", unique: true} + t.string "authentication_token", :null=>false, :index=>{:name=>"index_tokens_on_authentication_token", :unique=>true} t.datetime "created_at" t.datetime "updated_at" end create_table "user_builds_settings", force: :cascade do |t| - t.integer "user_id", null: false, index: {name: "index_user_builds_settings_on_user_id", unique: true} - t.text "platforms", default: [], null: false, array: true + t.integer "user_id", :null=>false, :index=>{:name=>"index_user_builds_settings_on_user_id", :unique=>true} + t.text "platforms", :default=>[], :null=>false, :array=>true t.string "external_nodes" end create_table "users", force: :cascade do |t| t.string "name" - t.string "email", default: "", null: false, index: {name: "index_users_on_email", unique: true} - t.string "encrypted_password", default: "", null: false - t.string "reset_password_token", index: {name: "index_users_on_reset_password_token", unique: true} + t.string "email", :default=>"", :null=>false, :index=>{:name=>"index_users_on_email", :unique=>true} + t.string "encrypted_password", :default=>"", :null=>false + t.string "reset_password_token", :index=>{:name=>"index_users_on_reset_password_token", :unique=>true} t.datetime "reset_password_sent_at" t.datetime "remember_created_at" t.datetime "created_at" t.datetime "updated_at" - t.string "uname", index: {name: "index_users_on_uname", unique: true} + t.string "uname", :index=>{:name=>"index_users_on_uname", :unique=>true} t.string "role" - t.string "language", default: "en" - t.integer "own_projects_count", default: 0, null: false - t.string "confirmation_token", index: {name: "index_users_on_confirmation_token", unique: true} + t.string "language", :default=>"en" + t.integer "own_projects_count", :default=>0, :null=>false + t.string "confirmation_token", :index=>{:name=>"index_users_on_confirmation_token", :unique=>true} t.datetime "confirmed_at" t.datetime "confirmation_sent_at" t.text "professional_experience" @@ -412,13 +401,13 @@ ActiveRecord::Schema.define(version: 20160326104007) do t.string "avatar_content_type" t.integer "avatar_file_size" t.datetime "avatar_updated_at" - t.integer "failed_attempts", default: 0 - t.string "unlock_token", index: {name: "index_users_on_unlock_token", unique: true} + t.integer "failed_attempts", :default=>0 + t.string "unlock_token", :index=>{:name=>"index_users_on_unlock_token", :unique=>true} t.datetime "locked_at" - t.string "authentication_token", index: {name: "index_users_on_authentication_token"} - t.integer "build_priority", default: 50 - t.boolean "sound_notifications", default: true - t.boolean "hide_email", default: true, null: false + t.string "authentication_token", :index=>{:name=>"index_users_on_authentication_token"} + t.integer "build_priority", :default=>50 + t.boolean "sound_notifications", :default=>true + t.boolean "hide_email", :default=>true, :null=>false end end diff --git a/spec/models/activity_feed_spec.rb b/spec/models/activity_feed_spec.rb deleted file mode 100644 index aa43930b2..000000000 --- a/spec/models/activity_feed_spec.rb +++ /dev/null @@ -1,9 +0,0 @@ -require 'spec_helper' - -describe ActivityFeed do - - it 'is valid given valid attributes' do - FactoryGirl.build(:activity_feed).should be_valid - end - -end