mirror of
https://github.com/hrfee/jfa-go.git
synced 2026-01-18 16:47:42 +01:00
storage: user set/get methods for contact method access
Get/GetKey/SetKey/DeleteKey methods are used for access to email/discord/telegram/matrix, everywhere. Mutex added for each, avoids concurrent read/write issues. Will also make potential transition to database easier.
This commit is contained in:
@@ -139,7 +139,7 @@ func migrateNotificationMethods(app *appContext) error {
|
||||
if !strings.Contains(address, "@") {
|
||||
continue
|
||||
}
|
||||
for id, email := range app.storage.emails {
|
||||
for id, email := range app.storage.GetEmails() {
|
||||
if email.Addr == address {
|
||||
invite.Notify[id] = notifyPrefs
|
||||
delete(invite.Notify, address)
|
||||
@@ -168,10 +168,10 @@ func linkExistingOmbiDiscordTelegram(app *appContext) error {
|
||||
return nil
|
||||
}
|
||||
idList := map[string][2]string{}
|
||||
for jfID, user := range app.storage.discord {
|
||||
for jfID, user := range app.storage.GetDiscord() {
|
||||
idList[jfID] = [2]string{user.ID, ""}
|
||||
}
|
||||
for jfID, user := range app.storage.telegram {
|
||||
for jfID, user := range app.storage.GetTelegram() {
|
||||
vals, ok := idList[jfID]
|
||||
if !ok {
|
||||
vals = [2]string{"", ""}
|
||||
@@ -212,7 +212,7 @@ func linkExistingOmbiDiscordTelegram(app *appContext) error {
|
||||
// app.jf.GetUsers(false)
|
||||
//
|
||||
// noHyphens := true
|
||||
// for id := range app.storage.emails {
|
||||
// for id := range app.storage.GetEmails() {
|
||||
// if strings.Contains(id, "-") {
|
||||
// noHyphens = false
|
||||
// break
|
||||
|
||||
Reference in New Issue
Block a user