Added support for reporting Changesets + Deleting issues from the CLI
This commit is contained in:
parent
cf639202b8
commit
b68b29b43c
9 changed files with 51 additions and 16 deletions
|
@ -60,7 +60,7 @@ class IssuesController < ApplicationController
|
||||||
|
|
||||||
# TODO: Find better place to add these
|
# TODO: Find better place to add these
|
||||||
admin_issues = [ 'DiaryEntry', 'DiaryComment', 'User']
|
admin_issues = [ 'DiaryEntry', 'DiaryComment', 'User']
|
||||||
moderator_issues = []
|
moderator_issues = [ 'Changeset' ]
|
||||||
|
|
||||||
|
|
||||||
@issue = Issue.find_by_reportable_id_and_reportable_type(params[:reportable_id],params[:reportable_type])
|
@issue = Issue.find_by_reportable_id_and_reportable_type(params[:reportable_id],params[:reportable_type])
|
||||||
|
|
|
@ -10,14 +10,17 @@ module IssuesHelper
|
||||||
:id => reportable.id
|
:id => reportable.id
|
||||||
when "User"
|
when "User"
|
||||||
link_to reportable.display_name.to_s, :controller => reportable.class.name.underscore,
|
link_to reportable.display_name.to_s, :controller => reportable.class.name.underscore,
|
||||||
:action => "view",
|
:action => :view,
|
||||||
:display_name => reportable.display_name
|
:display_name => reportable.display_name
|
||||||
when "DiaryComment"
|
when "DiaryComment"
|
||||||
link_to "#{reportable.diary_entry.title}, Comment id ##{reportable.id}", :controller => reportable.diary_entry.class.name.underscore,
|
link_to "#{reportable.diary_entry.title}, Comment id ##{reportable.id}", :controller => reportable.diary_entry.class.name.underscore,
|
||||||
:action => :view,
|
:action => :view,
|
||||||
:display_name => reportable.diary_entry.user.display_name,
|
:display_name => reportable.diary_entry.user.display_name,
|
||||||
:id => reportable.id
|
:id => reportable.id
|
||||||
|
when "Changeset"
|
||||||
|
link_to "Changeset ##{reportable.id}, Closed at: #{l(reportable.closed_at.to_datetime, :format => :long)}", :controller => :browse,
|
||||||
|
:action => :changeset,
|
||||||
|
:id => reportable.id
|
||||||
else
|
else
|
||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,8 +2,8 @@ class Issue < ActiveRecord::Base
|
||||||
belongs_to :reportable, :polymorphic => true
|
belongs_to :reportable, :polymorphic => true
|
||||||
belongs_to :user, :class_name => "User", :foreign_key => :reported_user_id
|
belongs_to :user, :class_name => "User", :foreign_key => :reported_user_id
|
||||||
|
|
||||||
has_many :reports
|
has_many :reports, dependent: :destroy
|
||||||
has_many :comments, :class_name => "IssueComment"
|
has_many :comments, :class_name => "IssueComment", dependent: :destroy
|
||||||
|
|
||||||
validates :reportable_id, :uniqueness => { :scope => [ :reportable_type ] }
|
validates :reportable_id, :uniqueness => { :scope => [ :reportable_type ] }
|
||||||
validates :reported_user_id, :presence => true
|
validates :reported_user_id, :presence => true
|
||||||
|
|
|
@ -129,6 +129,10 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<div class='secondary-actions'>
|
<div class='secondary-actions'>
|
||||||
|
<% if @user and @user.id != @changeset.user.id %>
|
||||||
|
<%= link_to t('browse.changeset.report'), new_issue_url(reportable_id: @changeset.id, reportable_type: @changeset.class.name, reported_user_id: @changeset.user.id) %>
|
||||||
|
·
|
||||||
|
<% end %>
|
||||||
<%= link_to(t('browse.changeset.changesetxml'), :controller => "changeset", :action => "read") %>
|
<%= link_to(t('browse.changeset.changesetxml'), :controller => "changeset", :action => "read") %>
|
||||||
·
|
·
|
||||||
<%= link_to(t('browse.changeset.osmchangexml'), :controller => "changeset", :action => "download") %>
|
<%= link_to(t('browse.changeset.osmchangexml'), :controller => "changeset", :action => "download") %>
|
||||||
|
|
|
@ -145,6 +145,7 @@ en-GB:
|
||||||
title_comment: Changeset %{id} - %{comment}
|
title_comment: Changeset %{id} - %{comment}
|
||||||
join_discussion: Log in to join the discussion
|
join_discussion: Log in to join the discussion
|
||||||
discussion: Discussion
|
discussion: Discussion
|
||||||
|
report: Report this changeset
|
||||||
node:
|
node:
|
||||||
title: 'Node: %{name}'
|
title: 'Node: %{name}'
|
||||||
history_title: 'Node History: %{name}'
|
history_title: 'Node History: %{name}'
|
||||||
|
@ -1006,6 +1007,19 @@ en-GB:
|
||||||
other:
|
other:
|
||||||
type: "[OTHER]"
|
type: "[OTHER]"
|
||||||
details: Other
|
details: Other
|
||||||
|
Changeset:
|
||||||
|
type1:
|
||||||
|
type: "[TYPE1]"
|
||||||
|
details: Placeholder 1
|
||||||
|
type2:
|
||||||
|
type: "[TYPE1]"
|
||||||
|
details: Placeholder 2
|
||||||
|
type3:
|
||||||
|
type: "[TYPE3]"
|
||||||
|
details: Placeholder 3
|
||||||
|
other:
|
||||||
|
type: "[OTHER]"
|
||||||
|
details: Other
|
||||||
layouts:
|
layouts:
|
||||||
project_name:
|
project_name:
|
||||||
title: OpenStreetMap
|
title: OpenStreetMap
|
||||||
|
|
|
@ -131,6 +131,7 @@ en:
|
||||||
title_comment: "Changeset %{id} - %{comment}"
|
title_comment: "Changeset %{id} - %{comment}"
|
||||||
join_discussion: "Log in to join the discussion"
|
join_discussion: "Log in to join the discussion"
|
||||||
discussion: Discussion
|
discussion: Discussion
|
||||||
|
report: Report this changeset
|
||||||
node:
|
node:
|
||||||
title: "Node: %{name}"
|
title: "Node: %{name}"
|
||||||
history_title: "Node History: %{name}"
|
history_title: "Node History: %{name}"
|
||||||
|
@ -976,6 +977,19 @@ en:
|
||||||
other:
|
other:
|
||||||
type: "[OTHER]"
|
type: "[OTHER]"
|
||||||
details: Other
|
details: Other
|
||||||
|
Changeset:
|
||||||
|
type1:
|
||||||
|
type: "[TYPE1]"
|
||||||
|
details: Placeholder 1
|
||||||
|
type2:
|
||||||
|
type: "[TYPE1]"
|
||||||
|
details: Placeholder 2
|
||||||
|
type3:
|
||||||
|
type: "[TYPE3]"
|
||||||
|
details: Placeholder 3
|
||||||
|
other:
|
||||||
|
type: "[OTHER]"
|
||||||
|
details: Other
|
||||||
layouts:
|
layouts:
|
||||||
project_name:
|
project_name:
|
||||||
# in <title>
|
# in <title>
|
||||||
|
|
|
@ -17,7 +17,7 @@ class CreateIssuesAndReports < ActiveRecord::Migration
|
||||||
t.timestamps null: false
|
t.timestamps null: false
|
||||||
end
|
end
|
||||||
|
|
||||||
add_foreign_key :issues, :users, :column => :reported_user_id,:name => "issues_reported_user_id_fkey"
|
add_foreign_key :issues, :users, :column => :reported_user_id,:name => "issues_reported_user_id_fkey", on_delete: :cascade
|
||||||
|
|
||||||
add_index :issues, :reported_user_id
|
add_index :issues, :reported_user_id
|
||||||
add_index :issues, [:reportable_id, :reportable_type]
|
add_index :issues, [:reportable_id, :reportable_type]
|
||||||
|
@ -32,8 +32,8 @@ class CreateIssuesAndReports < ActiveRecord::Migration
|
||||||
t.timestamps null: false
|
t.timestamps null: false
|
||||||
end
|
end
|
||||||
|
|
||||||
add_foreign_key :reports, :issues, :name => "reports_issue_id_fkey"
|
add_foreign_key :reports, :issues, :name => "reports_issue_id_fkey", on_delete: :cascade
|
||||||
add_foreign_key :reports, :users,:column => :reporter_user_id, :name => "reports_reporter_user_id_fkey"
|
add_foreign_key :reports, :users,:column => :reporter_user_id, :name => "reports_reporter_user_id_fkey", on_delete: :cascade
|
||||||
|
|
||||||
add_index :reports, :reporter_user_id
|
add_index :reports, :reporter_user_id
|
||||||
add_index :reports, :issue_id
|
add_index :reports, :issue_id
|
||||||
|
|
|
@ -9,8 +9,8 @@ class CreateIssueComments < ActiveRecord::Migration
|
||||||
t.timestamps null: false
|
t.timestamps null: false
|
||||||
end
|
end
|
||||||
|
|
||||||
add_foreign_key :issue_comments, :issues, :name => "issue_comments_issue_id_fkey"
|
add_foreign_key :issue_comments, :issues, :name => "issue_comments_issue_id_fkey", on_delete: :cascade
|
||||||
add_foreign_key :issue_comments, :users,:column => :commenter_user_id, :name => "issue_comments_commenter_user_id"
|
add_foreign_key :issue_comments, :users,:column => :commenter_user_id, :name => "issue_comments_commenter_user_id", on_delete: :cascade
|
||||||
|
|
||||||
add_index :issue_comments, :commenter_user_id
|
add_index :issue_comments, :commenter_user_id
|
||||||
add_index :issue_comments, :issue_id
|
add_index :issue_comments, :issue_id
|
||||||
|
|
|
@ -2449,7 +2449,7 @@ ALTER TABLE ONLY gpx_files
|
||||||
--
|
--
|
||||||
|
|
||||||
ALTER TABLE ONLY issue_comments
|
ALTER TABLE ONLY issue_comments
|
||||||
ADD CONSTRAINT issue_comments_commenter_user_id FOREIGN KEY (commenter_user_id) REFERENCES users(id);
|
ADD CONSTRAINT issue_comments_commenter_user_id FOREIGN KEY (commenter_user_id) REFERENCES users(id) ON DELETE CASCADE;
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
|
@ -2457,7 +2457,7 @@ ALTER TABLE ONLY issue_comments
|
||||||
--
|
--
|
||||||
|
|
||||||
ALTER TABLE ONLY issue_comments
|
ALTER TABLE ONLY issue_comments
|
||||||
ADD CONSTRAINT issue_comments_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES issues(id);
|
ADD CONSTRAINT issue_comments_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE;
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
|
@ -2465,7 +2465,7 @@ ALTER TABLE ONLY issue_comments
|
||||||
--
|
--
|
||||||
|
|
||||||
ALTER TABLE ONLY issues
|
ALTER TABLE ONLY issues
|
||||||
ADD CONSTRAINT issues_reported_user_id_fkey FOREIGN KEY (reported_user_id) REFERENCES users(id);
|
ADD CONSTRAINT issues_reported_user_id_fkey FOREIGN KEY (reported_user_id) REFERENCES users(id) ON DELETE CASCADE;
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
|
@ -2585,7 +2585,7 @@ ALTER TABLE ONLY relations
|
||||||
--
|
--
|
||||||
|
|
||||||
ALTER TABLE ONLY reports
|
ALTER TABLE ONLY reports
|
||||||
ADD CONSTRAINT reports_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES issues(id);
|
ADD CONSTRAINT reports_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE;
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
|
@ -2593,7 +2593,7 @@ ALTER TABLE ONLY reports
|
||||||
--
|
--
|
||||||
|
|
||||||
ALTER TABLE ONLY reports
|
ALTER TABLE ONLY reports
|
||||||
ADD CONSTRAINT reports_reporter_user_id_fkey FOREIGN KEY (reporter_user_id) REFERENCES users(id);
|
ADD CONSTRAINT reports_reporter_user_id_fkey FOREIGN KEY (reporter_user_id) REFERENCES users(id) ON DELETE CASCADE;
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue