# TODO: Find better place to add these
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])
:id => reportable.id
when "User"
link_to reportable.display_name.to_s, :controller => reportable.class.name.underscore,
- :action => "view",
+ :action => :view,
:display_name => reportable.display_name
when "DiaryComment"
link_to "#{reportable.diary_entry.title}, Comment id ##{reportable.id}", :controller => reportable.diary_entry.class.name.underscore,
:action => :view,
:display_name => reportable.diary_entry.user.display_name,
: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
nil
end
belongs_to :reportable, :polymorphic => true
belongs_to :user, :class_name => "User", :foreign_key => :reported_user_id
- has_many :reports
- has_many :comments, :class_name => "IssueComment"
+ has_many :reports, dependent: :destroy
+ has_many :comments, :class_name => "IssueComment", dependent: :destroy
validates :reportable_id, :uniqueness => { :scope => [ :reportable_type ] }
validates :reported_user_id, :presence => true
<% end %>
<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.osmchangexml'), :controller => "changeset", :action => "download") %>
title_comment: Changeset %{id} - %{comment}
join_discussion: Log in to join the discussion
discussion: Discussion
+ report: Report this changeset
node:
title: 'Node: %{name}'
history_title: 'Node History: %{name}'
details: This User is a vandal
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:
project_name:
title: OpenStreetMap
title_comment: "Changeset %{id} - %{comment}"
join_discussion: "Log in to join the discussion"
discussion: Discussion
+ report: Report this changeset
node:
title: "Node: %{name}"
history_title: "Node History: %{name}"
other:
type: "[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:
project_name:
# in <title>
t.timestamps null: false
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, [:reportable_id, :reportable_type]
t.timestamps null: false
end
- add_foreign_key :reports, :issues, :name => "reports_issue_id_fkey"
- add_foreign_key :reports, :users,:column => :reporter_user_id, :name => "reports_reporter_user_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", on_delete: :cascade
add_index :reports, :reporter_user_id
add_index :reports, :issue_id
t.timestamps null: false
end
- add_foreign_key :issue_comments, :issues, :name => "issue_comments_issue_id_fkey"
- add_foreign_key :issue_comments, :users,:column => :commenter_user_id, :name => "issue_comments_commenter_user_id"
+ 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", on_delete: :cascade
add_index :issue_comments, :commenter_user_id
add_index :issue_comments, :issue_id
--
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;
--
--
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;
--
--
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;
--
--
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;
--
--
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;
--