Commit 294f10b9ced4b26417f24114f68f4f96fb201610

Authored by OpenWapp Developer
1 parent e617844575

Fix #46. Only allow max_subject characters for group name

Showing 1 changed file with 6 additions and 1 deletions

app/scripts/views/group-profile.js View file @ 294f10b
... ... @@ -85,7 +85,12 @@
85 85 if (evt) { evt.preventDefault(); }
86 86 var subject = $('input[name=subject]').val();
87 87 var button = $('button.done');
88   - button.prop('disabled', subject.length < 3 || subject.length > 25);
  88 + var maxSubjectLength = global.client.getProperty('max_subject');
  89 + button.prop('disabled', subject.length < 3 ||
  90 + subject.length > maxSubjectLength);
  91 + if (subject.length >= maxSubjectLength) {
  92 + $('input[name=subject]').val(subject.slice(0, 24));
  93 + }
89 94 },
90 95  
91 96 _createGroup: function (evt) {