Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions app/models/lab.rb
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ def excluded_slug
before_save :truncate_blurb
before_save :get_time_zone unless Rails.env.test?
after_save :save_roles
after_save :discourse_sync_if_needed, if: Figaro.env.discourse_enabled

attr_accessor :geocomplete

Expand Down Expand Up @@ -226,14 +225,6 @@ def is_approved?
return true if workflow_state == "approved"
end

def async_discourse_sync
DiscourseLabWorker.perform_async(self.id)
end

def discourse_sync
DiscourseService::Lab.new(self).sync
end

def avatar_url
if avatar_uid.present?
avatar.thumb('150x150#').url
Expand All @@ -250,12 +241,6 @@ def avatar_url

private

def discourse_sync_if_needed
if (changes.keys & ["name", "description"]).present?
async_discourse_sync
end
end

def get_time_zone
if latitude_changed? or longitude_changed?
begin
Expand Down
16 changes: 0 additions & 16 deletions app/models/machine.rb
Original file line number Diff line number Diff line change
@@ -1,24 +1,8 @@
class Machine < Thing

after_save :discourse_sync_if_needed, if: Figaro.env.discourse_enabled

def to_param
slug
end

def async_discourse_sync
DiscourseMachineWorker.perform_async(self.id)
end

def discourse_sync
DiscourseService::Machine.new(self).sync
end

private

def discourse_sync_if_needed
if (changes.keys & ["name", "description"]).present?
async_discourse_sync
end
end
end
16 changes: 0 additions & 16 deletions app/models/organization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ class Organization < ActiveRecord::Base

scope :approved, -> {where(workflow_state: STATE_APPROVED)}

after_save :discourse_sync_if_needed, if: Figaro.env.discourse_enabled

attr_accessor :geocomplete

extend FriendlyId
Expand All @@ -62,14 +60,6 @@ def geojson_file=(value)
end
end

def async_discourse_sync
DiscourseOrganizationWorker.perform_async(self.id)
end

def discourse_sync
DiscourseService::Organization.new(self).sync
end

def formatted_address
[address_1, address_2, city, county, postal_code, country].reject(&:blank?).join(", ")
end
Expand All @@ -96,12 +86,6 @@ def country

private

def discourse_sync_if_needed
if (changes.keys & ["name", "description"]).present?
async_discourse_sync
end
end

def truncate_blurb
self.blurb = blurb[0...250].gsub(/\s+/, ' ').gsub(/\n/," ").strip if blurb_changed?
end
Expand Down
16 changes: 0 additions & 16 deletions app/models/project.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ class Project < ActiveRecord::Base
enum visibility: { hidden: 0, visible: 1 }

before_save :assign_to_lab, :strip_zeroes
after_save :discourse_sync_if_needed, if: Figaro.env.discourse_enabled

self.authorizer_name = 'ProjectAuthorizer'

Expand Down Expand Up @@ -91,14 +90,6 @@ def project_cover
nil
end

def async_discourse_sync
DiscourseProjectWorker.perform_async(self.id)
end

def discourse_sync
DiscourseService::Project.new(self).sync
end

protected

def total_grades
Expand All @@ -118,11 +109,4 @@ def assign_to_lab
def strip_zeroes
self.tag_list.remove("0")
end

def discourse_sync_if_needed
if (changes.keys & ["name", "description"]).present?
async_discourse_sync
end
end

end
5 changes: 0 additions & 5 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ def slug_candidates
before_create { generate_token(:email_validation_hash) }
before_create :downcase_email

after_save :discourse_sync_if_needed, if: Figaro.env.discourse_enabled

def avatar_url
if avatar_uid.present?
Expand Down Expand Up @@ -217,10 +216,6 @@ def role_names
roles.map(&:name).uniq.join(', ')
end

def async_discourse_sync
DiscourseUserSyncWorker.perform_async(self.id)
end

def discourse_profile_url
return '' if username.blank?

Expand Down
2 changes: 0 additions & 2 deletions app/views/backstage/labs/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,6 @@
%pre
= @lab.discourse_errors

= comments_script(@lab.discourse_id)

- if current_user.present?
- if current_user.has_role? :superadmin
= link_to edit_backstage_lab_path(@lab), class: 'btn btn-primary btn-lg' do
Expand Down
2 changes: 0 additions & 2 deletions app/views/backstage/labs_manager/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,6 @@
%pre
= @lab.discourse_errors

= comments_script(@lab.discourse_id)

- if current_user.present?
- if current_user.has_role? :superadmin
= link_to edit_backstage_lab_path(@lab), class: 'btn btn-primary btn-lg' do
Expand Down
6 changes: 0 additions & 6 deletions app/views/labs/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,3 @@
.row.mt-3
.col-lg-12
= render("academics", lab: @lab, academics: @academics)

- if @lab.discourse_id.present?
.row.mt-5
.col-lg-12
%h3 Discuss this Lab on discuss.fablabs.io
= comments_script(@lab.discourse_id)
3 changes: 0 additions & 3 deletions app/views/layouts/application.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,3 @@
#main
= yield
= render 'footer'
- if current_user
- # Automatic login on discourse
%iframe{src: "#{Figaro.env.discourse_endpoint}session/sso", width: '0px', height: '0px', border: 'none'}
7 changes: 0 additions & 7 deletions app/views/machines/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,3 @@
= link_to "Edit", edit_machine_path(@machine), class: 'btn btn-primary'
- if current_or_null_user.can_delete?(@machine)
= link_to icon('trash-o'), @machine, method: :delete, class: 'btn btn-danger', data: { confirm: "Are you sure?" }


.row
.col-lg-12
- if @machine.discourse_id.present?
%h3 Discuss this Machine on discuss.fablabs.io
= comments_script(@machine.discourse_id)
6 changes: 0 additions & 6 deletions app/views/organizations/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,3 @@

.col-lg-4
= render "links", links: @organization.links

.row
.col-lg-12
- if @organization.discourse_id.present?
%h3 Discuss this Organization on discuss.fablabs.io
= comments_script(@organization.discourse_id)
5 changes: 0 additions & 5 deletions app/views/projects/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,3 @@
= link_to icon('pencil'), edit_project_path(@project), class: 'btn btn-primary'
- if current_or_null_user.can_delete?(@project)
= link_to icon('trash-o'), @project, method: :delete, class: 'btn btn-danger', data: { confirm: "Are you sure?" }
.row
.col-lg-12
- if @project.discourse_id.present?
%h3 Discuss this Project on discuss.fablabs.io
= comments_script(@project.discourse_id)
29 changes: 0 additions & 29 deletions lib/tasks/discourse.rake

This file was deleted.