]> git.openstreetmap.org Git - rails.git/commitdiff
Merge branch 'master' into moderation
authorAndy Allan <git@gravitystorm.co.uk>
Wed, 28 Feb 2018 07:55:28 +0000 (15:55 +0800)
committerAndy Allan <git@gravitystorm.co.uk>
Wed, 28 Feb 2018 07:55:28 +0000 (15:55 +0800)
1  2 
Gemfile
Gemfile.lock
app/assets/stylesheets/common.scss
app/models/user.rb
config/locales/en.yml
config/routes.rb

diff --combined Gemfile
index 55493b9b684d6f868a44e7d6a8a8a33b4056581d,09c662e4a802a926a42cffb14d913922ff16acfd..a9a6cb4b6d1466d65c41c05d8037a695e8900b54
+++ 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 60147782433e02fbce53c5f5d20072f80679f027,bbfb73c5a6e67f604d2ae177ba56b6750c5143d3..02bb3e5fdbeaf3634243e6ca46721cdddf7caaa2
@@@ -2,42 -2,41 +2,42 @@@ GE
    remote: https://rubygems.org/
    specs:
      SystemTimer (1.2.3)
-     actioncable (5.1.4)
-       actionpack (= 5.1.4)
 +    aasm (4.1.0)
+     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)
        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)
      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)
      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
    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
index 3e64728a7625403dd80332509dfbd1a385fed459,4353e5e659d85628ff9a8f175d291ffdd4465652..665ea8c2446ccff94f5e6c516315a0d6dc02876e
@@@ -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 352c58fb51ae55154aa134be58bc7c02920c7589,1cd8c6d89f439651d5b88f35b04ef2dda887a4a6..2d51b5af56915296825acb9ca33d1437cf1f5ceb
@@@ -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) }
    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 a40f1571978a44023071bee0e3960be77e2a5333,54ec7a4682e5b3848bd15de0ac14138fee87587a..6b70afea7e9c03950731b8b30cf16aaf6c6fccda
@@@ -207,7 -207,6 +207,7 @@@ en
        reopened_by: "Reactivated by %{user} <abbr title='%{exact_time}'>%{when} ago</abbr>"
        reopened_by_anonymous: "Reactivated by anonymous <abbr title='%{exact_time}'>%{when} ago</abbr>"
        hidden_by: "Hidden by %{user} <abbr title='%{exact_time}'>%{when} ago</abbr>"
 +      report: Report this note?
      query:
        title: "Query Features"
        introduction: "Click on the map to find nearby features."
        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"
      search:
        title:
          latlon: 'Results from <a href="https://openstreetmap.org/">Internal</a>'
-         uk_postcode: 'Results from <a href="http://www.npemap.org.uk/">NPEMap / FreeThe Postcode</a>'
          ca_postcode: 'Results from <a href="https://geocoder.ca/">Geocoder.CA</a>'
          osm_nominatim: 'Results from <a href="https://nominatim.openstreetmap.org/">OpenStreetMap Nominatim</a>'
          geonames: 'Results from <a href="http://www.geonames.org/">GeoNames</a>'
      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 <a href=\"%{user_url}\">%{user_name}</a>"
 +    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 <title>
      edit: Edit
      history: History
      export: Export
 +    issues: Issues
      data: Data
      export_data: Export Data
      gps_traces: GPS Traces
        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?
          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.
        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: |
        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
        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:
    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:
        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"
        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}
          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 8a5dca166756ef71663af5fc5a84a5687720a8f5,66eda1916504026e4c3d76e64ac57b6bee0563a9..8160c878c6304172a4df5c4ac39312ac66b91788
@@@ -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
    # 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
    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