module ValidationMessages # Note that these are not set up to be internationalizable # general messages PERMISSION_VALIDATION_ERROR = "You do not have permissions to perform this action." USER_NOT_MUSICIAN_VALIDATION_ERROR = "You must be a Musician to perform this action." USER_NOT_BAND_MEMBER_VALIDATION_ERROR = "You must be a band member to perform this action." # band invitations BAND_INVITATION_NOT_FOUND = "Band invitation not found." # recordings RECORDING_NOT_FOUND = "Recording not found." # tracks TRACK_NOT_FOUND = "Track not found." # sessions SESSION_NOT_FOUND = "Session not found." # genres RECORDING_GENRE_LIMIT_EXCEEDED = "No more than 1 genre is allowed." BAND_GENRE_LIMIT_EXCEEDED = "No more than 3 genres are allowed." SESSION_GENRE_LIMIT_EXCEEDED = "No more than 3 genres are allowed." RECORDING_GENRE_MINIMUM_NOT_MET = "At least 1 genre is required." BAND_GENRE_MINIMUM_NOT_MET = "At least 1 genre is required." SESSION_GENRE_MINIMUM_NOT_MET = "At least 1 genre is required." # instruments INSTRUMENT_LIMIT_EXCEEDED = "No more than 5 instruments are allowed." INSTRUMENT_MINIMUM_NOT_MET = "At least 1 instrument is required." # user OLD_PASSWORD_DOESNT_MATCH = "Your old password is incorrect." EMAIL_NOT_FOUND = "Email address not found." NOT_YOUR_PASSWORD = "is not your current password" EMAIL_ALREADY_TAKEN = "has already been taken" EMAIL_MATCHES_CURRENT = "is same as your current email" INVALID_FPFILE = "is not valid" #connection USER_OR_LATENCY_TESTER_PRESENT = "user or latency_tester must be present" SELECT_AT_LEAST_ONE = "Please select at least one track" # DO NOT CHANGE THIS TEXT MESSAGE UNLESS YOU CHANGE createSession.js.erb, which is looking for it FAN_CAN_NOT_JOIN_AS_MUSICIAN = "A fan can not join a music session as a musician" MUSIC_SESSION_MUST_BE_SPECIFIED = "A music session must be specified" INVITE_REQUIRED = "You must be invited to join this session" FANS_CAN_NOT_JOIN = "Fans can not join this session" CANT_JOIN_RECORDING_SESSION = "is currently recording" CANT_JOIN_MULTIPLE_SESSIONS = 'You cannot join more than one music session' # recordings ALREADY_BEING_RECORDED = "already being recorded" ALREADY_PLAYBACK_RECORDING = "already playing a recording" NO_LONGER_RECORDING = "no longer recording" NOT_IN_SESSION = "not in session" PREVIOUS_RECORDING_STILL_BEING_FINALIZED = "still has previous recording being finalized" # recorded tracks ALREADY_UPLOADED = "already set" INVALID_PART_NUMBER_SPECIFIED = "is unexpected value" PART_NOT_FOUND_IN_AWS = "not found in AWS" FILE_OFFSET_EXCEEDS_LENGTH = "exceeds upload file length" LENGTH_NOT_SPECIFIED = "not specified" BAD_UPLOAD = "incorrectly uploaded" PART_NOT_STARTED = "not started" UPLOAD_FAILURES_EXCEEDED = "exceeded" ONLY_ONE_MIX = "can not be multiple" # claimed recordings NOT_PART_OF_RECORDING = "not a part of this recording" # music sessions MUST_BE_A_MUSICIAN = "must be a musician" CLAIMED_RECORDING_ALREADY_IN_PROGRESS = "already started by someone else" MUST_BE_KNOWN_TIMEZONE = "not valid" # notification DIFFERENT_SOURCE_TARGET = 'can\'t be same as the sender' # mods MODS_MUST_BE_HASH = 'must be a hash' MODS_UNKNOWN_KEY = 'unknown mod' # takes either a string/string hash, or a string/array-of-strings|symbols hash, # and creates a ActiveRecord.errors style object def createValidationStyleObject(validation_errors) validate = {} errors = {} validate[:errors] = errors validation_errors.each do | key, value | if value.class == Array errors[key] = value elsif value.class == String || value.class == Symbol errors[key] = [value.to_s] else raise Exception.new("must be array or string") end end return validate end end