lodash 2 -> lodash 4

stable
Juanfran 2015-12-04 08:28:30 +01:00
parent 802b632845
commit 74dfe60a34
18 changed files with 39 additions and 32 deletions

View File

@ -53,7 +53,7 @@ loadPlugins = (plugins) ->
promise = $.getJSON "/conf.json" promise = $.getJSON "/conf.json"
promise.done (data) -> promise.done (data) ->
window.taigaConfig = _.extend({}, window.taigaConfig, data) window.taigaConfig = _.assign({}, window.taigaConfig, data)
promise.always -> promise.always ->
if window.taigaConfig.contribPlugins.length > 0 if window.taigaConfig.contribPlugins.length > 0

View File

@ -586,7 +586,7 @@ init = ($log, $rootscope, $auth, $events, $analytics, $translate, $location, $na
# Taiga Plugins # Taiga Plugins
$rootscope.contribPlugins = @.taigaContribPlugins $rootscope.contribPlugins = @.taigaContribPlugins
$rootscope.adminPlugins = _.where(@.taigaContribPlugins, {"type": "admin"}) $rootscope.adminPlugins = _.filter(@.taigaContribPlugins, {"type": "admin"})
$rootscope.$on "$translateChangeEnd", (e, ctx) -> $rootscope.$on "$translateChangeEnd", (e, ctx) ->
lang = ctx.language lang = ctx.language

View File

@ -108,7 +108,7 @@ class ProjectValuesController extends taiga.Controller
loadValues: => loadValues: =>
return @rs[@scope.resource].listValues(@scope.projectId, @scope.type).then (values) => return @rs[@scope.resource].listValues(@scope.projectId, @scope.type).then (values) =>
@scope.values = values @scope.values = values
@scope.maxValueOrder = _.max(values, "order").order @scope.maxValueOrder = _.maxBy(values, "order").order
return values return values
moveValue: (ctx, itemValue, itemIndex) => moveValue: (ctx, itemValue, itemIndex) =>
@ -436,7 +436,7 @@ class ProjectCustomAttributesController extends mixOf(taiga.Controller, taiga.Pa
loadCustomAttributes: => loadCustomAttributes: =>
return @rs.customAttributes[@scope.type].list(@scope.projectId).then (customAttributes) => return @rs.customAttributes[@scope.type].list(@scope.projectId).then (customAttributes) =>
@scope.customAttributes = customAttributes @scope.customAttributes = customAttributes
@scope.maxOrder = _.max(customAttributes, "order").order @scope.maxOrder = _.maxBy(customAttributes, "order").order
return customAttributes return customAttributes
createCustomAttribute: (attrValues) => createCustomAttribute: (attrValues) =>

View File

@ -251,7 +251,7 @@ NewRoleDirective = ($tgrepo, $confirm) ->
project: $scope.projectId project: $scope.projectId
name: target.val() name: target.val()
permissions: DEFAULT_PERMISSIONS permissions: DEFAULT_PERMISSIONS
order: _.max($scope.roles, (r) -> r.order).order + 1 order: _.maxBy($scope.roles, (r) -> r.order).order + 1
computable: false computable: false
} }

View File

@ -103,7 +103,7 @@ WebhookDirective = ($rs, $repo, $confirm, $loading, $translate) ->
$rs.webhooklogs.list(webhook.id).then (webhooklogs) => $rs.webhooklogs.list(webhook.id).then (webhooklogs) =>
for log in webhooklogs for log in webhooklogs
log.validStatus = 200 <= log.status < 300 log.validStatus = 200 <= log.status < 300
log.prettySentHeaders = _.map(_.pairs(log.request_headers), ([header, value]) -> "#{header}: #{value}").join("\n") log.prettySentHeaders = _.map(_.toPairs(log.request_headers), ([header, value]) -> "#{header}: #{value}").join("\n")
log.prettySentData = JSON.stringify(log.request_data) log.prettySentData = JSON.stringify(log.request_data)
log.prettyDate = moment(log.created).format(prettyDate) log.prettyDate = moment(log.created).format(prettyDate)

View File

@ -36,7 +36,7 @@ class ContribController extends taiga.Controller
] ]
constructor: (@rootScope, @scope, @params, @repo, @rs, @confirm) -> constructor: (@rootScope, @scope, @params, @repo, @rs, @confirm) ->
@scope.currentPlugin = _.first(_.where(@rootScope.adminPlugins, {"slug": @params.plugin})) @scope.currentPlugin = _.head(_.filter(@rootScope.adminPlugins, {"slug": @params.plugin}))
@scope.projectSlug = @params.pslug @scope.projectSlug = @params.pslug
promise = @.loadInitialData() promise = @.loadInitialData()

View File

