Skip to content

Commit

Permalink
build: revert "feat: Increase attachment size options (#668)"
Browse files Browse the repository at this point in the history
  • Loading branch information
tshuli committed Nov 19, 2020
1 parent f25cd36 commit 1d4e3c4
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 65 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ const DATE_VALIDATION_OPTIONS = {
custom: 'Custom date range',
}

const EMAIL_MODE_ALLOWED_SIZES = ['1', '2', '3', '4', '5', '6', '7']

angular
.module('forms')
.controller('EditFieldsModalController', [
Expand Down Expand Up @@ -306,13 +304,7 @@ function EditFieldsModalController(
field.ValidationOptions.customMin = null
}

// For email mode, show only up to 7MB for dropdown
vm.attachmentSizes =
vm.myform.responseMode === responseModeEnum.EMAIL
? Attachment.dropdown.filter((option) =>
EMAIL_MODE_ALLOWED_SIZES.includes(option.value),
)
: Attachment.dropdown
vm.attachmentSizes = Attachment.dropdown

let previousAttachmentSize = 0

Expand Down
40 changes: 1 addition & 39 deletions src/public/modules/forms/services/attachment.client.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,50 +3,12 @@ const { zipWith } = require('lodash')
angular.module('forms').service('Attachment', [Attachment])

function Attachment() {
this.sizes = [
'1',
'2',
'3',
'4',
'5',
'6',
'7',
'8',
'9',
'10',
'11',
'12',
'13',
'14',
'15',
'16',
'17',
'18',
'19',
'20',
]
this.sizes = ['1', '3', '7']

this.descriptions = [
'1 MB (e.g. Pictures)',
'2 MB (e.g. Pictures)',
'3 MB (e.g. PDF files)',
'4 MB (e.g. PDF files)',
'5 MB (e.g. PDF files)',
'6 MB (e.g. PDF files)',
'7 MB (e.g. Slides)',
'8 MB (e.g. Slides)',
'9 MB (e.g. Slides)',
'10 MB (e.g. Slides)',
'11 MB (e.g. Video files)',
'12 MB (e.g. Video files)',
'13 MB (e.g. Video files)',
'14 MB (e.g. Video files)',
'15 MB (e.g. Video files)',
'16 MB (e.g. Video files)',
'17 MB (e.g. Video files)',
'18 MB (e.g. Video files)',
'19 MB (e.g. Video files)',
'20 MB (e.g. Video files)',
]

this.dropdown = zipWith(this.descriptions, this.sizes, (desc, size) => {
Expand Down
17 changes: 0 additions & 17 deletions src/types/field/attachmentField.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,8 @@ import { IField, IFieldSchema } from './baseField'

export enum AttachmentSize {
OneMb = '1',
TwoMb = '2',
ThreeMb = '3',
FourMb = '4',
FiveMb = '5',
SixMb = '6',
SevenMb = '7',
EightMb = '8',
NineMb = '9',
TenMb = '10',
ElevenMb = '11',
TwelveMb = '12',
ThirteenMb = '13',
FourteenMb = '14',
FifteenMb = '15',
SixteenMb = '16',
SeventeenMb = '17',
EighteenMb = '18',
NineteenMb = '19',
TwentyMb = '20',
}

export interface IAttachmentField extends IField {
Expand Down

0 comments on commit 1d4e3c4

Please sign in to comment.