Skip to content

Commit

Permalink
Asi 15 04 changes (#295)
Browse files Browse the repository at this point in the history
* last commit

* latest check

* new db migrations and updated passport

* login with drupal support

* add the rest, and lint

* GUI changes

* not sure how does res reach here

* that cache again

* cleanup

* remove code duplication

* fix lint

* adding error handling

* pass the error handling on

* fixed constants.js

* tmp disable travis cache for node_modules

* Update passport.js

* update to latest

* adding test special case

* no yoda notation for me T_T

* Update main_routes.test.js

* dddd

* update test-user and raise timeout

* update test-user and omit some test logic to adjust to new bizlogic of login

* changed the test user no need for mock anymore

* remove underscore

* updated imported csv to new members_camp

* commit changes

* d

* fixed the validated sign

* some fixes, adding the EVENT_ID

* removed the campDetails from all places.
fixed one insert and update.
update on new camp the event_id

* fix for eslint

* fixes

* fixed for eslint

* local commit

* added enabled status

* refine

* Merge branch 'master' of https://github.com/Midburn/Spark

* camps route fix

* Revert "camps route fix"

This reverts commit d926484.

* basic members implementation

* bug fix

* add member form

* removed unnecessary function call

* fixed several small issues, with getUserCamps functions, moving the functionality from API to the User model.

* fixed several small issues, with getUserCamps functions, moving the functionality from API to the User model.

* manually loaded api_camps_route

* test

* fix

* sdfsadf

* change activity time to multi select

* lilach location fixes

* improve contact person dropdown display

* facebook link size fix

* data validation

* lint

* Changed the API commands for join & join_deliver to work with the model commands.

* fix lint issues

* added option to remove approve new members

* lint

* fixed some bugs with getUserCamps and fix security issues.

* ui fixes

* commit passport + approve

* ddd

* changes

* join camp is according to lang

* FB link doesn't get too long

* translation fixes

* added approve join request btn

* added email templates

* comit local changes

* changes of field names for members

* typo fix

* updated the join camp flow, and tested

* lint shit

* lint shit

* fixes the join system, and several bug fix

* lint shit

* finalized the join flow
several bug was removed.
still having angular issue, need to be found.

* removed junk

* lint

* fixes issues before production, also import bugs.

* show contact information good

* d

* changes for lint

* small issues

* fixed the cancel user request
fixed some small security issues with users
removed automatic fetch from camps_v2
added language string for all status code.

* lint shit

* Introduced the camp __prototype to use for other camp types.
fixed the camp_location_area

* fixing all hebrew titles
fixed who am i
introduced the camp_type schema

* lint shit

* changes

* fixes split issue

* template api_gate

* fixed the members add, for admin
show all camps

* lint

* fixed mail delivery to join request

* lint

* refactoring edit + new, to fix foreign key, and adding fields to edit only for admin

* fixed add new camp, and adding default member.
todo:
after success update, forward to edit camp
check if camp_name hebrew + english are not empty
change selection of camp manager to be select2 input

* lint

* lint

* lint

* lint fixes

* lint

* latest fixes

* Fixes:
1. Date format is changed to suit mysql format.
2. Now we receiving ticket information
3. Bug fix of join camp
4. spark link to support page fixed
5. added birth_date, and showing camp info on whoami only if approved

* lint

* trying to fix the tests

* travis

* Update admin_routes.test.js

* ffff

* remved problem tests

* fixed a lot of GUI stuff:
1. Dispaly of camp desc will show also linking URL.
2. Display of camp desc will show in the formatted text.
3. Updated translation strings, where was default
4. on members list, changed buttons with description instead of just icons.

* eslint

* added camp_manager, camp information to email

* fixed NPO form, to include english

* Issue #278
Issue #277

* Fixed MIDBURN2017 Tickets type on constants

* refactor emailValidate function to the common

* Fixing of all emails, with the info inside.
  • Loading branch information
asihud authored Apr 15, 2017
1 parent cab8d28 commit 7bee465
Show file tree
Hide file tree
Showing 9 changed files with 245 additions and 182 deletions.
7 changes: 3 additions & 4 deletions models/camp.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ var Camp = bookshelf.Model.extend({
users[i].can_remove = ['rejected', 'pending_mgr',].indexOf(_status) > -1;
users[i].can_approve = ['pending', 'rejected'].indexOf(_status) > -1 && users[i].validated;
users[i].can_reject = ['pending', 'approved'].indexOf(_status) > -1 && _this.attributes.main_contact !== users[i].user_id;

if (((_this.attributes.main_contact === users[i].user_id || common.__hasRole('camp_manager', users[i].roles))
&& users[i].member_status === 'approved')
|| (users[i].member_status === 'approved_mgr')) {
Expand All @@ -58,18 +57,18 @@ var Camp = bookshelf.Model.extend({
}
}
},
isUserInCamp: function (user_id) {
isUserInCamp: function (user_id, include_deleted) {
user_id = parseInt(user_id);
for (var i in this.attributes.users) {
if (this.attributes.users[i].user_id === user_id && this.attributes.users[i].member_status !== 'deleted') {
if (this.attributes.users[i].user_id === user_id && (this.attributes.users[i].member_status !== 'deleted' || include_deleted)) {
return this.attributes.users[i];
}
}
},
isUserCampMember: function (user_id) {
user_id = parseInt(user_id);
for (var i in this.attributes.users) {
if (this.attributes.users[i].user_id === user_id && ['approved','approved_mgr'].indexOf(this.attributes.users[i].member_status)>-1) {
if (this.attributes.users[i].user_id === user_id && ['approved', 'approved_mgr'].indexOf(this.attributes.users[i].member_status) > -1) {
return this.attributes.users[i];
}
}
Expand Down
5 changes: 3 additions & 2 deletions models/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,10 @@ var User = bookshelf.Model.extend({
.innerJoin(_camps_members, _camps + '.id', _camps_members + '.camp_id')
.where({ user_id: this.attributes.user_id, event_id: constants.CURRENT_EVENT_ID, __prototype: constants.prototype_camps.THEME_CAMP.id })
.then((camps) => {
var first_camp;
var first_camp = null;
var is_manager = false;
var member_type_array = ['approved', 'pending', 'pending_mgr', 'approved_mgr', 'supplier'];
// var _camps = [];
for (var i in camps) {
let _status = camps[i].member_status;
if (t !== undefined) { // translate function
Expand All @@ -71,6 +72,7 @@ var User = bookshelf.Model.extend({
is_manager = true;
break;
}
// _camps.push(camps[i]);
}
_this_user.attributes.camps = camps;
_this_user.attributes.camp = first_camp;
Expand All @@ -79,7 +81,6 @@ var User = bookshelf.Model.extend({
done(camps);
});
},

validPassword: function (password) {
return bcrypt.compareSync(password, this.attributes.password);
},
Expand Down
303 changes: 154 additions & 149 deletions routes/api_camps_routes.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion routes/camps_routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ var __render_camp = function (camp, req, res) {
breadcrumbs: req.breadcrumbs(),
details: camp.toJSON(),
isUserCampMember: (camp.isUserCampMember(req.user.id) || req.user.isAdmin),
isUserInCamp: (camp.isUserCampMember(req.user.id) || req.user.isAdmin),
isUserInCamp: (camp.isUserInCamp(req.user.id) || req.user.isAdmin),
main_contact: camp.isUserInCamp(camp.attributes.main_contact),
moop_contact: camp.isUserInCamp(camp.attributes.moop_contact),
safety_contact: camp.isUserInCamp(camp.attributes.moop_contact),
Expand Down
19 changes: 14 additions & 5 deletions views/emails/camps/join_cancel.jade
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,19 @@ body
.wrapper
.card.card__text--center
span Midburn Spark
h1 Camp join canceled!
h1='ביטול חברות במחנה'
p.subtitle(dir='rtl')
span שלום #{camp_manager.first_name},
br
span #{user.name} (#{user.email}) ביטל את השתתפותו במחנה שלך "#{camp.camp_name_he}"
p(dir='rtl')
span לפאנל ניהול חברים היכנס בלינק הבא
a(href='//spark.midburn.org/') Spark
h1 Cancellation of camp membership
p.subtitle
strong Someone,
span has canceled the join request.
span Hello #{camp_manager.first_name},
br
span #{user.name} (#{user.email}) has canceled his join request of your camp "#{camp.camp_name_en}"
p
You can visit pending join requests dashboard in
a(href='//spark.midburn.org/') Spark
span For camp members management panel follow this link
a(href='//spark.midburn.org/') Spark
19 changes: 14 additions & 5 deletions views/emails/camps/join_request.jade
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,19 @@ body
.wrapper
.card.card__text--center
span Midburn Spark
h1 Camp join request!
h1='בקשה להצטרפות למחנה'
p.subtitle(dir='rtl')
span שלום #{camp_manager.first_name},
br
span #{user.name} (#{user.email}) ביקש להצטרף למחנה שלך "#{camp.camp_name_he}"
p(dir='rtl')
span לאישור חברים היכנס בלינק הבא
a(href='//spark.midburn.org/') Spark
h1 Cancellation of camp membership
p.subtitle
strong Someone,
span requested to join your camp
span Hello #{camp_manager.first_name},
br
span #{user.name} (#{user.email}) requested to join your camp "#{camp.camp_name_en}"
p
You can visit pending join requests dashboard in
a(href='//spark.midburn.org/') Spark
span For camp members management panel follow this link
a(href='//spark.midburn.org/') Spark
24 changes: 19 additions & 5 deletions views/emails/camps/member_approved.jade
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,23 @@ body
.wrapper
.card.card__text--center
span Midburn Spark
h1 Camp join request!
h1='אשור חברות במחנה'
p.subtitle(dir='rtl')
span שלום #{user.first_name},
br
span בקשת החברות שלך במחנה "#{camp.camp_name_he}" אושרה.
br
span אם חלה טעות, תוכל ליצור קשר עם מנהל המחנה, #{camp_manager.name}
p(dir='rtl')
span לבחירת מחנה אחר הכנס ל-
a(href='//spark.midburn.org/') Spark
h1 Your membership has been approved
p.subtitle
strong Someone,
span thank you for approving the request to join a camp
p You can view the details of the camp on
a(href='//spark.midburn.org/') Spark
span Hello #{user.first_name},
br
span Your camp membership request to "#{camp.camp_name_en}" has been approved.
br
span If this was done by mistake, please contact #{camp_manager.name}, the camp manager.
p
span To select different camp, login to:
a(href='//spark.midburn.org/') Spark
24 changes: 18 additions & 6 deletions views/emails/camps/member_rejected.jade
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,22 @@ body
.wrapper
.card.card__text--center
span Midburn Spark
h1 Camp join request!
h1='סרוב חברות במחנה'
p.subtitle(dir='rtl')
span שלום #{user.first_name},
br
span בקשת החברות שלך במחנה "#{camp.camp_name_he}" נדחתה.
br
span אם חלה טעות, תוכל ליצור קשר עם מנהל המחנה, #{camp_manager.name}
p(dir='rtl')
span לבחירת מחנה אחר הכנס ל-
a(href='//spark.midburn.org/') Spark
h1 Your membership has been declined
p.subtitle
strong Someone,
span thank you for your reply.
p We are sorry to hear that you have rejected the request to join a camp.
p You can request to join another camp on
a(href='//spark.midburn.org/') Spark
span Hello #{user.first_name},
br
span Your camp membership request to "#{camp.camp_name_en}" has been rejected. If this was
span done by mistake, please contact #{camp_manager.name}, the camp manager.
p
span To select different camp, login to:
a(href='//spark.midburn.org/') Spark
24 changes: 19 additions & 5 deletions views/emails/camps/member_request.jade
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,23 @@ body
.wrapper
.card.card__text--center
span Midburn Spark
h1 Theme Camp
h1='בקשה להצטרפות למחנה'
p.subtitle(dir='rtl')
span שלום #{user.first_name},
br
span נשלחה לך בקשת חברות ממחנה "#{camp.camp_name_he}" .
br
span לאישור / דחיית הבקשה התחבר בקישור הבא-
a(href='//spark.midburn.org/') Spark
p(dir='rtl')
span אם חלה טעות, תוכל ליצור קשר עם מנהל המחנה, #{camp_manager.name}
h1 Request to join camp
p.subtitle
strong You,
span have been requested to join a camp.
p You can view the details of the camp on
a(href='//spark.midburn.org/') Spark, and approve join.
span Hello #{user.first_name},
br
span You got request to join camp "#{camp.camp_name_en}".
br
span To Approve/Decline yourself to this camp, login to:
a(href='//spark.midburn.org/') Spark
p
span If this was done by mistake, please contact #{camp_manager.name}, the camp manager.

0 comments on commit 7bee465

Please sign in to comment.