Commit Graph

275 Commits

Author SHA1 Message Date
Henry
eaaed06fba add label to own entry in members list
Shows a green "this is you" label on the members list. Green because
that's also the color of the tag on the top right.

Also changes the color of the  moderator label from green to blue to be
less confusing.
2021-05-11 08:18:35 +02:00
Henry
5385ef65bb add middleware to check roles
fixes #176
2021-05-10 13:52:45 +02:00
Henry
691f0e75b9 add test for notice creation role check
updates #176
2021-05-10 13:52:45 +02:00
Henry
e72f1a3787 cleanup redirect mess for denied removal
updates #205
2021-05-10 13:51:29 +02:00
Henry
3651432b42 use errHandler in admin tests 2021-04-26 09:29:22 +02:00
cae80e385e make alias mockdb return alias entry 2021-04-26 09:29:22 +02:00
f0b4c7a534 test that alias resolving is turned off for restricted rooms 2021-04-26 09:29:22 +02:00
ab06233f28 test invite creation under community & restricted for admin, mod & member
Update web/handlers/admin/setup_test.go

Co-authored-by: Henry <111202+cryptix@users.noreply.github.com>
2021-04-26 09:29:17 +02:00
80686dec26 cherrypick: ts.User is now pointer 2021-04-23 13:25:13 +02:00
Henry
57c1375e54 fix missing context 2021-04-23 11:25:35 +02:00
Henry
e6ca0ed74b remove unused argument 2021-04-23 08:56:01 +02:00
User Cryptix
fc5d3e440e add json response for invite facade (fixes #188) 2021-04-23 08:55:50 +02:00
Andre Staltz
2f0afe8f33 improve sign-in with ssb JS for Firefox 2021-04-23 08:55:26 +02:00
Andre Staltz
3beb656b9c change join-room to claim-http-invite 2021-04-23 08:54:29 +02:00
cec5f93fb6 tests for restricted UI behavior
* add tests for privacy mode settings
* test privacy mode settings for member role
* test default language settings
* test denied keys interface for each role
* test adding new member interface depending on role
* test member details depending on role
* test invite button is disabled pending on user role
2021-04-23 08:34:27 +02:00
2c9fdcb98e update HTML UI to reflect role access restrictions
* disable ui if user is unelevated
* disable revoke button if unelevated and not own invite
* improve styling of disabled elements
* remove revoke if alias not made my current user
2021-04-23 08:33:20 +02:00
Andre Staltz
34eef5fb9b
rename address field in alias JSON resolver 2021-04-21 19:46:45 +03:00
16985bba8d rewrite list_languages function to use html/template 2021-04-20 11:49:24 +02:00
c6077337d1 use more robust identifier for test 2021-04-20 10:36:40 +02:00
a5f7701437 Apply suggestions from code review
Co-authored-by: Henry <111202+cryptix@users.noreply.github.com>

use eh.Handle
2021-04-20 10:36:34 +02:00
0574c9a235 test language picking 2021-04-20 09:22:53 +02:00
1c5c0b9867 make tests more robust when validating specific csrf token 2021-04-20 09:22:53 +02:00
7759e8f898 add de translation, use []TagTranslation, and sort
to make sure the list of languages is sorted, we now use a slice of
TagTranslation{Tag: string, Translation: string} structs, sorted
by `TagTranslation.Tag`.
2021-04-20 09:22:53 +02:00
b9fe27b0ca fix inconsistent cookies, set csrf cookie path
while working on the /set-language route, i noticed that i was getting a
csrf error for all /admin views when setting the language, while it
worked well on non-admin routes.

the issue, it turned out, was that we needed to configure gorilla's csrf
feature to set all cookies on the same route. when unconfigured, the
set cookies will only be set for the path they are being set at.

see more in the gorilla.csrf documentation (in particular the csrf.Path
option): https://pkg.go.dev/github.com/gorilla/csrf?utm_source=godoc#Path
2021-04-20 09:22:53 +02:00
c97b7d44c3 add default language admin ui functionality 2021-04-20 09:22:49 +02:00
534bdfcb6d improve api comment for ListLanguages 2021-04-20 09:12:15 +02:00
682283374d mock injected functions for tests 2021-04-20 09:12:15 +02:00
ee185e5f43 don't render language picker if we have less than 2 translations 2021-04-20 09:12:15 +02:00
93f84e04b0 redirect with 303 See Other 2021-04-20 09:12:15 +02:00
f535aa8f9c set & use language cookie 2021-04-20 09:12:13 +02:00
9863c6b166 add template func for listing languages 2021-04-20 09:11:41 +02:00
8c32b88cce add helper i18n.ListLanguages()
i18n.ListLanguages() returns a map, mapping language tags ('en', 'sv')
to the names of their corresponding languages (as translated by the
language itself).

This functionality will be used in the language picker, to present a
nice list of the translated languages.

I renamed testing.go to conform to go's testing conventions, and
added a test for i18n.ListLanguages().
2021-04-20 09:09:57 +02:00
cb3feb2a2e add language picker element mock 2021-04-20 09:09:57 +02:00
Henry
52ec94e878 fix link generation for alias registration
fixes #160
2021-04-19 15:00:35 +02:00
Henry
a78c039cc7 reuse urlTo in urlToNotice 2021-04-19 15:00:35 +02:00
Henry
3323a85226 refactor urlTo to use domain information for all links 2021-04-19 15:00:29 +02:00
Andre Staltz
bb25283b4c
style the alias page and add JS redirect 2021-04-19 10:07:26 +03:00
André Staltz
0e5b2f3843
Merge pull request #163 from ssb-ngi-pointer/ssb-uri-tmpl
refactor templates that have ssb uri links
2021-04-19 10:03:37 +03:00
Andre Staltz
0f119565e9
update tests 2021-04-16 18:38:13 +03:00
Andre Staltz
7bbe33adab
refactor templates that have ssb uri links 2021-04-16 18:31:32 +03:00
Andre Staltz
fb8c20fffe
update TestMembers to check for roles 2021-04-16 14:43:35 +03:00
Andre Staltz
8a7ffee4b5
member-list.tmpl uses string comparison, not magic enum numbers 2021-04-16 14:25:32 +03:00
Andre Staltz
f6a24921eb
show admin and moderator tags on members list 2021-04-16 13:09:59 +03:00
Henry
04fb06dcaa add member_is_admin and member_has_role template helpers 2021-04-16 09:40:19 +02:00
Andre Staltz
6b082c45f7
more content and member links on the dashboard 2021-04-15 16:24:57 +03:00
Andre Staltz
ed5a7f603e
fix invite QR code 2021-04-14 16:10:25 +03:00
André Staltz
919fe51922
Merge pull request #144 from ssb-ngi-pointer/withssb-remotelogin
change withssb login QR code to be a login URL
2021-04-14 13:55:32 +03:00
André Staltz
7d229adf39
refactor an if condition in web/handlers/auth/withssb.go
Co-authored-by: Henry <111202+cryptix@users.noreply.github.com>
2021-04-14 12:59:09 +03:00
Andre Staltz
87f7a716e8
change withssb login QR code to be a login URL 2021-04-13 19:04:25 +03:00
Henry
8ff4adf160 various fixes
* fix test compilation
* fix aliases on member page
* add tests for aliases on member.GetByID and ByFeed
* fix admin tests
* use webassert helper for flash messages
* fix flashes
2021-04-12 14:10:42 +02:00