-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove explicit project column from notifications
- Loading branch information
Showing
36 changed files
with
230 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 83 additions & 0 deletions
83
db/migrate/20240820123011_remove_project_from_notification.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
#-- copyright | ||
# OpenProject is an open source project management software. | ||
# Copyright (C) the OpenProject GmbH | ||
# | ||
# This program is free software; you can redistribute it and/or | ||
# modify it under the terms of the GNU General Public License version 3. | ||
# | ||
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: | ||
# Copyright (C) 2006-2013 Jean-Philippe Lang | ||
# Copyright (C) 2010-2013 the ChiliProject Team | ||
# | ||
# This program is free software; you can redistribute it and/or | ||
# modify it under the terms of the GNU General Public License | ||
# as published by the Free Software Foundation; either version 2 | ||
# of the License, or (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program; if not, write to the Free Software | ||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
# | ||
# See COPYRIGHT and LICENSE files for more details. | ||
#++ | ||
|
||
class RemoveProjectFromNotification < ActiveRecord::Migration[7.1] | ||
def change | ||
reversible do |direction| | ||
direction.down do | ||
execute <<~SQL.squish | ||
UPDATE notifications | ||
SET project_id = work_package_journals.project_id | ||
FROM journals | ||
JOIN work_package_journals | ||
ON journals.data_id = work_package_journals.id AND journals.data_type = 'Journal::WorkPackageJournal' | ||
WHERE notifications.journal_id = journals.id AND notifications.resource_type = 'WorkPackage' | ||
SQL | ||
|
||
execute <<~SQL.squish | ||
UPDATE notifications | ||
SET project_id = forums.project_id | ||
FROM journals | ||
JOIN message_journals | ||
ON journals.data_id = message_journals.id AND journals.data_type = 'Journal::MessageJournal' | ||
JOIN forums ON message_journals.forum_id = forums.id | ||
WHERE notifications.journal_id = journals.id AND notifications.resource_type = 'Message' | ||
SQL | ||
|
||
execute <<~SQL.squish | ||
UPDATE notifications | ||
SET project_id = wikis.project_id | ||
FROM wiki_pages | ||
JOIN wikis | ||
ON wiki_pages.wiki_id = wikis.id | ||
WHERE notifications.resource_id = wiki_pages.id AND notifications.resource_type = 'WikiPage' | ||
SQL | ||
|
||
execute <<~SQL.squish | ||
UPDATE notifications | ||
SET project_id = news_journals.project_id | ||
FROM journals | ||
JOIN news_journals | ||
ON journals.data_id = news_journals.id AND journals.data_type = 'Journal::NewsJournal' | ||
WHERE notifications.journal_id = journals.id AND notifications.resource_type = 'News' | ||
SQL | ||
|
||
execute <<~SQL.squish | ||
UPDATE notifications | ||
SET project_id = news.project_id | ||
FROM comments | ||
JOIN news | ||
ON comments.commented_id = news.id AND comments.commented_type = 'News' | ||
WHERE notifications.resource_id = comments.id AND notifications.resource_type = 'Comment' | ||
SQL | ||
end | ||
end | ||
|
||
remove_reference :notifications, :project | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
...features/notifications/notification_center/notification_center_date_alert_mention_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
require "spec_helper" | ||
require "features/page_objects/notification" | ||
|
||
RSpec.describe "Notification center date alert and mention", | ||
:js, | ||
:with_cuprite, | ||
with_settings: { journal_aggregation_time_minutes: 0 } do | ||
shared_let(:project) { create(:project) } | ||
shared_let(:actor) { create(:user, firstname: "Actor", lastname: "User") } | ||
shared_let(:user) do | ||
create(:user, | ||
member_with_permissions: { project => %w[view_work_packages] }) | ||
end | ||
shared_let(:work_package) { create(:work_package, project:, due_date: 1.day.ago) } | ||
|
||
shared_let(:notification_mention) do | ||
create(:notification, | ||
reason: :mentioned, | ||
recipient: user, | ||
resource: work_package, | ||
actor:) | ||
end | ||
|
||
shared_let(:notification_date_alert) do | ||
create(:notification, | ||
reason: :date_alert_due_date, | ||
recipient: user, | ||
resource: work_package) | ||
end | ||
|
||
let(:center) { Pages::Notifications::Center.new } | ||
|
||
before do | ||
login_as user | ||
visit notifications_center_path | ||
wait_for_reload | ||
end | ||
|
||
context "with date alerts ee", with_ee: %i[date_alerts] do | ||
it "shows only the date alert time, not the mentioned author" do | ||
center.within_item(notification_date_alert) do | ||
expect(page).to have_text("Date alert, Mentioned") | ||
expect(page).to have_no_text("Actor user") | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.