Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update-widgets-based-on-group-content #177

Merged
merged 18 commits into from
Feb 3, 2025
Merged
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Make sure groups have a home tag when transitioning menu
tibetsprague committed Jan 31, 2025
commit 1a9187b012375ba25dcd36bd04175d81d11fb7f6
5 changes: 5 additions & 0 deletions apps/backend/api/models/Group.js
Original file line number Diff line number Diff line change
@@ -511,6 +511,11 @@ module.exports = bookshelf.Model.extend(merge({

// Get home tag id for the home chat
const homeTag = await Tag.where({ name: 'home' }).fetch({ transacting: trx })
// XXX: make sure there is a home tag for every group
const homeGroupTag = await GroupTag.where({ group_id: this.id, tag_id: homeTag.id }).fetch({ transacting: trx })
if (!homeGroupTag) {
await GroupTag.create({ group_id: this.id, tag_id: homeTag.id, user_id: this.get('created_by_id'), is_default: true }, { transacting: trx })
}

// XXX: make sure there is a home tag for every group
const homeGroupTag = await GroupTag.where({ group_id: this.id, tag_id: homeTag.id }).fetch({ transacting: trx })