-
-
Notifications
You must be signed in to change notification settings - Fork 201
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ui/routes: re-implement multi language filtering
Once again supported by the Twitch API
- Loading branch information
1 parent
d900ccb
commit 4ae04f0
Showing
21 changed files
with
226 additions
and
187 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,36 @@ | ||
import { computed } from "@ember/object"; | ||
import Mixin from "@ember/object/mixin"; | ||
import { inject as service } from "@ember/service"; | ||
import { ATTR_STREAMS_LANGUAGES_FILTER } from "data/models/settings/streams/fragment"; | ||
|
||
|
||
export default Mixin.create({ | ||
/** @type {SettingsService} */ | ||
settings: service(), | ||
|
||
language: computed( | ||
"settings.content.hasSingleStreamsLanguagesSelection", | ||
"settings.content.streams.languages_filter", | ||
"settings.content.streams.languages", | ||
function() { | ||
const settings = this.settings.content; | ||
const { languages_filter, languages } = settings.streams; | ||
const { languages_filter, languages } = this.settings.content.streams; | ||
|
||
if ( languages_filter && settings.hasSingleStreamsLanguagesSelection ) { | ||
for ( const [ key, value ] of Object.entries( languages.toJSON() ) ) { | ||
if ( value ) { | ||
return key; | ||
} | ||
} | ||
} | ||
|
||
return undefined; | ||
return languages_filter !== ATTR_STREAMS_LANGUAGES_FILTER | ||
? [] | ||
: Object.entries( languages.toJSON() ) | ||
.filter( ([ , value ]) => value ) | ||
.map( ([ key ]) => key ); | ||
} | ||
), | ||
|
||
model( params ) { | ||
model( params, ...args ) { | ||
const { language } = this; | ||
if ( language.length ) { | ||
params = Object.assign( | ||
params || /* istanbul ignore next */ {}, | ||
{ language } | ||
); | ||
} | ||
|
||
return this._super( | ||
Object.assign( params || /* istanbul ignore next */ {}, { language } ) | ||
); | ||
return this._super( params, ...args ); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.