Run rubocop --fix-layout and remove encoding comments
This commit is contained in:
parent
fa63e6e81d
commit
ea2862fdef
283 changed files with 1164 additions and 1969 deletions
|
|
@ -23,8 +23,6 @@ end
|
|||
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
|
||||
load 'rails/tasks/engine.rake'
|
||||
|
||||
|
||||
|
||||
Bundler::GemHelper.install_tasks
|
||||
|
||||
require 'rake/testtask'
|
||||
|
|
@ -36,5 +34,4 @@ Rake::TestTask.new(:test) do |t|
|
|||
t.verbose = false
|
||||
end
|
||||
|
||||
|
||||
task :default => :test
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
# encoding: utf-8
|
||||
class Admin::MessagegroupsController < Admin::BaseController
|
||||
inherit_resources
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
class MessageThreadsController < ApplicationController
|
||||
|
||||
before_action -> { require_plugin_enabled FoodsoftMessages }
|
||||
|
||||
def index
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
class MessagegroupsController < ApplicationController
|
||||
|
||||
def index
|
||||
@messagegroups = Messagegroup.order("name")
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
class MessagesController < ApplicationController
|
||||
|
||||
before_action -> { require_plugin_enabled FoodsoftMessages }
|
||||
|
||||
# Renders the "inbox" action.
|
||||
|
|
@ -22,7 +21,7 @@ class MessagesController < ApplicationController
|
|||
@message.private = original_message.private
|
||||
@message.subject = I18n.t('messages.model.reply_subject', :subject => original_message.subject)
|
||||
@message.body = I18n.t('messages.model.reply_header', :user => original_message.sender.display, :when => I18n.l(original_message.created_at, :format => :short)) + "\n"
|
||||
original_message.body.each_line{ |l| @message.body += I18n.t('messages.model.reply_indent', :line => l) }
|
||||
original_message.body.each_line { |l| @message.body += I18n.t('messages.model.reply_indent', :line => l) }
|
||||
else
|
||||
redirect_to new_message_url, alert: I18n.t('messages.new.error_private')
|
||||
end
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ module MessagesHelper
|
|||
link_text = content_tag :i, nil, class: 'icon-envelope'
|
||||
link_text << " #{options[:text]}" if options[:text].present?
|
||||
link_to(link_text.html_safe, new_message_path(message: messages_params), class: 'btn',
|
||||
title: I18n.t('helpers.submit.message.create'))
|
||||
title: I18n.t('helpers.submit.message.create'))
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
require "email_reply_trimmer"
|
||||
|
||||
class MessagesMailReceiver
|
||||
|
||||
def self.regexp
|
||||
/(?<message_id>\d+)\.(?<user_id>\d+)\.(?<hash>\w+)/
|
||||
end
|
||||
|
|
@ -37,9 +36,9 @@ class MessagesMailReceiver
|
|||
raise BlankBodyException if body.empty?
|
||||
|
||||
message = @user.send_messages.new body: body,
|
||||
group: @message.group,
|
||||
private: @message.private,
|
||||
received_email: data
|
||||
group: @message.group,
|
||||
private: @message.private,
|
||||
received_email: data
|
||||
if @message.reply_to
|
||||
message.reply_to_message = @message.reply_to_message
|
||||
else
|
||||
|
|
@ -73,11 +72,8 @@ class MessagesMailReceiver
|
|||
end
|
||||
|
||||
class BlankBodyException < MidiSmtpServer::SmtpdException
|
||||
|
||||
def initialize(msg = nil)
|
||||
super msg, 541, 'The recipient address rejected your message because of a blank plain body'
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@ class Message < ApplicationRecord
|
|||
attr_accessor :send_method, :recipient_tokens, :order_id
|
||||
|
||||
scope :threads, -> { where(:reply_to => nil) }
|
||||
scope :thread, -> (id) { where("id = ? OR reply_to = ?", id, id) }
|
||||
scope :readable_for, -> (user) {
|
||||
scope :thread, ->(id) { where("id = ? OR reply_to = ?", id, id) }
|
||||
scope :readable_for, ->(user) {
|
||||
user_id = user.try(&:id)
|
||||
|
||||
joins(:message_recipients)
|
||||
|
|
@ -128,12 +128,13 @@ class Message < ApplicationRecord
|
|||
def can_toggle_private?(user)
|
||||
return true if sender == user
|
||||
return false if private?
|
||||
|
||||
user.role_admin?
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def create_salt
|
||||
self.salt = [Array.new(6){rand(256).chr}.join].pack("m").chomp
|
||||
self.salt = [Array.new(6) { rand(256).chr }.join].pack("m").chomp
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
# encoding: utf-8
|
||||
class Messagegroup < Group
|
||||
|
||||
validates_uniqueness_of :name
|
||||
|
||||
protected
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ module FoodsoftMessages
|
|||
class Engine < ::Rails::Engine
|
||||
def navigation(primary, context)
|
||||
return unless FoodsoftMessages.enabled?
|
||||
|
||||
unless primary[:foodcoop].nil?
|
||||
sub_nav = primary[:foodcoop].sub_navigation
|
||||
sub_nav.items <<
|
||||
|
|
|
|||
|
|
@ -1,23 +1,19 @@
|
|||
module FoodsoftMessages
|
||||
|
||||
module UserLink
|
||||
def self.included(base) # :nodoc:
|
||||
base.class_eval do
|
||||
|
||||
# modify user presentation link to writing a message for the user
|
||||
def show_user_link(user=@current_user)
|
||||
def show_user_link(user = @current_user)
|
||||
if user.nil? || !FoodsoftMessages.enabled?
|
||||
show_user user
|
||||
else
|
||||
link_to show_user(user), new_message_path('message[mail_to]' => user.id),
|
||||
:title => I18n.t('helpers.messages.write_message')
|
||||
:title => I18n.t('helpers.messages.write_message')
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# modify existing helper
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue