mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge branch 'master' into sk-tpr
This commit is contained in:
commit
939d7cd042
12 changed files with 1191 additions and 12 deletions
|
@ -35,7 +35,7 @@ module.exports = ReferalAllocator =
|
|||
query = _id: user_id
|
||||
User.findOne query, (error, user) ->
|
||||
return callback(error) if error
|
||||
return callback(new Error("user not found")) if !user?
|
||||
return callback(new Error("user not found #{user_id} for assignBonus")) if !user?
|
||||
logger.log user_id: user_id, refered_user_count: user.refered_user_count, "assigning bonus"
|
||||
if user.refered_user_count? and user.refered_user_count > 0
|
||||
newFeatures = ReferalAllocator._calculateFeatures(user)
|
||||
|
|
|
@ -25,4 +25,4 @@ module.exports =
|
|||
Subscription.findOne {member_ids: user_id, _id:subscription_id}, {_id:1}, callback
|
||||
|
||||
getGroupSubscriptionMemberOf: (user_id, callback)->
|
||||
Subscription.findOne {member_ids: user_id}, {_id:1}, callback
|
||||
Subscription.findOne {member_ids: user_id}, {_id:1, planCode:1}, callback
|
|
@ -71,7 +71,7 @@ module.exports = SubscriptionUpdater =
|
|||
subscription.groupPlan = true
|
||||
subscription.membersLimit = plan.membersLimit
|
||||
subscription.save ->
|
||||
allIds = _.union subscription.members_id, [subscription.admin_id]
|
||||
allIds = _.union subscription.member_ids, [subscription.admin_id]
|
||||
jobs = allIds.map (user_id)->
|
||||
return (cb)->
|
||||
SubscriptionUpdater._setUsersMinimumFeatures user_id, cb
|
||||
|
@ -84,12 +84,18 @@ module.exports = SubscriptionUpdater =
|
|||
groupSubscription: (cb)->
|
||||
SubscriptionLocator.getGroupSubscriptionMemberOf user_id, cb
|
||||
async.series jobs, (err, results)->
|
||||
if err?
|
||||
logger.err err:err, user_id:user, "error getting subscription or group for _setUsersMinimumFeatures"
|
||||
return callback(err)
|
||||
{subscription, groupSubscription} = results
|
||||
if subscription? and subscription.planCode?
|
||||
if subscription? and subscription.planCode? and subscription.planCode != Settings.defaultPlanCode
|
||||
logger.log user_id:user_id, "using users subscription plan code for features"
|
||||
UserFeaturesUpdater.updateFeatures user_id, subscription.planCode, callback
|
||||
else if groupSubscription? and groupSubscription.planCode?
|
||||
logger.log user_id:user_id, "using group which user is memor of for features"
|
||||
UserFeaturesUpdater.updateFeatures user_id, groupSubscription.planCode, callback
|
||||
else
|
||||
logger.log user_id:user_id, "using default features for user with no subscription or group"
|
||||
UserFeaturesUpdater.updateFeatures user_id, Settings.defaultPlanCode, (err)->
|
||||
if err?
|
||||
logger.err err:err, user_id:user_id, "Error setting minimum user feature"
|
||||
|
|
|
@ -12,9 +12,9 @@ script(type='text/ng-template', id='supportModalTemplate')
|
|||
| #{translate("subject")}
|
||||
.form-group
|
||||
input.field.text.medium.span8.form-control(ng-model="form.subject", maxlength='255', tabindex='1', onkeyup='')
|
||||
label.desc
|
||||
label.desc(ng-show="'#{getUserEmail()}'.length < 1")
|
||||
| #{translate("email")}
|
||||
.form-group
|
||||
.form-group(ng-show="'#{getUserEmail()}'.length < 1")
|
||||
input.field.text.medium.span8.form-control(ng-model="form.email", ng-init="form.email = '#{getUserEmail()}'", type='email', spellcheck='false', value='', maxlength='255', tabindex='2')
|
||||
label#title12.desc
|
||||
| #{translate("project_url")} (#{translate("optional")})
|
||||
|
|
|
@ -393,6 +393,10 @@ module.exports =
|
|||
# anonymous: false
|
||||
# adminDN: 'cn=read-only-admin,dc=example,dc=com'
|
||||
# adminPW: 'password'
|
||||
# starttls: true
|
||||
# tlsOptions:
|
||||
# rejectUnauthorized: false
|
||||
# ca: '/etc/ldap/ca_certs.pem'
|
||||
|
||||
#templateLinks: [{
|
||||
# name : "CV projects",
|
||||
|
|
|
@ -23,10 +23,11 @@
|
|||
"dateformat": "1.0.4-1.2.3",
|
||||
"express": "4.13.0",
|
||||
"express-session": "1.11.3",
|
||||
"grunt": "^0.4.5",
|
||||
"heapdump": "^0.3.7",
|
||||
"http-proxy": "^1.8.1",
|
||||
"jade": "~1.3.1",
|
||||
"ldapjs": "^0.7.1",
|
||||
"ldapjs": "^1.0.0",
|
||||
"logger-sharelatex": "git+https://github.com/sharelatex/logger-sharelatex.git#v1.3.1",
|
||||
"lynx": "0.1.1",
|
||||
"marked": "^0.3.3",
|
||||
|
|
|
@ -112,4 +112,17 @@ define [
|
|||
|
||||
ide.localStorage = localStorage
|
||||
|
||||
ide.browserIsSafari = false
|
||||
try
|
||||
userAgent = navigator.userAgent
|
||||
ide.browserIsSafari = (
|
||||
userAgent &&
|
||||
userAgent.match(/.*Safari\/.*/) &&
|
||||
!userAgent.match(/.*Chrome\/.*/) &&
|
||||
!userAgent.match(/.*Chromium\/.*/)
|
||||
)
|
||||
catch err
|
||||
console.error err
|
||||
|
||||
|
||||
angular.bootstrap(document.body, ["SharelatexApp"])
|
||||
|
|
|
@ -1,11 +1,23 @@
|
|||
define [], () ->
|
||||
|
||||
class Parser
|
||||
constructor: (@doc) ->
|
||||
|
||||
parse: () ->
|
||||
# Safari regex is super slow, freezes browser for minutes on end,
|
||||
# hacky solution: limit iterations
|
||||
limit = null
|
||||
if window?._ide?.browserIsSafari
|
||||
limit = 100
|
||||
|
||||
commands = []
|
||||
seen = {}
|
||||
iterations = 0
|
||||
while command = @nextCommand()
|
||||
iterations += 1
|
||||
if limit && iterations > limit
|
||||
return commands
|
||||
|
||||
docState = @doc
|
||||
|
||||
optionalArgs = 0
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
define [
|
||||
"base"
|
||||
], (App) ->
|
||||
"libs/platform"
|
||||
], (App, platform) ->
|
||||
|
||||
|
||||
App.controller 'ContactModal', ($scope, $modal) ->
|
||||
|
@ -28,6 +29,8 @@ define [
|
|||
message: message or ""
|
||||
subject: $scope.form.subject + " - [#{ticketNumber}]"
|
||||
labels: "support"
|
||||
about: "<div>browser: #{platform?.name} #{platform?.version}</div>
|
||||
<div>os: #{platform?.os?.family} #{platform?.os?.version}</div>"
|
||||
|
||||
Groove.createTicket params, (err, json)->
|
||||
$scope.sent = true
|
||||
|
@ -59,3 +62,5 @@ define [
|
|||
Groove.createTicket params, (err, json)->
|
||||
$scope.sent = true
|
||||
$scope.$apply()
|
||||
|
||||
|
||||
|
|
BIN
services/web/public/img/about/michael.jpg
Normal file
BIN
services/web/public/img/about/michael.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.7 KiB |
1130
services/web/public/js/libs/platform.js
Normal file
1130
services/web/public/js/libs/platform.js
Normal file
File diff suppressed because it is too large
Load diff
|
@ -18,14 +18,14 @@ describe "SubscriptionUpdater", ->
|
|||
@allUserIds = ["13213", "dsadas", "djsaiud89"]
|
||||
@subscription = subscription =
|
||||
admin_id: @adminUser._id
|
||||
members_id: @allUserIds
|
||||
member_ids: @allUserIds
|
||||
save: sinon.stub().callsArgWith(0)
|
||||
freeTrial:{}
|
||||
planCode:"student_or_something"
|
||||
|
||||
@groupSubscription =
|
||||
admin_id: @adminUser._id
|
||||
members_id: @allUserIds
|
||||
member_ids: @allUserIds
|
||||
save: sinon.stub().callsArgWith(0)
|
||||
freeTrial:{}
|
||||
planCode:"group_subscription"
|
||||
|
@ -183,8 +183,6 @@ describe "SubscriptionUpdater", ->
|
|||
|
||||
describe "_setUsersMinimumFeatures", ->
|
||||
|
||||
|
||||
|
||||
it "should call updateFeatures with the subscription if set", (done)->
|
||||
@SubscriptionLocator.getUsersSubscription.callsArgWith(1, null, @subscription)
|
||||
@SubscriptionLocator.getGroupSubscriptionMemberOf.callsArgWith(1, null)
|
||||
|
@ -205,6 +203,16 @@ describe "SubscriptionUpdater", ->
|
|||
assert.equal args[1], @groupSubscription.planCode
|
||||
done()
|
||||
|
||||
it "should call not call updateFeatures with users subscription if the subscription plan code is the default one (downgraded)", (done)->
|
||||
@subscription.planCode = @Settings.defaultPlanCode
|
||||
@SubscriptionLocator.getUsersSubscription.callsArgWith(1, null, @subscription)
|
||||
@SubscriptionLocator.getGroupSubscriptionMemberOf.callsArgWith(1, null, @groupSubscription)
|
||||
@SubscriptionUpdater._setUsersMinimumFeatures @adminuser_id, (err)=>
|
||||
args = @UserFeaturesUpdater.updateFeatures.args[0]
|
||||
assert.equal args[0], @adminUser._id
|
||||
assert.equal args[1], @groupSubscription.planCode
|
||||
done()
|
||||
|
||||
|
||||
it "should call updateFeatures with default if there are no subscriptions for user", (done)->
|
||||
@SubscriptionLocator.getUsersSubscription.callsArgWith(1, null)
|
||||
|
|
Loading…
Reference in a new issue