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

1135 calendar updates button #1246

Merged
merged 10 commits into from
Dec 22, 2017
Merged

1135 calendar updates button #1246

merged 10 commits into from
Dec 22, 2017

Conversation

entantoencuanto
Copy link
Member

Related with #1135

What does this PR do?

Adds a link on admin edition view of calendar configurations to sync the calendar if some integration is defined. Also a new activity is created when a calendar is synchronized. If there are previous calendar update activities the date of last sync is shown next to the link.

How should this be manually tested?

Visit http:https://madrid.gobify.net/admin/gobierto_calendars/configurations/29/edit

Does this PR changes any configuration file?

  • Only config/initializers/subscribers.rb to include activities related with calendars

Copy link
Member

@ferblape ferblape left a comment

Choose a reason for hiding this comment

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

Thanks @entantoencuanto, it works great. I have added a couple of small issues in the code review, but I'd like you to add also an integration test. Ping me if you need help mocking the calendar synchronization.

current_site.activities.where(action: 'admin_gobierto_calendars.calendars_synchronized', subject: collection_container)
.order(created_at: :asc)
.last.try(:created_at)
else
Copy link
Member

Choose a reason for hiding this comment

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

The else is not necessary, isn't it?

calendar_integration.sync_person_events(@calendar_configuration_form.collection_container)
publish_calendar_sync_activity(@calendar_configuration_form)
end
redirect_to edit_admin_calendars_configuration_path(@collection)
Copy link
Member

Choose a reason for hiding this comment

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

Could you add a flash message after the sync? Right now it works but there's no clear feedback for the user that it worked

<%= t('.last_sync') %>: <%= time_ago_in_words @last_sync %> -
<% end %>

<%= link_to sync_calendars_admin_calendars_configuration_path(@calendar_configuration_form.collection_id), method: :put, data: { confirm: "Are you sure?" } do %>
Copy link
Member

Choose a reason for hiding this comment

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

Missing translation

@codecov-io
Copy link

Codecov Report

Merging #1246 into master will increase coverage by 0.09%.
The diff coverage is 96.15%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1246      +/-   ##
==========================================
+ Coverage   75.79%   75.88%   +0.09%     
==========================================
  Files         455      457       +2     
  Lines       12205    12231      +26     
==========================================
+ Hits         9251     9282      +31     
+ Misses       2954     2949       -5
Impacted Files Coverage Δ
app/services/gobierto_people/remote_calendars.rb 0% <0%> (ø) ⬆️
...pp/publishers/admin_gobierto_calendars_activity.rb 100% <100%> (ø)
.../gobierto_calendars/calendar_configuration_form.rb 90.76% <100%> (+0.14%) ⬆️
...p/subscribers/admin_gobierto_calendars_activity.rb 100% <100%> (ø)
...rto_calendars/calendar_configuration_controller.rb 100% <100%> (ø) ⬆️
app/models/gobierto_common/collection.rb 87.64% <0%> (+4.49%) ⬆️
app/controllers/gobierto_admin/base_controller.rb 94.87% <0%> (+5.12%) ⬆️

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 cfe100b...966830c. Read the comment docs.

@ferblape
Copy link
Member

Hey @entantoencuanto can this be accepted again?

@entantoencuanto
Copy link
Member Author

Yes, I think so

@ferblape ferblape merged commit c06db16 into master Dec 22, 2017
@ferblape ferblape deleted the 1135-calendar_updates_button branch December 22, 2017 09:54
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.

None yet

3 participants