Skip to content

Commit

Permalink
Add an option to link to Couchers.org on profile (#2508)
Browse files Browse the repository at this point in the history
  • Loading branch information
aapeliv committed Jan 6, 2022
1 parent 6da77cf commit 0618477
Show file tree
Hide file tree
Showing 16 changed files with 95 additions and 5 deletions.
4 changes: 4 additions & 0 deletions modules/core/client/less/modules/icons.less
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@
}

// Colorful hospitality network icons (nothing to do with fonts otherwise but we use the same .icon- base class).
.icon-couchers,
.icon-bw,
.icon-cs {
&:before {
Expand All @@ -158,6 +159,9 @@
}
}

.icon-couchers:before {
.img-retina('~img/external/icon-couchers.png', '~img/external/icon-couchers@2x.png', 16px, 16px);
}
.icon-bw:before {
.img-retina('~img/external/icon-bw.png', '~img/external/icon-bw@2x.png', 16px, 16px);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ exports.getExternalSiteCount = function (site, callback) {
const query = { public: true };

switch (site) {
case 'couchers':
query.extSitesCouchers = { $exists: true, $ne: '' };
break;
case 'bewelcome':
query.extSitesBW = { $exists: true, $ne: '' };
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ describe('Statistics CRUD tests', () => {
const _usersPublic2 = utils.generateUsers(2, {
public: true,
newsletter: true,
extSitesCouchers: 'username',
extSitesCS: 'username',
extSitesBW: 'username',
extSitesWS: '12312312',
Expand Down
15 changes: 15 additions & 0 deletions modules/users/client/components/ProfileViewBasics.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,20 @@ export default function ProfileViewBasics({ profile }) {
)
);
})}
{/* Couchers.org */}
{profile.extSitesCouchers && (
<li className="social-profile">
<i className="social-profile-icon icon-fw icon-lg icon-couchers"></i>
<a
rel="noopener"
className="social-profile-handle"
href={`https://app.couchers.org/user/${profile.extSitesCouchers}`}
>
Couchers.org
</a>
</li>
)}

{/* BeWelcome */}
{profile.extSitesBW && (
<li className="social-profile">
Expand Down Expand Up @@ -218,6 +232,7 @@ export default function ProfileViewBasics({ profile }) {

{/* social networks */}
{(hasConnectedAdditionalSocialAccounts(profile) ||
profile.extSitesCouchers ||
profile.extSitesBW ||
profile.extSitesCS ||
profile.extSitesWS) &&
Expand Down
2 changes: 2 additions & 0 deletions modules/users/client/utils/networks.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ export function socialAccountLink(providerName, providerData) {
*/
export function getNetworkName(network) {
switch (network) {
case 'couchers':
return 'Couchers.org';
case 'bewelcome':
return 'BeWelcome';
case 'couchsurfing':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,53 @@ <h4>Other hospitality networks</h4>
- CS link has `rel="noreferrer"` because;
https://github.com/Trustroots/trustroots/issues/464
-->
<div class="form-group">
<div class="input-group">
<div class="input-group-addon">
<a
tabindex="0"
class="icon-help cursor-help tr-help"
popover-placement="bottom-left"
popover-trigger="'mouseenter'"
uib-popover-template="'couchersGuidePopover.html'"
></a>
<script type="text/ng-template" id="couchersGuidePopover.html">
<div>
Go to your <a href="https://app.couchers.org/account-settings">Couchers.org account settings</a> and copy the username.
<br><br>
<img class="img-responsive clearfix" src="/img/guide-couchers.png" alt="" width="319" height="32" aria-hidden="true">
</div>
</script>
</div>
<label class="input-group-addon" for="extSitesCouchers">
<span class="hidden-xs">app.couchers.org/user/</span>
<span class="visible-xs-inline">Couchers.org:</span>
</label>
<input
id="extSitesCouchers"
type="text"
class="form-control"
ng-model="profileEditNetworks.user.extSitesCouchers"
ng-change="profileEdit.unsavedModifications=true"
placeholder="your-username"
aria-label="Couchers.org username"
/>
<span
class="input-group-btn"
ng-if="profileEditNetworks.user.extSitesCouchers.length"
>
<a
ng-href="https://app.couchers.org/user/{{ profileEditNetworks.user.extSitesCouchers }}"
target="_blank"
class="btn btn-primary"
role="button"
rel="noopener"
>
<small>Test</small>
</a>
</span>
</div>
</div>
<div class="form-group">
<div class="input-group">
<div class="input-group-addon">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ exports.userProfileFields = [
'member',
'replyRate',
'replyTime',
'extSitesCouchers', // BeWelcome username
'extSitesBW', // BeWelcome username
'extSitesCS', // CouchSurfing username
'extSitesWS', // WarmShowers username
Expand Down
6 changes: 6 additions & 0 deletions modules/users/server/models/user.server.model.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,12 @@ const UserSchema = new Schema({
usernameUpdated: {
type: Date,
},
// Couchers.org username
extSitesCouchers: {
type: String,
trim: true,
set: setPlainTextField,
},
// Bewelcome.org username
extSitesBW: {
type: String,
Expand Down
Binary file added public/img/external/icon-couchers.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/external/icon-couchers@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/guide-couchers.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions public/locales/en/core.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"Host": "Host",
"Join": "Join",
"Language: {{code}}": "Language: {{code}}",
"Loading…": "Loading…",
"Login": "Login",
"Media": "Media",
"Meet": "Meet",
Expand All @@ -29,6 +30,7 @@
"New to Trustroots?": "New to Trustroots?",
"Next": "Next",
"Next section": "Next section",
"No languages found; try typing something else.": "No languages found; try typing something else.",
"Outdoors": "Outdoors",
"Page navigation": "Page navigation",
"Previous section": "Previous section",
Expand All @@ -42,8 +44,11 @@
"Search hosts": "Search hosts",
"Search languages…": "Search languages…",
"Select a language": "Select a language",
"Select…": "Select…",
"Sign out": "Sign out",
"Skip to main content": "Skip to main content",
"Snap! Something went wrong. If this keeps happening, please contact us.": "Snap! Something went wrong. If this keeps happening, please contact us.",
"Start typing a language…": "Start typing a language…",
"Streets": "Streets",
"Support": "Support",
"Team": "Team",
Expand Down
11 changes: 6 additions & 5 deletions public/locales/en/pages.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"": "",
"\"We want a world that encourages trust, adventure and intercultural connections.\"": "\"We want a world that encourages trust, adventure and intercultural connections.\"",
"(March, 2015)": "(March, 2015)",
"(recommended for websites)": "(recommended for websites)",
"...explaining that you are interested in meeting them, not just looking for free accommodation.": "...explaining that you are interested in meeting them, not just looking for free accommodation.",
"<0>Ask</0> us for more photos etc": "<0>Ask</0> us for more photos etc",
Expand All @@ -16,7 +15,6 @@
"A world that encourages trust and adventure.": "A world that encourages trust and adventure.",
"About": "About",
"Account": "Account",
"Account settings": "Account settings",
"Additionally our by-laws (articles of association) specifically prohibit selling the users database and specify that the company code will be licensed under an<1>open source license</1>": "Additionally our by-laws (articles of association) specifically prohibit selling the users database and specify that the company code will be licensed under an<1>open source license</1>",
"Additionally our website is mobile optimized, so you could also add it to your phone's home screen for quick access. Here are instructions for <2>iOS</2>, <5>Android (Chrome)</5> and <9>Android (Firefox)</9>. <br/>": "Additionally our website is mobile optimized, so you could also add it to your phone's home screen for quick access. Here are instructions for <2>iOS</2>, <5>Android (Chrome)</5> and <9>Android (Firefox)</9>. <br/>",
"Additionally, section 60 exemption from the obligation to have name ending with “limited” <2>requires</2> that:<5><0>The company purposes are for the public benefit.</0><1>It is a non for profit.</1><2>Assets are to be specially protected on winding up.</2></5>": "Additionally, section 60 exemption from the obligation to have name ending with “limited” <2>requires</2> that:<5><0>The company purposes are for the public benefit.</0><1>It is a non for profit.</1><2>Assets are to be specially protected on winding up.</2></5>",
Expand Down Expand Up @@ -126,7 +124,7 @@
"Join Trustroots": "Join Trustroots",
"Join Trustroots now": "Join Trustroots now",
"Joining circles helps you find likeminded Trustroots members and\n tells others what you're interested in.": "Joining circles helps you find likeminded Trustroots members and\n tells others what you're interested in.",
"Last updated on December 4th, 2018": "Last updated on December 4th, 2018",
"Last updated on {{date, LL}}": "Last updated on {{date, LL}}",
"Launched {{date, LL}}": "Launched {{date, LL}}",
"Learn more": "Learn more",
"Like with Google Analytics, we would like to reduce our reliance on these services in the future, and we can definitely use <1>help</1> with this.": "Like with Google Analytics, we would like to reduce our reliance on these services in the future, and we can definitely use <1>help</1> with this.",
Expand All @@ -139,6 +137,7 @@
"Media": "Media",
"Meet": "Meet",
"Meet the team": "Meet the team",
"Members on Trustroots can download their profile, contact and hosting data through the <1>Account settings</1>.": "Members on Trustroots can download their profile, contact and hosting data through the <1>Account settings</1>.",
"Messages from and to other members": "Messages from and to other members",
"Mission": "Mission",
"More circles": "More circles",
Expand All @@ -150,6 +149,7 @@
"Nobody can do everything, but everyone can do something.": "Nobody can do everything, but everyone can do something.",
"Non-profit & open source": "Non-profit & open source",
"Operating costs covered entirely by <2>donations</2>": "Operating costs covered entirely by <2>donations</2>",
"Our currency is hospitality: don't ask or accept any form of monetary exchange to use Trustroots.": "Our currency is hospitality: don't ask or accept any form of monetary exchange to use Trustroots.",
"Our response.": "Our response.",
"Our server": "Our server",
"Our server (and thus your data) is securely hosted at <2>DigitalOcean</2> in Amsterdam, Europe.": "Our server (and thus your data) is securely hosted at <2>DigitalOcean</2> in Amsterdam, Europe.",
Expand Down Expand Up @@ -234,12 +234,12 @@
"Trustroots logo": "Trustroots logo",
"Trustroots needs developers, designers, people handling support queue, copywriting and much more.": "Trustroots needs developers, designers, people handling support queue, copywriting and much more.",
"Trustroots page at Facebook": "Trustroots page at Facebook",
"Trustroots profile": "Trustroots profile",
"Trustroots seeks to be a platform for sharing and getting people\n together. We aim to connect likeminded people together. We encourage\n trust, adventure and intercultural connections.": "Trustroots seeks to be a platform for sharing and getting people\n together. We aim to connect likeminded people together. We encourage\n trust, adventure and intercultural connections.",
"Trustroots uses <2>Google Analytics</2> to collect usage, device and browser statistics.": "Trustroots uses <2>Google Analytics</2> to collect usage, device and browser statistics.",
"Trustroots was initially built with hitchhikers in mind but anyone has always been welcome to sign up even if they've never hitchhiked.": "Trustroots was initially built with hitchhikers in mind but anyone has always been welcome to sign up even if they've never hitchhiked.",
"UK Companies House: incorporation and names (pdf)": "UK Companies House: incorporation and names (pdf)",
"Until then, be patient. Please help stop the spread of the virus. Consider not traveling, especially internationally. Consider not hosting people, especially if you live with <2>people at higher risk</2>": "Until then, be patient. Please help stop the spread of the virus. Consider not traveling, especially internationally. Consider not hosting people, especially if you live with <2>people at higher risk</2>",
"Users on Trustroots can download their profile, contact and hosting data through the": "Users on Trustroots can download their profile, contact and hosting data through the",
"Using Analytics we automatically collect information such as usage times, browser details, screen size, network location (IP), country, language etc. This information is anonymized and never published so that individual users cannot be recognized.": "Using Analytics we automatically collect information such as usage times, browser details, screen size, network location (IP), country, language etc. This information is anonymized and never published so that individual users cannot be recognized.",
"Using Expo <2>seems to block</2> inclusion to F-Droid, although we don't directly use any of the services mentioned in the blocking list but Expo itself might. Expo is an <5>open source</5> project. <br/>": "Using Expo <2>seems to block</2> inclusion to F-Droid, although we don't directly use any of the services mentioned in the blocking list but Expo itself might. Expo is an <5>open source</5> project. <br/>",
"Using the word Foundation in the name also requires that any profits should be used to further the objects of the company and not paid to the members as dividends.": "Using the word Foundation in the name also requires that any profits should be used to further the objects of the company and not paid to the members as dividends.",
Expand Down Expand Up @@ -288,7 +288,7 @@
"Yep, see <1>statistics</1> page for some basic statistics. We are planning to publish more thorough statistics eventually. If you are interested in analysing our data deeper, please <4>write to us</4>.": "Yep, see <1>statistics</1> page for some basic statistics. We are planning to publish more thorough statistics eventually. If you are interested in analysing our data deeper, please <4>write to us</4>.",
"Yes! Our code is available on <2>GitHub</2> and licensed under the <5>AGPL License</5>.": "Yes! Our code is available on <2>GitHub</2> and licensed under the <5>AGPL License</5>.",
"Yes! We currently have a very simple Android version, which basically wraps around our website and gives you push notifications to your phone when you have new messages.": "Yes! We currently have a very simple Android version, which basically wraps around our website and gives you push notifications to your phone when you have new messages.",
"You are able to remove your info from the system by asking us to delete your account through the": "You are able to remove your info from the system by asking us to delete your account through the",
"You are able to remove your profile from the Trustroots by asking us to delete your account through the <2>Account settings</2>.": "You are able to remove your profile from the Trustroots by asking us to delete your account through the <2>Account settings</2>.",
"You can remove your account via <2>account page</2>. We will not store your profile in our systems after removal.": "You can remove your account via <2>account page</2>. We will not store your profile in our systems after removal.",
"You can start now by joining <1>circles</1> that you identify yourself with.": "You can start now by joining <1>circles</1> that you identify yourself with.",
"You're much more likely to get a positive response if you have written a bit about yourself.": "You're much more likely to get a positive response if you have written a bit about yourself.",
Expand All @@ -302,6 +302,7 @@
"from 37:00": "from 37:00",
"in Media": "in Media",
"podcast": "podcast",
"{{date, LL}}": "{{date, LL}}",
"{{date, MMMM Do}}": "{{date, MMMM Do}}",
"“If you want to go fast, go alone. If you want to go far, go together.”": "“If you want to go fast, go alone. If you want to go far, go together.”"
}
2 changes: 2 additions & 0 deletions public/locales/en/search.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
"No members found by this name.": "No members found by this name.",
"Search": "Search",
"Search members": "Search members",
"Select languages…": "Select languages…",
"Spoken languages": "Spoken languages",
"Type name, username…": "Type name, username…",
"Zoom closer to find members.": "Zoom closer to find members.",
"{{count}} members found": "One member found",
Expand Down
1 change: 1 addition & 0 deletions public/locales/en/users.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"About": "About",
"About me": "About me",
"Add contact": "Add contact",
"Add languages you speak.": "Add languages you speak.",
"Anonymous member": "Anonymous member",
"Are you sure you want to block them? They will not be able to see or message you.": "Are you sure you want to block them? They will not be able to see or message you.",
"Are you sure you want to unblock them? They will be able to see your profile and messaage you again.": "Are you sure you want to unblock them? They will be able to see your profile and message you again.",
Expand Down
2 changes: 2 additions & 0 deletions testutils/common/data.common.testutil.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ function generateUsers(
count,
{
additionalProvidersData,
extSitesCouchers,
extSitesBW,
extSitesCS,
extSitesWS,
Expand All @@ -69,6 +70,7 @@ function generateUsers(
case 'server':
return generateServerUser({
additionalProvidersData,
extSitesCouchers,
extSitesBW,
extSitesCS,
extSitesWS,
Expand Down

0 comments on commit 0618477

Please sign in to comment.