Skip to content

Commit 9cb30e1

Browse files
authored
Merge pull request #1107 from StoDevX/trim-org-description
Remove html from org descriptions
2 parents c0a7cdf + 15a74f3 commit 9cb30e1

File tree

3 files changed

+17
-38
lines changed

3 files changed

+17
-38
lines changed

source/views/student-orgs/clean-org.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// @flow
22
import type {StudentOrgType} from './types'
3+
import {fastGetTrimmedText} from '../../lib/html'
34

45
export default function cleanOrg(org: StudentOrgType): StudentOrgType {
56
const name = org.name.trim()
@@ -20,9 +21,9 @@ export default function cleanOrg(org: StudentOrgType): StudentOrgType {
2021

2122
const category = org.category.trim()
2223
const meetings = org.meetings.trim()
23-
const description = org.description.trim()
24+
const description = fastGetTrimmedText(org.description)
2425
let website = org.website.trim()
25-
if (website && /^https?:\/\//.test(website)) {
26+
if (website && !/^https?:\/\//.test(website)) {
2627
website = `http://${website}`
2728
}
2829

source/views/student-orgs/detail.android.js

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
// @flow
22
import React from 'react'
3-
import {ScrollView, Text, StyleSheet} from 'react-native'
3+
import {ScrollView, Text, View, StyleSheet} from 'react-native'
44
import moment from 'moment'
5-
import {HtmlView} from '../components/html-view'
65
import {Card} from '../components/card'
76
import * as c from '../components/colors'
87
import type {StudentOrgType} from './types'
@@ -38,7 +37,9 @@ const styles = StyleSheet.create({
3837
paddingLeft: 16,
3938
paddingRight: 16,
4039
backgroundColor: c.white,
41-
height: 200,
40+
},
41+
descriptionText: {
42+
fontSize: 16,
4243
},
4344
footer: {
4445
fontSize: 10,
@@ -136,21 +137,9 @@ export class StudentOrgsDetailView extends React.Component {
136137

137138
{description
138139
? <Card header="Description" style={styles.card}>
139-
<HtmlView
140-
style={styles.description}
141-
html={`
142-
<style>
143-
body {
144-
margin: 10px 15px 10px;
145-
font-family: -apple-system;
146-
}
147-
* {
148-
max-width: 100%;
149-
}
150-
</style>
151-
${description}
152-
`}
153-
/>
140+
<View style={styles.description}>
141+
<Text style={styles.descriptionText}>{description}</Text>
142+
</View>
154143
</Card>
155144
: null}
156145

source/views/student-orgs/detail.ios.js

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
// @flow
22
import React from 'react'
3-
import {ScrollView, Text, StyleSheet, Linking} from 'react-native'
3+
import {ScrollView, Text, View, StyleSheet, Linking} from 'react-native'
44
import moment from 'moment'
5-
import {HtmlView} from '../components/html-view'
65
import {Cell, Section, TableView} from 'react-native-tableview-simple'
76
import * as c from '../components/colors'
87
import type {StudentOrgType} from './types'
@@ -31,7 +30,9 @@ const styles = StyleSheet.create({
3130
paddingLeft: 16,
3231
paddingRight: 16,
3332
backgroundColor: c.white,
34-
height: 200,
33+
},
34+
descriptionText: {
35+
fontSize: 16,
3536
},
3637
footer: {
3738
fontSize: 10,
@@ -127,21 +128,9 @@ export class StudentOrgsDetailView extends React.Component {
127128

128129
{description
129130
? <Section header="DESCRIPTION">
130-
<HtmlView
131-
style={styles.description}
132-
html={`
133-
<style>
134-
body {
135-
margin: 10px 15px 10px;
136-
font-family: -apple-system;
137-
}
138-
* {
139-
max-width: 100%;
140-
}
141-
</style>
142-
${description}
143-
`}
144-
/>
131+
<View style={styles.description}>
132+
<Text style={styles.descriptionText}>{description}</Text>
133+
</View>
145134
</Section>
146135
: null}
147136

0 commit comments

Comments
 (0)