@ -48,8 +48,8 @@ class UrlsService extends taiga.Service
url = format(@.urls[name], args.slice(1)) url = format(@.urls[name], args.slice(1))
return format("%s/%s", [ return format("%s/%s", [
_.str.rtrim(@.mainUrl, "/"), _.trimEnd(@.mainUrl, "/"),
_.str.ltrim(url, "/") _.trimStart(url, "/")
]) ])
resolveAbsolute: -> resolveAbsolute: ->

View File

@ -370,10 +370,12 @@ HistoryDirective = ($log, $loading, $qqueue, $template, $confirm, $translate, $c
renderComments = -> renderComments = ->
comments = $scope.comments or [] comments = $scope.comments or []
totalComments = comments.length totalComments = comments.length
if not showAllComments
comments = _.last(comments, 4)
comments = _.map(comments, (x) -> renderComment(x)) if not showAllComments
comments = _.takeRight(comments, 4)
comments = _.map comments, (x) -> renderComment(x)
html = renderHistory(comments, totalComments) html = renderHistory(comments, totalComments)
$el.find(".comments-list").html(html) $el.find(".comments-list").html(html)
@ -381,7 +383,7 @@ HistoryDirective = ($log, $loading, $qqueue, $template, $confirm, $translate, $c
changes = $scope.history or [] changes = $scope.history or []
totalChanges = changes.length totalChanges = changes.length
if not showAllActivity if not showAllActivity
changes = _.last(changes, 4) changes = _.takeRight(changes, 4)
changes = _.map(changes, (x) -> renderChange(x)) changes = _.map(changes, (x) -> renderChange(x))
html = renderHistory(changes, totalChanges) html = renderHistory(changes, totalChanges)

View File

@ -513,7 +513,7 @@ AssignedToLightboxDirective = (lightboxService, lightboxKeyboardNavigationServic
username = normalizeString(username) username = normalizeString(username)
text = text.toUpperCase() text = text.toUpperCase()
text = normalizeString(text) text = normalizeString(text)
return _.contains(username, text) return _.includes(username, text)
render = (selected, text) -> render = (selected, text) ->
users = _.clone($scope.activeUsers, true) users = _.clone($scope.activeUsers, true)
@ -522,7 +522,7 @@ AssignedToLightboxDirective = (lightboxService, lightboxKeyboardNavigationServic
ctx = { ctx = {
selected: selected selected: selected
users: _.first(users, 5) users: _.slice(users, 0, 5)
showMore: users.length > 5 showMore: users.length > 5
} }
@ -608,7 +608,7 @@ WatchersLightboxDirective = ($repo, lightboxService, lightboxKeyboardNavigationS
username = user.full_name_display.toUpperCase() username = user.full_name_display.toUpperCase()
text = text.toUpperCase() text = text.toUpperCase()
return _.contains(username, text) return _.includes(username, text)
users = _.clone($scope.activeUsers, true) users = _.clone($scope.activeUsers, true)
users = _.filter(users, _.partial(_filterUsers, text)) users = _.filter(users, _.partial(_filterUsers, text))
@ -618,7 +618,7 @@ WatchersLightboxDirective = ($repo, lightboxService, lightboxKeyboardNavigationS
render = (users) -> render = (users) ->
ctx = { ctx = {
selected: false selected: false
users: _.first(users, 5) users: _.head(users, 5)
showMore: users.length > 5 showMore: users.length > 5
} }

View File

@ -38,7 +38,7 @@ TagsDirective = ->
parser = (v) -> parser = (v) ->
return [] if not v return [] if not v
result = _(v.split(",")).map((x) -> _.str.trim(x)) result = _(v.split(",")).map((x) -> _.trim(x))
return result.value() return result.value()

View File

@ -46,7 +46,7 @@ class PageMixin
@scope.roles = _.sortBy(roles, "order") @scope.roles = _.sortBy(roles, "order")
computableRoles = _(@scope.project.members).map("role").uniq().value() computableRoles = _(@scope.project.members).map("role").uniq().value()
@scope.computableRoles = _(roles).filter("computable") @scope.computableRoles = _(roles).filter("computable")
.filter((x) -> _.contains(computableRoles, x.id)) .filter((x) -> _.includes(computableRoles, x.id))
.value() .value()
loadUsersAndRoles: -> loadUsersAndRoles: ->
promise = @q.all([ promise = @q.all([

View File

@ -59,7 +59,7 @@ class EventsService
if not startswith(url, "ws:") and not startswith(url, "wss:") if not startswith(url, "ws:") and not startswith(url, "wss:")
loc = @win.location loc = @win.location
scheme = if loc.protocol == "https:" then "wss:" else "ws:" scheme = if loc.protocol == "https:" then "wss:" else "ws:"
path = _.str.ltrim(url, "/") path = _.trimStart(url, "/")
url = "#{scheme}//#{loc.host}/#{path}" url = "#{scheme}//#{loc.host}/#{path}"
@.ws = new @win.WebSocket(url) @.ws = new @win.WebSocket(url)

View File

@ -59,16 +59,19 @@ mixOf = (base, mixins...) ->
trim = (data, char) -> trim = (data, char) ->
return _.str.trim(data, char) return _.trim(data, char)
slugify = (data) -> slugify = (data) ->
return _.str.slugify(data) return data.toString().toLowerCase().trim()
.replace(/\s+/g, '-')
.replace(/&/g, '-and-')
.replace(/[^\w\-]+/g, '')
.replace(/\-\-+/g, '-')
unslugify = (data) -> unslugify = (data) ->
if data if data
return _.str.capitalize(data.replace(/-/g, ' ')) return _.capitalize(data.replace(/-/g, ' '))
return data return data
@ -114,7 +117,7 @@ toString = (value) ->
joinStr = (str, coll) -> joinStr = (str, coll) ->
return _.str.join(str, coll) return coll.join(str)
debounce = (wait, func) -> debounce = (wait, func) ->
@ -126,7 +129,7 @@ debounceLeading = (wait, func) ->
startswith = (str1, str2) -> startswith = (str1, str2) ->
return _.str.startsWith(str1, str2) return _.startsWith(str1, str2)
truncate = (str, maxLength, suffix="...") -> truncate = (str, maxLength, suffix="...") ->

View File

@ -47,7 +47,6 @@
"tests" "tests"
], ],
"dependencies": { "dependencies": {
"lodash": "~2.4.2",
"emoticons": "~0.1.7", "emoticons": "~0.1.7",
"jquery-flot": "~0.8.2", "jquery-flot": "~0.8.2",
"angular": "1.4.7", "angular": "1.4.7",
@ -83,10 +82,11 @@
"eventemitter2": "~0.4.14", "eventemitter2": "~0.4.14",
"immutable": "~3.7.6", "immutable": "~3.7.6",
"bluebird": "~2.10.2", "bluebird": "~2.10.2",
"intro.js": "~1.1.1" "intro.js": "~1.1.1",
"lodash": "~4.0.0"
}, },
"resolutions": { "resolutions": {
"lodash": "~2.4.2", "lodash": "~4.0.0",
"moment": "~2.10.6", "moment": "~2.10.6",
"jquery": "~2.1.1", "jquery": "~2.1.1",
"angular": "1.4.7" "angular": "1.4.7"

View File

@ -65,6 +65,7 @@ shared.statusTesting = async function(status1 , status2) {
await statusHelper.setStatus(1); await statusHelper.setStatus(1);
let selectedStatus = await statusHelper.getSelectedStatus(); let selectedStatus = await statusHelper.getSelectedStatus();
expect(selectedStatus).to.be.equal(status1); expect(selectedStatus).to.be.equal(status1);
// Status 2 // Status 2

View File

@ -33,7 +33,7 @@ describe('Task detail', function(){
it('description edition', sharedDetail.descriptionTesting); it('description edition', sharedDetail.descriptionTesting);
it('status edition', sharedDetail.statusTesting); it('status edition', sharedDetail.bind(this, 'Ready', 'In progress'));
describe('assigned to edition', sharedDetail.assignedToTesting); describe('assigned to edition', sharedDetail.assignedToTesting);

View File

@ -140,9 +140,8 @@ paths.coffee_order = [
paths.libs = [ paths.libs = [
paths.vendor + "bluebird/js/browser/bluebird.js", paths.vendor + "bluebird/js/browser/bluebird.js",
paths.vendor + "jquery/dist/jquery.js", paths.vendor + "jquery/dist/jquery.js",
paths.vendor + "lodash/dist/lodash.js", paths.vendor + "lodash/lodash.js",
paths.vendor + "emoticons/lib/emoticons.js", paths.vendor + "emoticons/lib/emoticons.js",
paths.vendor + "underscore.string/lib/underscore.string.js",
paths.vendor + "messageformat/messageformat.js", paths.vendor + "messageformat/messageformat.js",
paths.vendor + "angular/angular.js", paths.vendor + "angular/angular.js",
paths.vendor + "angular-route/angular-route.js", paths.vendor + "angular-route/angular-route.js",

View File

@ -3,6 +3,8 @@ var child_process = require('child_process');
var inquirer = require("inquirer"); var inquirer = require("inquirer");
var Promise = require('bluebird'); var Promise = require('bluebird');
// npm run e2e -- -s userStories, auth
var suites = [ var suites = [
'auth', 'auth',
'public', 'public',