bug fixes to Find and Member List due to outdated function definitions
This commit is contained in:
@@ -168,18 +168,6 @@ func (c *Community) Host(ctx context.Context) (*User, error) {
|
|||||||
return AmGetUser(ctx, *c.HostUid)
|
return AmGetUser(ctx, *c.HostUid)
|
||||||
}
|
}
|
||||||
|
|
||||||
// HostQ returns the reference to the community's host, quietly.
|
|
||||||
func (c *Community) HostQ(ctx context.Context) *User {
|
|
||||||
if c.HostUid == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
u, err := AmGetUser(ctx, *c.HostUid)
|
|
||||||
if err != nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return u
|
|
||||||
}
|
|
||||||
|
|
||||||
// LanguageTag returns the tag for the community's language.
|
// LanguageTag returns the tag for the community's language.
|
||||||
func (c *Community) LanguageTag() (*language.Tag, error) {
|
func (c *Community) LanguageTag() (*language.Tag, error) {
|
||||||
if c.Language == nil {
|
if c.Language == nil {
|
||||||
|
|||||||
@@ -190,15 +190,6 @@ func (u *User) ContactInfo(ctx context.Context) (*ContactInfo, error) {
|
|||||||
return AmGetContactInfo(ctx, u.ContactID)
|
return AmGetContactInfo(ctx, u.ContactID)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ContactInfo returns the contact info structure for the user, quietly.
|
|
||||||
func (u *User) ContactInfoQ(ctx context.Context) *ContactInfo {
|
|
||||||
if u.ContactID < 0 {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
ci, _ := AmGetContactInfo(ctx, u.ContactID)
|
|
||||||
return ci
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetContactID sets the contact ID of a user.
|
// SetContactID sets the contact ID of a user.
|
||||||
func (u *User) SetContactID(ctx context.Context, cid int32) error {
|
func (u *User) SetContactID(ctx context.Context, cid int32) error {
|
||||||
u.Mutex.Lock()
|
u.Mutex.Lock()
|
||||||
|
|||||||
+25
-1
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Amsterdam Web Communities System
|
* Amsterdam Web Communities System
|
||||||
* Copyright (c) 2025 Erbosoft Metaverse Design Solutions, All Rights Reserved
|
* Copyright (c) 2025-2026 Erbosoft Metaverse Design Solutions, All Rights Reserved
|
||||||
*
|
*
|
||||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
@@ -122,6 +122,28 @@ func extractCommunityLogo(a jet.Arguments) reflect.Value {
|
|||||||
return reflect.ValueOf(rc)
|
return reflect.ValueOf(rc)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// communityHost retrieves the community host for a community.
|
||||||
|
func communityHost(a jet.Arguments) reflect.Value {
|
||||||
|
comm := a.Get(0).Convert(reflect.TypeFor[*database.Community]()).Interface().(*database.Community)
|
||||||
|
ctxt := a.Get(1).Convert(reflect.TypeFor[AmContext]()).Interface().(AmContext)
|
||||||
|
u, err := comm.Host(ctxt.Ctx())
|
||||||
|
if err != nil {
|
||||||
|
u, _ = database.AmGetAnonUser(ctxt.Ctx())
|
||||||
|
}
|
||||||
|
return reflect.ValueOf(u)
|
||||||
|
}
|
||||||
|
|
||||||
|
// userContactInfo retrieves the contact info for a user.
|
||||||
|
func userContactInfo(a jet.Arguments) reflect.Value {
|
||||||
|
user := a.Get(0).Convert(reflect.TypeFor[*database.User]()).Interface().(*database.User)
|
||||||
|
ctxt := a.Get(1).Convert(reflect.TypeFor[AmContext]()).Interface().(AmContext)
|
||||||
|
ci, err := user.ContactInfo(ctxt.Ctx())
|
||||||
|
if err != nil {
|
||||||
|
ci = database.AmNewUserContactInfo(0)
|
||||||
|
}
|
||||||
|
return reflect.ValueOf(ci)
|
||||||
|
}
|
||||||
|
|
||||||
// displayDateTime formats a date and time value.
|
// displayDateTime formats a date and time value.
|
||||||
func displayDateTime(a jet.Arguments) reflect.Value {
|
func displayDateTime(a jet.Arguments) reflect.Value {
|
||||||
timeval := a.Get(0).Convert(reflect.TypeFor[time.Time]()).Interface().(time.Time)
|
timeval := a.Get(0).Convert(reflect.TypeFor[time.Time]()).Interface().(time.Time)
|
||||||
@@ -286,6 +308,8 @@ func SetupTemplates() {
|
|||||||
views.AddGlobalFunc("MakeIntRange", makeIntRange)
|
views.AddGlobalFunc("MakeIntRange", makeIntRange)
|
||||||
views.AddGlobalFunc("MakeYearRange", makeYearRange)
|
views.AddGlobalFunc("MakeYearRange", makeYearRange)
|
||||||
views.AddGlobalFunc("ExtractCommunityLogo", extractCommunityLogo)
|
views.AddGlobalFunc("ExtractCommunityLogo", extractCommunityLogo)
|
||||||
|
views.AddGlobalFunc("CommunityHost", communityHost)
|
||||||
|
views.AddGlobalFunc("UserContactInfo", userContactInfo)
|
||||||
views.AddGlobalFunc("DisplayActivity", displayActivity)
|
views.AddGlobalFunc("DisplayActivity", displayActivity)
|
||||||
views.AddGlobalFunc("DisplayDateTime", displayDateTime)
|
views.AddGlobalFunc("DisplayDateTime", displayDateTime)
|
||||||
views.AddGlobalFunc("DisplayMemberCount", displayMemberCount)
|
views.AddGlobalFunc("DisplayMemberCount", displayMemberCount)
|
||||||
|
|||||||
+5
-5
@@ -1,6 +1,6 @@
|
|||||||
{*
|
{*
|
||||||
* Amsterdam Web Communities System
|
* Amsterdam Web Communities System
|
||||||
* Copyright (c) 2025 Erbosoft Metaverse Design Solutions, All Rights Reserved
|
* Copyright (c) 2025-2026 Erbosoft Metaverse Design Solutions, All Rights Reserved
|
||||||
*
|
*
|
||||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
@@ -102,7 +102,7 @@
|
|||||||
class="px-3 py-2 border border-gray-300 rounded focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
|
class="px-3 py-2 border border-gray-300 rounded focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
|
||||||
<option value="st" {{ if oper == "st" }}selected{{ end }}>starts with the string</option>
|
<option value="st" {{ if oper == "st" }}selected{{ end }}>starts with the string</option>
|
||||||
<option value="in" {{ if oper == "in" }}selected{{ end }}>contains the string</option>
|
<option value="in" {{ if oper == "in" }}selected{{ end }}>contains the string</option>
|
||||||
<option value="re" {{ if oper == "in" }}selected{{ end }}>matches the regular expression</option>
|
<option value="re" {{ if oper == "re" }}selected{{ end }}>matches the regular expression</option>
|
||||||
</select>
|
</select>
|
||||||
<input type="text" name="term" size="32" maxlength="255" value="{{ term }}"
|
<input type="text" name="term" size="32" maxlength="255" value="{{ term }}"
|
||||||
placeholder="Enter search term..."
|
placeholder="Enter search term..."
|
||||||
@@ -117,7 +117,7 @@
|
|||||||
class="px-3 py-2 border border-gray-300 rounded focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
|
class="px-3 py-2 border border-gray-300 rounded focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
|
||||||
<option value="st" {{ if oper == "st" }}selected{{ end }}>starts with the string</option>
|
<option value="st" {{ if oper == "st" }}selected{{ end }}>starts with the string</option>
|
||||||
<option value="in" {{ if oper == "in" }}selected{{ end }}>contains the string</option>
|
<option value="in" {{ if oper == "in" }}selected{{ end }}>contains the string</option>
|
||||||
<option value="re" {{ if oper == "in" }}selected{{ end }}>matches the regular expression</option>
|
<option value="re" {{ if oper == "re" }}selected{{ end }}>matches the regular expression</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<!-- Search Criteria -->
|
<!-- Search Criteria -->
|
||||||
@@ -217,7 +217,7 @@
|
|||||||
<div class="text-sm text-gray-700 space-y-1">
|
<div class="text-sm text-gray-700 space-y-1">
|
||||||
<div>
|
<div>
|
||||||
<span class="font-medium">Host:</span>
|
<span class="font-medium">Host:</span>
|
||||||
{{ h := rx.HostQ() }}
|
{{ h := CommunityHost(rx, .) }}
|
||||||
<a href="/user/{{ h.Username }}" class="text-blue-700 hover:text-blue-900">{{ h.Username }}</a>
|
<a href="/user/{{ h.Username }}" class="text-blue-700 hover:text-blue-900">{{ h.Username }}</a>
|
||||||
<span class="mx-2">-</span>
|
<span class="mx-2">-</span>
|
||||||
{{ n := DisplayMemberCount(rx, .) }}
|
{{ n := DisplayMemberCount(rx, .) }}
|
||||||
@@ -245,7 +245,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="text-sm text-gray-700 space-y-1">
|
<div class="text-sm text-gray-700 space-y-1">
|
||||||
<div>
|
<div>
|
||||||
{{ ci := rx.ContactInfoQ() }}
|
{{ ci := UserContactInfo(rx, .) }}
|
||||||
{{ DisplayFullName(ci) }}, from {{ ci.Locality }}, {{ ci.Region }} {{ ci.Country }}
|
{{ DisplayFullName(ci) }}, from {{ ci.Locality }}, {{ ci.Region }} {{ ci.Country }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{*
|
{*
|
||||||
* Amsterdam Web Communities System
|
* Amsterdam Web Communities System
|
||||||
* Copyright (c) 2025 Erbosoft Metaverse Design Solutions, All Rights Reserved
|
* Copyright (c) 2025-2026 Erbosoft Metaverse Design Solutions, All Rights Reserved
|
||||||
*
|
*
|
||||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
@@ -104,7 +104,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="text-sm text-gray-700 space-y-1">
|
<div class="text-sm text-gray-700 space-y-1">
|
||||||
<div>
|
<div>
|
||||||
{{ ci := rx.ContactInfoQ() }}
|
{{ ci := UserContactInfo(rx, .) }}
|
||||||
{{ DisplayFullName(ci) }}, from {{ ci.Locality }}, {{ ci.Region }} {{ ci.Country }}
|
{{ DisplayFullName(ci) }}, from {{ ci.Locality }}, {{ ci.Region }} {{ ci.Country }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user