Skip to content

Commit

Permalink
Merge pull request #43 from aboire/master
Browse files Browse the repository at this point in the history
update
  • Loading branch information
aboire authored Feb 8, 2019
2 parents 811d758 + 038d173 commit 11626a4
Show file tree
Hide file tree
Showing 15 changed files with 74 additions and 56 deletions.
17 changes: 7 additions & 10 deletions .desktop/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "communecter",
"version": "0.0.31",
"version": "0.0.33",
"projectName": "communecter",
"devTools": true,
"devtron": true,
Expand All @@ -21,14 +21,13 @@
"uglify": true,
"plugins": {
"meteor-desktop-splash-screen": {
"version": "0.3.0",
"version": "0.4.3",
"imagePath": "splash.png",
"windowSettings": {
"width": 800,
"height": 600
}
},
"meteor-desktop-localstorage": "0.0.11",
"meteor-desktop-system-notifications": {
"version": "0.0.2"
}
Expand All @@ -41,8 +40,6 @@
},
"builderOptions": {
"win": {
"title": "communecter",
"authors": "Thomas Craipeau",
"target": ["squirrel","nsis"]
},
"squirrelWindows": {
Expand Down Expand Up @@ -74,15 +71,15 @@
"_osx": {
"icon": ".desktop/assets/icon.icns"
},
"version-string": {
"appVersion": "@version",
"buildVersion": "@version",
"appCopyright": "communecter",
"win32metadata": {
"CompanyName": "communecter",
"LegalCopyright": "communecter.org",
"FileDescription": "communecter",
"OriginalFilename": "communecter.exe",
"FileVersion": "@version",
"ProductVersion": "@version",
"ProductName": "communecter",
"InternalName": "communecter.exe"
}
}
}
}
2 changes: 2 additions & 0 deletions .meteor/packages
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,5 @@ comerc:autoform-selectize
natestrauser:publish-performant-counts
mizzao:user-status
[email protected]
omega:meteor-desktop-watcher@=2.0.0
omega:meteor-desktop-bundler@=2.0.0
2 changes: 2 additions & 0 deletions .meteor/versions
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ multiply:[email protected]
natestrauser:[email protected]
[email protected]
[email protected]
omega:[email protected]
omega:[email protected]
[email protected]
outatime:[email protected]
[email protected]
Expand Down
1 change: 1 addition & 0 deletions i18n/en.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"Name is Too short":"Name is Too short",
"Password is Too short":"Password is Too short",
"Not the same password":"Not the same password",
"The-username-is-incorrect": "The username is incorrect: Only the characters A-Z, a-z, 0-9 and '-' are accepted.",
"are you sure you want to delete":"Are you sure you want to delete ?",
"Current":"Current",
"Upcoming":"Upcoming",
Expand Down
1 change: 1 addition & 0 deletions i18n/fr.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"Name is Too short":"Votre nom est trop court",
"Password is Too short":"Votre mot de passe est trop court",
"Not the same password":"Vous n'avez pas saisis le même mot de passe",
"The-username-is-incorrect": "Le nom d'utilisateur est incorrect : Seul les caractères A-Z, a-z, 0-9 et '-' sont acceptés.",
"are you sure you want to delete":"Etes-vous sûr que vous voulez supprimer ?",
"Current":"En cours",
"Upcoming":"A venir",
Expand Down
20 changes: 3 additions & 17 deletions imports/api/citoyens.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const Citoyens = new Mongo.Collection('citoyens', { idGeneration: 'MONGO'
const baseSchemaCitoyens = baseSchema.pick(['name', 'shortDescription', 'description', 'url', 'tags', 'tags.$']);

const updateSchemaCitoyens = new SimpleSchema({
username: {
/* username: {
type: String,
custom () {
if (Meteor.isClient && this.isSet) {
Expand All @@ -37,7 +37,7 @@ const updateSchemaCitoyens = new SimpleSchema({
});
}
},
},
}, */
email: {
type: String,
unique: true,
Expand Down Expand Up @@ -102,21 +102,7 @@ export const SchemasCitoyensRest = new SimpleSchema([baseSchemaCitoyens, updateS

export const BlockCitoyensRest = {};
BlockCitoyensRest.descriptions = new SimpleSchema([blockBaseSchema, baseSchema.pick(['shortDescription', 'description', 'tags', 'tags.$'])]);
BlockCitoyensRest.info = new SimpleSchema([blockBaseSchema, baseSchema.pick(['name', 'url']), updateSchemaCitoyens.pick(['email', 'fixe', 'mobile', 'fax', 'birthDate']), {
username: {
type: String,
custom () {
if (Meteor.isClient && this.isSet) {
Meteor.call('checkUsername', this.value, function (error, result) {
// console.log(result);
if (!result) {
BlockCitoyensRest.info.namedContext('editBlockCitoyen').addInvalidKeys([{ name: 'username', type: 'usernameNotUnique' }]);
}
});
}
},
},
}]);
BlockCitoyensRest.info = new SimpleSchema([blockBaseSchema, baseSchema.pick(['name', 'url']), updateSchemaCitoyens.pick(['email', 'fixe', 'mobile', 'fax', 'birthDate'])]);
BlockCitoyensRest.network = new SimpleSchema([blockBaseSchema, updateSchemaCitoyens.pick(['github', 'telegram', 'skype', 'gpplus', 'twitter', 'facebook'])]);
BlockCitoyensRest.locality = new SimpleSchema([blockBaseSchema, geoSchema]);
BlockCitoyensRest.preferences = new SimpleSchema([blockBaseSchema, {
Expand Down
5 changes: 5 additions & 0 deletions imports/api/server/method.js
Original file line number Diff line number Diff line change
Expand Up @@ -1747,6 +1747,11 @@ indexMax:20 */
throw new Meteor.Error('Username not unique');
}

const urlRegEx = new RegExp(/^[a-z0-9-]+$/, 'i');
if (urlRegEx.test(user.username) !== true) {
throw new Meteor.Error('The-username-is-incorrect');
}

const insee = Cities.findOne({ insee: user.city });

console.log({
Expand Down
40 changes: 24 additions & 16 deletions imports/startup/client/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Meteor.startup(function () {
const m = regex.exec(intent);
// alert(`${Meteor.settings.public.endpoint}${m[0]}`);
if (m && m[0] && m[1] && m[2]) {
//${Meteor.settings.public.endpoint}
// ${Meteor.settings.public.endpoint}
Meteor.call('validateEmail', `${Meteor.settings.public.endpoint}${m[0]}`, (error, result) => {
if (error) {
// alert(`${error}`);
Expand Down Expand Up @@ -203,6 +203,14 @@ Meteor.startup(function () {
},
);

Template.registerHelper('calculateAge', (birth) => {
const bday = moment(birth, 'YYYYMMDD HH:mm');
const today = moment().startOf('day').hour(12);
let age = today.year() - bday.year();
if (bday > today.subtract(age, 'years')) { age -= 1; }
return age;
});

Template.registerHelper('i18npref', (prefix, text) => TAPi18n.__(`${prefix}.${text}`));


Expand Down Expand Up @@ -287,24 +295,24 @@ Meteor.startup(function () {
return count >= 0;
}
});

Template.registerHelper('markdown', new Blaze.Template('markdown', function () {
const view = this;
let content = '';
const view = this;
let content = '';

if (view.templateContentBlock) {
content = Blaze._toText(view.templateContentBlock, HTML.TEXTMODE.STRING);
// content = view.templateContentBlock;
}
const md = new MarkdownIt('default', {
html: true,
linkify: true,
typographer: true,
});

if (view.templateContentBlock) {
content = Blaze._toText(view.templateContentBlock, HTML.TEXTMODE.STRING);
//content = view.templateContentBlock;
}
const md = new MarkdownIt('default',{
html: true,
linkify: true,
typographer: true
});

const result = md.render(content);
return HTML.Raw(result);
}));
return HTML.Raw(result);
}));

Template.registerHelper('SchemasFollowRest', SchemasFollowRest);
Template.registerHelper('SchemasInviteAttendeesEventRest', SchemasInviteAttendeesEventRest);
Expand Down
3 changes: 2 additions & 1 deletion imports/startup/client/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@ Router.map(function() {

this.route('detailListHome', {
before () {
if (Meteor.loggingIn() && Meteor.user()) {
if (Meteor.userId()) {
this.redirect('actusList', { scope: 'citoyens', _id: Meteor.userId() });
}
this.next();
},
template: 'dashboard',
path: '/',
Expand Down
1 change: 0 additions & 1 deletion imports/ui/citoyens/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ <h1 class="title">{{_ "citoyens"}}</h1>
<template name="citoyensFields">
{{#if equals block 'info'}}
{{> afQuickField name='name' label-type='placeholder' icon="fa fa-user positive"}}
{{> afQuickField name='username' label-type='placeholder' icon="fa fa-user positive"}}
{{> afQuickField name='email' label-type='placeholder' icon="fa fa-envelope"}}
{{> afQuickField name='url' label-type='placeholder' icon="fa fa-link"}}
{{> afQuickField name='fixe' label-type='placeholder' icon="fa fa-phone"}}
Expand Down
2 changes: 1 addition & 1 deletion imports/ui/components/news/card.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ <h2 class="homestead">{{name}}</h2>
{{#if typeValue}}{{typeValue}}{{/if}}
{{#if isVisibleFields 'birthDate'}}
{{#if birthDate}}
<p><i class="icon fa fa-birthday-cake"></i> {{formatBirthDate}} ({{diffInText birthDate}})</p>
<p><i class="icon fa fa-birthday-cake"></i> {{formatBirthDate}} ({{calculateAge birthDate}})</p>
{{/if}}
{{/if}}
{{#unless ../shareVisible}}
Expand Down
12 changes: 12 additions & 0 deletions imports/ui/login/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,15 @@ Template.signin.events({
return false;
};

const isValidUsernameChar = (val) => {
const urlRegEx = new RegExp(/^[a-z0-9-]+$/, 'i');
if (urlRegEx.test(val) === true) {
return true;
}
pageSession.set('error', 'The-username-is-incorrect');
return false;
};

const isValidPassword = (val) => {
if (val.length > 7) {
return true;
Expand All @@ -167,6 +176,9 @@ Template.signin.events({
if (!isValidUsername(username)) {
return;
}
if (!isValidUsernameChar(username)) {
return;
}
if (!IsValidEmail(email)) {
pageSession.set('error', 'Email not valid');
return;
Expand Down
4 changes: 2 additions & 2 deletions imports/ui/news/news.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,15 +217,15 @@ Template.scopeFilActusTemplate.onRendered(function() {
}
const threshold =
$('.content.overflow-scroll').scrollTop() +
$('.content.overflow-scroll').height() + 130;
$('.content.overflow-scroll').height() + 150;
/* console.log(`threshold: ${threshold}`);
console.log(`traget top: ${$target.offset().top}`);
console.log(`list height: ${$('.content.overflow-scroll .list').height()}`); */
const heightLimit = $('.content.overflow-scroll .list').height();
if (heightLimit < threshold) {
if (!$target.data('visiblelimitFilActus')) {
$target.data('visiblelimitFilActus', true);
pageSession.set('limitFilActus', pageSession.get('limit') + 5);
pageSession.set('limitFilActus', pageSession.get('limitFilActus') + 5);
}
} else if ($target.data('visiblelimitFilActus')) {
$target.data('visiblelimitFilActus', false);
Expand Down
4 changes: 2 additions & 2 deletions mobile-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ App.info({
description: 'communecter mobile',
author: 'thomas',
email: '[email protected]',
version: '0.0.31',
buildNumber: '131',
version: '0.0.33',
buildNumber: '133',
});

App.setPreference('android-targetSdkVersion', '26');
Expand Down
16 changes: 10 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "communecter",
"version": "0.0.31",
"version": "0.0.33",
"description": "communecter",
"private": true,
"scripts": {
Expand Down Expand Up @@ -59,12 +59,12 @@
}
},
"dependencies": {
"@babel/runtime": "^7.2.0",
"autolinker": "^1.4.3",
"bcrypt": "^0.8.7",
"@babel/runtime": "^7.3.1",
"autolinker": "^3.0.0",
"bcrypt": "^3.0.4",
"markdown-it": "^8.4.2",
"meteor-node-stubs": "^0.4.1",
"sanitize-html": "^1.14.1"
"sanitize-html": "^1.20.0"
},
"repository": {
"type": "git",
Expand All @@ -79,13 +79,17 @@
"devDependencies": {
"@meteorjs/eslint-config-meteor": "^1.0.5",
"babel-eslint": "^7.2.3",
"electron": "2.0.17",
"electron-builder": "20.38.5",
"electron-builder-squirrel-windows": "20.38.5",
"eslint": "^4.3.0",
"eslint-config-airbnb": "^15.1.0",
"eslint-import-resolver-meteor": "^0.4.0",
"eslint-plugin-import": "^2.7.0",
"eslint-plugin-jsx-a11y": "^5.0.1",
"eslint-plugin-meteor": "^4.1.0",
"eslint-plugin-react": "^7.1.0"
"eslint-plugin-react": "^7.1.0",
"meteor-desktop": "^2.0.0"
},
"meteor": {
"mainModule": {
Expand Down

0 comments on commit 11626a4

Please sign in to comment.