Permalink
Browse files

Configurable comment and chat limits. Closes #970

* Make comment and chat length limits configurable through
`maxCommentLength` and `maxChatLength` settings, respectively, in the
taskingmanager.config.json file.

* Set default limit to 5000 characters for both comments and chats.

* Include migration to remove the 250 character limit from the
project_chat.message column.
  • Loading branch information...
nrotstan committed Aug 30, 2018
1 parent af90fa3 commit b2bacacb195406647fe1040cc7a2f8afaf9e4f95
@@ -8,7 +8,7 @@
angular
.module('taskingManager')
.controller('projectChatController', ['$scope', '$anchorScroll', '$location', '$timeout', '$interval', 'messageService', 'userService', projectChatController])
.controller('projectChatController', ['$scope', '$anchorScroll', '$location', '$timeout', '$interval', 'messageService', 'userService', 'configService', projectChatController])
.directive('projectChat', projectChatDirective);
/**
@@ -34,14 +34,14 @@
return directive;
}
function projectChatController($scope, $anchorScroll, $location, $timeout, $interval, messageService, userService) {
function projectChatController($scope, $anchorScroll, $location, $timeout, $interval, messageService, userService, configService) {
var vm = this;
vm.projectId = 0;
vm.author = '';
vm.message = '';
vm.messages = [];
vm.maxlengthComment = 250;
vm.maxlengthComment = configService.maxChatLength;
vm.hasScrolled = false;
@@ -19,7 +19,7 @@
vm.lockedByCurrentUserVectorLayer = null;
vm.map = null;
vm.user = null;
vm.maxlengthComment = 500;
vm.maxlengthComment = configService.maxCommentLength;
vm.taskUrl = '';
// tab and view control
@@ -25,7 +25,9 @@
"key": "AioPAglzP9Qw32KN17dOkKYRdSlzj7W5kIQY6zct_UCmGc0WRxAh-QeiRBpRUgrv",
"imagerySet": "Aerial"
}
]
],
"maxCommentLength": 5000,
"maxChatLength": 5000
}
},
"release": {
@@ -55,7 +57,9 @@
"attribution": "Courtesy of Microsoft Bing",
"imagerySet": "Aerial"
}
]
],
"maxCommentLength": 5000,
"maxChatLength": 5000
}
}
}
@@ -0,0 +1,28 @@
"""empty message
Revision ID: 251a7638da78
Revises: deec8123583d
Create Date: 2018-08-30 07:46:49.074078
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '251a7638da78'
down_revision = 'deec8123583d'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.alter_column('project_chat', 'message', existing_type=sa.String(length=250), type_=sa.String())
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.alter_column('project_chat', 'message', existing_type=sa.String(), type_=sa.String(length=250))
# ### end Alembic commands ###
@@ -13,7 +13,7 @@ class ProjectChat(db.Model):
project_id = db.Column(db.Integer, db.ForeignKey('projects.id'), index=True, nullable=False)
user_id = db.Column(db.Integer, db.ForeignKey('users.id'), nullable=False)
time_stamp = db.Column(db.DateTime, nullable=False, default=timestamp)
message = db.Column(db.String(250), nullable=False)
message = db.Column(db.String, nullable=False)
# Relationships
posted_by = db.relationship(User, foreign_keys=[user_id])

0 comments on commit b2bacac

Please sign in to comment.