Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import { computed } from '@ember/object';
import { or } from '@ember/object/computed';
import attr from 'ember-data/attr';
import Fragment from 'ember-data-model-fragments/fragment';
export const schema = {
Name: {
required: true,
},
HeaderType: {
allowedValues: ['Exact', 'Prefix', 'Suffix', 'Regex', 'Present'],
},
};
export default Fragment.extend({
Name: attr('string'),
Exact: attr('string'),
Prefix: attr('string'),
Suffix: attr('string'),
Regex: attr('string'),
Present: attr(), // this is a boolean but we don't want it to automatically be set to false
Value: or(...schema.HeaderType.allowedValues),
HeaderType: computed(...schema.HeaderType.allowedValues, function() {
return schema.HeaderType.allowedValues.find(prop => typeof this[prop] !== 'undefined');
}),
});
validator('time', {
allowEmpty: true
}),
// alias title validation especially for unique validation
validator('alias', {
alias: 'title',
firstMessageOnly: true
}),
// alias is partially filled validation as that's part of time validation
validator('alias', {
alias: 'isPartiallyFilled',
}),
]
});
export default Fragment.extend(Validations, {
poll: fragmentOwner(),
title: attr('string'),
date: computed('title', function() {
const allowedFormats = [
'YYYY-MM-DD',
'YYYY-MM-DDTHH:mm:ss.SSSZ'
];
const value = this.title;
if (isEmpty(value)) {
return;
}
const format = allowedFormats.find((f) => {
// if format length does not match value length
// string can't be in this format
export const ATTR_STREAMS_NAME_BOTH = ATTR_STREAMS_NAME_CUSTOM | ATTR_STREAMS_NAME_ORIGINAL;
export const ATTR_STREAMS_INFO_GAME = 0;
export const ATTR_STREAMS_INFO_TITLE = 1;
export const ATTR_STREAMS_CLICK_NOOP = 0;
export const ATTR_STREAMS_CLICK_LAUNCH = 1;
export const ATTR_STREAMS_CLICK_CHAT = 2;
export const ATTR_STREAMS_CLICK_CHANNEL = 3;
export const ATTR_STREAMS_CLICK_SETTINGS = 4;
// eslint-disable-next-line max-len
export const DEFAULT_VODCAST_REGEXP = "\\b(not live|re-?(run|streaming)|(vod-?|re-?broad)cast(ing)?)\\b";
export default Fragment.extend({
name: attr( "number", { defaultValue: ATTR_STREAMS_NAME_BOTH } ),
modal_close_end: attr( "boolean", { defaultValue: false } ),
modal_close_launch: attr( "boolean", { defaultValue: false } ),
chat_open: attr( "boolean", { defaultValue: false } ),
chat_open_context: attr( "boolean", { defaultValue: false } ),
twitchemotes: attr( "boolean", { defaultValue: false } ),
filter_vodcast: attr( "boolean", { defaultValue: true } ),
vodcast_regexp: attr( "string", { defaultValue: "" } ),
filter_languages: attr( "boolean", { defaultValue: false } ),
languages: fragment( "settingsStreamsLanguages", { defaultValue: {} } ),
show_flag: attr( "boolean", { defaultValue: false } ),
import attr from 'ember-data/attr';
import Fragment from 'ember-data-model-fragments/fragment';
export default Fragment.extend({
street : attr('string'),
city : attr('string'),
region : attr('string'),
country : attr('string')
});
import attr from 'ember-data/attr';
import Fragment from 'ember-data-model-fragments/fragment';
export default Fragment.extend({
place: attr('string'),
number: attr('number')
});
import attr from 'ember-data/attr';
import Fragment from 'ember-data-model-fragments/fragment';
export default Fragment.extend({
firstName : attr('string'),
lastName : attr('string')
});
import attr from 'ember-data/attr';
import Fragment from 'ember-data-model-fragments/fragment';
import { fragment } from 'ember-data-model-fragments/attributes';
export default Fragment.extend({
startDate: attr('date'),
endDate: attr('date'),
department: fragment('department')
});
import chatProviders from "services/chat/providers";
const attributes = {};
for ( const [ type ] of Object.entries( chatProviders ) ) {
attributes[ type ] = fragment( "settings-chat-provider", {
defaultValue: {
[ typeKey ]: `settings-chat-provider-${type}`
},
polymorphic: true,
typeKey
});
}
export default Fragment.extend( attributes );
import attr from "ember-data/attr";
import Fragment from "ember-data-model-fragments/fragment";
import { fragment } from "ember-data-model-fragments/attributes";
import chatProviders from "services/chat/providers";
const defaultProvider = Object.keys( chatProviders )[0] || "browser";
export default Fragment.extend({
provider: attr( "string", { defaultValue: defaultProvider } ),
providers: fragment( "settingsChatProviders", { defaultValue: {} } )
});
import attr from "ember-data/attr";
import Fragment from "ember-data-model-fragments/fragment";
export const ATTR_NOTIFY_CLICK_NOOP = 0;
export const ATTR_NOTIFY_CLICK_FOLLOWED = 1;
export const ATTR_NOTIFY_CLICK_STREAM = 2;
export const ATTR_NOTIFY_CLICK_STREAMANDCHAT = 3;
export default Fragment.extend({
enabled: attr( "boolean", { defaultValue: true } ),
provider: attr( "string", { defaultValue: "auto" } ),
filter: attr( "boolean", { defaultValue: true } ),
filter_vodcasts: attr( "boolean", { defaultValue: true } ),
grouping: attr( "boolean", { defaultValue: true } ),
click: attr( "number", { defaultValue: 1 } ),
click_group: attr( "number", { defaultValue: 1 } ),
click_restore: attr( "boolean", { defaultValue: true } ),
badgelabel: attr( "boolean", { defaultValue: true } )
}).reopenClass({
providers: [
{ id: "auto" },
{ id: "native" },
{ id: "snoretoast" },