Skip to content
This repository has been archived by the owner on Apr 29, 2024. It is now read-only.

Deactivated users listed #5

Open
darkobodnaruk opened this issue Jul 19, 2023 · 1 comment
Open

Deactivated users listed #5

darkobodnaruk opened this issue Jul 19, 2023 · 1 comment

Comments

@darkobodnaruk
Copy link

Great workflow! I have a small comment - we have a bunch of deactivated users that are also shown on @ command. Obviously they're not needed, could they be filtered out when updating the user list?

@darkobodnaruk
Copy link
Author

Managed to do it with this:

const actions = {
    async setUsers(users) {
        let items = []

        users.forEach((user) => {
            user.title = user.profile.display_name === "" ? user.real_name : user.profile.display_name
            user.subtitle = getUserSubtitle(user)
            user.valid = !user.is_bot
            user.match = user.profile.real_name_normalized + ' ' + user.profile.display_name
            user.autocomplete = user.profile.display_name
            user.arg = `slack://user?team=${user.profile.team}&id=${user.id}`
            if (user.profile.image_original) {
                user.icon = {
                    path: downloadAndSaveImage(user.profile.image_192, './profile_images/')
                }
            }
            if (!user.deleted) {     // <=============== exclude deleted users
                items.push(user)
            }

        });
        store.data.items = items;
        await store.write()
    }
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant