Skip to content

Commit e2a7cc8

Browse files
authored
Merge pull request #1154 from UniversityRadioYork/rens-updates
Adding Nickname's to users and fixing some wordings on user profile to be line with gdpr
2 parents 2a756b8 + 40bd095 commit e2a7cc8

File tree

21 files changed

+260
-62
lines changed

21 files changed

+260
-62
lines changed

docs/install.md

+90-32
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,18 @@ The codespace includes Mailhog, which will trap any emails sent by MyRadio. To s
2424
click the Local Address next to port 8025 in the Ports panel.
2525

2626
## Docker Install
27+
2728
If you have Docker on your system, use Docker Compose to set up an environment.
28-
Simply run `docker compose up -d`, and visit "https://localhost:4443/myradio/".
29+
Simply run `docker compose up -d` and visit "https://localhost:4443/myradio/".
30+
31+
If you encounter an error with autoload.php:
32+
find the id of your myradio container using `docker dontainer ls`
33+
enter a bash session with `docker exec -it [myradioid] bash`
34+
then in this session run `composer install`
35+
finally exit the session by running `exit`
2936

3037
## Vagrant Install
38+
3139
MyRadio comes with a Vagrantfile based on Ubuntu 19.10.
3240
If you have [Vagrant](https://www.vagrantup.com) installed and want to get
3341
developing or playing right away, just run `vagrant up` and a few minutes
@@ -43,8 +51,9 @@ so be sure to never run this in a production environment, or remove the
4351
permission before doing so.
4452

4553
## Uncontained Install
54+
4655
Install Apache2, PHP, Composer and PostgreSQL on your prefered Unix-based distro.
47-
Or Windows, if you're into that.
56+
Or Windows, if you're into that.
4857
MyRadio has been tested with Ubuntu and FreeBSD.
4958

5059
cd to your MyRadio installation and run `composer install`
@@ -74,6 +83,7 @@ Alias /api /usr/local/www/MyRadio/src/PublicAPI
7483
Restart Apache2, go to http://hostname/myradio
7584

7685
To make a new postgresql server, run the following after:
86+
7787
```
7888
pg_createcluster [YOUR_POSTGRES_VERSION] myradio
7989
su postgres
@@ -85,36 +95,47 @@ CREATE DATABASE myradio WITH OWNER=myradio;
8595
# Post-Installation
8696

8797
## Myradio Setup
98+
8899
CONNECT:
89-
- Open up "https://localhost:4443/myradio/" in a browser
90-
- [Use Chrome as this often fails to run on Firefox]
91-
- It will say "connection not private" so press "advanced" and then "proceed"
100+
101+
- Open up "https://localhost:4443/myradio/" in a browser
102+
- [Use Chrome as this often fails to run on Firefox]
103+
- It will say "connection not private" so press "advanced" and then "proceed"
92104

93105
DATABASE:
94-
- On the intro screen press "Click here to continue"
95-
- Enter the database details (see Default Credentials) and press Next
96-
- Press "run task", wait a few seconds and then press "run task" again.
97-
- [This method is a workaround for a slight bug in how we build the database]
98-
106+
107+
- On the intro screen press "Click here to continue"
108+
- Enter the database details (see Default Credentials) and press Next
109+
- Press "run task", wait a few seconds and then press "run task" again.
110+
- [This method is a workaround for a slight bug in how we build the database]
111+
99112
USER:
100-
- [Here you can make config changes but the defaults are autofilled]
101-
- Press "complete starting set", scroll and press "save and continue"
102-
- Input any first and last name, an email (NOT an @york.ac.uk email) and a password
103-
- [If you enter an @york.ac.uk email you will not be able to login at all]
104-
- Login using the email and password you just enterted
113+
114+
- [Here you can make config changes but the defaults are autofilled]
115+
- Press "complete starting set", scroll and press "save and continue"
116+
- Input any first and last name, an email (NOT an @york.ac.uk email) and a password
117+
- [If you enter an @york.ac.uk email you will not be able to login at all]
118+
- Login using the email and password you just enterted
119+
120+
- If you encounter an error you need to create the file /var/www/myradio/src/MyRadio_Config.local.php with the text from the "Show Config" button
121+
- [if you are using docker this needs to be done within the docker container using `docker exec -it [myradioid] bash`]
105122

106123
## Default Credentials
124+
107125
Database: (when building the database, these credentials are needed)
108-
- Hostname: `postgres` if running in Docker, `localhost` otherwise
109-
- Database: myradio
110-
- Username: myradio
111-
- Password: myradio
126+
127+
- Hostname: `postgres` if running in Docker, `localhost` otherwise
128+
- Database: myradio
129+
- Username: myradio
130+
- Password: myradio
112131

113132
Vagrant VM: (if you need to ssh into the virtual machine)
114-
- Username: vagrant
115-
- Password: vagrant
133+
134+
- Username: vagrant
135+
- Password: vagrant
116136

117137
## Tests
138+
118139
MyRadio uses [Codeception](http://codeception.com/quickstart) for its test suite.
119140

120141
[This was written with a Vagrant install in mind - has not been tested on Docker]
@@ -132,28 +153,65 @@ blanks the `myradio_test` database each time it is ran, so it can be used to
132153
reset the database and config file, should this prove necessary.
133154

134155
Summary:
135-
* `composer install`
136-
* `vagrant up`
137-
* `vagrant ssh -- /vagrant/scripts/reset-db.sh`
138-
* `src/vendor/bin/codecept run`
156+
157+
- `composer install`
158+
- `vagrant up`
159+
- `vagrant ssh -- /vagrant/scripts/reset-db.sh`
160+
- `src/vendor/bin/codecept run`
139161

140162
The vagrant initialisation script also runs `composer install`, but that is run
141163
on the virtual machine which also installs the PHP extensions required for
142164
Codeception. These extensions may be missing locally, so running composer will
143165
confirm that they are present.
144166

145167
## Next Steps
168+
146169
Once you've got through the setup wizard, the next thing that's most useful to
147170
you is most likely creating a show.
148171

149172
To do this, you first need to:
150-
- Create a Term (Show Scheduler -> Manage Terms)
151-
- Create a Show (List My Shows -> Create a Show)
152-
- Apply for a Season of your new Show (List My Shows -> New Season)
153-
- Schedule the Season (Shows Scheduler)
173+
174+
- Create a Term (Show Scheduler -> Manage Terms)
175+
- Create a Show (List My Shows -> Create a Show)
176+
- Apply for a Season of your new Show (List My Shows -> New Season)
177+
- Schedule the Season (Shows Scheduler)
178+
179+
### Setting up your own 2016-site
180+
181+
First pull [2016-site](https://github.com/UniversityRadioYork/2016-site)
182+
183+
#### database
184+
185+
Next you need a api_key to allow the website to access myradio's show information,
186+
187+
login into database with details used during setup of myradio
188+
189+
`INSERT INTO myury.api_key (key_string, description) VALUES ('ARANDOMSTRINGOFCHARACTERS', '2016-site development api key');`
190+
191+
`INSERT INTO myury.api_key_auth (key_string, typeid) VALUES ('ARANDOMSTRINGOFCHARACTERS', (SELECT typeid FROM l_action WHERE phpconstant = 'AUTH_APISUDO'));`
192+
193+
[please choose a better key than 'ARANDOMSTRINGOFCHARACTERS']
194+
195+
You might need add some other database columns to create shows
196+
197+
for example:
198+
199+
- explict podcasts (to create shows)
200+
- selector (expected by 2016-site/can remove this from models/index.go 2016-site)
201+
202+
2016-site uses parts of database that aren't made on myradio creation,
203+
204+
#### finishing steps
205+
206+
This will fix shows not loading on 2016-site when using the base myradio database
207+
208+
After completing all these setups:
209+
210+
you can use setup guide in [2016-site](https://github.com/UniversityRadioYork/2016-site),
211+
And setup a reverse proxy to "https://localhost:4443/api/v2" or configure ssl for https connections
212+
To complete the setup.
154213

155214
### A note on Seasons and Terms
156-
MyRadio splits Shows into "Seasons". Any Season is applied to in relation to a
157-
"Term", which is a 10-week space of time. This is because The University of
158-
York has 10 week terms, if you didn't know.
159215

216+
MyRadio splits Shows into "Seasons". Any Season is applied to in relation to a
217+
"Term", which is a user defined space of time (normally 11-15 weeks). This is because The University of York has 12 week semesters, if you didn't know.

schema/api.graphql

+2
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ type User implements Node & MyRadioObject {
9999
id: ID! @bind(method: "getID")
100100
itemId: Int! @bind(method: "getID")
101101
fname: String! @bind(method: "getFName")
102+
nname: String! @bind(method: "getNName")
102103
sname: String! @bind(method: "getSName")
103104

104105
# Public information
@@ -393,6 +394,7 @@ type EmailDestination {
393394
type MemberSearchResult {
394395
memberid: Int!
395396
fname: String!
397+
nname: String!
396398
sname: String!
397399
eduroam: String
398400
local_alias: String

schema/api.json

+3
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,9 @@
116116
"fname": {
117117
"type": "string"
118118
},
119+
"nname": {
120+
"type": "string"
121+
},
119122
"sname": {
120123
"type": "string"
121124
},

schema/base.sql

+2-1
Original file line numberDiff line numberDiff line change
@@ -1257,7 +1257,7 @@ CREATE TABLE mail_list (
12571257
COMMENT ON TABLE mail_list IS 'Definitions of mailing lists';
12581258
COMMENT ON COLUMN mail_list.listid IS 'Surrogate Key';
12591259
COMMENT ON COLUMN mail_list.listname IS 'Name of the list';
1260-
COMMENT ON COLUMN mail_list.defn IS 'A SQL string that returns fname, sname and email address.';
1260+
COMMENT ON COLUMN mail_list.defn IS 'A SQL string that returns fname, nname ,sname and email address.';
12611261
COMMENT ON COLUMN mail_list.toexim IS 'Whether to create a mail alias on the email server for this list.';
12621262
COMMENT ON COLUMN mail_list.listaddress IS 'If the list is exported, this is the list''s email address.';
12631263
COMMENT ON COLUMN mail_list.subscribable IS 'Whether members can (un)subscribe freely.';
@@ -1276,6 +1276,7 @@ COMMENT ON TABLE mail_subscription IS 'If a list is subscribable, then all membe
12761276
CREATE TABLE member (
12771277
memberid integer DEFAULT nextval(('"member_memberid_seq"'::text)::regclass) NOT NULL,
12781278
fname character varying(255) NOT NULL,
1279+
nname character varying(255),
12791280
sname character varying(255) NOT NULL,
12801281
college integer NOT NULL,
12811282
phone character varying(255),

schema/patches/19.sql

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
ALTER TABLE member
2+
ADD COLUMN nname character varying(255);
3+
4+
INSERT INTO metadata.metadata_key VALUES (20,'upload_starttime',false,'In the case where a manual upload is required (because an event started late) will need to start late. This is a UTC time.',300,false);
5+
INSERT INTO metadata.metadata_key VALUES (21,'upload_endtime',false,'In the case where a manual upload is required (because an event started late) will need to finish early/late.',300,false);

scripts/gdprdeleteuser.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
try{
4141
$db->query(
4242
'INSERT INTO public.member(
43-
memberid, fname, sname, college, receive_email, data_removal)
43+
memberid, fname, nname, sname, college, receive_email, data_removal)
4444
VALUES ($1, \'deleted\', \'user\', 10, false, \'deleted\')',
4545
[$deletedUserId]
4646
);

src/Classes/MyRadio/MyRadioNews.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public static function getNewsItem($newsentryid, MyRadio_User $user = null)
7575
$db = Database::getInstance();
7676

7777
$news = $db->fetchOne(
78-
'SELECT newsentryid, fname || \' \' || sname AS author, timestamp AS posted, content
78+
'SELECT newsentryid, fname || \' \' || sname AS author, fname || \' "\' || nname || \'" \' || sname as nickname, timestamp AS posted, content
7979
FROM public.news_feed, public.member
8080
WHERE newsentryid=$1
8181
AND news_feed.memberid = member.memberid',

src/Classes/ServiceAPI/MyRadio_Season.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ public static function create($params = [])
188188
* Select an appropriate value for $term_id.
189189
*/
190190
$term_id = MyRadio_Term::getActiveApplicationTerm()->getID();
191-
$num_weeks = MyRadio_Term::getActiveApplicationTerm()->getTermWeeks();
191+
$num_weeks = MyRadio_Term::getActiveApplicationTerm()->getTermWeeks();
192192

193193
//Start a transaction
194194
self::$db->query('BEGIN');

src/Classes/ServiceAPI/MyRadio_Track.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,11 @@ public function reportExplicit()
634634

635635
$title = htmlspecialchars($this->getTitle());
636636
$artist = htmlspecialchars($this->getArtist());
637-
$userName = htmlspecialchars($currentUser->getFName() . ' ' . $currentUser->getSName());
637+
if (empty($currentUser->getNName()) == True) {
638+
$userName = htmlspecialchars($currentUser->getFName() . ' ' . $currentUser->getSName());
639+
} else {
640+
$userName = htmlspecialchars($currentUser->getFName() . ' "' . $currentUser->getNName() . '" ' . $currentUser->getSName());
641+
}
638642
$editUrl = URLUtils::makeURL('Library', 'editTrack', ['trackid' => $this->getID()]);
639643
MyRadioEmail::sendEmailToList(
640644
MyRadio_List::getByName('playlisting'),

0 commit comments

Comments
 (0)