Compare commits
1 commit
develop
...
rubocop-fi
Author | SHA1 | Date | |
---|---|---|---|
|
9f1a2fa2b2 |
208 changed files with 515 additions and 325 deletions
7
Gemfile
7
Gemfile
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
source 'https://rubygems.org'
|
source 'https://rubygems.org'
|
||||||
ruby '2.3.0'
|
ruby '2.3.0'
|
||||||
|
|
||||||
|
@ -47,10 +48,10 @@ end
|
||||||
group :development, :test do
|
group :development, :test do
|
||||||
gem 'better_errors'
|
gem 'better_errors'
|
||||||
gem 'binding_of_caller'
|
gem 'binding_of_caller'
|
||||||
|
gem 'faker'
|
||||||
gem 'pry-byebug'
|
gem 'pry-byebug'
|
||||||
gem 'pry-rails'
|
gem 'pry-rails'
|
||||||
gem 'rubocop'
|
gem 'rubocop', '~> 0.46.0' # match code climate https://github.com/tootsuite/mastodon/issues/1758
|
||||||
gem 'tunemygc'
|
|
||||||
gem 'faker'
|
|
||||||
gem 'timecop'
|
gem 'timecop'
|
||||||
|
gem 'tunemygc'
|
||||||
end
|
end
|
||||||
|
|
10
Gemfile.lock
10
Gemfile.lock
|
@ -166,7 +166,6 @@ GEM
|
||||||
cocaine (~> 0.5.5)
|
cocaine (~> 0.5.5)
|
||||||
mime-types
|
mime-types
|
||||||
mimemagic (~> 0.3.0)
|
mimemagic (~> 0.3.0)
|
||||||
parallel (1.12.0)
|
|
||||||
parser (2.4.0.0)
|
parser (2.4.0.0)
|
||||||
ast (~> 2.2)
|
ast (~> 2.2)
|
||||||
pg (0.21.0)
|
pg (0.21.0)
|
||||||
|
@ -241,14 +240,13 @@ GEM
|
||||||
rspec-mocks (~> 3.6.0)
|
rspec-mocks (~> 3.6.0)
|
||||||
rspec-support (~> 3.6.0)
|
rspec-support (~> 3.6.0)
|
||||||
rspec-support (3.6.0)
|
rspec-support (3.6.0)
|
||||||
rubocop (0.49.1)
|
rubocop (0.46.0)
|
||||||
parallel (~> 1.10)
|
parser (>= 2.3.1.1, < 3.0)
|
||||||
parser (>= 2.3.3.1, < 3.0)
|
|
||||||
powerpack (~> 0.1)
|
powerpack (~> 0.1)
|
||||||
rainbow (>= 1.99.1, < 3.0)
|
rainbow (>= 1.99.1, < 3.0)
|
||||||
ruby-progressbar (~> 1.7)
|
ruby-progressbar (~> 1.7)
|
||||||
unicode-display_width (~> 1.0, >= 1.0.1)
|
unicode-display_width (~> 1.0, >= 1.0.1)
|
||||||
ruby-progressbar (1.8.1)
|
ruby-progressbar (1.9.0)
|
||||||
sass (3.5.1)
|
sass (3.5.1)
|
||||||
sass-listen (~> 4.0.0)
|
sass-listen (~> 4.0.0)
|
||||||
sass-listen (4.0.0)
|
sass-listen (4.0.0)
|
||||||
|
@ -333,7 +331,7 @@ DEPENDENCIES
|
||||||
rails (~> 5.0.0)
|
rails (~> 5.0.0)
|
||||||
redis (~> 3.3.3)
|
redis (~> 3.3.3)
|
||||||
rspec-rails
|
rspec-rails
|
||||||
rubocop
|
rubocop (~> 0.46.0)
|
||||||
sass-rails
|
sass-rails
|
||||||
shoulda-matchers
|
shoulda-matchers
|
||||||
simplecov
|
simplecov
|
||||||
|
|
1
Rakefile
1
Rakefile
|
@ -1,5 +1,6 @@
|
||||||
#!/usr/bin/env rake
|
#!/usr/bin/env rake
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
||||||
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module ApplicationCable
|
module ApplicationCable
|
||||||
class Channel < ActionCable::Channel::Base
|
class Channel < ActionCable::Channel::Base
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module ApplicationCable
|
module ApplicationCable
|
||||||
class Connection < ActionCable::Connection::Base
|
class Connection < ActionCable::Connection::Base
|
||||||
identified_by :current_user
|
identified_by :current_user
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class MapChannel < ApplicationCable::Channel
|
class MapChannel < ApplicationCable::Channel
|
||||||
# Called when the consumer has successfully
|
# Called when the consumer has successfully
|
||||||
# become a subscriber of this channel.
|
# become a subscriber of this channel.
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class AccessController < ApplicationController
|
class AccessController < ApplicationController
|
||||||
before_action :require_user, only: [:access, :access_request,
|
before_action :require_user, only: %i(access access_request
|
||||||
:approve_access, :approve_access_post,
|
approve_access approve_access_post
|
||||||
:deny_access, :deny_access_post, :request_access]
|
deny_access deny_access_post request_access)
|
||||||
before_action :set_map, only: [:access, :access_request,
|
before_action :set_map, only: %i(access access_request
|
||||||
:approve_access, :approve_access_post,
|
approve_access approve_access_post
|
||||||
:deny_access, :deny_access_post, :request_access]
|
deny_access deny_access_post request_access)
|
||||||
after_action :verify_authorized
|
after_action :verify_authorized
|
||||||
|
|
||||||
# GET maps/:id/request_access
|
# GET maps/:id/request_access
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Api
|
module Api
|
||||||
module V1
|
module V1
|
||||||
class DeprecatedController < ApplicationController
|
class DeprecatedController < ApplicationController
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Api
|
module Api
|
||||||
module V2
|
module V2
|
||||||
class MappingsController < WithUpdatesController
|
class MappingsController < WithUpdatesController
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Api
|
module Api
|
||||||
module V2
|
module V2
|
||||||
class MapsController < WithUpdatesController
|
class MapsController < WithUpdatesController
|
||||||
def searchable_columns
|
def searchable_columns
|
||||||
[:name, :desc]
|
%i(name desc)
|
||||||
end
|
end
|
||||||
|
|
||||||
def apply_filters(collection)
|
def apply_filters(collection)
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Api
|
module Api
|
||||||
module V2
|
module V2
|
||||||
class MetacodesController < RestfulController
|
class MetacodesController < RestfulController
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Api
|
module Api
|
||||||
module V2
|
module V2
|
||||||
class RestfulController < ActionController::Base
|
class RestfulController < ActionController::Base
|
||||||
|
@ -7,7 +8,7 @@ module Api
|
||||||
|
|
||||||
snorlax_used_rest!
|
snorlax_used_rest!
|
||||||
|
|
||||||
before_action :load_resource, only: [:show, :update, :destroy]
|
before_action :load_resource, only: %i(show update destroy)
|
||||||
after_action :verify_authorized
|
after_action :verify_authorized
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
@ -91,7 +92,7 @@ module Api
|
||||||
end
|
end
|
||||||
|
|
||||||
def doorkeeper_user
|
def doorkeeper_user
|
||||||
return unless doorkeeper_token.present?
|
return if doorkeeper_token.blank?
|
||||||
doorkeeper_render_error unless valid_doorkeeper_token?
|
doorkeeper_render_error unless valid_doorkeeper_token?
|
||||||
@doorkeeper_user ||= User.find(doorkeeper_token.resource_owner_id)
|
@doorkeeper_user ||= User.find(doorkeeper_token.resource_owner_id)
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Api
|
module Api
|
||||||
module V2
|
module V2
|
||||||
class SessionsController < ApplicationController
|
class SessionsController < ApplicationController
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Api
|
module Api
|
||||||
module V2
|
module V2
|
||||||
class StarsController < RestfulController
|
class StarsController < RestfulController
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Api
|
module Api
|
||||||
module V2
|
module V2
|
||||||
class SynapsesController < WithUpdatesController
|
class SynapsesController < WithUpdatesController
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Api
|
module Api
|
||||||
module V2
|
module V2
|
||||||
class TokensController < RestfulController
|
class TokensController < RestfulController
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Api
|
module Api
|
||||||
module V2
|
module V2
|
||||||
class TopicsController < WithUpdatesController
|
class TopicsController < WithUpdatesController
|
||||||
def searchable_columns
|
def searchable_columns
|
||||||
[:name, :desc, :link]
|
%i(name desc link)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Api
|
module Api
|
||||||
module V2
|
module V2
|
||||||
class UsersController < RestfulController
|
class UsersController < RestfulController
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Api
|
module Api
|
||||||
module V2
|
module V2
|
||||||
class WithUpdatesController < RestfulController
|
class WithUpdatesController < RestfulController
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class ApplicationController < ActionController::Base
|
class ApplicationController < ActionController::Base
|
||||||
include ApplicationHelper
|
include ApplicationHelper
|
||||||
include Pundit
|
include Pundit
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class ExploreController < ApplicationController
|
class ExploreController < ApplicationController
|
||||||
before_action :require_authentication, only: [:mine, :shared, :starred]
|
before_action :require_authentication, only: %i(mine shared starred)
|
||||||
before_action :authorize_explore
|
before_action :authorize_explore
|
||||||
after_action :verify_authorized
|
after_action :verify_authorized
|
||||||
after_action :verify_policy_scoped
|
after_action :verify_policy_scoped
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# bad code that should be checked over before entering one of the
|
# bad code that should be checked over before entering one of the
|
||||||
# nice files from the right side of this repo
|
# nice files from the right side of this repo
|
||||||
class HacksController < ApplicationController
|
class HacksController < ApplicationController
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class MainController < ApplicationController
|
class MainController < ApplicationController
|
||||||
before_action :authorize_main
|
before_action :authorize_main
|
||||||
after_action :verify_authorized
|
after_action :verify_authorized
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class MappingsController < ApplicationController
|
class MappingsController < ApplicationController
|
||||||
before_action :require_user, only: [:create, :update, :destroy]
|
before_action :require_user, only: %i(create update destroy)
|
||||||
after_action :verify_authorized, except: :index
|
after_action :verify_authorized, except: :index
|
||||||
after_action :verify_policy_scoped, only: :index
|
after_action :verify_policy_scoped, only: :index
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class MapsController < ApplicationController
|
class MapsController < ApplicationController
|
||||||
before_action :require_user, only: [:create, :update, :destroy, :events, :follow, :unfollow]
|
before_action :require_user, only: %i(create update destroy events follow unfollow)
|
||||||
before_action :set_map, only: [:show, :conversation, :update, :destroy, :contains, :events, :export, :follow, :unfollow, :unfollow_from_email]
|
before_action :set_map, only: %i(show conversation update destroy contains events export follow unfollow unfollow_from_email)
|
||||||
after_action :verify_authorized
|
after_action :verify_authorized
|
||||||
|
|
||||||
# GET maps/:id
|
# GET maps/:id
|
||||||
|
@ -23,7 +24,7 @@ class MapsController < ApplicationController
|
||||||
format.ttl { redirect_to action: :export, format: :ttl }
|
format.ttl { redirect_to action: :export, format: :ttl }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# GET maps/:id/conversation
|
# GET maps/:id/conversation
|
||||||
def conversation
|
def conversation
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
|
@ -140,7 +141,7 @@ class MapsController < ApplicationController
|
||||||
|
|
||||||
# POST maps/:id/follow
|
# POST maps/:id/follow
|
||||||
def follow
|
def follow
|
||||||
follow = FollowService.follow(@map, current_user, 'followed')
|
follow = FollowService.follow(@map, current_user, 'followed')
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.json do
|
format.json do
|
||||||
|
@ -155,7 +156,7 @@ class MapsController < ApplicationController
|
||||||
|
|
||||||
# POST maps/:id/unfollow
|
# POST maps/:id/unfollow
|
||||||
def unfollow
|
def unfollow
|
||||||
FollowService.unfollow(@map, current_user)
|
FollowService.unfollow(@map, current_user)
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.json do
|
format.json do
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class MessagesController < ApplicationController
|
class MessagesController < ApplicationController
|
||||||
before_action :require_user, except: [:show]
|
before_action :require_user, except: [:show]
|
||||||
after_action :verify_authorized
|
after_action :verify_authorized
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class MetacodeSetsController < ApplicationController
|
class MetacodeSetsController < ApplicationController
|
||||||
before_action :require_admin
|
before_action :require_admin
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class MetacodesController < ApplicationController
|
class MetacodesController < ApplicationController
|
||||||
before_action :require_admin, except: [:index, :show]
|
before_action :require_admin, except: %i(index show)
|
||||||
before_action :set_metacode, only: [:edit, :update]
|
before_action :set_metacode, only: %i(edit update)
|
||||||
|
|
||||||
# GET /metacodes
|
# GET /metacodes
|
||||||
# GET /metacodes.json
|
# GET /metacodes.json
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class NotificationsController < ApplicationController
|
class NotificationsController < ApplicationController
|
||||||
before_action :set_receipts, only: [:index, :show, :mark_read, :mark_unread]
|
before_action :set_receipts, only: %i(index show mark_read mark_unread)
|
||||||
before_action :set_notification, only: [:show, :mark_read, :mark_unread]
|
before_action :set_notification, only: %i(show mark_read mark_unread)
|
||||||
before_action :set_receipt, only: [:show, :mark_read, :mark_unread]
|
before_action :set_receipt, only: %i(show mark_read mark_unread)
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@notifications = current_user.mailbox.notifications.page(params[:page]).per(25)
|
@notifications = current_user.mailbox.notifications.page(params[:page]).per(25)
|
||||||
|
@ -27,14 +28,14 @@ class NotificationsController < ApplicationController
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html do
|
format.html do
|
||||||
case @notification.notification_code
|
case @notification.notification_code
|
||||||
when MAP_ACCESS_APPROVED, MAP_INVITE_TO_EDIT
|
when MAP_ACCESS_APPROVED, MAP_INVITE_TO_EDIT
|
||||||
redirect_to map_path(@notification.notified_object.map)
|
redirect_to map_path(@notification.notified_object.map)
|
||||||
when TOPIC_ADDED_TO_MAP
|
when TOPIC_ADDED_TO_MAP
|
||||||
redirect_to map_path(@notification.notified_object.map)
|
redirect_to map_path(@notification.notified_object.map)
|
||||||
when TOPIC_CONNECTED_1
|
when TOPIC_CONNECTED_1
|
||||||
redirect_to topic_path(@notification.notified_object.topic1)
|
redirect_to topic_path(@notification.notified_object.topic1)
|
||||||
when TOPIC_CONNECTED_2
|
when TOPIC_CONNECTED_2
|
||||||
redirect_to topic_path(@notification.notified_object.topic2)
|
redirect_to topic_path(@notification.notified_object.topic2)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
format.json do
|
format.json do
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class SearchController < ApplicationController
|
class SearchController < ApplicationController
|
||||||
include TopicsHelper
|
include TopicsHelper
|
||||||
include MapsHelper
|
include MapsHelper
|
||||||
|
@ -7,7 +8,7 @@ class SearchController < ApplicationController
|
||||||
|
|
||||||
before_action :authorize_search
|
before_action :authorize_search
|
||||||
after_action :verify_authorized
|
after_action :verify_authorized
|
||||||
after_action :verify_policy_scoped, only: [:maps, :mappers, :synapses, :topics]
|
after_action :verify_policy_scoped, only: %i(maps mappers synapses topics)
|
||||||
|
|
||||||
# get /search/topics?term=SOMETERM
|
# get /search/topics?term=SOMETERM
|
||||||
def topics
|
def topics
|
||||||
|
@ -140,13 +141,13 @@ class SearchController < ApplicationController
|
||||||
topic1id = params[:topic1id]
|
topic1id = params[:topic1id]
|
||||||
topic2id = params[:topic2id]
|
topic2id = params[:topic2id]
|
||||||
|
|
||||||
if term && !term.empty?
|
if term.present?
|
||||||
@synapses = policy_scope(Synapse)
|
@synapses = policy_scope(Synapse)
|
||||||
.where('LOWER("desc") like ?', '%' + term.downcase.strip + '%')
|
.where('LOWER("desc") like ?', '%' + term.downcase.strip + '%')
|
||||||
.order('"desc"')
|
.order('"desc"')
|
||||||
|
|
||||||
@synapses = @synapses.uniq(&:desc)
|
@synapses = @synapses.uniq(&:desc)
|
||||||
elsif topic1id && !topic1id.empty?
|
elsif topic1id.present?
|
||||||
one = policy_scope(Synapse).where(topic1_id: topic1id, topic2_id: topic2id)
|
one = policy_scope(Synapse).where(topic1_id: topic1id, topic2_id: topic2id)
|
||||||
two = policy_scope(Synapse).where(topic2_id: topic1id, topic1_id: topic2id)
|
two = policy_scope(Synapse).where(topic2_id: topic1id, topic1_id: topic2id)
|
||||||
@synapses = one + two
|
@synapses = one + two
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class StarsController < ApplicationController
|
class StarsController < ApplicationController
|
||||||
before_action :require_user
|
before_action :require_user
|
||||||
before_action :set_map
|
before_action :set_map
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class SynapsesController < ApplicationController
|
class SynapsesController < ApplicationController
|
||||||
include TopicsHelper
|
include TopicsHelper
|
||||||
|
|
||||||
before_action :require_user, only: [:create, :update, :destroy]
|
before_action :require_user, only: %i(create update destroy)
|
||||||
after_action :verify_authorized, except: :index
|
after_action :verify_authorized, except: :index
|
||||||
after_action :verify_policy_scoped, only: :index
|
after_action :verify_policy_scoped, only: :index
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class TokensController < ApplicationController
|
class TokensController < ApplicationController
|
||||||
before_action :require_user, only: [:new]
|
before_action :require_user, only: [:new]
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class TopicsController < ApplicationController
|
class TopicsController < ApplicationController
|
||||||
include TopicsHelper
|
include TopicsHelper
|
||||||
|
|
||||||
before_action :require_user, only: [:create, :update, :destroy, :follow, :unfollow]
|
before_action :require_user, only: %i(create update destroy follow unfollow)
|
||||||
before_action :set_topic, only: [:show, :update, :relative_numbers,
|
before_action :set_topic, only: %i(show update relative_numbers
|
||||||
:relatives, :network, :destroy,
|
relatives network destroy
|
||||||
:follow, :unfollow, :unfollow_from_email]
|
follow unfollow unfollow_from_email)
|
||||||
after_action :verify_authorized, except: :autocomplete_topic
|
after_action :verify_authorized, except: :autocomplete_topic
|
||||||
|
|
||||||
respond_to :html, :js, :json
|
respond_to :html, :js, :json
|
||||||
|
@ -13,7 +14,7 @@ class TopicsController < ApplicationController
|
||||||
# GET /topics/autocomplete_topic
|
# GET /topics/autocomplete_topic
|
||||||
def autocomplete_topic
|
def autocomplete_topic
|
||||||
term = params[:term]
|
term = params[:term]
|
||||||
if term && !term.empty?
|
if term.present?
|
||||||
topics = policy_scope(Topic)
|
topics = policy_scope(Topic)
|
||||||
.where('LOWER("name") like ?', term.downcase + '%')
|
.where('LOWER("name") like ?', term.downcase + '%')
|
||||||
.order('"name"')
|
.order('"name"')
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Users
|
module Users
|
||||||
class PasswordsController < Devise::PasswordsController
|
class PasswordsController < Devise::PasswordsController
|
||||||
protected
|
protected
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Users
|
module Users
|
||||||
class RegistrationsController < Devise::RegistrationsController
|
class RegistrationsController < Devise::RegistrationsController
|
||||||
before_action :configure_sign_up_params, only: [:create]
|
before_action :configure_sign_up_params, only: [:create]
|
||||||
|
@ -29,7 +30,7 @@ module Users
|
||||||
end
|
end
|
||||||
|
|
||||||
def configure_sign_up_params
|
def configure_sign_up_params
|
||||||
devise_parameter_sanitizer.permit(:sign_up, keys: [:name, :joinedwithcode])
|
devise_parameter_sanitizer.permit(:sign_up, keys: %i(name joinedwithcode))
|
||||||
end
|
end
|
||||||
|
|
||||||
def configure_account_update_params
|
def configure_account_update_params
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Users
|
module Users
|
||||||
class SessionsController < Devise::SessionsController
|
class SessionsController < Devise::SessionsController
|
||||||
after_action :store_location, only: [:new]
|
after_action :store_location, only: [:new]
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class UsersController < ApplicationController
|
class UsersController < ApplicationController
|
||||||
before_action :require_user, only: [:edit, :update, :updatemetacodes, :update_metacode_focus]
|
before_action :require_user, only: %i(edit update updatemetacodes update_metacode_focus)
|
||||||
|
|
||||||
respond_to :html, :json
|
respond_to :html, :json
|
||||||
|
|
||||||
|
@ -100,7 +101,7 @@ class UsersController < ApplicationController
|
||||||
@user.settings.metacode_focus = params[:value]
|
@user.settings.metacode_focus = params[:value]
|
||||||
@user.save
|
@user.save
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.json { render json: { success: "success" }}
|
format.json { render json: { success: 'success' } }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class NotificationDecorator
|
class NotificationDecorator
|
||||||
class << self
|
class << self
|
||||||
def decorate(notification, receipt)
|
def decorate(notification, receipt)
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module ApplicationHelper
|
module ApplicationHelper
|
||||||
def invite_link
|
def invite_link
|
||||||
"#{request.base_url}/join" + (current_user ? "?code=#{current_user.code}" : '')
|
"#{request.base_url}/join" + (current_user ? "?code=#{current_user.code}" : '')
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module ContentHelper
|
module ContentHelper
|
||||||
def resource_name
|
def resource_name
|
||||||
:user
|
:user
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module DeviseHelper
|
module DeviseHelper
|
||||||
def devise_error_messages!
|
def devise_error_messages!
|
||||||
resource.errors.to_a[0]
|
resource.errors.to_a[0]
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module InMetacodeSetsHelper
|
module InMetacodeSetsHelper
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module MainHelper
|
module MainHelper
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module MapMailerHelper
|
module MapMailerHelper
|
||||||
def access_approved_subject(map)
|
def access_approved_subject(map)
|
||||||
map.name + ' - access approved'
|
map.name + ' - access approved'
|
||||||
|
@ -5,9 +7,9 @@ module MapMailerHelper
|
||||||
|
|
||||||
def access_request_subject(map)
|
def access_request_subject(map)
|
||||||
map.name + ' - request to edit'
|
map.name + ' - request to edit'
|
||||||
end
|
end
|
||||||
|
|
||||||
def invite_to_edit_subject(map)
|
def invite_to_edit_subject(map)
|
||||||
map.name + ' - invited to edit'
|
map.name + ' - invited to edit'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module MappingHelper
|
module MappingHelper
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module MapsHelper
|
module MapsHelper
|
||||||
# JSON autocomplete format for typeahead
|
# JSON autocomplete format for typeahead
|
||||||
def autocomplete_map_array_json(maps)
|
def autocomplete_map_array_json(maps)
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module MetacodesHelper
|
module MetacodesHelper
|
||||||
def metacodeset
|
def metacodeset
|
||||||
metacodes = current_user.settings.metacodes
|
metacodes = current_user.settings.metacodes
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module SynapsesHelper
|
module SynapsesHelper
|
||||||
## this one is for building our custom JSON autocomplete format for typeahead
|
## this one is for building our custom JSON autocomplete format for typeahead
|
||||||
def autocomplete_synapse_generic_json(unique)
|
def autocomplete_synapse_generic_json(unique)
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module TopicMailerHelper
|
module TopicMailerHelper
|
||||||
def added_to_map_subject(topic, map)
|
def added_to_map_subject(topic, map)
|
||||||
topic.name + ' was added to map ' + map.name
|
topic.name + ' was added to map ' + map.name
|
||||||
|
@ -7,4 +8,4 @@ module TopicMailerHelper
|
||||||
def connected_subject(topic)
|
def connected_subject(topic)
|
||||||
'new synapse to topic ' + topic.name
|
'new synapse to topic ' + topic.name
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module TopicsHelper
|
module TopicsHelper
|
||||||
## this one is for building our custom JSON autocomplete format for typeahead
|
## this one is for building our custom JSON autocomplete format for typeahead
|
||||||
def autocomplete_array_json(topics)
|
def autocomplete_array_json(topics)
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module UsersHelper
|
module UsersHelper
|
||||||
# build custom json autocomplete for typeahead
|
# build custom json autocomplete for typeahead
|
||||||
def autocomplete_user_array_json(users)
|
def autocomplete_user_array_json(users)
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class ApplicationMailer < ActionMailer::Base
|
class ApplicationMailer < ActionMailer::Base
|
||||||
default from: 'team@metamaps.cc'
|
default from: 'team@metamaps.cc'
|
||||||
layout 'mailer'
|
layout 'mailer'
|
||||||
|
@ -6,24 +7,24 @@ class ApplicationMailer < ActionMailer::Base
|
||||||
class << self
|
class << self
|
||||||
def mail_for_notification(notification)
|
def mail_for_notification(notification)
|
||||||
case notification.notification_code
|
case notification.notification_code
|
||||||
when MAP_ACCESS_REQUEST
|
when MAP_ACCESS_REQUEST
|
||||||
request = notification.notified_object
|
request = notification.notified_object
|
||||||
MapMailer.access_request(request)
|
MapMailer.access_request(request)
|
||||||
when MAP_ACCESS_APPROVED
|
when MAP_ACCESS_APPROVED
|
||||||
request = notification.notified_object
|
request = notification.notified_object
|
||||||
MapMailer.access_approved(request)
|
MapMailer.access_approved(request)
|
||||||
when MAP_INVITE_TO_EDIT
|
when MAP_INVITE_TO_EDIT
|
||||||
user_map = notification.notified_object
|
user_map = notification.notified_object
|
||||||
MapMailer.invite_to_edit(user_map)
|
MapMailer.invite_to_edit(user_map)
|
||||||
when TOPIC_ADDED_TO_MAP
|
when TOPIC_ADDED_TO_MAP
|
||||||
event = notification.notified_object
|
event = notification.notified_object
|
||||||
TopicMailer.added_to_map(event, notification.recipients[0])
|
TopicMailer.added_to_map(event, notification.recipients[0])
|
||||||
when TOPIC_CONNECTED_1
|
when TOPIC_CONNECTED_1
|
||||||
synapse = notification.notified_object
|
synapse = notification.notified_object
|
||||||
TopicMailer.connected(synapse, synapse.topic1, notification.recipients[0])
|
TopicMailer.connected(synapse, synapse.topic1, notification.recipients[0])
|
||||||
when TOPIC_CONNECTED_2
|
when TOPIC_CONNECTED_2
|
||||||
synapse = notification.notified_object
|
synapse = notification.notified_object
|
||||||
TopicMailer.connected(synapse, synapse.topic2, notification.recipients[0])
|
TopicMailer.connected(synapse, synapse.topic2, notification.recipients[0])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class MapActivityMailer < ApplicationMailer
|
class MapActivityMailer < ApplicationMailer
|
||||||
default from: 'team@metamaps.cc'
|
default from: 'team@metamaps.cc'
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class MapMailer < ApplicationMailer
|
class MapMailer < ApplicationMailer
|
||||||
include MapMailerHelper
|
include MapMailerHelper
|
||||||
default from: 'team@metamaps.cc'
|
default from: 'team@metamaps.cc'
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class TopicMailer < ApplicationMailer
|
class TopicMailer < ApplicationMailer
|
||||||
include TopicMailerHelper
|
include TopicMailerHelper
|
||||||
default from: 'team@metamaps.cc'
|
default from: 'team@metamaps.cc'
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class AccessRequest < ApplicationRecord
|
class AccessRequest < ApplicationRecord
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
belongs_to :map
|
belongs_to :map
|
||||||
has_one :user_map
|
has_one :user_map
|
||||||
|
|
||||||
after_create :after_created_async
|
after_create :after_created_async
|
||||||
|
|
||||||
def approve
|
def approve
|
||||||
|
@ -27,9 +28,9 @@ class AccessRequest < ApplicationRecord
|
||||||
Mailboxer::Receipt.where(notification: notification).update_all(is_read: true)
|
Mailboxer::Receipt.where(notification: notification).update_all(is_read: true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def after_created_async
|
def after_created_async
|
||||||
NotificationService.access_request(self)
|
NotificationService.access_request(self)
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class ApplicationRecord < ActiveRecord::Base
|
class ApplicationRecord < ActiveRecord::Base
|
||||||
self.abstract_class = true
|
self.abstract_class = true
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Attachment < ApplicationRecord
|
class Attachment < ApplicationRecord
|
||||||
belongs_to :attachable, polymorphic: true
|
belongs_to :attachable, polymorphic: true
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Attachable
|
module Attachable
|
||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Routing
|
module Routing
|
||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
include Rails.application.routes.url_helpers
|
include Rails.application.routes.url_helpers
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Event < ApplicationRecord
|
class Event < ApplicationRecord
|
||||||
KINDS = %w(user_present_on_map user_not_present_on_map
|
KINDS = %w(user_present_on_map user_not_present_on_map
|
||||||
conversation_started_on_map
|
conversation_started_on_map
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Events
|
module Events
|
||||||
class ConversationStartedOnMap < Event
|
class ConversationStartedOnMap < Event
|
||||||
# after_create :notify_users!
|
# after_create :notify_users!
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Events
|
module Events
|
||||||
class SynapseAddedToMap < Event
|
class SynapseAddedToMap < Event
|
||||||
# after_create :notify_users!
|
# after_create :notify_users!
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Events
|
module Events
|
||||||
class SynapseRemovedFromMap < Event
|
class SynapseRemovedFromMap < Event
|
||||||
# after_create :notify_users!
|
# after_create :notify_users!
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Events
|
module Events
|
||||||
class SynapseUpdated < Event
|
class SynapseUpdated < Event
|
||||||
# after_create :notify_users!
|
# after_create :notify_users!
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Events
|
module Events
|
||||||
class TopicAddedToMap < Event
|
class TopicAddedToMap < Event
|
||||||
after_create :notify_users!
|
after_create :notify_users!
|
||||||
|
@ -10,7 +11,7 @@ module Events
|
||||||
user: user,
|
user: user,
|
||||||
meta: meta)
|
meta: meta)
|
||||||
end
|
end
|
||||||
|
|
||||||
def notify_users!
|
def notify_users!
|
||||||
# in the future, notify followers of both the topic, and the map
|
# in the future, notify followers of both the topic, and the map
|
||||||
NotificationService.notify_followers(eventable, TOPIC_ADDED_TO_MAP, self)
|
NotificationService.notify_followers(eventable, TOPIC_ADDED_TO_MAP, self)
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Events
|
module Events
|
||||||
class TopicMovedOnMap < Event
|
class TopicMovedOnMap < Event
|
||||||
# after_create :notify_users!
|
# after_create :notify_users!
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Events
|
module Events
|
||||||
class TopicRemovedFromMap < Event
|
class TopicRemovedFromMap < Event
|
||||||
# after_create :notify_users!
|
# after_create :notify_users!
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Events
|
module Events
|
||||||
class TopicUpdated < Event
|
class TopicUpdated < Event
|
||||||
#after_create :notify_users!
|
# after_create :notify_users!
|
||||||
|
|
||||||
def self.publish!(topic, user, meta)
|
def self.publish!(topic, user, meta)
|
||||||
create!(kind: 'topic_updated',
|
create!(kind: 'topic_updated',
|
||||||
|
@ -9,7 +10,7 @@ module Events
|
||||||
user: user,
|
user: user,
|
||||||
meta: meta)
|
meta: meta)
|
||||||
end
|
end
|
||||||
|
|
||||||
def notify_users!
|
def notify_users!
|
||||||
NotificationService.notify_followers(eventable, 'topic_updated', self)
|
NotificationService.notify_followers(eventable, 'topic_updated', self)
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Events
|
module Events
|
||||||
class UserNotPresentOnMap < Event
|
class UserNotPresentOnMap < Event
|
||||||
# after_create :notify_users!
|
# after_create :notify_users!
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Events
|
module Events
|
||||||
class UserPresentOnMap < Event
|
class UserPresentOnMap < Event
|
||||||
# after_create :notify_users!
|
# after_create :notify_users!
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
class Follow < ApplicationRecord
|
|
||||||
|
|
||||||
|
class Follow < ApplicationRecord
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
belongs_to :followed, polymorphic: true
|
belongs_to :followed, polymorphic: true
|
||||||
has_one :follow_reason, dependent: :destroy
|
has_one :follow_reason, dependent: :destroy
|
||||||
|
|
||||||
validates :user, presence: true
|
validates :user, presence: true
|
||||||
validates :followed, presence: true
|
validates :followed, presence: true
|
||||||
validates :user, uniqueness: { scope: :followed, message: 'This entity is already followed by this user' }
|
validates :user, uniqueness: { scope: :followed, message: 'This entity is already followed by this user' }
|
||||||
|
|
||||||
after_create :add_subsetting
|
after_create :add_subsetting
|
||||||
|
|
||||||
scope :active, -> {
|
scope :active, -> {
|
||||||
where(muted: false)
|
where(muted: false)
|
||||||
}
|
}
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class FollowReason < ApplicationRecord
|
class FollowReason < ApplicationRecord
|
||||||
REASONS = %w(created commented contributed followed shared_on starred).freeze
|
REASONS = %w(created commented contributed followed shared_on starred).freeze
|
||||||
|
|
||||||
belongs_to :follow
|
belongs_to :follow
|
||||||
|
|
||||||
validates :follow, presence: true
|
validates :follow, presence: true
|
||||||
|
|
||||||
def has_reason
|
def has_reason
|
||||||
created || commented || contributed || followed || shared_on || starred
|
created || commented || contributed || followed || shared_on || starred
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class InMetacodeSet < ApplicationRecord
|
class InMetacodeSet < ApplicationRecord
|
||||||
belongs_to :metacode, class_name: 'Metacode', foreign_key: 'metacode_id'
|
belongs_to :metacode, class_name: 'Metacode', foreign_key: 'metacode_id'
|
||||||
belongs_to :metacode_set, class_name: 'MetacodeSet', foreign_key: 'metacode_set_id'
|
belongs_to :metacode_set, class_name: 'MetacodeSet', foreign_key: 'metacode_set_id'
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Map < ApplicationRecord
|
class Map < ApplicationRecord
|
||||||
ATTRS_TO_WATCH = %w(name desc permission).freeze
|
ATTRS_TO_WATCH = %w(name desc permission).freeze
|
||||||
|
|
||||||
|
@ -15,7 +16,7 @@ class Map < ApplicationRecord
|
||||||
has_many :messages, as: :resource, dependent: :destroy
|
has_many :messages, as: :resource, dependent: :destroy
|
||||||
has_many :stars, dependent: :destroy
|
has_many :stars, dependent: :destroy
|
||||||
has_many :follows, as: :followed, dependent: :destroy
|
has_many :follows, as: :followed, dependent: :destroy
|
||||||
has_many :followers, :through => :follows, source: :user
|
has_many :followers, through: :follows, source: :user
|
||||||
|
|
||||||
has_many :access_requests, dependent: :destroy
|
has_many :access_requests, dependent: :destroy
|
||||||
has_many :user_maps, dependent: :destroy
|
has_many :user_maps, dependent: :destroy
|
||||||
|
@ -89,10 +90,10 @@ class Map < ApplicationRecord
|
||||||
|
|
||||||
def as_json(_options = {})
|
def as_json(_options = {})
|
||||||
json = super(
|
json = super(
|
||||||
methods: [:user_name, :user_image, :star_count, :topic_count, :synapse_count,
|
methods: %i(user_name user_image star_count topic_count synapse_count
|
||||||
:contributor_count, :collaborator_ids, :screenshot_url],
|
contributor_count collaborator_ids screenshot_url),
|
||||||
except: [:screenshot_content_type, :screenshot_file_size, :screenshot_file_name,
|
except: %i(screenshot_content_type screenshot_file_size screenshot_file_name
|
||||||
:screenshot_updated_at]
|
screenshot_updated_at)
|
||||||
)
|
)
|
||||||
json[:created_at_clean] = created_at_str
|
json[:created_at_clean] = created_at_str
|
||||||
json[:updated_at_clean] = updated_at_str
|
json[:updated_at_clean] = updated_at_str
|
||||||
|
@ -133,16 +134,16 @@ class Map < ApplicationRecord
|
||||||
end
|
end
|
||||||
removed.compact
|
removed.compact
|
||||||
end
|
end
|
||||||
|
|
||||||
def update_deferring_topics_and_synapses
|
def update_deferring_topics_and_synapses
|
||||||
Topic.where(defer_to_map_id: id).update(permission: permission)
|
Topic.where(defer_to_map_id: id).update(permission: permission)
|
||||||
Synapse.where(defer_to_map_id: id).update(permission: permission)
|
Synapse.where(defer_to_map_id: id).update(permission: permission)
|
||||||
end
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def after_created
|
def after_created
|
||||||
FollowService.follow(self, self.user, 'created')
|
FollowService.follow(self, user, 'created')
|
||||||
# notify users following the map creator
|
# notify users following the map creator
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -150,7 +151,7 @@ class Map < ApplicationRecord
|
||||||
return unless ATTRS_TO_WATCH.any? { |k| changed_attributes.key?(k) }
|
return unless ATTRS_TO_WATCH.any? { |k| changed_attributes.key?(k) }
|
||||||
ActionCable.server.broadcast 'map_' + id.to_s, type: 'mapUpdated'
|
ActionCable.server.broadcast 'map_' + id.to_s, type: 'mapUpdated'
|
||||||
end
|
end
|
||||||
|
|
||||||
def after_updated_async
|
def after_updated_async
|
||||||
if ATTRS_TO_WATCH.any? { |k| changed_attributes.key?(k) }
|
if ATTRS_TO_WATCH.any? { |k| changed_attributes.key?(k) }
|
||||||
FollowService.follow(self, updated_by, 'contributed')
|
FollowService.follow(self, updated_by, 'contributed')
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Mapping < ApplicationRecord
|
class Mapping < ApplicationRecord
|
||||||
scope :topicmapping, -> { where(mappable_type: :Topic) }
|
scope :topicmapping, -> { where(mappable_type: :Topic) }
|
||||||
scope :synapsemapping, -> { where(mappable_type: :Synapse) }
|
scope :synapsemapping, -> { where(mappable_type: :Synapse) }
|
||||||
|
@ -24,7 +25,7 @@ class Mapping < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def as_json(_options = {})
|
def as_json(_options = {})
|
||||||
super(methods: [:user_name, :user_image])
|
super(methods: %i(user_name user_image))
|
||||||
end
|
end
|
||||||
|
|
||||||
def after_created
|
def after_created
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Message < ApplicationRecord
|
class Message < ApplicationRecord
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
belongs_to :resource, polymorphic: true
|
belongs_to :resource, polymorphic: true
|
||||||
|
@ -6,15 +7,14 @@ class Message < ApplicationRecord
|
||||||
delegate :name, to: :user, prefix: true
|
delegate :name, to: :user, prefix: true
|
||||||
|
|
||||||
after_create :after_created
|
after_create :after_created
|
||||||
#after_create :after_created_async
|
# after_create :after_created_async
|
||||||
|
|
||||||
|
|
||||||
def user_image
|
def user_image
|
||||||
user.image.url
|
user.image.url
|
||||||
end
|
end
|
||||||
|
|
||||||
def as_json(_options = {})
|
def as_json(_options = {})
|
||||||
json = super(methods: [:user_name, :user_image])
|
json = super(methods: %i(user_name user_image))
|
||||||
json
|
json
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Metacode < ApplicationRecord
|
class Metacode < ApplicationRecord
|
||||||
has_many :in_metacode_sets
|
has_many :in_metacode_sets
|
||||||
has_many :metacode_sets, through: :in_metacode_sets
|
has_many :metacode_sets, through: :in_metacode_sets
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class MetacodeSet < ApplicationRecord
|
class MetacodeSet < ApplicationRecord
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
has_many :in_metacode_sets
|
has_many :in_metacode_sets
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class PermittedParams < Struct.new(:params)
|
class PermittedParams < Struct.new(:params)
|
||||||
%w(map synapse topic mapping token).each do |kind|
|
%w(map synapse topic mapping token).each do |kind|
|
||||||
define_method(kind) do
|
define_method(kind) do
|
||||||
|
@ -15,18 +16,18 @@ class PermittedParams < Struct.new(:params)
|
||||||
end
|
end
|
||||||
|
|
||||||
def map_attributes
|
def map_attributes
|
||||||
[:name, :desc, :permission, :arranged]
|
%i(name desc permission arranged)
|
||||||
end
|
end
|
||||||
|
|
||||||
def synapse_attributes
|
def synapse_attributes
|
||||||
[:desc, :category, :weight, :permission, :topic1_id, :topic2_id]
|
%i(desc category weight permission topic1_id topic2_id)
|
||||||
end
|
end
|
||||||
|
|
||||||
def topic_attributes
|
def topic_attributes
|
||||||
[:name, :desc, :link, :permission, :metacode_id]
|
%i(name desc link permission metacode_id)
|
||||||
end
|
end
|
||||||
|
|
||||||
def mapping_attributes
|
def mapping_attributes
|
||||||
[:xloc, :yloc, :map_id, :mappable_type, :mappable_id]
|
%i(xloc yloc map_id mappable_type mappable_id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,20 +1,21 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
class Star < ActiveRecord::Base
|
|
||||||
|
class Star < ApplicationRecord
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
belongs_to :map
|
belongs_to :map
|
||||||
validates :map, uniqueness: { scope: :user, message: 'You have already starred this map' }
|
validates :map, uniqueness: { scope: :user, message: 'You have already starred this map' }
|
||||||
|
|
||||||
#after_create :after_created_async
|
# after_create :after_created_async
|
||||||
#before_destroy :before_destroyed
|
# before_destroy :before_destroyed
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def after_created_async
|
def after_created_async
|
||||||
FollowService.follow(map, user, 'starred')
|
FollowService.follow(map, user, 'starred')
|
||||||
NotificationService.notify_followers(map, 'map_starred', self, 'created')
|
NotificationService.notify_followers(map, 'map_starred', self, 'created')
|
||||||
end
|
end
|
||||||
handle_asynchronously :after_created_async
|
handle_asynchronously :after_created_async
|
||||||
|
|
||||||
def before_destroyed
|
def before_destroyed
|
||||||
FollowService.remove_reason(map, user, 'starred')
|
FollowService.remove_reason(map, user, 'starred')
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Synapse < ApplicationRecord
|
class Synapse < ApplicationRecord
|
||||||
ATTRS_TO_WATCH = %w(desc category permission defer_to_map_id).freeze
|
ATTRS_TO_WATCH = %w(desc category permission defer_to_map_id).freeze
|
||||||
|
|
||||||
|
@ -38,7 +39,7 @@ class Synapse < ApplicationRecord
|
||||||
|
|
||||||
def collaborator_ids
|
def collaborator_ids
|
||||||
if defer_to_map
|
if defer_to_map
|
||||||
defer_to_map.editors.select { |mapper| mapper != user }.map(&:id)
|
defer_to_map.editors.reject { |mapper| mapper == user }.map(&:id)
|
||||||
else
|
else
|
||||||
[]
|
[]
|
||||||
end
|
end
|
||||||
|
@ -54,7 +55,7 @@ class Synapse < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def as_json(_options = {})
|
def as_json(_options = {})
|
||||||
super(methods: [:user_name, :user_image, :collaborator_ids])
|
super(methods: %i(user_name user_image collaborator_ids))
|
||||||
end
|
end
|
||||||
|
|
||||||
def as_rdf
|
def as_rdf
|
||||||
|
@ -96,7 +97,7 @@ class Synapse < ApplicationRecord
|
||||||
|
|
||||||
def before_destroyed
|
def before_destroyed
|
||||||
# hard to know how to do this yet, because the synapse actually gets destroyed
|
# hard to know how to do this yet, because the synapse actually gets destroyed
|
||||||
#NotificationService.notify_followers(topic1, 'topic_disconnected', self)
|
# NotificationService.notify_followers(topic1, 'topic_disconnected', self)
|
||||||
#NotificationService.notify_followers(topic2, 'topic_disconnected', self)
|
# NotificationService.notify_followers(topic2, 'topic_disconnected', self)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Token < ApplicationRecord
|
class Token < ApplicationRecord
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Topic < ApplicationRecord
|
class Topic < ApplicationRecord
|
||||||
ATTRS_TO_WATCH = %w(name desc link metacode_id permission defer_to_map_id).freeze
|
ATTRS_TO_WATCH = %w(name desc link metacode_id permission defer_to_map_id).freeze
|
||||||
include TopicsHelper
|
include TopicsHelper
|
||||||
|
@ -16,7 +17,7 @@ class Topic < ApplicationRecord
|
||||||
has_many :mappings, as: :mappable, dependent: :destroy
|
has_many :mappings, as: :mappable, dependent: :destroy
|
||||||
has_many :maps, through: :mappings
|
has_many :maps, through: :mappings
|
||||||
has_many :follows, as: :followed, dependent: :destroy
|
has_many :follows, as: :followed, dependent: :destroy
|
||||||
has_many :followers, :through => :follows, source: :user
|
has_many :followers, through: :follows, source: :user
|
||||||
|
|
||||||
belongs_to :metacode
|
belongs_to :metacode
|
||||||
|
|
||||||
|
@ -25,7 +26,7 @@ class Topic < ApplicationRecord
|
||||||
after_create :after_created_async
|
after_create :after_created_async
|
||||||
after_update :after_updated
|
after_update :after_updated
|
||||||
after_update :after_updated_async
|
after_update :after_updated_async
|
||||||
#before_destroy :before_destroyed
|
# before_destroy :before_destroyed
|
||||||
|
|
||||||
validates :permission, presence: true
|
validates :permission, presence: true
|
||||||
validates :permission, inclusion: { in: Perm::ISSIONS.map(&:to_s) }
|
validates :permission, inclusion: { in: Perm::ISSIONS.map(&:to_s) }
|
||||||
|
@ -69,7 +70,7 @@ class Topic < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def as_json(options = {})
|
def as_json(options = {})
|
||||||
super(methods: [:user_name, :user_image, :collaborator_ids])
|
super(methods: %i(user_name user_image collaborator_ids))
|
||||||
.merge(inmaps: inmaps(options[:user]), inmapsLinks: inmapsLinks(options[:user]),
|
.merge(inmaps: inmaps(options[:user]), inmapsLinks: inmapsLinks(options[:user]),
|
||||||
map_count: map_count(options[:user]), synapse_count: synapse_count(options[:user]))
|
map_count: map_count(options[:user]), synapse_count: synapse_count(options[:user]))
|
||||||
end
|
end
|
||||||
|
@ -89,7 +90,7 @@ class Topic < ApplicationRecord
|
||||||
|
|
||||||
def collaborator_ids
|
def collaborator_ids
|
||||||
if defer_to_map
|
if defer_to_map
|
||||||
defer_to_map.editors.select { |mapper| mapper != user }.map(&:id)
|
defer_to_map.editors.reject { |mapper| mapper == user }.map(&:id)
|
||||||
else
|
else
|
||||||
[]
|
[]
|
||||||
end
|
end
|
||||||
|
@ -154,9 +155,9 @@ class Topic < ApplicationRecord
|
||||||
self.link = Rails.application.routes.url_helpers
|
self.link = Rails.application.routes.url_helpers
|
||||||
.map_url(host: ENV['MAILER_DEFAULT_URL'], id: @map.id)
|
.map_url(host: ENV['MAILER_DEFAULT_URL'], id: @map.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
def after_created_async
|
def after_created_async
|
||||||
FollowService.follow(self, self.user, 'created')
|
FollowService.follow(self, user, 'created')
|
||||||
# notify users following the topic creator
|
# notify users following the topic creator
|
||||||
end
|
end
|
||||||
handle_asynchronously :after_created_async
|
handle_asynchronously :after_created_async
|
||||||
|
@ -173,7 +174,7 @@ class Topic < ApplicationRecord
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def after_updated_async
|
def after_updated_async
|
||||||
if ATTRS_TO_WATCH.any? { |k| changed_attributes.key?(k) }
|
if ATTRS_TO_WATCH.any? { |k| changed_attributes.key?(k) }
|
||||||
FollowService.follow(self, updated_by, 'contributed')
|
FollowService.follow(self, updated_by, 'contributed')
|
||||||
|
@ -183,6 +184,6 @@ class Topic < ApplicationRecord
|
||||||
|
|
||||||
def before_destroyed
|
def before_destroyed
|
||||||
# hard to know how to do this yet, because the topic actually gets destroyed
|
# hard to know how to do this yet, because the topic actually gets destroyed
|
||||||
#NotificationService.notify_followers(self, 'topic_deleted', ?)
|
# NotificationService.notify_followers(self, 'topic_deleted', ?)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require 'open-uri'
|
require 'open-uri'
|
||||||
|
|
||||||
class User < ApplicationRecord
|
class User < ApplicationRecord
|
||||||
|
@ -53,24 +54,22 @@ class User < ApplicationRecord
|
||||||
# override default as_json
|
# override default as_json
|
||||||
def as_json(_options = {})
|
def as_json(_options = {})
|
||||||
json = { id: id,
|
json = { id: id,
|
||||||
name: name,
|
name: name,
|
||||||
image: image.url(:sixtyfour),
|
image: image.url(:sixtyfour),
|
||||||
admin: admin }
|
admin: admin }
|
||||||
if (_options[:follows])
|
if _options[:follows]
|
||||||
json['follows'] = {
|
json['follows'] = {
|
||||||
topics: following.active.where(followed_type: 'Topic').to_a.map(&:followed_id),
|
topics: following.active.where(followed_type: 'Topic').to_a.map(&:followed_id),
|
||||||
maps: following.active.where(followed_type: 'Map').to_a.map(&:followed_id)
|
maps: following.active.where(followed_type: 'Map').to_a.map(&:followed_id)
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
if (_options[:follow_settings])
|
if _options[:follow_settings]
|
||||||
json['follow_topic_on_created'] = settings.follow_topic_on_created == "1"
|
json['follow_topic_on_created'] = settings.follow_topic_on_created == '1'
|
||||||
json['follow_topic_on_contributed'] = settings.follow_topic_on_contributed == "1"
|
json['follow_topic_on_contributed'] = settings.follow_topic_on_contributed == '1'
|
||||||
json['follow_map_on_created'] = settings.follow_map_on_created == "1"
|
json['follow_map_on_created'] = settings.follow_map_on_created == '1'
|
||||||
json['follow_map_on_contributed'] = settings.follow_map_on_contributed == "1"
|
json['follow_map_on_contributed'] = settings.follow_map_on_contributed == '1'
|
||||||
end
|
|
||||||
if (_options[:email])
|
|
||||||
json['email'] = email
|
|
||||||
end
|
end
|
||||||
|
json['email'] = email if _options[:email]
|
||||||
json
|
json
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -134,19 +133,19 @@ class User < ApplicationRecord
|
||||||
|
|
||||||
def has_map_open(map)
|
def has_map_open(map)
|
||||||
latestEvent = Event.where(map: map, user: self)
|
latestEvent = Event.where(map: map, user: self)
|
||||||
.where(kind: ['user_present_on_map', 'user_not_present_on_map'])
|
.where(kind: %w(user_present_on_map user_not_present_on_map))
|
||||||
.order(:created_at)
|
.order(:created_at)
|
||||||
.last
|
.last
|
||||||
latestEvent && latestEvent.kind == 'user_present_on_map'
|
latestEvent && latestEvent.kind == 'user_present_on_map'
|
||||||
end
|
end
|
||||||
|
|
||||||
def has_map_with_synapse_open(synapse)
|
def has_map_with_synapse_open(synapse)
|
||||||
synapse.maps.any?{|map| has_map_open(map)}
|
synapse.maps.any? { |map| has_map_open(map) }
|
||||||
end
|
end
|
||||||
|
|
||||||
def settings
|
def settings
|
||||||
self[:settings] = UserPreference.new if self[:settings].nil?
|
self[:settings] = UserPreference.new if self[:settings].nil?
|
||||||
if not self[:settings].respond_to?(:follow_topic_on_created)
|
unless self[:settings].respond_to?(:follow_topic_on_created)
|
||||||
self[:settings].initialize_follow_settings
|
self[:settings].initialize_follow_settings
|
||||||
end
|
end
|
||||||
self[:settings]
|
self[:settings]
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class UserMap < ApplicationRecord
|
class UserMap < ApplicationRecord
|
||||||
belongs_to :map
|
belongs_to :map
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
belongs_to :access_request
|
belongs_to :access_request
|
||||||
|
|
||||||
after_create :after_created_async
|
after_create :after_created_async
|
||||||
before_destroy :before_destroyed
|
before_destroy :before_destroyed
|
||||||
|
|
||||||
|
@ -12,20 +13,20 @@ class UserMap < ApplicationRecord
|
||||||
Mailboxer::Receipt.where(notification: notification).update_all(is_read: true)
|
Mailboxer::Receipt.where(notification: notification).update_all(is_read: true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def after_created_async
|
def after_created_async
|
||||||
FollowService.follow(map, user, 'shared_on')
|
FollowService.follow(map, user, 'shared_on')
|
||||||
if access_request
|
if access_request
|
||||||
NotificationService.access_approved(self.access_request)
|
NotificationService.access_approved(access_request)
|
||||||
else
|
else
|
||||||
NotificationService.invite_to_edit(self)
|
NotificationService.invite_to_edit(self)
|
||||||
end
|
end
|
||||||
# NotificationService.notify_followers(map, 'map_collaborator_added', self, 'shared_on')
|
# NotificationService.notify_followers(map, 'map_collaborator_added', self, 'shared_on')
|
||||||
end
|
end
|
||||||
handle_asynchronously :after_created_async
|
handle_asynchronously :after_created_async
|
||||||
|
|
||||||
def before_destroyed
|
def before_destroyed
|
||||||
FollowService.remove_reason(map, user, 'shared_on')
|
FollowService.remove_reason(map, user, 'shared_on')
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class UserPreference
|
class UserPreference
|
||||||
attr_accessor :metacodes, :metacode_focus, :follow_topic_on_created, :follow_topic_on_contributed,
|
attr_accessor :metacodes, :metacode_focus, :follow_topic_on_created, :follow_topic_on_contributed,
|
||||||
:follow_map_on_created, :follow_map_on_contributed
|
:follow_map_on_created, :follow_map_on_contributed
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Webhook < ApplicationRecord
|
class Webhook < ApplicationRecord
|
||||||
belongs_to :hookable, polymorphic: true
|
belongs_to :hookable, polymorphic: true
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Webhooks::Slack::Base = Struct.new(:webhook, :event) do
|
Webhooks::Slack::Base = Struct.new(:webhook, :event) do
|
||||||
include Routing
|
include Routing
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Webhooks::Slack::ConversationStartedOnMap < Webhooks::Slack::Base
|
class Webhooks::Slack::ConversationStartedOnMap < Webhooks::Slack::Base
|
||||||
def text
|
def text
|
||||||
"There is a live conversation starting on map *#{event.map.name}*. #{view_map_on_metamaps('Join in!')}"
|
"There is a live conversation starting on map *#{event.map.name}*. #{view_map_on_metamaps('Join in!')}"
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Webhooks::Slack::SynapseAddedToMap < Webhooks::Slack::Base
|
class Webhooks::Slack::SynapseAddedToMap < Webhooks::Slack::Base
|
||||||
def text
|
def text
|
||||||
connector = eventable.desc.empty? ? '->' : eventable.desc
|
connector = eventable.desc.empty? ? '->' : eventable.desc
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Webhooks::Slack::SynapseRemovedFromMap < Webhooks::Slack::Base
|
class Webhooks::Slack::SynapseRemovedFromMap < Webhooks::Slack::Base
|
||||||
def text
|
def text
|
||||||
connector = eventable.desc.empty? ? '->' : eventable.desc
|
connector = eventable.desc.empty? ? '->' : eventable.desc
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Webhooks::Slack::TopicAddedToMap < Webhooks::Slack::Base
|
class Webhooks::Slack::TopicAddedToMap < Webhooks::Slack::Base
|
||||||
def text
|
def text
|
||||||
"*#{eventable.name}* was added by *#{event.user.name}* to the map *#{view_map_on_metamaps}*"
|
"*#{eventable.name}* was added by *#{event.user.name}* to the map *#{view_map_on_metamaps}*"
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Webhooks::Slack::TopicMovedOnMap < Webhooks::Slack::Base
|
class Webhooks::Slack::TopicMovedOnMap < Webhooks::Slack::Base
|
||||||
def text
|
def text
|
||||||
"*#{eventable.name}* was moved by *#{event.user.name}* on the map *#{view_map_on_metamaps}*"
|
"*#{eventable.name}* was moved by *#{event.user.name}* on the map *#{view_map_on_metamaps}*"
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Webhooks::Slack::TopicRemovedFromMap < Webhooks::Slack::Base
|
class Webhooks::Slack::TopicRemovedFromMap < Webhooks::Slack::Base
|
||||||
def text
|
def text
|
||||||
"*#{eventable.name}* was removed by *#{event.user.name}* from the map *#{view_map_on_metamaps}*"
|
"*#{eventable.name}* was removed by *#{event.user.name}* from the map *#{view_map_on_metamaps}*"
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Webhooks::Slack::UserPresentOnMap < Webhooks::Slack::Base
|
class Webhooks::Slack::UserPresentOnMap < Webhooks::Slack::Base
|
||||||
def text
|
def text
|
||||||
"Mapper *#{event.user.name}* has joined the map *#{event.map.name}*. #{view_map_on_metamaps('Map with them')}"
|
"Mapper *#{event.user.name}* has joined the map *#{event.map.name}*. #{view_map_on_metamaps('Map with them')}"
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class ApplicationPolicy
|
class ApplicationPolicy
|
||||||
attr_reader :user, :record
|
attr_reader :user, :record
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class ExplorePolicy < ApplicationPolicy
|
class ExplorePolicy < ApplicationPolicy
|
||||||
def active?
|
def active?
|
||||||
true
|
true
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class HackPolicy < ApplicationPolicy
|
class HackPolicy < ApplicationPolicy
|
||||||
def load_url_title?
|
def load_url_title?
|
||||||
true
|
true
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue