From: Andy Allan Date: Wed, 28 Feb 2018 07:55:28 +0000 (+0800) Subject: Merge branch 'master' into moderation X-Git-Tag: live~3053^2~44 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/a20e28809f5ca1e3f3579faeaf118fff3ecc4994?hp=-c Merge branch 'master' into moderation --- a20e28809f5ca1e3f3579faeaf118fff3ecc4994 diff --combined Gemfile index 55493b9b6,09c662e4a..a9a6cb4b6 --- a/Gemfile +++ b/Gemfile @@@ -1,7 -1,7 +1,7 @@@ source "https://rubygems.org" # Require rails - gem "rails", "5.1.4" + gem "rails", "5.1.5" # Require things which have moved to gems in ruby 1.9 gem "bigdecimal", "~> 1.1.0", :platforms => :ruby_19 @@@ -70,9 -70,6 +70,9 @@@ gem "omniauth-windowslive # Markdown formatting support gem "redcarpet" +# For status transitions of Issues +gem "aasm" + # Load libxml support for XML parsing and generation gem "libxml-ruby", ">= 2.0.5", :require => "libxml" diff --combined Gemfile.lock index 601477824,bbfb73c5a..02bb3e5fd --- a/Gemfile.lock +++ b/Gemfile.lock @@@ -2,42 -2,41 +2,42 @@@ GE remote: https://rubygems.org/ specs: SystemTimer (1.2.3) + aasm (4.1.0) - actioncable (5.1.4) - actionpack (= 5.1.4) + actioncable (5.1.5) + actionpack (= 5.1.5) nio4r (~> 2.0) websocket-driver (~> 0.6.1) - actionmailer (5.1.4) - actionpack (= 5.1.4) - actionview (= 5.1.4) - activejob (= 5.1.4) + actionmailer (5.1.5) + actionpack (= 5.1.5) + actionview (= 5.1.5) + activejob (= 5.1.5) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (5.1.4) - actionview (= 5.1.4) - activesupport (= 5.1.4) + actionpack (5.1.5) + actionview (= 5.1.5) + activesupport (= 5.1.5) rack (~> 2.0) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) actionpack-page_caching (1.1.0) actionpack (>= 4.0.0, < 6) - actionview (5.1.4) - activesupport (= 5.1.4) + actionview (5.1.5) + activesupport (= 5.1.5) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.3) - activejob (5.1.4) - activesupport (= 5.1.4) + activejob (5.1.5) + activesupport (= 5.1.5) globalid (>= 0.3.6) - activemodel (5.1.4) - activesupport (= 5.1.4) - activerecord (5.1.4) - activemodel (= 5.1.4) - activesupport (= 5.1.4) + activemodel (5.1.5) + activesupport (= 5.1.5) + activerecord (5.1.5) + activemodel (= 5.1.5) + activesupport (= 5.1.5) arel (~> 8.0) - activesupport (5.1.4) + activesupport (5.1.5) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (~> 0.7) minitest (~> 5.1) @@@ -73,8 -72,8 +73,8 @@@ coffee-script-source execjs coffee-script-source (1.12.2) - composite_primary_keys (10.0.2) - activerecord (~> 5.1.0, >= 5.1.4) + composite_primary_keys (10.0.3) + activerecord (~> 5.1.0, >= 5.1.5) concurrent-ruby (1.0.5) coveralls (0.8.21) json (>= 1.8, < 3) @@@ -98,7 -97,7 +98,7 @@@ railties (>= 3.0.0) faraday (0.12.2) multipart-post (>= 1.2, < 3) - ffi (1.9.21) + ffi (1.9.23) fspath (3.1.0) geoip (1.6.3) globalid (0.4.1) @@@ -218,8 -217,8 +218,8 @@@ mime-types mimemagic (~> 0.3.0) parallel (1.12.1) - parser (2.4.0.2) - ast (~> 2.3) + parser (2.5.0.2) + ast (~> 2.4.0) pg (0.21.0) poltergeist (1.17.0) capybara (~> 2.1) @@@ -239,17 -238,17 +239,17 @@@ rack-test (0.8.2) rack (>= 1.0, < 3) rack-uri_sanitizer (0.0.2) - rails (5.1.4) - actioncable (= 5.1.4) - actionmailer (= 5.1.4) - actionpack (= 5.1.4) - actionview (= 5.1.4) - activejob (= 5.1.4) - activemodel (= 5.1.4) - activerecord (= 5.1.4) - activesupport (= 5.1.4) + rails (5.1.5) + actioncable (= 5.1.5) + actionmailer (= 5.1.5) + actionpack (= 5.1.5) + actionview (= 5.1.5) + activejob (= 5.1.5) + activemodel (= 5.1.5) + activerecord (= 5.1.5) + activesupport (= 5.1.5) bundler (>= 1.3.0) - railties (= 5.1.4) + railties (= 5.1.5) sprockets-rails (>= 2.0.0) rails-controller-testing (1.0.2) actionpack (~> 5.x, >= 5.0.1) @@@ -263,9 -262,9 +263,9 @@@ rails-i18n (4.0.2) i18n (~> 0.6) rails (>= 4.0) - railties (5.1.4) - actionpack (= 5.1.4) - activesupport (= 5.1.4) + railties (5.1.5) + actionpack (= 5.1.5) + activesupport (= 5.1.5) method_source rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) @@@ -355,7 -354,6 +355,7 @@@ PLATFORM DEPENDENCIES SystemTimer (>= 1.1.3) + aasm actionpack-page_caching annotate autoprefixer-rails @@@ -400,7 -398,7 +400,7 @@@ r2 (~> 0.2.7) rack-cors rack-uri_sanitizer - rails (= 5.1.4) + rails (= 5.1.5) rails-controller-testing rails-i18n (~> 4.0.0) record_tag_helper diff --combined app/assets/stylesheets/common.scss index 3e64728a7,4353e5e65..665ea8c24 --- a/app/assets/stylesheets/common.scss +++ b/app/assets/stylesheets/common.scss @@@ -38,7 -38,7 +38,7 @@@ textarea body { font: #{$typeheight}/#{$lineheight} "Helvetica Neue",Arial,sans-serif; } abbr, acronym { - border-bottom: .1em dotted; + text-decoration: underline dotted; cursor: help; } @@@ -2818,44 -2818,3 +2818,44 @@@ input.richtext_title[type="text"] display: none; } } + +.read-reports { + background: #eee; + opacity: 0.7; +} + +.report-related-block { + display:inline-block; +} + +.report-block { + width:475px; + float:left; + margin-right:100px; +} + +.related-block{ + width:280px; + float:right; +} + +.issue-comments { + width:475px; +} + +.report-disclaimer { + background: #fff1f0; + color: #d85030; + border-color: rgba(216, 80, 48, 0.3); + padding: 5px; + margin-bottom: $lineheight; + + ul { + padding-left: $lineheight; + margin-bottom: 0; + + li { + list-style: disc; + } + } +} diff --combined app/models/user.rb index 352c58fb5,1cd8c6d89..2d51b5af5 --- a/app/models/user.rb +++ b/app/models/user.rb @@@ -73,12 -73,6 +73,12 @@@ class User < ActiveRecord::Bas has_many :roles, :class_name => "UserRole" + has_many :issues, :class_name => "Issue", :foreign_key => :reported_user_id + has_one :issue, :class_name => "Issue", :foreign_key => :updated_by + has_many :issue_comments + + has_many :reports + scope :visible, -> { where(:status => %w[pending active confirmed]) } scope :active, -> { where(:status => %w[active confirmed]) } scope :identifiable, -> { where(:data_public => true) } @@@ -267,8 -261,8 +267,8 @@@ def spam_score changeset_score = changesets.size * 50 trace_score = traces.size * 50 - diary_entry_score = diary_entries.inject(0) { |acc, elem| acc + elem.body.spam_score } - diary_comment_score = diary_comments.inject(0) { |acc, elem| acc + elem.body.spam_score } + diary_entry_score = diary_entries.visible.inject(0) { |acc, elem| acc + elem.body.spam_score } + diary_comment_score = diary_comments.visible.inject(0) { |acc, elem| acc + elem.body.spam_score } score = description.spam_score / 4.0 score += diary_entries.where("created_at > ?", 1.day.ago).count * 10 diff --combined config/locales/en.yml index a40f15719,54ec7a468..6b70afea7 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@@ -207,7 -207,6 +207,7 @@@ en reopened_by: "Reactivated by %{user} %{when} ago" reopened_by_anonymous: "Reactivated by anonymous %{when} ago" hidden_by: "Hidden by %{user} %{when} ago" + report: Report this note? query: title: "Query Features" introduction: "Click on the map to find nearby features." @@@ -298,12 -297,10 +298,12 @@@ edit_link: Edit this entry hide_link: Hide this entry confirm: Confirm + report: Report this entry? diary_comment: comment_from: "Comment from %{link_user} on %{comment_created_at}" hide_link: Hide this comment confirm: Confirm + report: Report this comment? location: location: "Location:" view: "View" @@@ -371,7 -368,6 +371,6 @@@ search: title: latlon: 'Results from Internal' - uk_postcode: 'Results from NPEMap / FreeThe Postcode' ca_postcode: 'Results from Geocoder.CA' osm_nominatim: 'Results from OpenStreetMap Nominatim' geonames: 'Results from GeoNames' @@@ -963,106 -959,6 +962,106 @@@ results: no_results: "No results found" more_results: "More results" + issues: + report: Report + resolve: Resolve + ignore: Ignore + reopen: Reopen + index: + title: Issues + select_status: Select Status + select_type: Select Type + select_last_updated_by: Select Last Updated By + reported_user: Reported User + not_updated: Not Updated + search: Search + search_guidance: "Search Issues:" + user_not_found: User does not exist + issues_not_found: No such issues found + status: Status + reports: Reports + last_updated_at: Last Updated At + last_updated_by: Last Updated By + link_to_reports: View Reports + reported_user: Reported User + reports_count: + one: "1 Report" + other: "%{count} Reports" + reported_item: Reported Item + create: + successful_report: Your report has been registered sucessfully + provide_details: Please provide the required details + update: + new_report: Your report been registered sucessfully + successful_update: Your report has been updated successfully + provide_details: Please provide the required details + new: + details: Please provide some more details about the problem (required). + select: "Select a reason for your report:" + disclaimer: + intro: "Before sending your report to the site moderators, please ensure that:" + not_just_mistake: You are certain that the problem is not just a mistake + unable_to_fix: You are unable to fix the problem yourself or with the help of your fellow community members + resolve_with_user: You have already tried to resolve the problem with the user concerned + show: + title: "%{status} Issue #%{issue_id}" + reports: + zero: No reports + one: 1 report + other: "%{count} reports" + report_created_at: "First reported at %{datetime}" + last_resolved_at: "Last resolved at %{datetime}" + last_updated_at: "Last updated at %{datetime} by %{displayname}" + reports_of_this_issue: Reports of this Issue + read_reports: Read Reports + new_reports: New Reports + other_issues_against_this_user: Other issues against this user + no_other_issues: No other issues against this user. + comments_on_this_issue: Comments on this issue + comments: + reassign_param: Reassign Issue? + comment: + provide_details: Please provide the required details + comment_created: Your comment was successfully created + comments: + created_at: "On %{datetime}" + reports: + category: "Category: %{category}" + updated_at: "On %{datetime}" + reported_by_html: "Reported by %{user_name}" + resolved: Issue status has been set to 'Resolved' + ignored: Issue status has been set to 'Ignored' + reopened: Issue status has been set to 'Open' + states: + ignored: Ignored + open: Open + resolved: Resolved + reports: + new: + title_html: "Report %{link}" + categories: + DiaryEntry: + spam: This Diary Entry is/contains spam + offensive: This Diary Entry is obscene/offensive + threat: This Diary Entry contains a threat + other: Other + DiaryComment: + spam: This Diary Comment is/contains spam + offensive: This Diary Comment is obscene/offensive + threat: This Diary Comment contains a threat + other: Other + User: + spam: This User profile is/contains spam + offensive: This User profile is obscene/offensive + threat: This User profile contains a threat + vandal: This User is a vandal + other: Other + Note: + spam: This note is spam + vandalism: This note is vandalism + personal: This note contains personal data + abusive: This note is abusive + other: Other layouts: project_name: # in @@@ -1081,7 -977,6 +1080,7 @@@ edit: Edit history: History export: Export + issues: Issues data: Data export_data: Export Data gps_traces: GPS Traces @@@ -1274,8 -1169,8 +1273,8 @@@ paragraph_1_html: | OpenStreetMap has few formal rules but we expect all participants to collaborate with, and communicate with, the community. If you are considering - any activities other than editing by hand, please read and follow the guidelines on - <a href='https://wiki.openstreetmap.org/wiki/Import/Guidelines'>Imports</a> and + any activities other than editing by hand, please read and follow the guidelines on + <a href='https://wiki.openstreetmap.org/wiki/Import/Guidelines'>Imports</a> and <a href='https://wiki.openstreetmap.org/wiki/Automated_Edits_code_of_conduct'>Automated Edits</a>. questions: title: Any questions? @@@ -1301,7 -1196,7 +1300,7 @@@ title: Join the community explanation_html: | If you have noticed a problem with our map data, for example a road is missing or your address, the best way to - proceed is to join the OpenStreetMap community and add or repair the data yourself. + proceed is to join the OpenStreetMap community and add or repair the data yourself. add_a_note: instructions_html: | Just click <a class='icon note'></a> or the same icon on the map display. @@@ -1311,8 -1206,8 +1310,8 @@@ title: Other concerns explanation_html: | If you have concerns about how our data is being used or about the contents please consult our - <a href='/copyright'>copyright page</a> for more legal information, or contact the appropriate - <a href='https://wiki.osmfoundation.org/wiki/Working_Groups'>OSMF working group</a>. + <a href='/copyright'>copyright page</a> for more legal information, or contact the appropriate + <a href='https://wiki.osmfoundation.org/wiki/Working_Groups'>OSMF working group</a>. help_page: title: Getting Help introduction: | @@@ -1382,14 -1277,14 +1381,14 @@@ License page</a> for details. legal_title: Legal legal_html: | - This site and many other related services are formally operated by the - <a href='https://osmfoundation.org/'>OpenStreetMap Foundation</a> (OSMF) - on behalf of the community. Use of all OSMF operated services is subject + This site and many other related services are formally operated by the + <a href='https://osmfoundation.org/'>OpenStreetMap Foundation</a> (OSMF) + on behalf of the community. Use of all OSMF operated services is subject to our <a href="https://wiki.openstreetmap.org/wiki/Acceptable_Use_Policy"> Acceptable Use Policies</a> and our <a href="https://wiki.osmfoundation.org/wiki/Privacy_Policy">Privacy Policy</a> - <br> - Please <a href='https://osmfoundation.org/Contact'>contact the OSMF</a> - if you have licensing, copyright or other legal questions. + <br> + Please <a href='https://osmfoundation.org/Contact'>contact the OSMF</a> + if you have licensing, copyright or other legal questions and issues. <br> OpenStreetMap, the magnifying glass logo and State of the Map are <a href="https://wiki.osmfoundation.org/wiki/Trademark_Policy">registered trademarks of the OSMF</a>. partners_title: Partners @@@ -1765,7 -1660,7 +1764,7 @@@ public_traces: "Public GPS traces" your_traces: "Your GPS traces" public_traces_from: "Public GPS traces from %{user}" - description: "Browse recent GPS track uploads" + description: "Browse recent GPS trace uploads" tagged_with: " tagged with %{tags}" empty_html: "Nothing here yet. <a href='%{upload_link}'>Upload a new trace</a> or learn more about GPS tracing on the <a href='https://wiki.openstreetmap.org/wiki/Beginners_Guide_1.2'>wiki page</a>." delete: @@@ -1787,8 -1682,6 +1786,8 @@@ application: require_cookies: cookies_needed: "You appear to have cookies disabled - please enable cookies in your browser before continuing." + require_admin: + not_an_admin: You need to be an admin to perform that action. require_moderator: not_a_moderator: "You need to be a moderator to perform that action." setup_user_auth: @@@ -2060,7 -1953,6 +2059,7 @@@ friends_diaries: "friends' diary entries" nearby_changesets: "nearby user changesets" nearby_diaries: "nearby user diary entries" + report: "Report this user?" popup: your location: "Your location" nearby mapper: "Nearby mapper" @@@ -2437,13 -2329,17 +2436,17 @@@ instructions: continue_without_exit: Continue on %{name} slight_right_without_exit: Slight right onto %{name} - offramp_right_without_exit: Take the ramp on the right onto %{name} + offramp_right: Take the ramp on the right + offramp_right_with_exit: Take exit %{exit} on the right + offramp_right_with_exit_name: Take exit %{exit} on the right onto %{name} + offramp_right_with_exit_directions: Take exit %{exit} on the right towards %{directions} + offramp_right_with_exit_name_directions: Take exit %{exit} on the right onto %{name}, towards %{directions} + offramp_right_with_name: Take the ramp on the right onto %{name} offramp_right_with_directions: Take the ramp on the right towards %{directions} - offramp_right_with_name_and_directions: Take the ramp on the right onto %{name}, towards %{directions} - offramp_right_without_directions: Take the ramp on the right + offramp_right_with_name_directions: Take the ramp on the right onto %{name}, towards %{directions} onramp_right_without_exit: Turn right on the ramp onto %{name} onramp_right_with_directions: Turn right onto the ramp towards %{directions} - onramp_right_with_name_and_directions: Turn right on the ramp onto %{name}, towards %{directions} + onramp_right_with_name_directions: Turn right on the ramp onto %{name}, towards %{directions} onramp_right_without_directions: Turn right onto the ramp endofroad_right_without_exit: At the end of the road turn right onto %{name} merge_right_without_exit: Merge right onto %{name} @@@ -2453,13 -2349,17 +2456,17 @@@ uturn_without_exit: U-turn along %{name} sharp_left_without_exit: Sharp left onto %{name} turn_left_without_exit: Turn left onto %{name} - offramp_left_without_exit: Take the ramp on the left onto %{name} + offramp_left: Take the ramp on the left + offramp_left_with_exit: Take exit %{exit} on the left + offramp_left_with_exit_name: Take exit %{exit} on the left onto %{name} + offramp_left_with_exit_directions: Take exit %{exit} on the left towards %{directions} + offramp_left_with_exit_name_directions: Take exit %{exit} on the left onto %{name}, towards %{directions} + offramp_left_with_name: Take the ramp on the left onto %{name} offramp_left_with_directions: Take the ramp on the left towards %{directions} - offramp_left_with_name_and_directions: Take the ramp on the left onto %{name}, towards %{directions} - offramp_left_without_directions: Take the ramp on the left + offramp_left_with_name_directions: Take the ramp on the left onto %{name}, towards %{directions} onramp_left_without_exit: Turn left on the ramp onto %{name} onramp_left_with_directions: Turn left onto the ramp towards %{directions} - onramp_left_with_name_and_directions: Turn left on the ramp onto %{name}, towards %{directions} + onramp_left_with_name_directions: Turn left on the ramp onto %{name}, towards %{directions} onramp_left_without_directions: Turn left onto the ramp endofroad_left_without_exit: At the end of the road turn left onto %{name} merge_left_without_exit: Merge left onto %{name} diff --combined config/routes.rb index 8a5dca166,66eda1916..8160c878c --- a/config/routes.rb +++ b/config/routes.rb @@@ -223,7 -223,7 +223,7 @@@ OpenStreetMap::Application.routes.draw match "/user/:display_name/diary" => "diary_entry#list", :via => :get match "/diary/:language" => "diary_entry#list", :via => :get match "/diary" => "diary_entry#list", :via => :get - match "/user/:display_name/diary/:id" => "diary_entry#view", :via => :get, :id => /\d+/ + match "/user/:display_name/diary/:id" => "diary_entry#view", :via => :get, :id => /\d+/, :as => :diary_entry match "/user/:display_name/diary/:id/newcomment" => "diary_entry#comment", :via => :post, :id => /\d+/ match "/user/:display_name/diary/:id/edit" => "diary_entry#edit", :via => [:get, :post], :id => /\d+/ match "/user/:display_name/diary/:id/hide" => "diary_entry#hide", :via => :post, :id => /\d+/, :as => :hide_diary_entry @@@ -246,7 -246,6 +246,6 @@@ # geocoder match "/search" => "geocoder#search", :via => :get, :as => :search match "/geocoder/search_latlon" => "geocoder#search_latlon", :via => :get - match "/geocoder/search_uk_postcode" => "geocoder#search_uk_postcode", :via => :get match "/geocoder/search_ca_postcode" => "geocoder#search_ca_postcode", :via => :get match "/geocoder/search_osm_nominatim" => "geocoder#search_osm_nominatim", :via => :get match "/geocoder/search_geonames" => "geocoder#search_geonames", :via => :get @@@ -289,19 -288,6 +288,19 @@@ resources :user_blocks match "/blocks/:id/revoke" => "user_blocks#revoke", :via => [:get, :post], :as => "revoke_user_block" + # issues and reports + resources :issues do + resources :comments, :controller => :issue_comments + member do + post "resolve" + post "assign" + post "ignore" + post "reopen" + end + end + + resources :reports + # redactions resources :redactions end