gem 'oauth-plugin', '>= 0.5.1'
gem 'open_id_authentication', '>= 1.1.0'
gem 'validates_email_format_of', '>= 1.5.1'
-gem 'composite_primary_keys', '~> 7.0.10'
+gem 'composite_primary_keys', '~> 7.0.11'
gem 'http_accept_language', '~> 2.0.0'
gem 'paperclip', '~> 4.0'
gem 'deadlock_retry', '>= 1.2.0'
thread_safe (~> 0.1)
tzinfo (~> 1.1)
arel (5.0.1.20140414130214)
- autoprefixer-rails (3.1.0.20140911)
+ autoprefixer-rails (3.1.1.20141001)
execjs
bigdecimal (1.1.0)
builder (3.2.2)
execjs
coffee-script-source (1.8.0)
colorize (0.7.3)
- composite_primary_keys (7.0.10)
- activerecord (~> 4.1.4)
+ composite_primary_keys (7.0.11)
+ activerecord (= 4.1.6)
crass (0.2.1)
dalli (2.7.2)
deadlock_retry (1.2.0)
libxml-ruby (2.7.0)
mail (2.6.1)
mime-types (>= 1.16, < 3)
- mime-types (2.3)
+ mime-types (2.4.1)
mini_portile (0.6.0)
minitest (5.4.2)
multi_json (1.10.1)
validates_email_format_of (1.6.1)
i18n
vendorer (0.1.16)
- websocket-driver (0.3.4)
+ websocket-driver (0.3.5)
xpath (2.0.0)
nokogiri (~> 1.3)
autoprefixer-rails
bigdecimal (~> 1.1.0)
coffee-rails (~> 4.0.0)
- composite_primary_keys (~> 7.0.10)
+ composite_primary_keys (~> 7.0.11)
dalli
deadlock_retry (>= 1.2.0)
dynamic_form
if (query) {
OSM.router.route("/search?query=" + encodeURIComponent(query) + OSM.formatHash(map));
} else {
- OSM.router.route("/" + OSM.formatHash(map));
+ OSM.router.route("/");
}
});
validates_presence_of :visible
validates_associated :author
validates_inclusion_of :event, :in => [ "opened", "closed", "reopened", "commented", "hidden" ]
+ validates_format_of :body, :with => /\A[^\x00-\x08\x0b-\x0c\x0e-\x1f\x7f\ufffe\uffff]*\z/
# Return the comment text
def body
+++ /dev/null
-# Monkey patch id_was into CPK pending upstream integration
-# https://github.com/composite-primary-keys/composite_primary_keys/pull/236
-module ActiveRecord
- class Base
- module CompositeInstanceMethods
- def id_was
- attribute_was("id")
- end
- end
- end
-end
module Potlatch2
LOCALES = {
+ "af" => "af",
"ar" => "ar",
+ "arc" => "arc",
"ast" => "ast",
"az" => "az",
+ "ba" => "ba",
"be" => "be",
"be-Tarask" => "be-tarask",
"bn" => "bn",
"br" => "br",
"bs" => "bs",
"ca" => "ca",
+ "ce" => "ce",
"cs" => "cs_CZ",
"da" => "da",
"de" => "de_DE",
+ "de-Formal" => "de-formal",
"diq" => "diq",
"dsb" => "dsb",
"en" => "en_US",
"en-GB" => "en_GB",
"el" => "el",
+ "eo" => "eo",
"es" => "es_ES",
"et" => "et",
+ "eu" => "eu",
"fa" => "fa",
"fi" => "fi",
"fo" => "fo",
"fr" => "fr_FR",
+ "fur" => "fur",
"ga" => "ga",
"gl" => "gl",
+ "grc" => "grc",
"he" => "he",
"hr" => "hr",
"hsb" => "hsb",
"hu" => "hu",
"ia" => "ia",
+ "id" => "id",
"it" => "it_IT",
"ja" => "ja_JP",
"ka" => "ka",
+ "km" => "km",
+ "kn" => "kn",
"ko" => "ko",
+ "krc" => "krc",
+ "ku-Latn" => "ku-latn",
"ky" => "ky",
"lb" => "lb",
+ "lez" => "lez",
"lt" => "lt",
"lv" => "lv",
+ "lzz" => "lzz",
"mk" => "mk",
"mr" => "mr",
"ms" => "ms",
"nn" => "nn_NO",
"no" => "nb_NO",
"oc" => "oc",
+ "pa" => "pa",
"pl" => "pl_PL",
+ "ps" => "ps",
"pt" => "pt_PT",
"pt-BR" => "pt_BR",
"ro" => "ro",
"ru" => "ru",
"rue" => "rue",
+ "sah" => "sah",
"sk" => "sk",
"sl" => "sl",
"sq" => "sq",
"sr-Latn" => "sr-el",
"sv" => "sv_SE",
"ta" => "ta",
+ "te" => "te",
"tl" => "tl",
+ "tly" => "tly",
"tr" => "tr",
+ "tyv" => "tyv",
+ "tzm" => "tzm",
"uk" => "uk",
"vi" => "vi_VN",
- "zh" => "zh_CN"
+ "vo" => "vo",
+ "yi" => "yi",
+ "zh" => "zh_CN",
+ "zh-TW" => "zh_TW"
}
end
id: 1
note_id: 1
visible: true
+ event: opened
created_at: 2007-01-01 00:00:00
author_ip: '192.168.1.1'
body: 'This is the initial description of the note 1'
id: 2
note_id: 2
visible: true
+ event: opened
created_at: 2007-01-01 00:00:00
author_ip: '192.168.1.1'
body: 'This is the initial description of the note 2'
id: 3
note_id: 2
visible: true
+ event: opened
created_at: 2007-02-01 00:00:00
author_ip: '192.168.1.1'
body: 'This is an additional comment for note 2'
id: 4
note_id: 3
visible: true
+ event: opened
created_at: 2007-01-01 00:00:00
author_ip: '192.168.1.1'
body: 'This is the initial comment for note 3'
id: 5
note_id: 4
visible: true
+ event: opened
created_at: 2007-01-01 00:00:00
author_ip: '192.168.1.1'
body: 'Spam for note 4'
id: 6
note_id: 5
visible: true
+ event: opened
created_at: 2007-01-01 00:00:00
author_ip: '192.168.1.1'
body: 'Valid comment for note 5'
id: 7
note_id: 5
visible: false
+ event: commented
created_at: 2007-02-01 00:00:00
author_ip: '192.168.1.1'
body: 'Spam for note 5'
id: 8
note_id: 5
visible: true
+ event: commented
created_at: 2007-02-01 00:00:00
author_ip: '192.168.1.1'
body: 'Another valid comment for note 5'
id: 9
note_id: 6
visible: true
- created_at: 2007-01-01 00:00:00
event: opened
+ created_at: 2007-01-01 00:00:00
author_id: 1
body: 'This is a note with from a logged-in user'
id: 10
note_id: 6
visible: true
- created_at: 2007-02-01 00:00:00
event: commented
+ created_at: 2007-02-01 00:00:00
author_id: 4
body: 'A comment from another logged-in user'
--- /dev/null
+# -*- coding: utf-8 -*-
+require 'test_helper'
+
+class NoteCommentTest < ActiveSupport::TestCase
+ fixtures :users, :notes, :note_comments
+
+ def test_event_valid
+ ok = [ "opened", "closed", "reopened", "commented", "hidden" ]
+ bad = [ "expropriated", "fubared" ]
+
+ ok.each do |event|
+ note_comment = note_comments(:t1)
+ note_comment.event = event
+ assert note_comment.valid?, "#{event} is invalid, when it should be"
+ end
+
+ bad.each do |event|
+ note_comment = note_comments(:t1)
+ note_comment.event = event
+ assert !note_comment.valid?, "#{event} is valid when it shouldn't be"
+ end
+ end
+
+ def test_body_valid
+ ok = [ "Name", "vergrößern", "foo\x0abar",
+ "ルシステムにも対応します", "輕觸搖晃的遊戲", ]
+ bad = [ "foo\x00bar", "foo\x08bar", "foo\x1fbar", "foo\x7fbar",
+ "foo\ufffebar", "foo\uffffbar" ]
+
+ ok.each do |body|
+ note_comment = note_comments(:t1)
+ note_comment.body = body
+ assert note_comment.valid?, "#{body} is invalid, when it should be"
+ end
+
+ bad.each do |body|
+ note_comment = note_comments(:t1)
+ note_comment.body = body
+ assert !note_comment.valid?, "#{body} is valid when it shouldn't be"
+ end
+ end
+end
--- /dev/null
+# -*- coding: utf-8 -*-
+require 'test_helper'
+
+class NoteTest < ActiveSupport::TestCase
+ fixtures :users, :notes, :note_comments
+
+ def test_status_valid
+ ok = [ "open", "closed", "hidden" ]
+ bad = [ "expropriated", "fubared" ]
+
+ ok.each do |status|
+ note = notes(:open_note)
+ note.status = status
+ assert note.valid?, "#{status} is invalid, when it should be"
+ end
+
+ bad.each do |status|
+ note = notes(:open_note)
+ note.status = status
+ assert !note.valid?, "#{status} is valid when it shouldn't be"
+ end
+ end
+
+ def test_close
+ note = notes(:open_note)
+ assert_equal "open", note.status
+ assert_nil note.closed_at
+ note.close
+ assert_equal "closed", note.status
+ assert_not_nil note.closed_at
+ end
+
+ def test_close
+ note = notes(:closed_note_with_comment)
+ assert_equal "closed", note.status
+ assert_not_nil note.closed_at
+ note.reopen
+ assert_equal "open", note.status
+ assert_nil note.closed_at
+ end
+
+ def test_visible?
+ assert_equal true, notes(:open_note).visible?
+ assert_equal true, notes(:note_with_hidden_comment).visible?
+ assert_equal false, notes(:hidden_note_with_comment).visible?
+ end
+
+ def test_closed?
+ assert_equal true, notes(:closed_note_with_comment).closed?
+ assert_equal false, notes(:open_note).closed?
+ end
+
+ def test_author
+ assert_nil notes(:open_note).author
+ assert_equal users(:normal_user), notes(:note_with_comments_by_users).author
+ end
+
+ def test_author_ip
+ assert_equal IPAddr.new("192.168.1.1"), notes(:open_note).author_ip
+ assert_nil notes(:note_with_comments_by_users).author_ip
+ end
+end