before_action :authorize_web
before_action :require_user
before_action :set_issues
- before_action :check_permission, only: [:index, :show, :resolve,:open,:ignore,:comment]
- before_action :find_issue, only: [:show, :resolve, :reopen, :ignore]
- before_action :get_user_role, only: [:show, :index]
+ before_action :check_permission, :only => [:index, :show, :resolve, :open, :ignore, :comment]
+ before_action :find_issue, :only => [:show, :resolve, :reopen, :ignore]
+ before_action :setup_user_role, :only => [:show, :index]
helper_method :sort_column, :sort_direction
def index
if @user.moderator?
@issue_types = @moderator_issues
- @users = User.joins(:roles).where(user_roles: {role: 'moderator'})
+ @users = User.joins(:roles).where(:user_roles => { :role => "moderator" })
else
@issue_types = @admin_issues
- @users = User.joins(:roles).where(user_roles: {role: 'administrator'})
+ @users = User.joins(:roles).where(:user_roles => { :role => "administrator" })
end
- @issues = Issue.where(issue_type: @user_role).order(sort_column + " " + sort_direction)
+ @issues = Issue.where(:issue_type => @user_role).order(sort_column + " " + sort_direction)
# If search
- if params[:search_by_user] and !params[:search_by_user].blank?
+ if params[:search_by_user] && !params[:search_by_user].blank?
@find_user = User.find_by_display_name(params[:search_by_user])
if @find_user
- @issues = @issues.where(reported_user_id: @find_user.id)
- else
- notice = t('issues.index.search.user_not_found')
+ @issues = @issues.where(:reported_user_id => @find_user.id)
+ else
+ notice = t("issues.index.search.user_not_found")
end
end
-
- if params[:status] and !params[:status][0].blank?
- @issues = @issues.where(status: params[:status][0].to_i)
+ if params[:status] && !params[:status][0].blank?
+ @issues = @issues.where(:status => params[:status][0].to_i)
end
- if params[:issue_type] and !params[:issue_type][0].blank?
- @issues = @issues.where(reportable_type: params[:issue_type][0])
+ if params[:issue_type] && !params[:issue_type][0].blank?
+ @issues = @issues.where(:reportable_type => params[:issue_type][0])
end
# If last_updated_by
- if params[:last_updated_by] and !params[:last_updated_by][0].blank?
- last_reported_by = params[:last_updated_by][0].to_s == "nil" ? nil : params[:last_updated_by][0].to_i
- @issues = @issues.where(updated_by: last_updated_by)
+ if params[:last_updated_by] && !params[:last_updated_by][0].blank?
+ last_updated_by = params[:last_updated_by][0].to_s == "nil" ? nil : params[:last_updated_by][0].to_i
+ @issues = @issues.where(:updated_by => last_updated_by)
end
- if @issues.first == nil
- notice = t('issues.index.search.issues_not_found')
- end
+ notice = t("issues.index.search.issues_not_found") if @issues.first.nil?
- if params[:last_reported_by] and !params[:last_reported_by][0].blank?
+ if params[:last_reported_by] && !params[:last_reported_by][0].blank?
last_reported_by = params[:last_reported_by][0].to_s == "nil" ? nil : params[:last_reported_by][0].to_i
- @issues = @issues.where(updated_by: last_reported_by)
+ @issues = @issues.where(:updated_by => last_reported_by)
end
- if notice
- redirect_to issues_path, notice: notice
- end
+ redirect_to issues_path, :notice => notice if notice
end
def show
@read_reports = @issue.read_reports
@unread_reports = @issue.unread_reports
@comments = @issue.comments
- @related_issues = @issue.user.issues.where(issue_type: @user_role)
- if @issue.updated_by
- @updated_by_admin = User.find(@issue.updated_by)
- end
+ @related_issues = @issue.user.issues.where(:issue_type => @user_role)
+
+ @updated_by_admin = User.find(@issue.updated_by) if @issue.updated_by
end
def new
unless create_new_issue_params.blank?
@issue = Issue.find_or_initialize_by(create_new_issue_params)
- path = 'issues.report_strings.' + @issue.reportable.class.name.to_s
+ path = "issues.report_strings." + @issue.reportable.class.name.to_s
@report_strings_yaml = t(path)
flash[:referer] = params[:referer]
end
end
def create
- @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])
# Check if Issue already exists
- if !@issue
+ unless @issue
@issue = Issue.find_or_initialize_by(issue_params)
@issue.updated_by = nil
# Reassign to moderators if it is a moderator issue
@issue.issue_type = "administrator"
- if @moderator_issues.include? @issue.reportable.class.name
- reassign_issue
- end
+ reassign_issue if @moderator_issues.include? @issue.reportable.class.name
end
# Check if details provided are sufficient
if check_report_params
@report = @issue.reports.build(report_params)
- details = get_report_details
+ details = report_details
@report.reporter_user_id = @user.id
@report.details = details
# Checking if instance has been updated since last report
- @last_report = @issue.reports.order(updated_at: :desc).last
+ @last_report = @issue.reports.order(:updated_at => :desc).last
if check_if_updated
- if @issue.reopen
- @issue.save!
- end
+ @issue.save! if @issue.reopen
end
if @issue.save!
@issue.report_count = @issue.reports.count
@issue.save!
-
- @admins_or_mods = UserRole.where(role: @issue.issue_type)
+
+ @admins_or_mods = UserRole.where(:role => @issue.issue_type)
@admins_or_mods.each do |user|
Notifier.new_issue_notification(@issue.id, User.find(user.user_id)).deliver_now
end
- redirect_to flash[:referer], notice: t('issues.create.successful_report')
+ redirect_to flash[:referer], :notice => t("issues.create.successful_report")
end
else
- redirect_to new_issue_path(reportable_type: @issue.reportable_type,reportable_id: @issue.reportable_id, reported_user_id: @issue.reported_user_id), notice: t('issues.create.provide_details')
+ redirect_to new_issue_path(:reportable_type => @issue.reportable_type, :reportable_id => @issue.reportable_id, :reported_user_id => @issue.reported_user_id), :notice => t("issues.create.provide_details")
end
end
@issue = Issue.find_by(issue_params)
# Check if details provided are sufficient
if check_report_params
- @report = @issue.reports.where(reporter_user_id: @user.id).first
-
- if @report == nil
+ @report = @issue.reports.where(:reporter_user_id => @user.id).first
+
+ if @report.nil?
@report = @issue.reports.build(report_params)
@report.reporter_user_id = @user.id
- notice = t('issues.update.new_report')
+ notice = t("issues.update.new_report")
end
- details = get_report_details
- @report.details = details
+ details = report_details
+ @report.details = details
- # Checking if instance has been updated since last report
- @last_report = @issue.reports.order(updated_at: :desc).last
+ # Checking if instance has been updated since last report
+ @last_report = @issue.reports.order(:updated_at => :desc).last
if check_if_updated
@issue.reopen
@issue.save!
end
- if notice == nil
- notice = t('issues.update.successful_update')
- end
-
+ notice = t("issues.update.successful_update") if notice.nil?
if @report.save!
@issue.report_count = @issue.reports.count
@issue.save!
- redirect_to flash[:referer], notice: notice
+ redirect_to flash[:referer], :notice => notice
end
else
- redirect_to new_issue_path(reportable_type: @issue.reportable_type,reportable_id: @issue.reportable_id, reported_user_id: @issue.reported_user_id), notice: t('issues.update.provide_details')
- end
+ redirect_to new_issue_path(:reportable_type => @issue.reportable_type, :reportable_id => @issue.reportable_id, :reported_user_id => @issue.reported_user_id), :notice => t("issues.update.provide_details")
+ end
end
def comment
@issue = Issue.find(params[:id])
if issue_comment_params.blank?
- notice = t('issues.comment.provide_details')
+ notice = t("issues.comment.provide_details")
else
@issue_comment = @issue.comments.build(issue_comment_params)
@issue_comment.commenter_user_id = @user.id
@issue_comment.save!
@issue.updated_by = @user.id
@issue.save!
- notice = t('issues.comment.comment_created')
+ notice = t("issues.comment.comment_created")
end
- redirect_to @issue, notice: notice
+ redirect_to @issue, :notice => notice
end
# Status Transistions
def resolve
if @issue.resolve
@issue.save!
- redirect_to @issue, notice: t('issues.resolved')
+ redirect_to @issue, :notice => t("issues.resolved")
else
render :show
end
if @issue.ignore
@issue.updated_by = @user.id
@issue.save!
- redirect_to @issue, notice: t('issues.ignored')
+ redirect_to @issue, :notice => t("issues.ignored")
else
render :show
end
def reopen
if @issue.reopen
- @issue.updated_by = @user.id
+ @issue.updated_by = @user.id
@issue.save!
- redirect_to @issue, notice: t('issues.reopened')
+ redirect_to @issue, :notice => t("issues.reopened")
else
render :show
end
# Reassign Issues between Administrators and Moderators
def reassign_issue
- if @issue.issue_type == "moderator"
- @issue.issue_type = "administrator"
- else
- @issue.issue_type = "moderator"
- end
+ @issue.issue_type = upgrade_issue(@issue.issue_type)
@issue.save!
end
private
- def set_issues
- @admin_issues = [ 'DiaryEntry', 'DiaryComment', 'User']
- @moderator_issues = [ 'Changeset', 'Note' ]
+ def upgrade_issue(type)
+ if type == "moderator"
+ "administrator"
+ else
+ "moderator"
end
+ end
- def get_user_role
- # Get user role
- if @user.administrator?
- @user_role = "administrator"
- else
- @user_role = "moderator"
- end
- end
-
- def check_if_updated
- if @issue.reportable and (@issue.ignored? or @issue.resolved?) and @issue.reportable.has_attribute?(:updated_by) and @issue.reportable.updated_at > @last_report.updated_at
- return true
- else
- return false
- end
- end
-
- def get_report_details
- details = params[:report][:details] + "--||--"
- details = details + params[:report_type].to_s + "--||--"
- return details
- end
+ def set_issues
+ @admin_issues = %w(DiaryEntry DiaryComment User)
+ @moderator_issues = %w(Changeset Note)
+ end
- def check_report_params
- if params[:report] and params[:report][:details] and params[:report_type]
- return true
- end
+ def setup_user_role
+ # Get user role
+ @user_role = @user.administrator? ? "administrator" : "moderator"
+ end
+
+ def check_if_updated
+ if @issue.reportable && (@issue.ignored? || @issue.resolved?) && @issue.reportable.has_attribute?(:updated_by) && @issue.reportable.updated_at > @last_report.updated_at
+ return true
+ else
return false
end
+ end
- def find_issue
- @issue = Issue.find(params[:id])
- end
+ def report_details
+ params[:report][:details] + "--||--" + params[:report_type].to_s + "--||--"
+ end
- def check_permission
- unless @user.administrator? or @user.moderator?
- flash[:error] = t('application.require_admin.not_an_admin')
- redirect_to root_path
- end
- end
+ def check_report_params
+ params[:report] && params[:report][:details] && params[:report_type]
+ end
- def create_new_issue_params
- params.permit(:reportable_id, :reportable_type, :reported_user_id)
- end
+ def find_issue
+ @issue = Issue.find(params[:id])
+ end
- def issue_params
- params[:issue].permit(:reportable_id, :reportable_type,:reported_user_id)
+ def check_permission
+ unless @user.administrator? || @user.moderator?
+ flash[:error] = t("application.require_admin.not_an_admin")
+ redirect_to root_path
end
+ end
- def report_params
- params[:report].permit(:details)
- end
+ def create_new_issue_params
+ params.permit(:reportable_id, :reportable_type, :reported_user_id)
+ end
- def issue_comment_params
- params.require(:issue_comment).permit(:body)
- end
+ def issue_params
+ params[:issue].permit(:reportable_id, :reportable_type, :reported_user_id)
+ end
- def sort_column
- Issue.column_names.include?(params[:sort]) ? params[:sort] : "status"
- end
+ def report_params
+ params[:report].permit(:details)
+ end
- def sort_direction
- %w[asc desc].include?(params[:direction]) ? params[:direction] : "asc"
- end
+ def issue_comment_params
+ params.require(:issue_comment).permit(:body)
+ end
+
+ def sort_column
+ Issue.column_names.include?(params[:sort]) ? params[:sort] : "status"
+ end
+
+ def sort_direction
+ %w(asc desc).include?(params[:direction]) ? params[:direction] : "asc"
+ end
end
-- PostgreSQL database dump
--
--- Dumped from database version 9.5.3
--- Dumped by pg_dump version 9.5.3
-
SET statement_timeout = 0;
SET lock_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
-SET row_security = off;
--
-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: -
COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
---
--- Name: btree_gist; Type: EXTENSION; Schema: -; Owner: -
---
-
-CREATE EXTENSION IF NOT EXISTS btree_gist WITH SCHEMA public;
-
-
---
--- Name: EXTENSION btree_gist; Type: COMMENT; Schema: -; Owner: -
---
-
-COMMENT ON EXTENSION btree_gist IS 'support for indexing common datatypes in GiST';
-
-
SET search_path = public, pg_catalog;
--
);
---
--- Name: maptile_for_point(bigint, bigint, integer); Type: FUNCTION; Schema: public; Owner: -
---
-
-CREATE FUNCTION maptile_for_point(bigint, bigint, integer) RETURNS integer
- LANGUAGE c STRICT
- AS '$libdir/libpgosm', 'maptile_for_point';
-
-
---
--- Name: tile_for_point(integer, integer); Type: FUNCTION; Schema: public; Owner: -
---
-
-CREATE FUNCTION tile_for_point(integer, integer) RETURNS bigint
- LANGUAGE c STRICT
- AS '$libdir/libpgosm', 'tile_for_point';
-
-
---
--- Name: xid_to_int4(xid); Type: FUNCTION; Schema: public; Owner: -
---
-
-CREATE FUNCTION xid_to_int4(xid) RETURNS integer
- LANGUAGE c IMMUTABLE STRICT
- AS '$libdir/libpgosm', 'xid_to_int4';
-
-
SET default_tablespace = '';
SET default_with_oids = false;
--
--- Name: acls; Type: TABLE; Schema: public; Owner: -
+-- Name: acls; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE acls (
id integer NOT NULL,
address inet,
- k character varying(255) NOT NULL,
- v character varying(255),
- domain character varying(255)
+ k character varying NOT NULL,
+ v character varying,
+ domain character varying
);
--
--- Name: changeset_comments; Type: TABLE; Schema: public; Owner: -
+-- Name: changeset_comments; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE changeset_comments (
--
--- Name: changeset_tags; Type: TABLE; Schema: public; Owner: -
+-- Name: changeset_tags; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE changeset_tags (
changeset_id bigint NOT NULL,
- k character varying(255) DEFAULT ''::character varying NOT NULL,
- v character varying(255) DEFAULT ''::character varying NOT NULL
+ k character varying DEFAULT ''::character varying NOT NULL,
+ v character varying DEFAULT ''::character varying NOT NULL
);
--
--- Name: changesets; Type: TABLE; Schema: public; Owner: -
+-- Name: changesets; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE changesets (
--
--- Name: changesets_subscribers; Type: TABLE; Schema: public; Owner: -
+-- Name: changesets_subscribers; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE changesets_subscribers (
--
--- Name: client_applications; Type: TABLE; Schema: public; Owner: -
+-- Name: client_applications; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE client_applications (
id integer NOT NULL,
- name character varying(255),
- url character varying(255),
- support_url character varying(255),
- callback_url character varying(255),
+ name character varying,
+ url character varying,
+ support_url character varying,
+ callback_url character varying,
key character varying(50),
secret character varying(50),
user_id integer,
--
--- Name: current_node_tags; Type: TABLE; Schema: public; Owner: -
+-- Name: current_node_tags; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE current_node_tags (
node_id bigint NOT NULL,
- k character varying(255) DEFAULT ''::character varying NOT NULL,
- v character varying(255) DEFAULT ''::character varying NOT NULL
+ k character varying DEFAULT ''::character varying NOT NULL,
+ v character varying DEFAULT ''::character varying NOT NULL
);
--
--- Name: current_nodes; Type: TABLE; Schema: public; Owner: -
+-- Name: current_nodes; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE current_nodes (
--
--- Name: current_relation_members; Type: TABLE; Schema: public; Owner: -
+-- Name: current_relation_members; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE current_relation_members (
relation_id bigint NOT NULL,
member_type nwr_enum NOT NULL,
member_id bigint NOT NULL,
- member_role character varying(255) NOT NULL,
+ member_role character varying NOT NULL,
sequence_id integer DEFAULT 0 NOT NULL
);
--
--- Name: current_relation_tags; Type: TABLE; Schema: public; Owner: -
+-- Name: current_relation_tags; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE current_relation_tags (
relation_id bigint NOT NULL,
- k character varying(255) DEFAULT ''::character varying NOT NULL,
- v character varying(255) DEFAULT ''::character varying NOT NULL
+ k character varying DEFAULT ''::character varying NOT NULL,
+ v character varying DEFAULT ''::character varying NOT NULL
);
--
--- Name: current_relations; Type: TABLE; Schema: public; Owner: -
+-- Name: current_relations; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE current_relations (
--
--- Name: current_way_nodes; Type: TABLE; Schema: public; Owner: -
+-- Name: current_way_nodes; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE current_way_nodes (
--
--- Name: current_way_tags; Type: TABLE; Schema: public; Owner: -
+-- Name: current_way_tags; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE current_way_tags (
way_id bigint NOT NULL,
- k character varying(255) DEFAULT ''::character varying NOT NULL,
- v character varying(255) DEFAULT ''::character varying NOT NULL
+ k character varying DEFAULT ''::character varying NOT NULL,
+ v character varying DEFAULT ''::character varying NOT NULL
);
--
--- Name: current_ways; Type: TABLE; Schema: public; Owner: -
+-- Name: current_ways; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE current_ways (
--
--- Name: diary_comments; Type: TABLE; Schema: public; Owner: -
+-- Name: diary_comments; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE diary_comments (
--
--- Name: diary_entries; Type: TABLE; Schema: public; Owner: -
+-- Name: diary_entries; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE diary_entries (
id bigint NOT NULL,
user_id bigint NOT NULL,
- title character varying(255) NOT NULL,
+ title character varying NOT NULL,
body text NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
latitude double precision,
longitude double precision,
- language_code character varying(255) DEFAULT 'en'::character varying NOT NULL,
+ language_code character varying DEFAULT 'en'::character varying NOT NULL,
visible boolean DEFAULT true NOT NULL,
body_format format_enum DEFAULT 'markdown'::format_enum NOT NULL
);
--
--- Name: friends; Type: TABLE; Schema: public; Owner: -
+-- Name: friends; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE friends (
--
--- Name: gps_points; Type: TABLE; Schema: public; Owner: -
+-- Name: gps_points; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE gps_points (
--
--- Name: gpx_file_tags; Type: TABLE; Schema: public; Owner: -
+-- Name: gpx_file_tags; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE gpx_file_tags (
gpx_id bigint DEFAULT 0 NOT NULL,
- tag character varying(255) NOT NULL,
+ tag character varying NOT NULL,
id bigint NOT NULL
);
--
--- Name: gpx_files; Type: TABLE; Schema: public; Owner: -
+-- Name: gpx_files; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE gpx_files (
id bigint NOT NULL,
user_id bigint NOT NULL,
visible boolean DEFAULT true NOT NULL,
- name character varying(255) DEFAULT ''::character varying NOT NULL,
+ name character varying DEFAULT ''::character varying NOT NULL,
size bigint,
latitude double precision,
longitude double precision,
"timestamp" timestamp without time zone NOT NULL,
- description character varying(255) DEFAULT ''::character varying NOT NULL,
+ description character varying DEFAULT ''::character varying NOT NULL,
inserted boolean NOT NULL,
visibility gpx_visibility_enum DEFAULT 'public'::gpx_visibility_enum NOT NULL
);
--
--- Name: languages; Type: TABLE; Schema: public; Owner: -
+-- Name: languages; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE languages (
- code character varying(255) NOT NULL,
- english_name character varying(255) NOT NULL,
- native_name character varying(255)
+ code character varying NOT NULL,
+ english_name character varying NOT NULL,
+ native_name character varying
);
--
--- Name: messages; Type: TABLE; Schema: public; Owner: -
+-- Name: messages; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE messages (
id bigint NOT NULL,
from_user_id bigint NOT NULL,
- title character varying(255) NOT NULL,
+ title character varying NOT NULL,
body text NOT NULL,
sent_on timestamp without time zone NOT NULL,
message_read boolean DEFAULT false NOT NULL,
--
--- Name: node_tags; Type: TABLE; Schema: public; Owner: -
+-- Name: node_tags; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE node_tags (
node_id bigint NOT NULL,
version bigint NOT NULL,
- k character varying(255) DEFAULT ''::character varying NOT NULL,
- v character varying(255) DEFAULT ''::character varying NOT NULL
+ k character varying DEFAULT ''::character varying NOT NULL,
+ v character varying DEFAULT ''::character varying NOT NULL
);
--
--- Name: nodes; Type: TABLE; Schema: public; Owner: -
+-- Name: nodes; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE nodes (
--
--- Name: note_comments; Type: TABLE; Schema: public; Owner: -
+-- Name: note_comments; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE note_comments (
- id integer NOT NULL,
+ id bigint NOT NULL,
note_id bigint NOT NULL,
visible boolean NOT NULL,
created_at timestamp without time zone NOT NULL,
--
--- Name: notes; Type: TABLE; Schema: public; Owner: -
+-- Name: notes; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE notes (
- id integer NOT NULL,
+ id bigint NOT NULL,
latitude integer NOT NULL,
longitude integer NOT NULL,
tile bigint NOT NULL,
--
--- Name: oauth_nonces; Type: TABLE; Schema: public; Owner: -
+-- Name: oauth_nonces; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE oauth_nonces (
id integer NOT NULL,
- nonce character varying(255),
+ nonce character varying,
"timestamp" integer,
created_at timestamp without time zone,
updated_at timestamp without time zone
--
--- Name: oauth_tokens; Type: TABLE; Schema: public; Owner: -
+-- Name: oauth_tokens; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE oauth_tokens (
allow_write_api boolean DEFAULT false NOT NULL,
allow_read_gpx boolean DEFAULT false NOT NULL,
allow_write_gpx boolean DEFAULT false NOT NULL,
- callback_url character varying(255),
+ callback_url character varying,
verifier character varying(20),
- scope character varying(255),
+ scope character varying,
valid_to timestamp without time zone,
allow_write_notes boolean DEFAULT false NOT NULL
);
--
--- Name: redactions; Type: TABLE; Schema: public; Owner: -
+-- Name: redactions; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE redactions (
id integer NOT NULL,
- title character varying(255),
+ title character varying,
description text,
- created_at timestamp without time zone NOT NULL,
- updated_at timestamp without time zone NOT NULL,
+ created_at timestamp without time zone,
+ updated_at timestamp without time zone,
user_id bigint NOT NULL,
description_format format_enum DEFAULT 'markdown'::format_enum NOT NULL
);
--
--- Name: relation_members; Type: TABLE; Schema: public; Owner: -
+-- Name: relation_members; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE relation_members (
relation_id bigint DEFAULT 0 NOT NULL,
member_type nwr_enum NOT NULL,
member_id bigint NOT NULL,
- member_role character varying(255) NOT NULL,
+ member_role character varying NOT NULL,
version bigint DEFAULT 0 NOT NULL,
sequence_id integer DEFAULT 0 NOT NULL
);
--
--- Name: relation_tags; Type: TABLE; Schema: public; Owner: -
+-- Name: relation_tags; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE relation_tags (
relation_id bigint DEFAULT 0 NOT NULL,
- k character varying(255) DEFAULT ''::character varying NOT NULL,
- v character varying(255) DEFAULT ''::character varying NOT NULL,
+ k character varying DEFAULT ''::character varying NOT NULL,
+ v character varying DEFAULT ''::character varying NOT NULL,
version bigint NOT NULL
);
--
--- Name: relations; Type: TABLE; Schema: public; Owner: -
+-- Name: relations; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE relations (
--
--- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -
+-- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE schema_migrations (
- version character varying(255) NOT NULL
+ version character varying NOT NULL
);
--
--- Name: user_blocks; Type: TABLE; Schema: public; Owner: -
+-- Name: user_blocks; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE user_blocks (
--
--- Name: user_preferences; Type: TABLE; Schema: public; Owner: -
+-- Name: user_preferences; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE user_preferences (
user_id bigint NOT NULL,
- k character varying(255) NOT NULL,
- v character varying(255) NOT NULL
+ k character varying NOT NULL,
+ v character varying NOT NULL
);
--
--- Name: user_roles; Type: TABLE; Schema: public; Owner: -
+-- Name: user_roles; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE user_roles (
id integer NOT NULL,
user_id bigint NOT NULL,
+ role user_role_enum NOT NULL,
created_at timestamp without time zone,
updated_at timestamp without time zone,
- role user_role_enum NOT NULL,
granter_id bigint NOT NULL
);
--
--- Name: user_tokens; Type: TABLE; Schema: public; Owner: -
+-- Name: user_tokens; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE user_tokens (
id bigint NOT NULL,
user_id bigint NOT NULL,
- token character varying(255) NOT NULL,
+ token character varying NOT NULL,
expiry timestamp without time zone NOT NULL,
referer text
);
--
--- Name: users; Type: TABLE; Schema: public; Owner: -
+-- Name: users; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE users (
- email character varying(255) NOT NULL,
+ email character varying NOT NULL,
id bigint NOT NULL,
- pass_crypt character varying(255) NOT NULL,
+ pass_crypt character varying NOT NULL,
creation_time timestamp without time zone NOT NULL,
- display_name character varying(255) DEFAULT ''::character varying NOT NULL,
+ display_name character varying DEFAULT ''::character varying NOT NULL,
data_public boolean DEFAULT false NOT NULL,
description text DEFAULT ''::text NOT NULL,
home_lat double precision,
home_lon double precision,
home_zoom smallint DEFAULT 3,
nearby integer DEFAULT 50,
- pass_salt character varying(255),
+ pass_salt character varying,
image_file_name text,
email_valid boolean DEFAULT false NOT NULL,
- new_email character varying(255),
- creation_ip character varying(255),
- languages character varying(255),
+ new_email character varying,
+ creation_ip character varying,
+ languages character varying,
status user_status_enum DEFAULT 'pending'::user_status_enum NOT NULL,
terms_agreed timestamp without time zone,
consider_pd boolean DEFAULT false NOT NULL,
- preferred_editor character varying(255),
+ auth_uid character varying,
+ preferred_editor character varying,
terms_seen boolean DEFAULT false NOT NULL,
- auth_uid character varying(255),
description_format format_enum DEFAULT 'markdown'::format_enum NOT NULL,
- image_fingerprint character varying(255),
+ image_fingerprint character varying,
changesets_count integer DEFAULT 0 NOT NULL,
traces_count integer DEFAULT 0 NOT NULL,
diary_entries_count integer DEFAULT 0 NOT NULL,
image_use_gravatar boolean DEFAULT false NOT NULL,
- image_content_type character varying(255),
+ image_content_type character varying,
auth_provider character varying
);
--
--- Name: way_nodes; Type: TABLE; Schema: public; Owner: -
+-- Name: way_nodes; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE way_nodes (
--
--- Name: way_tags; Type: TABLE; Schema: public; Owner: -
+-- Name: way_tags; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE way_tags (
way_id bigint DEFAULT 0 NOT NULL,
- k character varying(255) NOT NULL,
- v character varying(255) NOT NULL,
+ k character varying NOT NULL,
+ v character varying NOT NULL,
version bigint NOT NULL
);
--
--- Name: ways; Type: TABLE; Schema: public; Owner: -
+-- Name: ways; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE ways (
--
--- Name: acls_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+-- Name: acls_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY acls
--
--- Name: changeset_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+-- Name: changeset_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY changeset_comments
--
--- Name: changesets_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+-- Name: changesets_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY changesets
--
--- Name: client_applications_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+-- Name: client_applications_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY client_applications
--
--- Name: current_node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+-- Name: current_node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY current_node_tags
--
--- Name: current_nodes_pkey1; Type: CONSTRAINT; Schema: public; Owner: -
+-- Name: current_nodes_pkey1; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY current_nodes
--
--- Name: current_relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+-- Name: current_relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY current_relation_members
--
--- Name: current_relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+-- Name: current_relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY current_relation_tags
--
--- Name: current_relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+-- Name: current_relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY current_relations
--
--- Name: current_way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+-- Name: current_way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY current_way_nodes
--
--- Name: current_way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+-- Name: current_way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY current_way_tags
--
--- Name: current_ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+-- Name: current_ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY current_ways
--
--- Name: diary_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+-- Name: diary_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY diary_comments
--
--- Name: diary_entries_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+-- Name: diary_entries_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY diary_entries
--
--- Name: friends_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+-- Name: friends_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY friends
--
--- Name: gpx_file_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+-- Name: gpx_file_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY gpx_file_tags
--
--- Name: gpx_files_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+-- Name: gpx_files_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY gpx_files
--
--- Name: languages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+-- Name: languages_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY languages
--
--- Name: messages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+-- Name: messages_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY messages
--
--- Name: node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+-- Name: node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY node_tags
--
--- Name: nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+-- Name: nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY nodes
--
--- Name: note_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+-- Name: note_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY note_comments
--
--- Name: notes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+-- Name: notes_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY notes
--
--- Name: oauth_nonces_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+-- Name: oauth_nonces_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY oauth_nonces
--
--- Name: oauth_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+-- Name: oauth_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY oauth_tokens
--
--- Name: redactions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+-- Name: redactions_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY redactions
--
--- Name: relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+-- Name: relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY relation_members
--
--- Name: relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+-- Name: relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY relation_tags
--
--- Name: relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+-- Name: relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY relations
--
--- Name: user_blocks_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+-- Name: user_blocks_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY user_blocks
--
--- Name: user_preferences_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+-- Name: user_preferences_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY user_preferences
--
--- Name: user_roles_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+-- Name: user_roles_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY user_roles
--
--- Name: user_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+-- Name: user_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY user_tokens
--
--- Name: users_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+-- Name: users_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY users
--
--- Name: way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+-- Name: way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY way_nodes
--
--- Name: way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+-- Name: way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY way_tags
--
--- Name: ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+-- Name: ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY ways
--
--- Name: acls_k_idx; Type: INDEX; Schema: public; Owner: -
+-- Name: acls_k_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX acls_k_idx ON acls USING btree (k);
--
--- Name: changeset_tags_id_idx; Type: INDEX; Schema: public; Owner: -
+-- Name: changeset_tags_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX changeset_tags_id_idx ON changeset_tags USING btree (changeset_id);
--
--- Name: changesets_bbox_idx; Type: INDEX; Schema: public; Owner: -
+-- Name: changesets_bbox_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
-CREATE INDEX changesets_bbox_idx ON changesets USING gist (min_lat, max_lat, min_lon, max_lon);
+CREATE INDEX changesets_bbox_idx ON changesets USING btree (min_lat, max_lat, min_lon, max_lon);
--
--- Name: changesets_closed_at_idx; Type: INDEX; Schema: public; Owner: -
+-- Name: changesets_closed_at_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX changesets_closed_at_idx ON changesets USING btree (closed_at);
--
--- Name: changesets_created_at_idx; Type: INDEX; Schema: public; Owner: -
+-- Name: changesets_created_at_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX changesets_created_at_idx ON changesets USING btree (created_at);
--
--- Name: changesets_user_id_created_at_idx; Type: INDEX; Schema: public; Owner: -
+-- Name: changesets_user_id_created_at_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX changesets_user_id_created_at_idx ON changesets USING btree (user_id, created_at);
--
--- Name: changesets_user_id_id_idx; Type: INDEX; Schema: public; Owner: -
+-- Name: changesets_user_id_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX changesets_user_id_id_idx ON changesets USING btree (user_id, id);
--
--- Name: current_nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
+-- Name: current_nodes_tile_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX current_nodes_tile_idx ON current_nodes USING btree (tile);
--
--- Name: current_nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
+-- Name: current_nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX current_nodes_timestamp_idx ON current_nodes USING btree ("timestamp");
--
--- Name: current_relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
+-- Name: current_relation_members_member_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX current_relation_members_member_idx ON current_relation_members USING btree (member_type, member_id);
--
--- Name: current_relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
+-- Name: current_relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX current_relations_timestamp_idx ON current_relations USING btree ("timestamp");
--
--- Name: current_way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
+-- Name: current_way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX current_way_nodes_node_idx ON current_way_nodes USING btree (node_id);
--
--- Name: current_ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
+-- Name: current_ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX current_ways_timestamp_idx ON current_ways USING btree ("timestamp");
--
--- Name: diary_comment_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
+-- Name: diary_comment_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX diary_comment_user_id_created_at_index ON diary_comments USING btree (user_id, created_at);
--
--- Name: diary_comments_entry_id_idx; Type: INDEX; Schema: public; Owner: -
+-- Name: diary_comments_entry_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE UNIQUE INDEX diary_comments_entry_id_idx ON diary_comments USING btree (diary_entry_id, id);
--
--- Name: diary_entry_created_at_index; Type: INDEX; Schema: public; Owner: -
+-- Name: diary_entry_created_at_index; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX diary_entry_created_at_index ON diary_entries USING btree (created_at);
--
--- Name: diary_entry_language_code_created_at_index; Type: INDEX; Schema: public; Owner: -
+-- Name: diary_entry_language_code_created_at_index; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX diary_entry_language_code_created_at_index ON diary_entries USING btree (language_code, created_at);
--
--- Name: diary_entry_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
+-- Name: diary_entry_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX diary_entry_user_id_created_at_index ON diary_entries USING btree (user_id, created_at);
--
--- Name: friends_user_id_idx; Type: INDEX; Schema: public; Owner: -
+-- Name: friends_user_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX friends_user_id_idx ON friends USING btree (user_id);
--
--- Name: gpx_file_tags_gpxid_idx; Type: INDEX; Schema: public; Owner: -
+-- Name: gpx_file_tags_gpxid_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX gpx_file_tags_gpxid_idx ON gpx_file_tags USING btree (gpx_id);
--
--- Name: gpx_file_tags_tag_idx; Type: INDEX; Schema: public; Owner: -
+-- Name: gpx_file_tags_tag_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX gpx_file_tags_tag_idx ON gpx_file_tags USING btree (tag);
--
--- Name: gpx_files_timestamp_idx; Type: INDEX; Schema: public; Owner: -
+-- Name: gpx_files_timestamp_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX gpx_files_timestamp_idx ON gpx_files USING btree ("timestamp");
--
--- Name: gpx_files_user_id_idx; Type: INDEX; Schema: public; Owner: -
+-- Name: gpx_files_user_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX gpx_files_user_id_idx ON gpx_files USING btree (user_id);
--
--- Name: gpx_files_visible_visibility_idx; Type: INDEX; Schema: public; Owner: -
+-- Name: gpx_files_visible_visibility_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX gpx_files_visible_visibility_idx ON gpx_files USING btree (visible, visibility);
--
--- Name: index_changeset_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
+-- Name: index_changeset_comments_on_created_at; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX index_changeset_comments_on_created_at ON changeset_comments USING btree (created_at);
--
--- Name: index_changesets_subscribers_on_changeset_id; Type: INDEX; Schema: public; Owner: -
+-- Name: index_changesets_subscribers_on_changeset_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX index_changesets_subscribers_on_changeset_id ON changesets_subscribers USING btree (changeset_id);
--
--- Name: index_changesets_subscribers_on_subscriber_id_and_changeset_id; Type: INDEX; Schema: public; Owner: -
+-- Name: index_changesets_subscribers_on_subscriber_id_and_changeset_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE UNIQUE INDEX index_changesets_subscribers_on_subscriber_id_and_changeset_id ON changesets_subscribers USING btree (subscriber_id, changeset_id);
--
--- Name: index_client_applications_on_key; Type: INDEX; Schema: public; Owner: -
+-- Name: index_client_applications_on_key; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE UNIQUE INDEX index_client_applications_on_key ON client_applications USING btree (key);
--
--- Name: index_note_comments_on_body; Type: INDEX; Schema: public; Owner: -
+-- Name: index_note_comments_on_body; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX index_note_comments_on_body ON note_comments USING gin (to_tsvector('english'::regconfig, body));
--
--- Name: index_note_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
+-- Name: index_note_comments_on_created_at; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX index_note_comments_on_created_at ON note_comments USING btree (created_at);
--
--- Name: index_oauth_nonces_on_nonce_and_timestamp; Type: INDEX; Schema: public; Owner: -
+-- Name: index_oauth_nonces_on_nonce_and_timestamp; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE UNIQUE INDEX index_oauth_nonces_on_nonce_and_timestamp ON oauth_nonces USING btree (nonce, "timestamp");
--
--- Name: index_oauth_tokens_on_token; Type: INDEX; Schema: public; Owner: -
+-- Name: index_oauth_tokens_on_token; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE UNIQUE INDEX index_oauth_tokens_on_token ON oauth_tokens USING btree (token);
--
--- Name: index_user_blocks_on_user_id; Type: INDEX; Schema: public; Owner: -
+-- Name: index_user_blocks_on_user_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX index_user_blocks_on_user_id ON user_blocks USING btree (user_id);
--
--- Name: messages_from_user_id_idx; Type: INDEX; Schema: public; Owner: -
+-- Name: messages_from_user_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX messages_from_user_id_idx ON messages USING btree (from_user_id);
--
--- Name: messages_to_user_id_idx; Type: INDEX; Schema: public; Owner: -
+-- Name: messages_to_user_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX messages_to_user_id_idx ON messages USING btree (to_user_id);
--
--- Name: nodes_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
+-- Name: nodes_changeset_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX nodes_changeset_id_idx ON nodes USING btree (changeset_id);
--
--- Name: nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
+-- Name: nodes_tile_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX nodes_tile_idx ON nodes USING btree (tile);
--
--- Name: nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
+-- Name: nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX nodes_timestamp_idx ON nodes USING btree ("timestamp");
--
--- Name: note_comments_note_id_idx; Type: INDEX; Schema: public; Owner: -
+-- Name: note_comments_note_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX note_comments_note_id_idx ON note_comments USING btree (note_id);
--
--- Name: notes_created_at_idx; Type: INDEX; Schema: public; Owner: -
+-- Name: notes_created_at_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX notes_created_at_idx ON notes USING btree (created_at);
--
--- Name: notes_tile_status_idx; Type: INDEX; Schema: public; Owner: -
+-- Name: notes_tile_status_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX notes_tile_status_idx ON notes USING btree (tile, status);
--
--- Name: notes_updated_at_idx; Type: INDEX; Schema: public; Owner: -
+-- Name: notes_updated_at_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX notes_updated_at_idx ON notes USING btree (updated_at);
--
--- Name: points_gpxid_idx; Type: INDEX; Schema: public; Owner: -
+-- Name: points_gpxid_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX points_gpxid_idx ON gps_points USING btree (gpx_id);
--
--- Name: points_tile_idx; Type: INDEX; Schema: public; Owner: -
+-- Name: points_tile_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX points_tile_idx ON gps_points USING btree (tile);
--
--- Name: relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
+-- Name: relation_members_member_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX relation_members_member_idx ON relation_members USING btree (member_type, member_id);
--
--- Name: relations_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
+-- Name: relations_changeset_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX relations_changeset_id_idx ON relations USING btree (changeset_id);
--
--- Name: relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
+-- Name: relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX relations_timestamp_idx ON relations USING btree ("timestamp");
--
--- Name: unique_schema_migrations; Type: INDEX; Schema: public; Owner: -
+-- Name: unique_schema_migrations; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE UNIQUE INDEX unique_schema_migrations ON schema_migrations USING btree (version);
--
--- Name: user_id_idx; Type: INDEX; Schema: public; Owner: -
+-- Name: user_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX user_id_idx ON friends USING btree (friend_user_id);
--
--- Name: user_roles_id_role_unique; Type: INDEX; Schema: public; Owner: -
+-- Name: user_roles_id_role_unique; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE UNIQUE INDEX user_roles_id_role_unique ON user_roles USING btree (user_id, role);
--
--- Name: user_tokens_token_idx; Type: INDEX; Schema: public; Owner: -
+-- Name: user_tokens_token_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE UNIQUE INDEX user_tokens_token_idx ON user_tokens USING btree (token);
--
--- Name: user_tokens_user_id_idx; Type: INDEX; Schema: public; Owner: -
+-- Name: user_tokens_user_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX user_tokens_user_id_idx ON user_tokens USING btree (user_id);
--
--- Name: users_auth_idx; Type: INDEX; Schema: public; Owner: -
+-- Name: users_auth_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE UNIQUE INDEX users_auth_idx ON users USING btree (auth_provider, auth_uid);
--
--- Name: users_display_name_idx; Type: INDEX; Schema: public; Owner: -
+-- Name: users_display_name_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE UNIQUE INDEX users_display_name_idx ON users USING btree (display_name);
--
--- Name: users_display_name_lower_idx; Type: INDEX; Schema: public; Owner: -
+-- Name: users_display_name_lower_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX users_display_name_lower_idx ON users USING btree (lower((display_name)::text));
--
--- Name: users_email_idx; Type: INDEX; Schema: public; Owner: -
+-- Name: users_email_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE UNIQUE INDEX users_email_idx ON users USING btree (email);
--
--- Name: users_email_lower_idx; Type: INDEX; Schema: public; Owner: -
+-- Name: users_email_lower_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX users_email_lower_idx ON users USING btree (lower((email)::text));
--
--- Name: way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
+-- Name: way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX way_nodes_node_idx ON way_nodes USING btree (node_id);
--
--- Name: ways_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
+-- Name: ways_changeset_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX ways_changeset_id_idx ON ways USING btree (changeset_id);
--
--- Name: ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
+-- Name: ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX ways_timestamp_idx ON ways USING btree ("timestamp");
-- PostgreSQL database dump complete
--
-SET search_path TO "$user", public;
+SET search_path TO "$user",public;
INSERT INTO schema_migrations (version) VALUES ('1');
INSERT INTO schema_migrations (version) VALUES ('20130328184137');
-INSERT INTO schema_migrations (version) VALUES ('20131029121300');
-
INSERT INTO schema_migrations (version) VALUES ('20131212124700');
INSERT INTO schema_migrations (version) VALUES ('20140115192822');
INSERT INTO schema_migrations (version) VALUES ('20150222101847');
-INSERT INTO schema_migrations (version) VALUES ('20150516073616');
+INSERT INTO schema_migrations (version) VALUES ('20150818224516');
+
+INSERT INTO schema_migrations (version) VALUES ('20160822153055');
-INSERT INTO schema_migrations (version) VALUES ('20150526130032');
+INSERT INTO schema_migrations (version) VALUES ('20160822153115');
-INSERT INTO schema_migrations (version) VALUES ('20150719160821');
+INSERT INTO schema_migrations (version) VALUES ('20160822153153');
INSERT INTO schema_migrations (version) VALUES ('21');
-require 'test_helper'
+require "test_helper"
class IssuesControllerTest < ActionController::TestCase
- fixtures :users,:user_roles
+ fixtures :users, :user_roles
def test_view_dashboard_without_auth
# Access issues_path without login
assert_response :success
# Access issues_path by moderator
- session[:user]= users(:moderator_user).id
+ session[:user] = users(:moderator_user).id
get :index
assert_response :success
end
def test_new_issue_without_login
# Test creation of a new issue and a new report without logging in
- get :new, {reportable_id: 1, reportable_type: "User", reported_user_id: 1}
+ get :new, :reportable_id => 1, :reportable_type => "User", :reported_user_id => 1
assert_response :redirect
- assert_redirected_to login_path(:referer => new_issue_path(:reportable_id=>1, :reportable_type=>"User",:reported_user_id=> 1))
+ assert_redirected_to login_path(:referer => new_issue_path(:reportable_id => 1, :reportable_type => "User", :reported_user_id => 1))
end
def test_new_issue_after_login
# Login
session[:user] = users(:normal_user).id
- assert_equal Issue.count,0
-
- # Create an Issue and a report
- get :new, {reportable_id: 1, reportable_type: "User", reported_user_id: 2}
+ assert_equal Issue.count, 0
+
+ # Create an Issue and a report
+ get :new, :reportable_id => 1, :reportable_type => "User", :reported_user_id => 2
assert_response :success
- assert_difference "Issue.count",1 do
+ assert_difference "Issue.count", 1 do
details = "Details of a report"
- post :create, { :report => { :details => details},
- :report_type => "[OFFENSIVE]",
- :issue => { reportable_id: 1, reportable_type: "User", reported_user_id: 2} }
+ post :create,
+ :report => { :details => details },
+ :report_type => "[OFFENSIVE]",
+ :issue => { :reportable_id => 1, :reportable_type => "User", :reported_user_id => 2 }
end
- assert_equal Issue.count,1
+ assert_equal Issue.count, 1
assert_response :redirect
assert_redirected_to root_path
end
# Login
session[:user] = users(:normal_user).id
- assert_equal Issue.count,0
+ assert_equal Issue.count, 0
# Create an Issue and a report
- get :new, {reportable_id: 1, reportable_type: "User", reported_user_id: 2}
+ get :new, :reportable_id => 1, :reportable_type => "User", :reported_user_id => 2
assert_response :success
- assert_difference "Issue.count",1 do
+ assert_difference "Issue.count", 1 do
details = "Details of a report"
- post :create, { :report => { :details => details},
- :report_type => "[OFFENSIVE]",
- :issue => { reportable_id: 1, reportable_type: "User", reported_user_id: 2} }
- end
- assert_equal Issue.count,1
+ post :create,
+ :report => { :details => details },
+ :report_type => "[OFFENSIVE]",
+ :issue => { :reportable_id => 1, :reportable_type => "User", :reported_user_id => 2 }
+ end
+ assert_equal Issue.count, 1
assert_response :redirect
assert_redirected_to root_path
-
- get :new, {reportable_id: 1, reportable_type: "User", reported_user_id: 2}
+
+ get :new, :reportable_id => 1, :reportable_type => "User", :reported_user_id => 2
assert_response :success
# Report without report_type
assert_no_difference "Issue.count" do
details = "Details of another report under the same issue"
- post :create, { :report => { :details => details},
- :issue => { reportable_id: 1, reportable_type: "User", reported_user_id: 2} }
+ post :create,
+ :report => { :details => details },
+ :issue => { :reportable_id => 1, :reportable_type => "User", :reported_user_id => 2 }
end
assert_response :redirect
- assert_equal Issue.find_by_reportable_id_and_reportable_type(1,"User").reports.count,1
+ assert_equal Issue.find_by_reportable_id_and_reportable_type(1, "User").reports.count, 1
# Report without details
assert_no_difference "Issue.count" do
- post :create, { :report_type => "[OFFENSIVE]",
- :issue => { reportable_id: 1, reportable_type: "User", reported_user_id: 2} }
+ post :create,
+ :report_type => "[OFFENSIVE]",
+ :issue => { :reportable_id => 1, :reportable_type => "User", :reported_user_id => 2 }
end
assert_response :redirect
- assert_equal Issue.find_by_reportable_id_and_reportable_type(1,"User").reports.count,1
+ assert_equal Issue.find_by_reportable_id_and_reportable_type(1, "User").reports.count, 1
end
def test_new_report_with_complete_details
# Login
session[:user] = users(:normal_user).id
- assert_equal Issue.count,0
+ assert_equal Issue.count, 0
# Create an Issue and a report
- get :new, {reportable_id: 1, reportable_type: "User", reported_user_id: 2}
+ get :new, :reportable_id => 1, :reportable_type => "User", :reported_user_id => 2
assert_response :success
- assert_difference "Issue.count",1 do
+ assert_difference "Issue.count", 1 do
details = "Details of a report"
- post :create, { :report => { :details => details},
- :report_type => "[OFFENSIVE]",
- :issue => { reportable_id: 1, reportable_type: "User", reported_user_id: 2} }
+ post :create,
+ :report => { :details => details },
+ :report_type => "[OFFENSIVE]",
+ :issue => { :reportable_id => 1, :reportable_type => "User", :reported_user_id => 2 }
end
- assert_equal Issue.count,1
+ assert_equal Issue.count, 1
assert_response :redirect
assert_redirected_to root_path
-
+
# Create a report for an existing Issue
- get :new, {reportable_id: 1, reportable_type: "User", reported_user_id: 2}
+ get :new, :reportable_id => 1, :reportable_type => "User", :reported_user_id => 2
assert_response :success
assert_no_difference "Issue.count" do
details = "Details of another report under the same issue"
- post :create, { :report => { :details => details},
- :report_type => "[OFFENSIVE]",
- :issue => { reportable_id: 1, reportable_type: "User", reported_user_id: 2} }
+ post :create,
+ :report => { :details => details },
+ :report_type => "[OFFENSIVE]",
+ :issue => { :reportable_id => 1, :reportable_type => "User", :reported_user_id => 2 }
end
assert_response :redirect
- assert_equal Issue.find_by_reportable_id_and_reportable_type(1,"User").reports.count,2
+ report_count = Issue.find_by_reportable_id_and_reportable_type(1, "User").reports.count
+ assert_equal report_count, 2
end
def test_change_status_by_normal_user
# Login as normal user
session[:user] = users(:normal_user).id
-
+
# Create Issue
- test_new_issue_after_login
- assert_equal Issue.count,1
-
- get :resolve, id: Issue.find_by_reportable_id_and_reportable_type(1,"User").id
+ test_new_issue_after_login
+ assert_equal Issue.count, 1
+
+ get :resolve, :id => Issue.find_by_reportable_id_and_reportable_type(1, "User").id
assert_response :redirect
assert_redirected_to root_path
# Create Issue
test_new_issue_after_login
- assert_equal Issue.count,1
+ assert_equal Issue.count, 1
assert_response :redirect
# Login as administrator
session[:user] = users(:administrator_user).id
-
+
# Test 'Resolved'
- get :resolve, id: Issue.find_by_reportable_id_and_reportable_type(1,"User").id
- assert_equal Issue.find_by_reportable_id_and_reportable_type(1,"User").resolved?, true
+ get :resolve, :id => Issue.find_by_reportable_id_and_reportable_type(1, "User").id
+ assert_equal Issue.find_by_reportable_id_and_reportable_type(1, "User").resolved?, true
assert_response :redirect
# Test 'Reopen'
- get :reopen, id: Issue.find_by_reportable_id_and_reportable_type(1,"User").id
- assert_equal Issue.find_by_reportable_id_and_reportable_type(1,"User").open?, true
+ get :reopen, :id => Issue.find_by_reportable_id_and_reportable_type(1, "User").id
+ assert_equal Issue.find_by_reportable_id_and_reportable_type(1, "User").open?, true
assert_response :redirect
# Test 'Ignored'
- get :ignore, id: Issue.find_by_reportable_id_and_reportable_type(1,"User").id
- assert_equal Issue.find_by_reportable_id_and_reportable_type(1,"User").ignored?, true
+ get :ignore, :id => Issue.find_by_reportable_id_and_reportable_type(1, "User").id
+ assert_equal Issue.find_by_reportable_id_and_reportable_type(1, "User").ignored?, true
assert_response :redirect
end
session[:user] = users(:administrator_user).id
# No issues against the user
- get :index, search_by_user: "test1"
+ get :index, :search_by_user => "test1"
assert_response :redirect
assert_redirected_to issues_path
# User doesn't exist
- get :index, search_by_user: "test1000"
+ get :index, :search_by_user => "test1000"
assert_response :redirect
assert_redirected_to issues_path
# Create Issue against user_id:2
test_new_issue_after_login
- assert_equal Issue.count,1
- assert_equal Issue.first.reported_user_id,2
+ assert_equal Issue.count, 1
+ assert_equal Issue.first.reported_user_id, 2
session[:user] = users(:administrator_user).id
# Find Issue against user_id:2
- get :index, search_by_user: "test2"
+ get :index, :search_by_user => "test2"
assert_response :success
end
def test_comment_by_normal_user
# Create Issue
test_new_issue_after_login
- assert_equal Issue.count,1
+ assert_equal Issue.count, 1
- get :comment, id: 1
+ get :comment, :id => 1
assert_response :redirect
assert_redirected_to root_path
end
def test_comment
# Create Issue
test_new_issue_after_login
- assert_equal Issue.count,1
+ assert_equal Issue.count, 1
@issue = Issue.all.first
# Login as administrator
session[:user] = users(:administrator_user).id
- get :comment, id: @issue.id, :issue_comment => { body: "test comment" }
+ get :comment, :id => @issue.id, :issue_comment => { :body => "test comment" }
assert_response :redirect
assert_redirected_to @issue
end