mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-09-10 15:48:29 +02:00
feat(ui): improve org header with new noJS dropdown and more options (#8572)
Related: https://codeberg.org/forgejo/forgejo/pulls/6977/files#diff-fd05eba523810d46c7763db938ad5839372a074a, https://codeberg.org/forgejo/forgejo/pulls/3949, https://codeberg.org/forgejo/forgejo/pulls/7906 * use the new noJS dropdown for extra actions in org view (currently only includes report button) * this required some refactoring of the area because the said dropdown was not built to be placed in an area where `font-size:36px` is forced onto everything * this greatly improves consistently with user profiles which now use this type of dropdown * I decided against making the opener button mimicrate an actual button because it looks ok as is and is consitent with menu in user profiles and because I don't think this is a good design language to make a kebab menu opener look this way * add icon to the entry * add atom entry Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8572 Reviewed-by: Gusted <gusted@noreply.codeberg.org> Reviewed-by: Beowulf <beowulf@beocode.eu> Co-authored-by: 0ko <0ko@noreply.codeberg.org> Co-committed-by: 0ko <0ko@noreply.codeberg.org>
This commit is contained in:
parent
b06f4fdd63
commit
c11dd3fb46
5 changed files with 88 additions and 27 deletions
|
@ -104,5 +104,51 @@ quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequa
|
|||
assert.NotContains(t, resp.Body.String(), "veniam")
|
||||
})
|
||||
})
|
||||
|
||||
t.Run("More actions - feeds only", func(t *testing.T) {
|
||||
defer tests.PrintCurrentTest(t)()
|
||||
defer test.MockVariableValue(&setting.Other.EnableFeed, true)()
|
||||
defer test.MockVariableValue(&setting.Moderation.Enabled, false)()
|
||||
|
||||
// Both guests and logged in users should see the feed option
|
||||
doc := NewHTMLParser(t, MakeRequest(t, NewRequest(t, "GET", "/org3"), http.StatusOK).Body)
|
||||
doc.AssertElement(t, "details.dropdown a[href='/org3.rss']", true)
|
||||
doc.AssertElement(t, "details.dropdown a[href^='/report_abuse']", false)
|
||||
|
||||
doc = NewHTMLParser(t, loginUser(t, "user10").MakeRequest(t, NewRequest(t, "GET", "/org3"), http.StatusOK).Body)
|
||||
doc.AssertElement(t, "details.dropdown a[href='/org3.rss']", true)
|
||||
doc.AssertElement(t, "details.dropdown a[href^='/report_abuse']", false)
|
||||
})
|
||||
|
||||
t.Run("More actions - none", func(t *testing.T) {
|
||||
defer tests.PrintCurrentTest(t)()
|
||||
defer test.MockVariableValue(&setting.Other.EnableFeed, false)()
|
||||
defer test.MockVariableValue(&setting.Moderation.Enabled, false)()
|
||||
|
||||
// The dropdown won't appear if no entries are available, for both guests and logged in users
|
||||
doc := NewHTMLParser(t, MakeRequest(t, NewRequest(t, "GET", "/org3"), http.StatusOK).Body)
|
||||
doc.AssertElement(t, "details.dropdown", false)
|
||||
|
||||
doc = NewHTMLParser(t, loginUser(t, "user10").MakeRequest(t, NewRequest(t, "GET", "/org3"), http.StatusOK).Body)
|
||||
doc.AssertElement(t, "details.dropdown", false)
|
||||
})
|
||||
|
||||
t.Run("More actions - moderation", func(t *testing.T) {
|
||||
defer tests.PrintCurrentTest(t)()
|
||||
defer test.MockVariableValue(&setting.Other.EnableFeed, false)()
|
||||
defer test.MockVariableValue(&setting.Moderation.Enabled, true)()
|
||||
|
||||
// The report option shouldn't be available to a guest
|
||||
doc := NewHTMLParser(t, MakeRequest(t, NewRequest(t, "GET", "/org3"), http.StatusOK).Body)
|
||||
doc.AssertElement(t, "details.dropdown", false)
|
||||
|
||||
// But should be available to a logged in user
|
||||
doc = NewHTMLParser(t, loginUser(t, "user10").MakeRequest(t, NewRequest(t, "GET", "/org3"), http.StatusOK).Body)
|
||||
doc.AssertElement(t, "details.dropdown a[href^='/report_abuse']", true)
|
||||
|
||||
// But the org owner shouldn't see the report option
|
||||
doc = NewHTMLParser(t, loginUser(t, "user1").MakeRequest(t, NewRequest(t, "GET", "/org3"), http.StatusOK).Body)
|
||||
doc.AssertElement(t, "details.dropdown", false)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue