Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove notifications #1393

Merged
merged 12 commits into from
Feb 9, 2018
Merged

Remove notifications #1393

merged 12 commits into from
Feb 9, 2018

Conversation

apradillap
Copy link
Contributor

@apradillap apradillap commented Feb 1, 2018

Closes #234
Closes #1420

What does this PR do?

Notifications have been limited in the case of topics and processes, only for creation. I haven't found references in Gobierto where only the creation was notified, I had doubts in expressing it:

def notify?
  process.created_at == process.updated_at
end

How should this be manually tested?

Update a issue or process and you shouldn't receive notification

@codecov-io
Copy link

codecov-io commented Feb 5, 2018

Codecov Report

Merging #1393 into master will decrease coverage by 0.01%.
The diff coverage is 96.77%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1393      +/-   ##
==========================================
- Coverage   77.38%   77.36%   -0.02%     
==========================================
  Files         495      497       +2     
  Lines       13164    13159       -5     
==========================================
- Hits        10187    10181       -6     
- Misses       2977     2978       +1
Impacted Files Coverage Δ
app/models/issue.rb 80.64% <0%> (+1.85%) ⬆️
app/publishers/gobierto_cms_page_activity.rb 100% <100%> (ø)
...ribers/gobierto_attachments_attachment_activity.rb 93.33% <100%> (ø)
app/forms/gobierto_admin/gobierto_cms/page_form.rb 92.64% <100%> (-0.41%) ⬇️
app/subscribers/gobierto_cms_page_activity.rb 93.33% <100%> (ø)
...pp/controllers/gobierto_admin/issues_controller.rb 90.19% <100%> (ø) ⬆️
app/publishers/issue_activity.rb 100% <100%> (ø) ⬆️
app/forms/gobierto_admin/issue_form.rb 100% <100%> (ø) ⬆️
...ierto_admin/gobierto_participation/process_form.rb 84.41% <100%> (-1.13%) ⬇️
...cribers/gobierto_participation_process_activity.rb 100% <100%> (ø) ⬆️
... and 13 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 346638b...0e8e736. Read the comment docs.

activity = Activity.last
assert_equal page, activity.subject
assert_equal admin, activity.author
assert_equal "gobierto_cms.page_updated", activity.action

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer single-quoted strings when you don't need string interpolation or special symbols.

def test_page_updated_event_handling
assert_difference "Activity.count" do
subject.page_updated Event.new(name: "activities/gobierto_cms_pages.page_updated", payload: {
subject: page, author: admin, ip: IP, site_id: site.id

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line is too long. [93/80]


def test_page_updated_event_handling
assert_difference "Activity.count" do
subject.page_updated Event.new(name: "activities/gobierto_cms_pages.page_updated", payload: {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer single-quoted strings when you don't need string interpolation or special symbols.
Line is too long. [99/80]

end

def test_page_updated_event_handling
assert_difference "Activity.count" do

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer single-quoted strings when you don't need string interpolation or special symbols.

assert_equal site.id, activity.site_id
end

def test_page_updated_event_handling

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assignment Branch Condition size for test_page_updated_event_handling is too high. [23.02/15]
Method has too many lines. [11/10]

end

def subject
@subject ||= Subscribers::GobiertoCmsPageActivity.new("activities")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer single-quoted strings when you don't need string interpolation or special symbols.

class Subscribers::GobiertoCmsPageActivityTest < ActiveSupport::TestCase
class Event < OpenStruct; end

IP = "1.2.3.4"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer single-quoted strings when you don't need string interpolation or special symbols.


require "test_helper"

class Subscribers::GobiertoCmsPageActivityTest < ActiveSupport::TestCase

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use nested module/class definitions instead of compact style.

@@ -0,0 +1,59 @@
# frozen_string_literal: true

require "test_helper"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer single-quoted strings when you don't need string interpolation or special symbols.

end

activity = Activity.last
assert_equal attachment, activity.subject
assert_equal admin, activity.author
assert_equal "gobierto_attachments.attachment.updated", activity.action
refute activity.admin_activity
assert_equal "gobierto_attachments.attachment_updated", activity.action

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer single-quoted strings when you don't need string interpolation or special symbols.

@ferblape
Copy link
Member

ferblape commented Feb 9, 2018

Hmmmm, I think #1420 is related with this PR.

Should we remove the existing notifications from the database to avoid the issue?

@furilo
Copy link
Member

furilo commented Feb 9, 2018 via email

@apradillap
Copy link
Contributor Author

@furilo @ferblape Thank you for your help, I had the migration before I went to the doctor 😄 Upload migration and tested in https://participacion.gobify.net/user/notifications

@ferblape
Copy link
Member

ferblape commented Feb 9, 2018 via email

@apradillap
Copy link
Contributor Author

Fixed @ferblape

@ferblape ferblape removed the wip label Feb 9, 2018
@ferblape ferblape merged commit 7532c86 into master Feb 9, 2018
@ferblape ferblape deleted the 234-remove-notifications branch February 9, 2018 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants