Skip to content
Snippets Groups Projects
Unverified Commit b40a7211 authored by Sébastien Gaya's avatar Sébastien Gaya Committed by GitHub
Browse files

Some bugsnag fixes (#2439)

* fix #2436

* fix #2399

* fix #2385

* fix #2364

* fix #2209

* fix #2315
parent d5159335
No related branches found
No related tags found
No related merge requests found
......@@ -49,6 +49,10 @@ window.osuny.contentEditor.tabs = {
loadCurrentTab: function () {
'use strict';
if (!this.target) {
return;
}
this.target.innerHTML = '';
this.xhr = new XMLHttpRequest();
this.xhr.open('GET', this.source, true);
......
......@@ -11,16 +11,28 @@ class Admin::Communication::PhotoImportsController < Admin::Communication::Appli
lang: @lang
}
p[:orientation] = params[:orientation] if params.has_key? :orientation
@search = Unsplash::Search.search "/search/photos", Unsplash::Photo, p
@total = @search.total
@total_pages = @search.total_pages
begin
@search = Unsplash::Search.search "/search/photos", Unsplash::Photo, p
@total = @search.total
@total_pages = @search.total_pages
rescue Unsplash::Error => e
@search = []
@total = 0
@total_pages = 1
end
end
def pexels
return if @query.blank?
@search = Pexels::Client.new.photos.search(@query, page: @page, per_page: @per_page)
@total = @search.total_results
@total_pages = @search.total_pages
begin
@search = Pexels::Client.new.photos.search(@query, page: @page, per_page: @per_page)
@total = @search.total_results
@total_pages = @search.total_pages
rescue Pexels::APIError => e
@search = []
@total = 0
@total_pages = 1
end
end
protected
......
......@@ -7,7 +7,6 @@ class Api::Osuny::Server::WebsitesController < Api::Osuny::ApplicationController
end
def verify_autoupdate_theme_key
render_forbidden if params[:secret_key].blank?
render_forbidden if params[:secret_key] != ENV['OSUNY_API_AUTOUPDATE_THEME_KEY']
render_forbidden if params[:secret_key].blank? || params[:secret_key] != ENV['OSUNY_API_AUTOUPDATE_THEME_KEY']
end
end
......@@ -12,9 +12,10 @@ module Admin::ActAsCategories
end
if old_parent_id.present?
old_parent = categories.find(old_parent_id)
old_parent.sync_with_git
trigger_category_sync(old_parent)
end
categories.find(params[:itemId]).sync_with_git # Will sync siblings
category = categories.find(params[:itemId])
trigger_category_sync(category) # Will sync siblings
end
def children
......@@ -38,4 +39,13 @@ module Admin::ActAsCategories
def categories_class
raise NoMethodError.new("categories_class must be implemented in the controller, for example Communication::Website::Agenda::Category")
end
def trigger_category_sync(category)
if category.respond_to?(:sync_with_git)
category.sync_with_git
else
# Indirect object (Person category, ...)
category.touch
end
end
end
\ No newline at end of file
......@@ -2,11 +2,11 @@ class Extranet::Contacts::SearchController < Extranet::Contacts::ApplicationCont
def index
@term = params[:term]
@people = current_extranet.connected_people
.for_search_term(@term)
.for_search_term(@term, current_language)
.ordered(current_language)
.limit(20)
@organizations = current_extranet.connected_organizations
.for_search_term(@term)
.for_search_term(@term, current_language)
.ordered(current_language)
.limit(20)
breadcrumb
......
......@@ -70,7 +70,6 @@ module AsLocalizedTree
.unscoped
.where(parent_id: about.parent_id, university: university)
.where.not(id: about.id)
.ordered(language)
end
def localizations_for(abouts)
......@@ -81,8 +80,8 @@ module AsLocalizedTree
# Beaucoup trop semblable à WithTree
def descendants_flattened
children.ordered(language).map {
|child| [child, child.descendants]
children.ordered(language).map {
|child| [child, child.descendants]
}.flatten
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment